From ba3f552b67a76bc62ef4aecdee778ac47abf330c Mon Sep 17 00:00:00 2001 From: Daniel Strommen Date: Tue, 27 Feb 2018 12:24:41 -0800 Subject: [PATCH] Install sqlite3.exe as part of sqlite3 port (#2525) * Install sqlite3.exe as part of sqlite3 port - Modeled after the bzip2 port: If SQLITE3_SKIP_TOOLS is not set, build and install sqlite3.exe as part of the sqlite3 package. sqlite3.dll must also be copied to the tools folder for sqlite3.exe to be able to launch. - Tested on Windows RS3 with VS 2017 15.5.2. * [sqlite3] Separate into tool feature --- ports/sqlite3/CMakeLists.txt | 21 ++++++++++++++------- ports/sqlite3/CONTROL | 5 ++++- ports/sqlite3/portfile.cmake | 12 +++++++++--- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ports/sqlite3/CMakeLists.txt b/ports/sqlite3/CMakeLists.txt index dbe636b79b..f0d6df1acf 100644 --- a/ports/sqlite3/CMakeLists.txt +++ b/ports/sqlite3/CMakeLists.txt @@ -1,14 +1,13 @@ cmake_minimum_required(VERSION 3.0) project(sqlite3 C) -include_directories(${SOURCE}) +include_directories(.) if(BUILD_SHARED_LIBS) set(API "-DSQLITE_API=__declspec(dllexport)") else() set(API "-DSQLITE_API=extern") endif() -add_library(sqlite3 ${SOURCE}/sqlite3.c) - +add_library(sqlite3 sqlite3.c) target_compile_definitions(sqlite3 PRIVATE $<$:-DSQLITE_DEBUG> @@ -18,14 +17,22 @@ target_compile_definitions(sqlite3 PRIVATE ) target_include_directories(sqlite3 INTERFACE $) -if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore") +if(CMAKE_SYSTEM_NAME MATCHES "WindowsStore") target_compile_definitions(sqlite3 PRIVATE -DSQLITE_OS_WINRT=1) endif() -install(TARGETS sqlite3 EXPORT sqlite3Config +if(NOT SQLITE3_SKIP_TOOLS) + add_executable(sqlite3-bin shell.c) + set_target_properties(sqlite3-bin PROPERTIES OUTPUT_NAME sqlite3) + target_link_libraries(sqlite3-bin PRIVATE sqlite3) + install(TARGETS sqlite3-bin sqlite3 RUNTIME DESTINATION tools) +endif() + +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) \ No newline at end of file + +install(FILES sqlite3.h sqlite3ext.h DESTINATION include CONFIGURATIONS Release) +install(EXPORT sqlite3Config DESTINATION share/sqlite3) diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index ccb3a3745e..7e39794dd6 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -1,3 +1,6 @@ Source: sqlite3 -Version: 3.21.0 +Version: 3.21.0-1 Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. + +Feature: tool +Description: sqlite3 executable diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index fc06850e27..031eefbf2c 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -12,14 +12,20 @@ vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +set(SQLITE3_SKIP_TOOLS ON) +if("tool" IN_LIST FEATURES) + set(SQLITE3_SKIP_TOOLS OFF) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DSOURCE=${SOURCE_PATH} - -DVCPKG_CMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME} + -DSQLITE3_SKIP_TOOLS=${SQLITE3_SKIP_TOOLS} + OPTIONS_DEBUG + -DSQLITE3_SKIP_TOOLS=ON ) -vcpkg_build_cmake() + vcpkg_install_cmake() file(READ ${CURRENT_PACKAGES_DIR}/debug/share/sqlite3/sqlite3Config-debug.cmake SQLITE3_DEBUG_CONFIG)