From 7e4fdb4c3abb9965643cff857c290b80876ca8f1 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Mon, 20 May 2019 08:03:57 +0000 Subject: [PATCH 1/5] [unicorn-lib]Fix build error. --- ports/unicorn-lib/CMakeLists.txt | 11 ++++++++++- ports/unicorn-lib/CONTROL | 2 +- ports/unicorn-lib/portfile.cmake | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ports/unicorn-lib/CMakeLists.txt b/ports/unicorn-lib/CMakeLists.txt index b34e04f23055b9..5e4cf3c3844a6b 100644 --- a/ports/unicorn-lib/CMakeLists.txt +++ b/ports/unicorn-lib/CMakeLists.txt @@ -6,6 +6,8 @@ option(UNICORN_LIB_SKIP_HEADERS "If the headers installation is skipped or not." find_path(RS_CORE_LIB_INCLUDE_DIR rs-core/common.hpp) #find_library(RW_UTILITIES_LIBRARY NAMES rw_utilities) +find_library(ZLIB_LIBRARY NAMES zlib HINTS ${INSTALLED_LIB_PATH}) +find_library(PCRE2_LIBRARY NAMES pcre2-8 HINTS ${INSTALLED_LIB_PATH}) file(GLOB_RECURSE UNICORN_LIB_SOURCES ${PROJECT_SOURCE_DIR}/unicorn/*.cpp) foreach(ITR ${UNICORN_LIB_SOURCES}) @@ -24,7 +26,14 @@ target_compile_definitions( PRIVATE -DUNICODE -D_UNICODE _CRT_SECURE_NO_WARNINGS ) +target_link_libraries(unicorn-lib ${PCRE2_LIBRARY}) +target_link_libraries(unicorn-lib ${ZLIB_LIBRARY}) + if(NOT UNICORN_LIB_SKIP_HEADERS) install(DIRECTORY ${PROJECT_SOURCE_DIR}/unicorn DESTINATION include FILES_MATCHING PATTERN "*.hpp") endif() -install(TARGETS unicorn-lib DESTINATION lib) \ No newline at end of file +install(TARGETS unicorn-lib + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) \ No newline at end of file diff --git a/ports/unicorn-lib/CONTROL b/ports/unicorn-lib/CONTROL index aa03f5148302da..655dd26d7209e4 100644 --- a/ports/unicorn-lib/CONTROL +++ b/ports/unicorn-lib/CONTROL @@ -1,4 +1,4 @@ Source: unicorn-lib -Version: 2019-05-07 +Version: 2019-05-07-1 Description: Unicode library for C++ by Ross Smith Build-Depends: rs-core-lib, pcre2, zlib, libiconv diff --git a/ports/unicorn-lib/portfile.cmake b/ports/unicorn-lib/portfile.cmake index 8c298ca7f1dbdc..180c1037c76088 100644 --- a/ports/unicorn-lib/portfile.cmake +++ b/ports/unicorn-lib/portfile.cmake @@ -15,10 +15,13 @@ vcpkg_configure_cmake( PREFER_NINJA OPTIONS_DEBUG -DUNICORN_LIB_SKIP_HEADERS=ON + -DINSTALLED_LIB_PATH=${CURRENT_INSTALLED_DIR}/lib ) vcpkg_install_cmake() vcpkg_copy_pdbs() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/unicorn-lib RENAME copyright) \ No newline at end of file From ed2a171d6f346ef401a72eed9f10bafdb6d2ad44 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Wed, 22 May 2019 02:40:16 +0000 Subject: [PATCH 2/5] [unicorn-lib]Changed library linkage to static. --- ports/unicorn-lib/CMakeLists.txt | 4 ++-- ports/unicorn-lib/portfile.cmake | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ports/unicorn-lib/CMakeLists.txt b/ports/unicorn-lib/CMakeLists.txt index 5e4cf3c3844a6b..59cbee5a1e079c 100644 --- a/ports/unicorn-lib/CMakeLists.txt +++ b/ports/unicorn-lib/CMakeLists.txt @@ -26,8 +26,8 @@ target_compile_definitions( PRIVATE -DUNICODE -D_UNICODE _CRT_SECURE_NO_WARNINGS ) -target_link_libraries(unicorn-lib ${PCRE2_LIBRARY}) -target_link_libraries(unicorn-lib ${ZLIB_LIBRARY}) +target_link_libraries(unicorn-lib PUBLIC ${PCRE2_LIBRARY}) +target_link_libraries(unicorn-lib PUBLIC ${ZLIB_LIBRARY}) if(NOT UNICORN_LIB_SKIP_HEADERS) install(DIRECTORY ${PROJECT_SOURCE_DIR}/unicorn DESTINATION include FILES_MATCHING PATTERN "*.hpp") diff --git a/ports/unicorn-lib/portfile.cmake b/ports/unicorn-lib/portfile.cmake index 180c1037c76088..dff094ef861634 100644 --- a/ports/unicorn-lib/portfile.cmake +++ b/ports/unicorn-lib/portfile.cmake @@ -1,5 +1,10 @@ include(vcpkg_common_functions) +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message("unicorn-lib is a static library, now build with static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO CaptainCrowbar/unicorn-lib @@ -15,7 +20,6 @@ vcpkg_configure_cmake( PREFER_NINJA OPTIONS_DEBUG -DUNICORN_LIB_SKIP_HEADERS=ON - -DINSTALLED_LIB_PATH=${CURRENT_INSTALLED_DIR}/lib ) vcpkg_install_cmake() From f03245fe84aff3d130c99a2aed0e68cabd16aa26 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Thu, 23 May 2019 08:12:03 +0000 Subject: [PATCH 3/5] [unicorn-lib]Use find_package instead of find_library to find zlib. --- ports/unicorn-lib/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/unicorn-lib/CMakeLists.txt b/ports/unicorn-lib/CMakeLists.txt index 59cbee5a1e079c..83ac9563a5eead 100644 --- a/ports/unicorn-lib/CMakeLists.txt +++ b/ports/unicorn-lib/CMakeLists.txt @@ -6,7 +6,7 @@ option(UNICORN_LIB_SKIP_HEADERS "If the headers installation is skipped or not." find_path(RS_CORE_LIB_INCLUDE_DIR rs-core/common.hpp) #find_library(RW_UTILITIES_LIBRARY NAMES rw_utilities) -find_library(ZLIB_LIBRARY NAMES zlib HINTS ${INSTALLED_LIB_PATH}) +find_package(ZLIB REQUIRED) find_library(PCRE2_LIBRARY NAMES pcre2-8 HINTS ${INSTALLED_LIB_PATH}) file(GLOB_RECURSE UNICORN_LIB_SOURCES ${PROJECT_SOURCE_DIR}/unicorn/*.cpp) @@ -27,7 +27,7 @@ target_compile_definitions( ) target_link_libraries(unicorn-lib PUBLIC ${PCRE2_LIBRARY}) -target_link_libraries(unicorn-lib PUBLIC ${ZLIB_LIBRARY}) +target_link_libraries(unicorn-lib PUBLIC ${ZLIB_LIBRARIES}) if(NOT UNICORN_LIB_SKIP_HEADERS) install(DIRECTORY ${PROJECT_SOURCE_DIR}/unicorn DESTINATION include FILES_MATCHING PATTERN "*.hpp") From b2a261d6c0bb571f7151504c03b66a7138109ab9 Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Thu, 23 May 2019 08:28:40 +0000 Subject: [PATCH 4/5] [unicorn-lib]Fix the name of the PCRE2 library under debug/release and modify ZLIB link name. --- ports/unicorn-lib/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ports/unicorn-lib/CMakeLists.txt b/ports/unicorn-lib/CMakeLists.txt index 83ac9563a5eead..d4585c609e4255 100644 --- a/ports/unicorn-lib/CMakeLists.txt +++ b/ports/unicorn-lib/CMakeLists.txt @@ -7,7 +7,11 @@ option(UNICORN_LIB_SKIP_HEADERS "If the headers installation is skipped or not." find_path(RS_CORE_LIB_INCLUDE_DIR rs-core/common.hpp) #find_library(RW_UTILITIES_LIBRARY NAMES rw_utilities) find_package(ZLIB REQUIRED) -find_library(PCRE2_LIBRARY NAMES pcre2-8 HINTS ${INSTALLED_LIB_PATH}) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + find_library(PCRE2_LIBRARY NAMES pcre2-8d HINTS ${INSTALLED_LIB_PATH}) +else() + find_library(PCRE2_LIBRARY NAMES pcre2-8 HINTS ${INSTALLED_LIB_PATH}) +endif() file(GLOB_RECURSE UNICORN_LIB_SOURCES ${PROJECT_SOURCE_DIR}/unicorn/*.cpp) foreach(ITR ${UNICORN_LIB_SOURCES}) @@ -27,7 +31,7 @@ target_compile_definitions( ) target_link_libraries(unicorn-lib PUBLIC ${PCRE2_LIBRARY}) -target_link_libraries(unicorn-lib PUBLIC ${ZLIB_LIBRARIES}) +target_link_libraries(unicorn-lib PUBLIC ZLIB::ZLIB) if(NOT UNICORN_LIB_SKIP_HEADERS) install(DIRECTORY ${PROJECT_SOURCE_DIR}/unicorn DESTINATION include FILES_MATCHING PATTERN "*.hpp") From 079928bc63ac832b486b2ae962e1a670d7cfdeaa Mon Sep 17 00:00:00 2001 From: JackBoosY Date: Fri, 24 May 2019 01:55:33 +0000 Subject: [PATCH 5/5] [unicorn-lib]Use select_library_configurations to select which pcre2 library should be linked. --- ports/unicorn-lib/CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ports/unicorn-lib/CMakeLists.txt b/ports/unicorn-lib/CMakeLists.txt index d4585c609e4255..9a9c5825e62d14 100644 --- a/ports/unicorn-lib/CMakeLists.txt +++ b/ports/unicorn-lib/CMakeLists.txt @@ -7,11 +7,9 @@ option(UNICORN_LIB_SKIP_HEADERS "If the headers installation is skipped or not." find_path(RS_CORE_LIB_INCLUDE_DIR rs-core/common.hpp) #find_library(RW_UTILITIES_LIBRARY NAMES rw_utilities) find_package(ZLIB REQUIRED) -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - find_library(PCRE2_LIBRARY NAMES pcre2-8d HINTS ${INSTALLED_LIB_PATH}) -else() - find_library(PCRE2_LIBRARY NAMES pcre2-8 HINTS ${INSTALLED_LIB_PATH}) -endif() +find_library(PCRE2_LIBRARY_DEBUG NAMES pcre2-8d HINTS ${INSTALLED_LIB_PATH}) +find_library(PCRE2_LIBRARY_RELEASE NAMES pcre2-8 HINTS ${INSTALLED_LIB_PATH}) +select_library_configurations(PCRE2) file(GLOB_RECURSE UNICORN_LIB_SOURCES ${PROJECT_SOURCE_DIR}/unicorn/*.cpp) foreach(ITR ${UNICORN_LIB_SOURCES})