diff options
| author | NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> | 2020-09-05 11:16:00 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-04 20:16:00 -0700 |
| commit | e0f0e7c1ec9b59543190543bfac93a37a2d1094a (patch) | |
| tree | 630d8b24a82a1f9fd5b19d692e6689d013ec8562 /ports/sqlite-orm | |
| parent | 2e110d26c621ba2536de7f47708bf1bf16f5159d (diff) | |
| download | vcpkg-e0f0e7c1ec9b59543190543bfac93a37a2d1094a.tar.gz vcpkg-e0f0e7c1ec9b59543190543bfac93a37a2d1094a.zip | |
[sqlite-orm] Add features and also fix usage (#13328)
Diffstat (limited to 'ports/sqlite-orm')
| -rw-r--r-- | ports/sqlite-orm/CONTROL | 9 | ||||
| -rw-r--r-- | ports/sqlite-orm/disable-examples.patch | 13 | ||||
| -rw-r--r-- | ports/sqlite-orm/fix-build-error.patch | 24 | ||||
| -rw-r--r-- | ports/sqlite-orm/fix-example-feature.patch | 11 | ||||
| -rw-r--r-- | ports/sqlite-orm/fix-includes-not-found.patch | 18 | ||||
| -rw-r--r-- | ports/sqlite-orm/fix-test-feature.patch | 30 | ||||
| -rw-r--r-- | ports/sqlite-orm/fix-usage.patch | 59 | ||||
| -rw-r--r-- | ports/sqlite-orm/portfile.cmake | 24 |
8 files changed, 151 insertions, 37 deletions
diff --git a/ports/sqlite-orm/CONTROL b/ports/sqlite-orm/CONTROL index b0735d1de..e5f4bccb0 100644 --- a/ports/sqlite-orm/CONTROL +++ b/ports/sqlite-orm/CONTROL @@ -1,6 +1,13 @@ Source: sqlite-orm Version: 1.5 -Port-Version: 1 +Port-Version: 2 Homepage: https://github.com/fnc12/sqlite_orm Build-Depends: sqlite3 Description: SQLite ORM light header only library for modern C++ + +Feature: test +Description: Build sqlite_orm unit tests +Build-Depends: catch2 + +Feature: example +Description: Build examples diff --git a/ports/sqlite-orm/disable-examples.patch b/ports/sqlite-orm/disable-examples.patch deleted file mode 100644 index 61d832016..000000000 --- a/ports/sqlite-orm/disable-examples.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 5ffbdf3..ba22109 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -75,7 +75,7 @@ if(SqliteOrm_BuildTests AND BUILD_TESTING)
- add_subdirectory(tests)
- endif()
-
--add_subdirectory(examples)
-+#add_subdirectory(examples)
-
- install(TARGETS sqlite_orm EXPORT "${ProjectName}Targets"
- INCLUDES DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development
diff --git a/ports/sqlite-orm/fix-build-error.patch b/ports/sqlite-orm/fix-build-error.patch new file mode 100644 index 000000000..ca4e005d4 --- /dev/null +++ b/ports/sqlite-orm/fix-build-error.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5ffbdf3..6debae6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -39,6 +39,9 @@ set(ProjectName "SqliteOrm")
+
+ option(SqliteOrm_BuildTests "Build sqlite_orm unit tests" ON)
+
++find_package(unofficial-sqlite3 CONFIG REQUIRED)
++link_libraries(unofficial::sqlite3::sqlite3)
++
+ set(SqliteOrm_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/include")
+ add_library(sqlite_orm INTERFACE)
+
+@@ -75,7 +78,9 @@ if(SqliteOrm_BuildTests AND BUILD_TESTING)
+ add_subdirectory(tests)
+ endif()
+
++if(BUILD_EXAMPLES)
+ add_subdirectory(examples)
++endif()
+
+ install(TARGETS sqlite_orm EXPORT "${ProjectName}Targets"
+ INCLUDES DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development
diff --git a/ports/sqlite-orm/fix-example-feature.patch b/ports/sqlite-orm/fix-example-feature.patch new file mode 100644 index 000000000..ad68dade0 --- /dev/null +++ b/ports/sqlite-orm/fix-example-feature.patch @@ -0,0 +1,11 @@ +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
+index 2857b65..3ee46e6 100644
+--- a/examples/CMakeLists.txt
++++ b/examples/CMakeLists.txt
+@@ -4,5 +4,5 @@ file(GLOB files "*.cpp")
+ foreach(file ${files})
+ get_filename_component(file_basename ${file} NAME_WE)
+ add_executable(${file_basename} ${file})
+- target_link_libraries(${file_basename} PRIVATE sqlite_orm sqlite3)
++ target_link_libraries(${file_basename} PRIVATE sqlite_orm)
+ endforeach()
diff --git a/ports/sqlite-orm/fix-includes-not-found.patch b/ports/sqlite-orm/fix-includes-not-found.patch deleted file mode 100644 index 42ee7672c..000000000 --- a/ports/sqlite-orm/fix-includes-not-found.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 5ffbdf3..a6b2659 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -43,11 +43,11 @@ set(SqliteOrm_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/include")
- add_library(sqlite_orm INTERFACE)
-
- target_sources(sqlite_orm INTERFACE
-- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/sqlite_orm/sqlite_orm.h>
-+ $<BUILD_INTERFACE:${SqliteOrm_INCLUDE}/include/sqlite_orm/sqlite_orm.h>
- $<INSTALL_INTERFACE:include/sqlite_orm/sqlite_orm.h>)
-
- target_include_directories(sqlite_orm INTERFACE
-- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
-+ $<BUILD_INTERFACE:${SqliteOrm_INCLUDE}/include>
- $<INSTALL_INTERFACE:include>)
-
- include(ucm)
diff --git a/ports/sqlite-orm/fix-test-feature.patch b/ports/sqlite-orm/fix-test-feature.patch new file mode 100644 index 000000000..2f8259384 --- /dev/null +++ b/ports/sqlite-orm/fix-test-feature.patch @@ -0,0 +1,30 @@ +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 578cbed..c1c6d56 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -4,11 +4,11 @@ option(SQLITE_ORM_OMITS_CODECVT "Omits codec testing" OFF)
+
+ option(SqliteOrm_SysSqlite "Use system version of sqlite library" OFF)
+
+-if(SqliteOrm_SysSqlite)
+- message(FATAL_ERROR "WIP: please, disable the SqliteOrm_SysSqlite option.")
+-else()
+- add_subdirectory(third_party/sqlite)
+-endif()
++#if(SqliteOrm_SysSqlite)
++# message(FATAL_ERROR "WIP: please, disable the SqliteOrm_SysSqlite option.")
++#else()
++# add_subdirectory(third_party/sqlite)
++#endif()
+
+ add_executable(unit_tests tests.cpp tests2.cpp tests3.cpp tests4.cpp tests4.cpp private_getters_tests.cpp pragma_tests.cpp explicit_columns.cpp core_functions_tests.cpp composite_key.cpp static_tests.cpp operators.cpp operators/like.cpp operators/glob.cpp operators/in.cpp operators/cast.cpp operators/is_null.cpp dynamic_order_by.cpp prepared_statement_tests/select.cpp prepared_statement_tests/get_all.cpp prepared_statement_tests/get_all_pointer.cpp prepared_statement_tests/get_all_optional.cpp prepared_statement_tests/update_all.cpp prepared_statement_tests/remove_all.cpp prepared_statement_tests/get.cpp prepared_statement_tests/get_pointer.cpp prepared_statement_tests/get_optional.cpp prepared_statement_tests/update.cpp prepared_statement_tests/remove.cpp prepared_statement_tests/insert.cpp prepared_statement_tests/replace.cpp prepared_statement_tests/insert_range.cpp prepared_statement_tests/replace_range.cpp prepared_statement_tests/insert_explicit.cpp pragma_tests.cpp simple_query.cpp static_tests/is_bindable.cpp static_tests/arithmetic_operators_result_type.cpp static_tests/tuple_conc.cpp static_tests/node_tuple.cpp static_tests/bindable_filter.cpp static_tests/count_tuple.cpp constraints/default.cpp constraints/foreign_key.cpp)
+
+@@ -19,7 +19,7 @@ if(SQLITE_ORM_OMITS_CODECVT)
+ endif()
+
+ find_package(Catch2 REQUIRED)
+-target_link_libraries(unit_tests PRIVATE sqlite_orm sqlite3 Catch2::Catch2)
++target_link_libraries(unit_tests PRIVATE sqlite_orm Catch2::Catch2)
+
+ enable_testing()
+
diff --git a/ports/sqlite-orm/fix-usage.patch b/ports/sqlite-orm/fix-usage.patch new file mode 100644 index 000000000..7e90b0edf --- /dev/null +++ b/ports/sqlite-orm/fix-usage.patch @@ -0,0 +1,59 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6debae6..facdc1e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -47,7 +47,7 @@ add_library(sqlite_orm INTERFACE)
+
+ target_sources(sqlite_orm INTERFACE
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/sqlite_orm/sqlite_orm.h>
+- $<INSTALL_INTERFACE:include/sqlite_orm/sqlite_orm.h>)
++ $<INSTALL_INTERFACE:include/sqlite_orm.h>)
+
+ target_include_directories(sqlite_orm INTERFACE
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
+@@ -83,11 +83,11 @@ add_subdirectory(examples)
+ endif()
+
+ install(TARGETS sqlite_orm EXPORT "${ProjectName}Targets"
+- INCLUDES DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development
+- PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development)
++ INCLUDES DESTINATION "${INCLUDE_INSTALL_DIR}"
++ PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}")
+
+ install(FILES "include/sqlite_orm/sqlite_orm.h"
+- DESTINATION "${INCLUDE_INSTALL_DIR}" COMPONENT Development)
++ DESTINATION "${INCLUDE_INSTALL_DIR}")
+
+ export(EXPORT "${ProjectName}Targets"
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/${ProjectName}/${ProjectName}Targets.cmake"
+diff --git a/build/cmake/GenerateConfigModule.cmake b/build/cmake/GenerateConfigModule.cmake
+index 3c5143d..a49f76a 100644
+--- a/build/cmake/GenerateConfigModule.cmake
++++ b/build/cmake/GenerateConfigModule.cmake
+@@ -1,7 +1,7 @@
+ include(CMakePackageConfigHelpers)
+
+-set(PACKAGE_INCLUDE_INSTALL_DIR "${includedir}/sqlite_orm")
+-set(PACKAGE_CMAKE_INSTALL_DIR "${cmakedir}/sqlite_orm")
++set(PACKAGE_INCLUDE_INSTALL_DIR "${includedir}")
++set(PACKAGE_CMAKE_INSTALL_DIR "${cmakedir}")
+
+ # In CYGWIN enviroment below commands does not work properly
+ if (NOT CYGWIN)
+diff --git a/build/cmake/SqliteOrmConfig.cmake.in b/build/cmake/SqliteOrmConfig.cmake.in
+index a6b6f20..7411aa1 100644
+--- a/build/cmake/SqliteOrmConfig.cmake.in
++++ b/build/cmake/SqliteOrmConfig.cmake.in
+@@ -3,10 +3,10 @@ set(SQLITE_ORM_VERSION ${sqlite_orm_VERSION})
+ @PACKAGE_INIT@
+
+ set_and_check(SQLITE_ORM_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
+-set_and_check(SQLITE_ORM_CMAKE_DIR "@PACKAGE_CMAKE_INSTALL_DIR@")
++set_and_check(SQLITE_ORM_CMAKE_DIR "@PACKAGE_CMAKE_INSTALL_DIR@/../../")
+
+ if (NOT TARGET sqlite_orm::sqlite_orm)
+- include("${SQLITE_ORM_CMAKE_DIR}/SqliteOrmTargets.cmake")
++ include("${SQLITE_ORM_CMAKE_DIR}/share/SqliteOrm/SqliteOrmTargets.cmake")
+ endif()
+
+ set(SQLITE_ORM_LIBRARIES sqlite_orm::sqlite_orm)
diff --git a/ports/sqlite-orm/portfile.cmake b/ports/sqlite-orm/portfile.cmake index 83dcfa923..140ab42c6 100644 --- a/ports/sqlite-orm/portfile.cmake +++ b/ports/sqlite-orm/portfile.cmake @@ -1,5 +1,15 @@ # header-only library +set(FEATURE_PATCHES) + +if(test IN_LIST FEATURES) + list(APPEND FEATURE_PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-test-feature.patch) +endif() + +if(example IN_LIST FEATURES) + list(APPEND FEATURE_PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-example-feature.patch) +endif() + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO fnc12/sqlite_orm @@ -7,17 +17,21 @@ vcpkg_from_github( SHA512 faeeef88aef11e89e9565850c23087925fb4d75ef48a16434055f18831db8e230d044c81574d840dacca406d7095cb83a113afc326996e289ab11a02d8caa2f4 HEAD_REF master PATCHES - fix-includes-not-found.patch - disable-examples.patch + fix-build-error.patch + fix-usage.patch + ${FEATURE_PATCHES} +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + test SqliteOrm_BuildTests + example BUILD_EXAMPLES ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS + OPTIONS ${FEATURE_OPTIONS} -DSQLITE_ORM_ENABLE_CXX_17=OFF - -DSqliteOrm_BuildTests=OFF - -DBUILD_TESTING=OFF ) vcpkg_install_cmake() |
