Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlpp11-connector-sqlite3: add version 0.31, support conan v2 #15582

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions recipes/sqlpp11-connector-sqlite3/all/CMakeLists.txt

This file was deleted.

25 changes: 17 additions & 8 deletions recipes/sqlpp11-connector-sqlite3/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
sources:
"0.29":
url: "https://github.com/rbock/sqlpp11-connector-sqlite3/archive/0.29.tar.gz"
sha256: "2904ddd578adb0e122a70f73a80bae4843434d685b7a23ae3ab43471c35efc4f"
"0.31":
url: "https://github.com/rbock/sqlpp11-connector-sqlite3/archive/0.31.tar.gz"
sha256: "b6be3b9b6c4a64ed9cf75d5434683d018c5fd517b2a428596e9dce97a9e030bd"
"0.30":
url: "https://github.com/rbock/sqlpp11-connector-sqlite3/archive/0.30.tar.gz"
sha256: "e39f420312d311f3eaa162e201883b4594c34e04739b39a4563f84be920e654f"
patches:
"0.29":
- patch_file: "patches/cmake-dependencies.patch"
base_path: "source_subfolder"
url: "https://github.com/rbock/sqlpp11-connector-sqlite3/archive/0.29.tar.gz"
sha256: "2904ddd578adb0e122a70f73a80bae4843434d685b7a23ae3ab43471c35efc4f"
patches:
"0.31":
- patch_file: "patches/0.31-0001-cmake-dependencies.patch"
patch_description: "use cci packages"
patch_type: "conan"
"0.30":
- patch_file: "patches/cmake-dependencies.patch"
base_path: "source_subfolder"
- patch_file: "patches/0.30-0001-cmake-dependencies.patch"
patch_description: "use cci packages"
patch_type: "conan"
"0.29":
- patch_file: "patches/0.29-0001-cmake-dependencies.patch"
patch_description: "use cci packages"
patch_type: "conan"
94 changes: 53 additions & 41 deletions recipes/sqlpp11-connector-sqlite3/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,77 +1,89 @@
from conans import ConanFile, CMake, tools
from conan import ConanFile
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
import os

required_conan_version = ">=1.53.0"

class sqlpp11Conan(ConanFile):
name = "sqlpp11-connector-sqlite3"
description = "A C++ wrapper for sqlite3 meant to be used in combination with sqlpp11."
topics = ("conan", "sqlpp11-connector-sqlite3", "sqlite3", "sqlpp11", "sql", "database")
settings = "os", "compiler", "build_type", "arch"
license = "BSD-2-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/rbock/sqlpp11-connector-sqlite3"
license = "BSD-2-Clause"
exports_sources = ["CMakeLists.txt", "patches/**"]
generators = "cmake"
options = {"shared": [True, False], "fPIC": [True, False], "with_sqlcipher": [True, False]}
default_options = {"shared": False, "fPIC": True, "with_sqlcipher": False}
topics = ("conan", "sqlpp11-connector-sqlite3", "sqlite3", "sqlpp11", "sql", "database")
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_sqlcipher": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_sqlcipher": False,
}
short_paths = True

_cmake = None

@property
def _source_subfolder(self):
return "source_subfolder"

@property
def _build_subfolder(self):
return "build_subfolder"
def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
del self.options.fPIC
if self.settings.compiler.cppstd:
tools.check_min_cppstd(self, 11)
self.options.rm_safe("fPIC")

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("sqlpp11/0.59")
self.requires("sqlpp11/0.60")
if Version(self.version) < "0.31.0":
self.requires("date/3.0.1")
if self.options.with_sqlcipher:
self.requires("sqlcipher/4.4.0")
self.requires("sqlcipher/4.5.1")
else:
self.requires("sqlite3/3.32.3")
self.requires("sqlite3/3.40.1")

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, 11)

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
if Version(self.version) < "0.31.0":
tc.variables["ENABLE_TESTS"] = False
else:
tc.variables["ENABLE_TESTING"] = False
tc.variables["SQLCIPHER"] = self.options.with_sqlcipher
tc.variables["SQLPP11_INCLUDE_DIR"] = self.deps_cpp_info["sqlpp11"].include_paths[0].replace("\\", "/")
tc.generate()

