mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 11:41:36 +08:00
6b117c9c7e
* [vcpkg docs] Change how documenting port functions works Instead of using `##`, use comment blocks for documentation. Also, add some minor docs and change RST -> MD so we actually get docs generated. * add CI stuff * regenerate docs * fix vcpkg_find_acquire_program to not use _execute_process
62 lines
1.8 KiB
CMake
62 lines
1.8 KiB
CMake
#[===[.md:
|
|
# vcpkg_configure_gn
|
|
|
|
Generate Ninja (GN) targets
|
|
|
|
## Usage:
|
|
```cmake
|
|
vcpkg_configure_gn(
|
|
SOURCE_PATH <SOURCE_PATH>
|
|
[OPTIONS <OPTIONS>]
|
|
[OPTIONS_DEBUG <OPTIONS_DEBUG>]
|
|
[OPTIONS_RELEASE <OPTIONS_RELEASE>]
|
|
)
|
|
```
|
|
|
|
## Parameters:
|
|
### SOURCE_PATH (required)
|
|
The path to the GN project.
|
|
|
|
### OPTIONS
|
|
Options to be passed to both the debug and release targets.
|
|
Note: Must be provided as a space-separated string.
|
|
|
|
### OPTIONS_DEBUG (space-separated string)
|
|
Options to be passed to the debug target.
|
|
|
|
### OPTIONS_RELEASE (space-separated string)
|
|
Options to be passed to the release target.
|
|
#]===]
|
|
|
|
function(vcpkg_configure_gn)
|
|
# parse parameters such that semicolons in options arguments to COMMAND don't get erased
|
|
cmake_parse_arguments(PARSE_ARGV 0 _vcg "" "SOURCE_PATH;OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" "")
|
|
|
|
if(NOT DEFINED _vcg_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)
|
|
|
|
function(generate CONFIG ARGS)
|
|
message(STATUS "Generating build (${CONFIG})...")
|
|
vcpkg_execute_required_process(
|
|
COMMAND "${GN}" gen "${CURRENT_BUILDTREES_DIR}/${CONFIG}" ${ARGS}
|
|
WORKING_DIRECTORY "${SOURCE_PATH}"
|
|
LOGNAME generate-${CONFIG}
|
|
)
|
|
endfunction()
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
generate(${TARGET_TRIPLET}-dbg "--args=${_vcg_OPTIONS} ${_vcg_OPTIONS_DEBUG}")
|
|
endif()
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
generate(${TARGET_TRIPLET}-rel "--args=${_vcg_OPTIONS} ${_vcg_OPTIONS_RELEASE}")
|
|
endif()
|
|
endfunction()
|