mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 00:39:44 +08:00
0719a71389
<!-- If your PR fixes issues, please note that here by adding "Fixes #NNNNNN." for each fixed issue on separate lines. --> Fixes #28358 By updating gn, we can remove a temporary fix in `vcpkg-gn` `z_vcpkg_gn_fixup_path` that fixed by: https://gn-review.googlesource.com/c/gn/+/16620 I also add long path support to gn, to fix a issue when generating vs solution with long file path: https://gn-review.googlesource.com/c/gn/+/16600 - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] SHA512s are updated for each updated download. - [x] The "supports" clause reflects platforms that may be fixed by this new version. - [x] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [x] 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. Time to let the world rebuild everything :) (Actually not, there ain't much ports builds with gn)
49 lines
1.7 KiB
CMake
49 lines
1.7 KiB
CMake
include_guard(GLOBAL)
|
|
|
|
function(z_vcpkg_gn_configure_generate)
|
|
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "SOURCE_PATH;CONFIG;ARGS" "")
|
|
if(DEFINED arg_UNPARSED_ARGUMENTS)
|
|
message(FATAL_ERROR "Internal error: generate was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
|
|
endif()
|
|
|
|
message(STATUS "Generating build (${arg_CONFIG})...")
|
|
vcpkg_execute_required_process(
|
|
COMMAND "${GN}" gen "${CURRENT_BUILDTREES_DIR}/${arg_CONFIG}" "${arg_ARGS}"
|
|
WORKING_DIRECTORY "${arg_SOURCE_PATH}"
|
|
LOGNAME "generate-${arg_CONFIG}"
|
|
)
|
|
endfunction()
|
|
|
|
function(vcpkg_gn_configure)
|
|
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "SOURCE_PATH;OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" "")
|
|
|
|
if(DEFINED arg_UNPARSED_ARGUMENTS)
|
|
message(WARNING "vcpkg_gn_configure was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
|
|
endif()
|
|
if(NOT DEFINED arg_SOURCE_PATH)
|
|
message(FATAL_ERROR "SOURCE_PATH must be specified.")
|
|
endif()
|
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
|
|
vcpkg_add_to_path(PREPEND "${PYTHON3_DIR}")
|
|
|
|
vcpkg_find_acquire_program(GN)
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
z_vcpkg_gn_configure_generate(
|
|
SOURCE_PATH "${arg_SOURCE_PATH}"
|
|
CONFIG "${TARGET_TRIPLET}-dbg"
|
|
ARGS "--args=${arg_OPTIONS} ${arg_OPTIONS_DEBUG}"
|
|
)
|
|
endif()
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
z_vcpkg_gn_configure_generate(
|
|
SOURCE_PATH "${arg_SOURCE_PATH}"
|
|
CONFIG "${TARGET_TRIPLET}-rel"
|
|
ARGS "--args=${arg_OPTIONS} ${arg_OPTIONS_RELEASE}"
|
|
)
|
|
endif()
|
|
endfunction()
|