def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.definitions["ENABLE_TESTS"] = False
self._cmake.definitions["SQLCIPHER"] = self.options.with_sqlcipher
self._cmake.definitions["SQLPP11_INCLUDE_DIR"] = self.deps_cpp_info["sqlpp11"].include_paths[0]
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake
deps = CMakeDeps(self)
deps.generate()

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
cmake = self._configure_cmake()
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
cmake = self._configure_cmake()
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["sqlpp11-connector-sqlite3"]
if self.settings.os == "Linux":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["m"]
if self.options.with_sqlcipher:
self.cpp_info.defines = ["SQLPP_USE_SQLCIPHER"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1fe77de..5db38f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,21 +36,22 @@ if (NOT DEFINED SQLPP11_DYNAMIC_LOADING)
set(SQLPP11_DYNAMIC_LOADING Off)
endif()

-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(SQLCIPHER )
- find_package(SQLCipher REQUIRED)
- set (SQLITE3_LIBRARIES "${SQLCIPHER_LIBRARIES}" )
- set (SQLITE3_INCLUDE_DIRS "${SQLCIPHER_INCLUDE_DIRS}" )
- set (SQLITE3_LIBRARY "${SQLCIPHER_LIBRARY}")
+ find_package(sqlcipher REQUIRED)
+ set (SQLite3_LIBRARIES "${sqlcipher_LIBRARIES}")
+ set (SQLite3_INCLUDE_DIRS "${sqlcipher_INCLUDE_DIRS}")
+ set (SQLite3_LIBRARY "${sqlcipher_LIBRARY}")
else()
- find_package(Sqlite3 REQUIRED)
+ find_package(SQLite3 REQUIRED)
endif()

-find_package(HinnantDate REQUIRED)
+find_package(date REQUIRED)

message(STATUS "Using ${CMAKE_CXX_COMPILER} (compiler id: ${CMAKE_CXX_COMPILER_ID})")

-set(SQLPP11_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../sqlpp11/include" CACHE FILEPATH "Path to sqlpp11 includes")
+find_package(Sqlpp11 REQUIRED)
+set(SQLPP11_INCLUDE_DIR "${Sqlpp11_INCLUDE_DIR}" CACHE FILEPATH "Path to sqlpp11 includes")

if(NOT EXISTS ${SQLPP11_INCLUDE_DIR}/sqlpp11/sqlpp11.h)
message(SEND_ERROR "Can't find file sqlpp11/sqlpp11.h")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3141a6d..11ce73c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,11 +16,11 @@ if (SQLPP_DYNAMIC_LOADING)
detail/dynamic_libsqlite3.cpp
)

- get_filename_component(SQLITE3_LIB_FILE ${SQLITE3_LIBRARY} NAME)
+ get_filename_component(SQLITE3_LIB_FILE ${SQLite3_LIBRARY} NAME)

if (WIN32)
# the import library (.lib) needs to be replaced by .dll
get_filename_component(SQLITE3_LIB_FILE ${SQLITE3_LIB_FILE} NAME_WE)
string(APPEND SQLITE3_LIB_FILE ".dll")
endif()

@@ -34,8 +34,8 @@ if (SQLPP_DYNAMIC_LOADING)
target_include_directories(sqlpp11-connector-sqlite3-dynamic
PUBLIC
${SQLPP11_INCLUDE_DIR}
- ${HinnantDate_INCLUDE_DIR}
- ${SQLITE3_INCLUDE_DIRS}
+ ${date_INCLUDE_DIR}
+ ${SQLite3_INCLUDE_DIRS}
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
endif()
@@ -43,9 +43,6 @@ endif()
# TODO export Targets for HinnantDate and Sqlite3 as well
target_include_directories(sqlpp11-connector-sqlite3
PUBLIC
- ${SQLPP11_INCLUDE_DIR}
- ${HinnantDate_INCLUDE_DIR}
- ${SQLITE3_INCLUDE_DIRS}
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

@@ -58,14 +55,13 @@ endif()

if (SQLCIPHER)
target_compile_definitions(sqlpp11-connector-sqlite3 PUBLIC SQLPP_USE_SQLCIPHER)
- target_link_libraries(sqlpp11-connector-sqlite3 SQLCipher::SQLCipher)
if (SQLPP_DYNAMIC_LOADING)
target_compile_definitions(sqlpp11-connector-sqlite3-dynamic PUBLIC SQLPP_USE_SQLCIPHER)
- target_include_directories(sqlpp11-connector-sqlite3-dynamic PUBLIC ${SQLCIPHER_INCLUDE_DIRS})
+ target_include_directories(sqlpp11-connector-sqlite3-dynamic PUBLIC ${sqlcipher_INCLUDE_DIRS})
endif()
else()
- target_link_libraries(sqlpp11-connector-sqlite3 ${SQLITE3_LIBRARIES})
endif()
+target_link_libraries(sqlpp11-connector-sqlite3 ${SQLite3_LIBRARIES} date::date sqlpp11::sqlpp11)

install(TARGETS sqlpp11-connector-sqlite3
ARCHIVE DESTINATION lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3008a4..2e72a74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,21 +39,21 @@ if (NOT DEFINED SQLPP11_DYNAMIC_LOADING)
set(SQLPP11_DYNAMIC_LOADING Off)
endif()

-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(SQLCIPHER )
- find_package(SQLCipher REQUIRED)
- set (SQLITE3_LIBRARIES "${SQLCIPHER_LIBRARIES}" )
- set (SQLITE3_INCLUDE_DIRS "${SQLCIPHER_INCLUDE_DIRS}" )
- set (SQLITE3_LIBRARY "${SQLCIPHER_LIBRARY}")
+ find_package(sqlcipher REQUIRED)
+ set (SQLite3_LIBRARIES "${sqlcipher_LIBRARIES}")
+ set (SQLite3_INCLUDE_DIRS "${sqlcipher_INCLUDE_DIRS}")
+ set (SQLite3_LIBRARY "${sqlcipher_LIBRARY}")
else()
- find_package(Sqlite3 REQUIRED)
+ find_package(SQLite3 REQUIRED)
endif()

-find_package(HinnantDate REQUIRED)
+find_package(date REQUIRED)

message(STATUS "Using ${CMAKE_CXX_COMPILER} (compiler id: ${CMAKE_CXX_COMPILER_ID})")

-set(SQLPP11_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../sqlpp11/include" CACHE FILEPATH "Path to sqlpp11 includes")
+find_package(Sqlpp11 REQUIRED)
+set(SQLPP11_INCLUDE_DIR "${Sqlpp11_INCLUDE_DIR}" CACHE FILEPATH "Path to sqlpp11 includes")

if(NOT EXISTS ${SQLPP11_INCLUDE_DIR}/sqlpp11/sqlpp11.h)
message(SEND_ERROR "Can't find file sqlpp11/sqlpp11.h")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3141a6d..d005579 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,7 +16,7 @@ if (SQLPP_DYNAMIC_LOADING)
detail/dynamic_libsqlite3.cpp
)

- get_filename_component(SQLITE3_LIB_FILE ${SQLITE3_LIBRARY} NAME)
+ get_filename_component(SQLITE3_LIB_FILE ${SQLite3_LIBRARY} NAME)

if (WIN32)
# the import library (.lib) needs to be replaced by .dll
@@ -34,8 +34,8 @@ if (SQLPP_DYNAMIC_LOADING)
target_include_directories(sqlpp11-connector-sqlite3-dynamic
PUBLIC
${SQLPP11_INCLUDE_DIR}
- ${HinnantDate_INCLUDE_DIR}
- ${SQLITE3_INCLUDE_DIRS}
+ ${date_INCLUDE_DIR}
+ ${SQLite3_INCLUDE_DIRS}
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
endif()
@@ -44,8 +44,8 @@ endif()
target_include_directories(sqlpp11-connector-sqlite3
PUBLIC
${SQLPP11_INCLUDE_DIR}
- ${HinnantDate_INCLUDE_DIR}
- ${SQLITE3_INCLUDE_DIRS}
+ ${date_INCLUDE_DIR}
+ ${SQLite3_INCLUDE_DIRS}
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)

@@ -58,14 +58,13 @@ endif()

if (SQLCIPHER)
target_compile_definitions(sqlpp11-connector-sqlite3 PUBLIC SQLPP_USE_SQLCIPHER)
- target_link_libraries(sqlpp11-connector-sqlite3 SQLCipher::SQLCipher)
if (SQLPP_DYNAMIC_LOADING)
target_compile_definitions(sqlpp11-connector-sqlite3-dynamic PUBLIC SQLPP_USE_SQLCIPHER)
- target_include_directories(sqlpp11-connector-sqlite3-dynamic PUBLIC ${SQLCIPHER_INCLUDE_DIRS})
+ target_include_directories(sqlpp11-connector-sqlite3-dynamic PUBLIC ${sqlcipher_INCLUDE_DIRS})
endif()
else()
- target_link_libraries(sqlpp11-connector-sqlite3 ${SQLITE3_LIBRARIES})
endif()
+target_link_libraries(sqlpp11-connector-sqlite3 ${SQLite3_LIBRARIES} date::date sqlpp11::sqlpp11)

install(TARGETS sqlpp11-connector-sqlite3
ARCHIVE DESTINATION lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 521927b..18a2615 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,15 +40,14 @@ if (NOT DEFINED SQLPP11_DYNAMIC_LOADING)
set(SQLPP11_DYNAMIC_LOADING Off)
endif()

-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(SQLCIPHER )
- find_package(SQLCipher REQUIRED)
- set (SQLite3_LIBRARY "${SQLCIPHER_LIBRARY}") # TO DO: Needed because of l. 19 in src/CmakeLists.txt?
+ find_package(sqlcipher REQUIRED)
+ set (SQLite3_LIBRARY "${sqlcipher_LIBRARY}") # TO DO: Needed because of l. 19 in src/CmakeLists.txt?
else()
find_package(SQLite3 REQUIRED)
endif()

-add_subdirectory(dependencies)
+find_package(Sqlpp11 REQUIRED)

message(STATUS "Using ${CMAKE_CXX_COMPILER} (compiler id: ${CMAKE_CXX_COMPILER_ID})")

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 22cc106..40f3381 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -74,10 +74,10 @@ target_include_directories(sqlpp11-connector-sqlite3 PUBLIC

if (SQLCIPHER)
target_compile_definitions(sqlpp11-connector-sqlite3 PUBLIC SQLPP_USE_SQLCIPHER)
- target_link_libraries(sqlpp11-connector-sqlite3 PUBLIC SQLCipher::SQLCipher)
+ target_link_libraries(sqlpp11-connector-sqlite3 PUBLIC sqlcipher::sqlcipher)
if (SQLPP_DYNAMIC_LOADING)
target_compile_definitions(sqlpp11-connector-sqlite3-dynamic PUBLIC SQLPP_USE_SQLCIPHER)
- target_include_directories(sqlpp11-connector-sqlite3-dynamic PUBLIC ${SQLCIPHER_INCLUDE_DIRS})
+ target_include_directories(sqlpp11-connector-sqlite3-dynamic PUBLIC ${sqlcipher_INCLUDE_DIRS})
endif()
else()
target_link_libraries(sqlpp11-connector-sqlite3 PUBLIC SQLite::SQLite3)
Loading