vcpkg/ports/sqlite3/portfile.cmake
Robert Schumacher bf2aaf9002
[sqlite3] Embed dllimport in header (#16646)
* [sqlite3] Embed dllimport in header

* Add sqlite3 version info

Co-authored-by: Robert Schumacher <ras0219@outlook.com>
2021-05-28 10:56:31 -07:00

56 lines
1.9 KiB
CMake

set(SQLITE_VERSION 3350400)
set(SQLITE_HASH 1e11c7fa11256a3ac862661e5992211fd29789dba37abfc40e1e39b5e00f7b029a9918e71e8a332e65338142cc62b9dc3d79adf2be28284e1934707e1332b4c6)
vcpkg_download_distfile(ARCHIVE
URLS "https://sqlite.org/2021/sqlite-amalgamation-${SQLITE_VERSION}.zip"
FILENAME "sqlite-amalgamation-${SQLITE_VERSION}.zip"
SHA512 ${SQLITE_HASH}
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${SQLITE_VERSION}
PATCHES fix-arm-uwp.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
geopoly WITH_GEOPOLY
json1 WITH_JSON1
INVERTED_FEATURES
tool SQLITE3_SKIP_TOOLS
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DSQLITE3_SKIP_TOOLS=ON
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_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
)
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sqlite3.h" "# define SQLITE_API\n" "# define SQLITE_API __declspec(dllimport)\n")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n")
vcpkg_copy_pdbs()