Merge pull request #180 from barcharcraz/sqlite3_unlock

Sqlite3 unlock_notify and static build support
This commit is contained in:
Robert Schumacher 2016-10-19 14:25:21 -07:00 committed by GitHub
commit 94ed4be3d9
2 changed files with 25 additions and 4 deletions

View File

@ -2,15 +2,29 @@ cmake_minimum_required(VERSION 3.0)
project(sqlite3 C)
include_directories(${SOURCE})
add_library(sqlite3 SHARED ${SOURCE}/sqlite3.c)
target_compile_definitions(sqlite3 PRIVATE $<$<CONFIG:Debug>:-DSQLITE_DEBUG> "-DSQLITE_API=__declspec(dllexport)")
if(BUILD_SHARED_LIBS)
set(API "-DSQLITE_API=__declspec(dllexport)")
else()
set(API "-DSQLITE_API=extern")
endif()
add_library(sqlite3 ${SOURCE}/sqlite3.c)
target_compile_definitions(sqlite3 PRIVATE
$<$<CONFIG:Debug>:-DSQLITE_DEBUG>
${API}
-DSQLITE_ENABLE_RTREE
-DSQLITE_ENABLE_UNLOCK_NOTIFY
)
target_include_directories(sqlite3 INTERFACE $<INSTALL_INTERFACE:include>)
if(TRIPLET_SYSTEM_NAME MATCHES "WindowsStore")
target_compile_definitions(sqlite3 PRIVATE -DSQLITE_OS_WINRT=1)
endif()
install(TARGETS sqlite3
install(TARGETS sqlite3 EXPORT sqlite3Config
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${SOURCE}/sqlite3.h ${SOURCE}/sqlite3ext.h DESTINATION include CONFIGURATIONS Release)
install(EXPORT sqlite3Config DESTINATION share/sqlite3)

View File

@ -1,3 +1,4 @@
include(${CMAKE_TRIPLET_FILE})
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3150000)
vcpkg_download_distfile(ARCHIVE
@ -14,8 +15,14 @@ vcpkg_configure_cmake(
OPTIONS
-DSOURCE=${SOURCE_PATH}
)
vcpkg_build_cmake()
vcpkg_install_cmake()
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/sqlite3/sqlite3Config-debug.cmake SQLITE3_DEBUG_CONFIG)
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SQLITE3_DEBUG_CONFIG "${SQLITE3_DEBUG_CONFIG}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/sqlite3Config-debug.cmake "${SQLITE3_DEBUG_CONFIG}")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n")
vcpkg_copy_pdbs()