vcpkg/ports/vcpkg-gn/vcpkg_gn_configure.cmake
Robert Schumacher 7d2449c346
[docs] Delete embedded documentation in favor of docs/ (#25096)
* [docs] Delete embedded documentation in favor of docs/

Drive-by for the helper ports:
1. "documentation": "https://vcpkg.io/en/docs/README.html"
2. "license": "MIT"
3. Use `include_guard(GLOBAL)` in all script files
4. Make sure any persistent variables are saved to the cache

* [docs] Restore empty regenerate.ps1 to satisfy Azure Pipelines

* [docs] PR comments
2022-06-07 16:26:51 -07:00

50 lines
1.8 KiB
CMake

include_guard(GLOBAL)
include("${CMAKE_CURRENT_LIST_DIR}/z_vcpkg_gn_real_path.cmake")
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 "${VCPKG_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(PYTHON2)
get_filename_component(PYTHON2_DIR "${PYTHON2}" DIRECTORY)
vcpkg_add_to_path(PREPEND "${PYTHON2_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()