From 8d5bbb4e6d1df4fa3801d23119e308e038b37e58 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Fri, 11 Aug 2023 10:17:39 +0200 Subject: [PATCH] Use custom vcpkg triplets --- .github/workflows/build-wheels.yml | 26 ++++++++++------------- .vcpkg/ports/lexbor-shared/portfile.cmake | 24 --------------------- .vcpkg/ports/lexbor-shared/vcpkg.json | 6 ------ .vcpkg/ports/lexbor/portfile.cmake | 25 ++++++++++++++++++++++ .vcpkg/ports/lexbor/vcpkg.json | 17 +++++++++++++++ .vcpkg/triplets/arm64-osx.cmake | 12 +++++++++++ .vcpkg/triplets/x64-osx.cmake | 12 +++++++++++ .vcpkg/triplets/x64-windows.cmake | 10 +++++++++ 8 files changed, 87 insertions(+), 45 deletions(-) delete mode 100644 .vcpkg/ports/lexbor-shared/portfile.cmake delete mode 100644 .vcpkg/ports/lexbor-shared/vcpkg.json create mode 100644 .vcpkg/ports/lexbor/portfile.cmake create mode 100644 .vcpkg/ports/lexbor/vcpkg.json create mode 100644 .vcpkg/triplets/arm64-osx.cmake create mode 100644 .vcpkg/triplets/x64-osx.cmake create mode 100644 .vcpkg/triplets/x64-windows.cmake diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 2430f3e2..33a05ae7 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -56,27 +56,23 @@ jobs: shell: bash run: | set -e - - VCPKG_CMD="vcpkg --overlay-ports .vcpkg/ports install" + + VCPKG_CMD="vcpkg --overlay-ports .vcpkg/ports --overlay-triplets .vcpkg/triplets install" # abseil is an automatic dependency of re2, but we need to build it with -std=c++17 - PKG_LIST="abseil[cxx17] lexbor-shared lz4 re2 uchardet zlib" - + PKG_LIST="abseil[cxx17] lexbor lz4 re2 uchardet zlib" + export VCPKG_BUILD_TYPE=release - + # MacOS - if [ -d /usr/local/share/vcpkg/ports ]; then - export VCPKG_DEFAULT_TRIPLET=x64-osx - $VCPKG_CMD $PKG_LIST - - export VCPKG_DEFAULT_TRIPLET=arm64-osx - $VCPKG_CMD $PKG_LIST - + if [ -d /usr/local/share/vcpkg/ports ]; then + $VCPKG_CMD --triplet=x64-osx $PKG_LIST + $VCPKG_CMD --triplet=arm64-osx $PKG_LIST + # Windows elif [ -d /c/vcpkg ]; then cp -rv .vcpkg/ports/* /c/vcpkg/ports - export VCPKG_DEFAULT_TRIPLET=x64-windows - $VCPKG_CMD $PKG_LIST - + $VCPKG_CMD --triplet=x64-windows $PKG_LIST + else exit 1 fi diff --git a/.vcpkg/ports/lexbor-shared/portfile.cmake b/.vcpkg/ports/lexbor-shared/portfile.cmake deleted file mode 100644 index 785aceba..00000000 --- a/.vcpkg/ports/lexbor-shared/portfile.cmake +++ /dev/null @@ -1,24 +0,0 @@ -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/lexbor/lexbor/archive/refs/tags/v2.2.0.tar.gz" - FILENAME "v2.2.0" - SHA512 26bbca3b41a417cbc59ba8cf736e1611966fc2202de85aabf621b840565d835e7e5ffc1b0294defc16ec883f9fb94e802bd19ed704be35fa79b41566acc05cbc -) - -vcpkg_extract_source_archive_ex( - OUT_SOURCE_PATH SOURCE_PATH - ARCHIVE ${ARCHIVE} -) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA -) - -vcpkg_install_cmake() - -# Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lexbor RENAME copyright) - -# Delete empty folders and duplicate files -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/lexbor/html/tree/insertion_mode") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/.vcpkg/ports/lexbor-shared/vcpkg.json b/.vcpkg/ports/lexbor-shared/vcpkg.json deleted file mode 100644 index 03a70188..00000000 --- a/.vcpkg/ports/lexbor-shared/vcpkg.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "lexbor-shared", - "version-string": "2.2.0", - "homepage": "https://lexbor.com/", - "description": "A lightweight and fast browser engine without dependencies." -} diff --git a/.vcpkg/ports/lexbor/portfile.cmake b/.vcpkg/ports/lexbor/portfile.cmake new file mode 100644 index 00000000..c604f666 --- /dev/null +++ b/.vcpkg/ports/lexbor/portfile.cmake @@ -0,0 +1,25 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO lexbor/lexbor + REF v${VERSION} + SHA512 26bbca3b41a417cbc59ba8cf736e1611966fc2202de85aabf621b840565d835e7e5ffc1b0294defc16ec883f9fb94e802bd19ed704be35fa79b41566acc05cbc +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DLEXBOR_BUILD_SHARED=${BUILD_SHARED} + -DLEXBOR_BUILD_STATIC=${BUILD_STATIC} +) +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/include/lexbor/html/tree/insertion_mode" + "${CURRENT_PACKAGES_DIR}/debug/include/lexbor/html/tree/insertion_mode" +) + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/.vcpkg/ports/lexbor/vcpkg.json b/.vcpkg/ports/lexbor/vcpkg.json new file mode 100644 index 00000000..f8d522ed --- /dev/null +++ b/.vcpkg/ports/lexbor/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "lexbor", + "version": "2.2.0", + "description": "Lexbor is development of an open source HTML Renderer library.", + "homepage": "https://github.com/lexbor/lexbor", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/.vcpkg/triplets/arm64-osx.cmake b/.vcpkg/triplets/arm64-osx.cmake new file mode 100644 index 00000000..101e7fe3 --- /dev/null +++ b/.vcpkg/triplets/arm64-osx.cmake @@ -0,0 +1,12 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES arm64) + +set(VCPKG_BUILD_TYPE release) +set(VCPKG_C_FLAGS "") +set(VCPKG_CXX_FLAGS "-std=c++17") +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +if(PORT MATCHES "abseil") + set(VCPKG_LIBRARY_LINKAGE static) +endif() diff --git a/.vcpkg/triplets/x64-osx.cmake b/.vcpkg/triplets/x64-osx.cmake new file mode 100644 index 00000000..fb84766c --- /dev/null +++ b/.vcpkg/triplets/x64-osx.cmake @@ -0,0 +1,12 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES x86_64) + +set(VCPKG_BUILD_TYPE release) +set(VCPKG_C_FLAGS "") +set(VCPKG_CXX_FLAGS "-std=c++17") +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +if(PORT MATCHES "abseil") + set(VCPKG_LIBRARY_LINKAGE static) +endif() diff --git a/.vcpkg/triplets/x64-windows.cmake b/.vcpkg/triplets/x64-windows.cmake new file mode 100644 index 00000000..ecf13420 --- /dev/null +++ b/.vcpkg/triplets/x64-windows.cmake @@ -0,0 +1,10 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) + +set(VCPKG_BUILD_TYPE release) +set(VCPKG_C_FLAGS "") +set(VCPKG_CXX_FLAGS "/std:c++latest") +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +if(PORT MATCHES "abseil") + set(VCPKG_LIBRARY_LINKAGE static) +endif()