diff --git a/ports/boost-hana/portfile.cmake b/ports/boost-hana/portfile.cmake index f619969dad..f4fe68d231 100644 --- a/ports/boost-hana/portfile.cmake +++ b/ports/boost-hana/portfile.cmake @@ -8,8 +8,28 @@ vcpkg_from_github( HEAD_REF master ) +if("large-struct-macros" IN_LIST FEATURES) + if(VCPKG_TARGET_IS_WINDOWS) + set(BOOST_HANA_MAX_NUMBER_OF_MEMBERS 124) + else() + set(BOOST_HANA_MAX_NUMBER_OF_MEMBERS 200) + endif() + + math(EXPR BOOST_HANA_GENERATOR_LIMIT "${BOOST_HANA_MAX_NUMBER_OF_MEMBERS} + 1") + vcpkg_find_acquire_program(RUBY) + vcpkg_execute_required_process( + COMMAND "${RUBY}" -rerb -e "ENV['MAX_NUMBER_OF_MEMBERS'] = ARGV[0]; print ERB.new(File.read(ARGV[1])).result" "${BOOST_HANA_GENERATOR_LIMIT}" "${SOURCE_PATH}/include/boost/hana/detail/struct_macros.hpp.erb" + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "boost-hana-generate-struct-macros" + OUTPUT_VARIABLE _boost_hana_struct_macros + ) + file(WRITE "${SOURCE_PATH}/include/boost/hana/detail/struct_macros.hpp" "${_boost_hana_struct_macros}") + message(STATUS "boost-hana: generated struct_macros.hpp for up to ${BOOST_HANA_MAX_NUMBER_OF_MEMBERS} members") +endif() + set(FEATURE_OPTIONS "") boost_configure_and_install( SOURCE_PATH "${SOURCE_PATH}" OPTIONS ${FEATURE_OPTIONS} ) +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/boost-hana/usage b/ports/boost-hana/usage new file mode 100644 index 0000000000..f043f565d6 --- /dev/null +++ b/ports/boost-hana/usage @@ -0,0 +1,4 @@ +boost-hana provides CMake targets: + + find_package(Boost CONFIG REQUIRED COMPONENTS hana) + target_link_libraries(main PRIVATE Boost::hana) diff --git a/ports/boost-hana/vcpkg.json b/ports/boost-hana/vcpkg.json index b98b0bbfc7..4fcefbae70 100644 --- a/ports/boost-hana/vcpkg.json +++ b/ports/boost-hana/vcpkg.json @@ -2,6 +2,7 @@ "$comment": "Automatically generated by scripts/boost/generate-ports.ps1", "name": "boost-hana", "version": "1.91.0", + "port-version": 1, "description": "Boost hana module", "homepage": "https://www.boost.org/library/latest/hana/", "documentation": "https://www.boost.org/libs/hana", @@ -35,5 +36,11 @@ "name": "boost-tuple", "version>=": "1.91.0" } - ] + ], + "features": { + "large-struct-macros": { + "description": "Regenerate Boost.Hana struct macros for up to 200 members (124 on Windows)", + "supports": "windows | osx | (linux & x64)" + } + } } diff --git a/scripts/boost/generate-ports.ps1 b/scripts/boost/generate-ports.ps1 index 06627c9cd6..c4226ce0c5 100644 --- a/scripts/boost/generate-ports.ps1 +++ b/scripts/boost/generate-ports.ps1 @@ -38,6 +38,7 @@ $semverVersion = ($version -replace '(\d+(\.\d+){1,3}).*', '$1') $defaultPortVersion = 0 $portVersions = @{ 'boost-cobalt' = 1 + 'boost-hana' = 1 } function Get-PortVersion { @@ -133,6 +134,14 @@ $portData = @{ }; }; }; + 'boost-hana' = @{ + 'features' = @{ + 'large-struct-macros' = @{ + 'description' = 'Regenerate Boost.Hana struct macros for up to 200 members (124 on Windows)'; + 'supports' = 'windows | osx | (linux & x64)'; + } + } + }; 'boost-locale' = @{ 'dependencies' = @(@{ 'name' = 'libiconv'; 'platform' = '!uwp & !windows & !mingw' }); 'supports' = '!uwp'; diff --git a/scripts/boost/post-build-stubs/hana.cmake b/scripts/boost/post-build-stubs/hana.cmake new file mode 100644 index 0000000000..920ffb1ae5 --- /dev/null +++ b/scripts/boost/post-build-stubs/hana.cmake @@ -0,0 +1 @@ +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/scripts/boost/post-source-stubs/hana.cmake b/scripts/boost/post-source-stubs/hana.cmake new file mode 100644 index 0000000000..5a5418b24e --- /dev/null +++ b/scripts/boost/post-source-stubs/hana.cmake @@ -0,0 +1,18 @@ +if("large-struct-macros" IN_LIST FEATURES) + if(VCPKG_TARGET_IS_WINDOWS) + set(BOOST_HANA_MAX_NUMBER_OF_MEMBERS 124) + else() + set(BOOST_HANA_MAX_NUMBER_OF_MEMBERS 200) + endif() + + math(EXPR BOOST_HANA_GENERATOR_LIMIT "${BOOST_HANA_MAX_NUMBER_OF_MEMBERS} + 1") + vcpkg_find_acquire_program(RUBY) + vcpkg_execute_required_process( + COMMAND "${RUBY}" -rerb -e "ENV['MAX_NUMBER_OF_MEMBERS'] = ARGV[0]; print ERB.new(File.read(ARGV[1])).result" "${BOOST_HANA_GENERATOR_LIMIT}" "${SOURCE_PATH}/include/boost/hana/detail/struct_macros.hpp.erb" + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "boost-hana-generate-struct-macros" + OUTPUT_VARIABLE _boost_hana_struct_macros + ) + file(WRITE "${SOURCE_PATH}/include/boost/hana/detail/struct_macros.hpp" "${_boost_hana_struct_macros}") + message(STATUS "boost-hana: generated struct_macros.hpp for up to ${BOOST_HANA_MAX_NUMBER_OF_MEMBERS} members") +endif() diff --git a/versions/b-/boost-hana.json b/versions/b-/boost-hana.json index 390216192e..f9c755fb0c 100644 --- a/versions/b-/boost-hana.json +++ b/versions/b-/boost-hana.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "52d28a00e03c5b86ae3faa2b4f40e6a16de1cbe2", + "version": "1.91.0", + "port-version": 1 + }, { "git-tree": "77335d8e473053357d8d5c331867a070605bc677", "version": "1.91.0", diff --git a/versions/baseline.json b/versions/baseline.json index dbdcf9761c..fc004e802f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1038,7 +1038,7 @@ }, "boost-hana": { "baseline": "1.91.0", - "port-version": 0 + "port-version": 1 }, "boost-hash2": { "baseline": "1.91.0",