Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg baseline][unicorn-lib] Fix, cleanup #31706

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions ports/unicorn-lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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
)
file(GLOB_RECURSE UNICORN_LIB_SOURCES "${PROJECT_SOURCE_DIR}/unicorn/*.cpp")
list(FILTER UNICORN_LIB_SOURCES EXCLUDE REGEX "(.*)-test.cpp(.*)")

target_link_libraries(unicorn-lib PUBLIC ${PCRE2_LIBRARY})
target_link_libraries(unicorn-lib PUBLIC ZLIB::ZLIB)
add_library(unicorn-lib ${UNICORN_LIB_SOURCES})
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()
Comment on lines +19 to +23
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key contribution.


if(NOT UNICORN_LIB_SKIP_HEADERS)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/unicorn DESTINATION include FILES_MATCHING PATTERN "*.hpp")
Expand Down
15 changes: 7 additions & 8 deletions ports/unicorn-lib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
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
)

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)
11 changes: 10 additions & 1 deletion ports/unicorn-lib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -8234,7 +8234,7 @@
},
"unicorn-lib": {
"baseline": "2022-01-24",
"port-version": 0
"port-version": 1
},
"units": {
"baseline": "2.3.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/u-/unicorn-lib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "20329e00e75f4f13bb1b77f3e19c23182861c6cd",
"version-date": "2022-01-24",
"port-version": 1
},
{
"git-tree": "278115c391839dcfc66ac80339c8dcd9a660c9e0",
"version-date": "2022-01-24",
Expand Down