mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-01 13:45:38 +08:00
185a7aa23a
* [sqlite3] Control features with a configuration header rather than CMake or pkgconfig. Resolves https://github.com/microsoft/vcpkg/pull/29335 Alternate of https://github.com/microsoft/vcpkg/pull/29258 @Neumann-A points out that controlling features through CMake configs and pkgconfig causes MSBuild customers to be left out in the cold. Moreover, attempting to add parenthesis to the SQLITE_API marco breaks autotools. This change makes such parenthesis unnecessary and ensures the configuration bits are used with automatic linking. * Ensure feature controls affect the .c too, use less MAYBE_UNUSED. * Correctly note that zlib has no effect without tools. * Always add DL_LIBS even when static linking. * [sqlitecpp] Unconditionally enable column metadata because that is done in the sqlite3 port. * Add missing -l prefix on CMAKE_DL_LIBS
94 lines
3.3 KiB
CMake
94 lines
3.3 KiB
CMake
string(REGEX REPLACE "^([0-9]+)[.]([0-9]+)[.]([0-9]+)[.]([0-9]+)" "\\1,0\\2,0\\3,0\\4," SQLITE_VERSION "${VERSION}.0")
|
|
string(REGEX REPLACE "^([0-9]+),0*([0-9][0-9]),0*([0-9][0-9]),0*([0-9][0-9])," "\\1\\2\\3\\4" SQLITE_VERSION "${SQLITE_VERSION}")
|
|
|
|
vcpkg_download_distfile(ARCHIVE
|
|
URLS "https://sqlite.org/2022/sqlite-amalgamation-${SQLITE_VERSION}.zip"
|
|
FILENAME "sqlite-amalgamation-${SQLITE_VERSION}.zip"
|
|
SHA512 863afdabbdbe27baaccc13477e08437ce3b4d7e6f0c51a294d1d71252476af474b6c275729ebe1bc801f004da7ca6775591a30fed1930c3a1920d8118864f1d2
|
|
)
|
|
|
|
vcpkg_extract_source_archive(
|
|
SOURCE_PATH
|
|
ARCHIVE "${ARCHIVE}"
|
|
PATCHES
|
|
fix-arm-uwp.patch
|
|
add-config-include.patch
|
|
)
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
set(SQLITE_API "__declspec(dllimport)")
|
|
else()
|
|
set(SQLITE_API "__attribute__((visibility(\"default\")))")
|
|
endif()
|
|
else()
|
|
set(SQLITE_API "")
|
|
endif()
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS Unused
|
|
FEATURES
|
|
fts3 SQLITE_ENABLE_FTS3
|
|
fts4 SQLITE_ENABLE_FTS4
|
|
fts5 SQLITE_ENABLE_FTS5
|
|
memsys3 SQLITE_ENABLE_MEMSYS3
|
|
memsys5 SQLITE_ENABLE_MEMSYS5
|
|
math SQLITE_ENABLE_MATH_FUNCTIONS
|
|
limit SQLITE_ENABLE_UPDATE_DELETE_LIMIT
|
|
rtree SQLITE_ENABLE_RTREE
|
|
session SQLITE_ENABLE_SESSION
|
|
session SQLITE_ENABLE_PREUPDATE_HOOK
|
|
omit-load-extension SQLITE_OMIT_LOAD_EXTENSION
|
|
geopoly SQLITE_ENABLE_GEOPOLY
|
|
json1 SQLITE_ENABLE_JSON1
|
|
)
|
|
|
|
if(VCPKG_TARGET_IS_WINDOWS)
|
|
set(SQLITE_OS_WIN "1")
|
|
if(VCPKG_TARGET_IS_UWP)
|
|
set(SQLITE_OS_WINRT "1")
|
|
endif()
|
|
else()
|
|
set(SQLITE_OS_UNIX "1")
|
|
endif()
|
|
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
|
file(COPY "${CMAKE_CURRENT_LIST_DIR}/sqlite3.pc.in" DESTINATION "${SOURCE_PATH}")
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/sqlite3-vcpkg-config.h.in" "${SOURCE_PATH}/sqlite3-vcpkg-config.h" @ONLY)
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
FEATURES
|
|
zlib WITH_ZLIB
|
|
INVERTED_FEATURES
|
|
tool SQLITE3_SKIP_TOOLS
|
|
)
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
OPTIONS
|
|
${FEATURE_OPTIONS}
|
|
-DPKGCONFIG_VERSION=${VERSION}
|
|
OPTIONS_DEBUG
|
|
-DSQLITE3_SKIP_TOOLS=ON
|
|
)
|
|
|
|
vcpkg_cmake_install()
|
|
vcpkg_copy_pdbs()
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT} CONFIG_PATH share/unofficial-${PORT})
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
|
|
if(NOT SQLITE3_SKIP_TOOLS AND EXISTS "${CURRENT_PACKAGES_DIR}/tools/sqlite3-bin${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/tools/sqlite3-bin${VCPKG_HOST_EXECUTABLE_SUFFIX}" "${CURRENT_PACKAGES_DIR}/tools/sqlite3${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
|
endif()
|
|
|
|
configure_file(
|
|
"${CMAKE_CURRENT_LIST_DIR}/sqlite3-config.in.cmake"
|
|
"${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-sqlite3-config.cmake"
|
|
@ONLY
|
|
)
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n")
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|