diff --git a/ports/unicorn-lib/CMakeLists.txt b/ports/unicorn-lib/CMakeLists.txt index b668c3c09a..4f0879e52d 100644 --- a/ports/unicorn-lib/CMakeLists.txt +++ b/ports/unicorn-lib/CMakeLists.txt @@ -4,30 +4,23 @@ project(Unicorn_Lib LANGUAGES CXX DESCRIPTION "Unicode library for C++ by Ross S set(CMAKE_CXX_STANDARD 17) option(UNICORN_LIB_SKIP_HEADERS "If the headers installation is skipped or not." OFF) -include(SelectLibraryConfigurations) find_package(ZLIB REQUIRED) -find_library(PCRE2_LIBRARY_DEBUG NAMES pcre2-8d pcre2-8-staticd HINTS ${INSTALLED_LIB_PATH}) -find_library(PCRE2_LIBRARY_RELEASE NAMES pcre2-8 pcre2-8-static HINTS ${INSTALLED_LIB_PATH}) -select_library_configurations(PCRE2) +find_package(PkgConfig REQUIRED) +pkg_check_modules(PCRE2 IMPORTED_TARGET REQUIRED libpcre2-8) + +file(GLOB_RECURSE UNICORN_LIB_SOURCES "${PROJECT_SOURCE_DIR}/unicorn/*.cpp") +list(FILTER UNICORN_LIB_SOURCES EXCLUDE REGEX "(.*)-test.cpp(.*)") -file(GLOB_RECURSE UNICORN_LIB_SOURCES ${PROJECT_SOURCE_DIR}/unicorn/*.cpp) -foreach(ITR ${UNICORN_LIB_SOURCES}) - if(ITR MATCHES "(.*)-test.cpp(.*)") - list(REMOVE_ITEM UNICORN_LIB_SOURCES ${ITR}) - endif() -endforeach() add_library(unicorn-lib ${UNICORN_LIB_SOURCES}) -target_include_directories( - unicorn-lib - PUBLIC ${PROJECT_SOURCE_DIR} -) -target_compile_definitions( - unicorn-lib - PRIVATE -DUNICODE -D_UNICODE _CRT_SECURE_NO_WARNINGS -) - -target_link_libraries(unicorn-lib PUBLIC ${PCRE2_LIBRARY}) -target_link_libraries(unicorn-lib PUBLIC ZLIB::ZLIB) +target_include_directories(unicorn-lib PUBLIC "${PROJECT_SOURCE_DIR}") +target_link_libraries(unicorn-lib PRIVATE PkgConfig::PCRE2 ZLIB::ZLIB) +if(WIN32) + target_compile_definitions(unicorn-lib PRIVATE -DNOMINMAX -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_WARNINGS) +else() + find_package(Iconv REQUIRED) + target_link_libraries(unicorn-lib PRIVATE Iconv::Iconv) + target_compile_definitions(unicorn-lib PRIVATE -D_XOPEN_SOURCE=700) +endif() 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 a206c633cb..25ef7557fb 100644 --- a/ports/unicorn-lib/portfile.cmake +++ b/ports/unicorn-lib/portfile.cmake @@ -1,20 +1,21 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - message("unicorn-lib is a static library, now build with static.") - set(VCPKG_LIBRARY_LINKAGE static) -endif() +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO CaptainCrowbar/unicorn-lib - REF 44e975ffc8dcd8dedbe01a8cbe7812e351f3f74f # 2022-01-24 + REF 44e975ffc8dcd8dedbe01a8cbe7812e351f3f74f # 2021-10-28 SHA512 b22264420174c950ca8025e861366118d79a53edce9297d84af9511e255af5971c3719f0b464f4a4886848edea7c2ba4ae32ce9abab135628d64adbde5fa7b0d HEAD_REF master ) -file(COPY ${CURRENT_PORT_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(COPY "${CURRENT_PORT_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_find_acquire_program(PKGCONFIG) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" OPTIONS_DEBUG -DUNICORN_LIB_SKIP_HEADERS=ON ) @@ -22,6 +23,4 @@ vcpkg_cmake_configure( vcpkg_cmake_install() vcpkg_copy_pdbs() -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") - file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/unicorn-lib/vcpkg.json b/ports/unicorn-lib/vcpkg.json index 9a7ed9aeb2..d62d1f9925 100644 --- a/ports/unicorn-lib/vcpkg.json +++ b/ports/unicorn-lib/vcpkg.json @@ -1,11 +1,20 @@ { "name": "unicorn-lib", "version-date": "2022-01-24", + "port-version": 1, "description": "Unicode library for C++ by Ross Smith", "homepage": "https://github.com/CaptainCrowbar/unicorn-lib", "license": "MIT", + "supports": "!uwp", "dependencies": [ - "pcre2", + { + "name": "libiconv", + "platform": "!windows" + }, + { + "name": "pcre2", + "default-features": false + }, { "name": "vcpkg-cmake", "host": true diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 2639867277..f25697edee 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1601,8 +1601,6 @@ turbobase64:arm-neon-android=fail tvision:arm-neon-android=fail tvision:arm64-android=fail tvision:x64-android=fail -unicorn-lib:arm-uwp=fail -unicorn-lib:x64-uwp=fail unicorn:x64-windows-static-md=fail unittest-cpp:arm-neon-android=fail unittest-cpp:arm64-android=fail diff --git a/versions/baseline.json b/versions/baseline.json index 6b408cde14..3b78d5ca71 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8234,7 +8234,7 @@ }, "unicorn-lib": { "baseline": "2022-01-24", - "port-version": 0 + "port-version": 1 }, "units": { "baseline": "2.3.3", diff --git a/versions/u-/unicorn-lib.json b/versions/u-/unicorn-lib.json index db2bc9f785..976fcb4cc8 100644 --- a/versions/u-/unicorn-lib.json +++ b/versions/u-/unicorn-lib.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "20329e00e75f4f13bb1b77f3e19c23182861c6cd", + "version-date": "2022-01-24", + "port-version": 1 + }, { "git-tree": "278115c391839dcfc66ac80339c8dcd9a660c9e0", "version-date": "2022-01-24",