vcpkg/ports/bond/portfile.cmake

71 lines
2.9 KiB
CMake
Raw Normal View History

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/bond
REF "${VERSION}"
SHA512 54316e955ce130ec8bb3795b45222fe38c6079cb29e4b5612a97bed8dd9876d378009af3ab0c554c0ded49ca5fde4544e87e3dc8a8c5f176947d439d73c662ee
HEAD_REF master
PATCHES
fix-install-path.patch
[bond] Fixed compilation error under Windows when msvc version is greater than or equal to 1915 (#38471) `D:\b\bond\src\10.0.0-efd5420c47.clean\cpp\inc\bond\core\detail\sdl.h(29): error C4996: 'stdext::checked_array_iterator<_Ptr>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.` The above problem occurred when I was testing an internal version of msvc, and then I consulted Stephan T. Lavavej. He proposed a repair plan and submitted PR [1205](https://github.com/microsoft/bond/pull/1205) upstream. I used stephan's repair plan to fix this problem in vcpkg. - [X] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [ ] ~~SHA512s are updated for each updated download.~~ - [ ] ~~The "supports" clause reflects platforms that may be fixed by this new version.~~ - [ ] ~~Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file.~~ - [ ] ~~Any patches that are no longer applied are deleted from the port's directory.~~ - [X] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [X] Only one version is added to each modified port's versions file. Compile test pass with following triplets: ``` x64-windows ```
2024-05-01 02:31:53 +08:00
fix-msc-ver.patch
)
if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_download_distfile(GBC_ARCHIVE
URLS "https://github.com/microsoft/bond/releases/download/${VERSION}/gbc-${VERSION}-amd64.zip"
FILENAME "gbc-${VERSION}-amd64.zip"
SHA512 fde9dc862b71c843278dcbb90137b86e23869d79036367008f01165f22b11b067bd78d21eff8385ab0e96d80fa3194380bdd661199c44a8552252bcc4c9e18c0
)
2020-05-29 04:07:54 +08:00
# Clear the generator to prevent it from updating
2021-11-30 09:02:49 +08:00
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/tools/")
# Extract the precompiled gbc
vcpkg_extract_source_archive(extracted_tool_dir ARCHIVE "${GBC_ARCHIVE}" NO_REMOVE_ONE_LEVEL)
file(RENAME "${extracted_tool_dir}" "${CURRENT_BUILDTREES_DIR}/tools")
set(FETCHED_GBC_PATH "${CURRENT_BUILDTREES_DIR}/tools/gbc-${VERSION}-amd64.exe")
if(NOT EXISTS "${FETCHED_GBC_PATH}")
message(FATAL_ERROR "Fetching GBC failed. Expected '${FETCHED_GBC_PATH}' to exist, but it doesn't.")
endif()
else()
# According to the readme on https://github.com/microsoft/bond/
# The build needs a version of the Haskel Tool stack that is newer than some distros ship with.
# For this reason the message is not guarded by checking to see if the tool is installed.
message("\nA recent version of Haskell Tool Stack is required to build.\n For information on how to install see https://docs.haskellstack.org/en/stable/README/\n")
endif()
set(ENV{STACK_ROOT} "${CURRENT_BUILDTREES_DIR}/stack")
2021-11-30 09:02:49 +08:00
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBOND_LIBRARIES_ONLY=TRUE
-DBOND_GBC_PATH=${FETCHED_GBC_PATH}
-DBOND_SKIP_GBC_TESTS=TRUE
-DBOND_FIND_RAPIDJSON=TRUE
-DBOND_SKIP_CORE_TESTS=TRUE
-DBOND_STACK_OPTIONS=--allow-different-user
${FEATURE_OPTIONS}
)
2021-11-30 09:02:49 +08:00
vcpkg_cmake_install()
2021-11-30 09:02:49 +08:00
vcpkg_cmake_config_fixup(CONFIG_PATH lib/bond)
vcpkg_copy_pdbs()
2021-11-30 09:02:49 +08:00
cmake_path(NATIVE_PATH SOURCE_PATH native_source_path)
foreach(header bond_apply.h bond_const_apply.h bond_const_enum.h bond_const_reflection.h bond_const_types.h bond_enum.h bond_reflection.h bond_types.h)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/bond/core/${header}" "${native_source_path}" "")
endforeach()
# There's no way to supress installation of the headers in the debug build,
# so we just delete them.
2021-11-30 09:02:49 +08:00
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# Put the license file where vcpkg expects it
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")