Accepting request 1345252 from devel:libraries:c_c++
- Change build system from meson to CMake. Some dependent packages
(e.g. OpenMS) require CMake config files.
- Add patches:
* 0001-Generate-pkgconfig-file-also-from-CMake-build.patch to
install pkgconfig file
* 0001-Fix-required-C-version-for-CMake-builds.patch to ensure
compatible C++ standard with gtest
OBS-URL: https://build.opensuse.org/request/show/1345252
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/SQLiteCpp?expand=0&rev=5
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 3 22:30:04 UTC 2026 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
|
||||
|
||||
- Change build system from meson to CMake. Some dependent packages
|
||||
(e.g. OpenMS) require CMake config files.
|
||||
- Add patches:
|
||||
* 0001-Generate-pkgconfig-file-also-from-CMake-build.patch to
|
||||
install pkgconfig file
|
||||
* 0001-Fix-required-C-version-for-CMake-builds.patch to ensure
|
||||
compatible C++ standard with gtest
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 21 15:22:28 UTC 2025 - Atri Bhattacharya <badshah400@gmail.com>
|
||||
|
||||
|
||||
+18
-8
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package SQLiteCpp
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
# Copyright (c) 2026 SUSE LLC and contributors
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -24,9 +24,13 @@ Summary: A C++ SQLite3 wrapper
|
||||
License: MIT
|
||||
URL: https://srombauts.github.io/SQLiteCpp
|
||||
Source: https://github.com/SRombauts/SQLiteCpp/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM
|
||||
Patch0: 0001-Fix-required-C-version-for-CMake-builds.patch
|
||||
# PATCH-FIX-UPSTREAM
|
||||
Patch1: 0001-Generate-pkgconfig-file-also-from-CMake-build.patch
|
||||
BuildRequires: c++_compiler
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gtest
|
||||
BuildRequires: meson
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: pkgconfig(sqlite3)
|
||||
|
||||
@@ -50,22 +54,27 @@ Requires: pkgconfig(sqlite3)
|
||||
This package provides the headers and sources for developing against SQLiteCpp.
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
%autosetup -p1
|
||||
sed -iE "s/\r$//" README.md
|
||||
# Make SONAME lowercase for compatibility with meson build - https://github.com/SRombauts/SQLiteCpp/issues/542
|
||||
echo 'set_property(TARGET SQLiteCpp PROPERTY OUTPUT_NAME "sqlitecpp")' >> CMakeLists.txt
|
||||
|
||||
%build
|
||||
%meson \
|
||||
%cmake \
|
||||
-DSQLITECPP_INTERNAL_SQLITE:BOOL=false \
|
||||
-DSQLITE_ENABLE_COLUMN_METADATA=true \
|
||||
-DSQLITECPP_BUILD_TESTS=true \
|
||||
-DSQLITECPP_BUILD_EXAMPLES=true \
|
||||
%{nil}
|
||||
%meson_build
|
||||
%{nil}
|
||||
%cmake_build
|
||||
|
||||
%install
|
||||
%meson_install
|
||||
%cmake_install
|
||||
# Remove ROS specific file
|
||||
rm %{buildroot}%{_datadir}/%{name}/package.xml
|
||||
|
||||
%check
|
||||
%meson_test
|
||||
%ctest --parallel 1
|
||||
|
||||
%ldconfig_scriptlets -n %{shlib}
|
||||
|
||||
@@ -79,5 +88,6 @@ sed -iE "s/\r$//" README.md
|
||||
%{_includedir}/%{name}/
|
||||
%{_libdir}/lib*.so
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
%{_libdir}/cmake/SQLiteCpp
|
||||
|
||||
%changelog
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
From 242cec703bbae5ac33862db483e7a9c968deb133 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||
Date: Fri, 3 Apr 2026 21:59:14 +0200
|
||||
Subject: [PATCH] Fix required C++ version for CMake builds
|
||||
|
||||
Current GTest versions required C++14 or C++17, so set the appropriate
|
||||
version in the compile_features.
|
||||
|
||||
Also change the library from using CMAKE_CXX_STANDARD to the equivalent
|
||||
target_compile_features. This avoids downgrading the used standard
|
||||
version and is properly exported to CMake Target.
|
||||
---
|
||||
CMakeLists.txt | 23 +++++++++++------------
|
||||
1 file changed, 11 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index c23d634..9d853c9 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -8,15 +8,6 @@ cmake_minimum_required(VERSION 3.5...4.0)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # custom CMake modules like FindSQLiteCpp
|
||||
project(SQLiteCpp VERSION 3.3.3)
|
||||
|
||||
-# SQLiteC++ 3.x requires C++11 features
|
||||
-if (NOT CMAKE_CXX_STANDARD)
|
||||
- set(CMAKE_CXX_STANDARD 11)
|
||||
-elseif (CMAKE_CXX_STANDARD LESS 11)
|
||||
- message(WARNING "CMAKE_CXX_STANDARD has been set to '${CMAKE_CXX_STANDARD}' which is lower than the minimum required standard (c++11).")
|
||||
-endif ()
|
||||
-message(STATUS "Using c++ standard c++${CMAKE_CXX_STANDARD}")
|
||||
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
-
|
||||
message (STATUS "CMake version: ${CMAKE_VERSION}")
|
||||
message (STATUS "Project version: ${PROJECT_VERSION}")
|
||||
|
||||
@@ -212,6 +203,8 @@ endif()
|
||||
|
||||
# add sources of the wrapper as a "SQLiteCpp" static library
|
||||
add_library(SQLiteCpp ${SQLITECPP_SRC} ${SQLITECPP_INC} ${SQLITECPP_DOC} ${SQLITECPP_SCRIPT})
|
||||
+# SQLiteC++ 3.x requires C++11 features
|
||||
+target_compile_features(SQLiteCpp PUBLIC cxx_std_11)
|
||||
|
||||
# Options relative to SQLite and SQLiteC++ functions
|
||||
|
||||
@@ -475,10 +468,15 @@ if (SQLITECPP_BUILD_TESTS)
|
||||
target_link_libraries(SQLiteCpp_tests SQLiteCpp)
|
||||
|
||||
find_package(GTest)
|
||||
- if (GTEST_FOUND)
|
||||
+ if (GTest_FOUND)
|
||||
message(STATUS "Link to GTest system library")
|
||||
target_link_libraries(SQLiteCpp_tests GTest::GTest GTest::Main)
|
||||
- else (GTEST_FOUND)
|
||||
+ if (GTest_VERSION AND (GTest_VERSION VERSION_LESS 1.17))
|
||||
+ target_compile_features(SQLiteCpp_tests PRIVATE cxx_std_14)
|
||||
+ else()
|
||||
+ target_compile_features(SQLiteCpp_tests PRIVATE cxx_std_17)
|
||||
+ endif()
|
||||
+ else (GTest_FOUND)
|
||||
message(STATUS "Compile googletest from source in submodule")
|
||||
# deactivate some warnings for compiling the googletest library
|
||||
if (NOT MSVC)
|
||||
@@ -505,7 +503,8 @@ if (SQLITECPP_BUILD_TESTS)
|
||||
endif (MSVC)
|
||||
|
||||
target_link_libraries(SQLiteCpp_tests gtest_main)
|
||||
- endif (GTEST_FOUND)
|
||||
+ target_compile_features(SQLiteCpp_tests PUBLIC cxx_std_17)
|
||||
+ endif (GTest_FOUND)
|
||||
|
||||
# add a "test" target:
|
||||
enable_testing()
|
||||
--
|
||||
2.53.0
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
From 613e338c59aa92d53d7a88f96aabc684dc1eeac4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||
Date: Fri, 3 Apr 2026 22:31:16 +0200
|
||||
Subject: [PATCH] Generate pkgconfig file also from CMake build
|
||||
|
||||
---
|
||||
CMakeLists.txt | 10 ++++++++++
|
||||
cmake/sqlitecpp.pc.in | 11 +++++++++++
|
||||
2 files changed, 21 insertions(+)
|
||||
create mode 100644 cmake/sqlitecpp.pc.in
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9d853c9..c2b048d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -381,6 +381,17 @@ if (SQLITECPP_INSTALL)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||
+
|
||||
+cmake_path(
|
||||
+ RELATIVE_PATH CMAKE_INSTALL_FULL_LIBDIR
|
||||
+ BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX}
|
||||
+ OUTPUT_VARIABLE PC_RELATIVE_LIBDIR)
|
||||
+string(JOIN " -l" PC_LIBS_PRIVATE "" ${CMAKE_DL_LIBS})
|
||||
+string(PREPEND PC_LIBS_PRIVATE ${CMAKE_THREAD_LIBS_INIT})
|
||||
+configure_file(cmake/sqlitecpp.pc.in cmake/sqlitecpp.pc @ONLY)
|
||||
+install(FILES
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/sqlitecpp.pc
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
|
||||
|
||||
# Optional additional targets:
|
||||
|
||||
diff --git a/cmake/sqlitecpp.pc.in b/cmake/sqlitecpp.pc.in
|
||||
new file mode 100644
|
||||
index 0000000..d964000
|
||||
--- /dev/null
|
||||
+++ b/cmake/sqlitecpp.pc.in
|
||||
@@ -0,0 +1,11 @@
|
||||
+prefix=@CMAKE_INSTALL_PREFIX@
|
||||
+includedir=${prefix}/include
|
||||
+libdir=${prefix}/@PC_RELATIVE_LIBDIR@
|
||||
+
|
||||
+Name: sqlitecpp
|
||||
+Description: a smart and easy to use C++ SQLite3 wrapper.
|
||||
+Version: @PROJECT_VERSION@
|
||||
+Requires.private: sqlite3
|
||||
+Libs: -L${libdir} -lsqlitecpp
|
||||
+Libs.private: @PC_LIBS_PRIVATE@
|
||||
+Cflags: -I${includedir}
|
||||
--
|
||||
2.53.0
|
||||
|
||||
Reference in New Issue
Block a user