2020-12-01 13:37:26 -08:00
|
|
|
#[===[.md:
|
|
|
|
# vcpkg_build_ninja
|
|
|
|
|
|
|
|
Build a ninja project
|
|
|
|
|
|
|
|
## Usage:
|
|
|
|
```cmake
|
|
|
|
vcpkg_build_ninja(
|
|
|
|
[TARGETS <target>...]
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters:
|
|
|
|
### TARGETS
|
|
|
|
Only build the specified targets.
|
|
|
|
#]===]
|
2020-05-12 04:58:12 +07:00
|
|
|
|
2021-07-20 12:24:58 -05:00
|
|
|
function(z_vcpkg_build_ninja_build config targets)
|
|
|
|
message(STATUS "Building (${config})...")
|
|
|
|
vcpkg_execute_build_process(
|
|
|
|
COMMAND "${NINJA}" -C "${CURRENT_BUILDTREES_DIR}/${config}" ${targets}
|
|
|
|
WORKING_DIRECTORY "${SOURCE_PATH}"
|
|
|
|
LOGNAME "build-${config}"
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
|
2020-05-12 04:58:12 +07:00
|
|
|
function(vcpkg_build_ninja)
|
2021-07-20 12:24:58 -05:00
|
|
|
cmake_parse_arguments(PARSE_ARGV 0 arg "" "" "TARGETS")
|
2020-05-12 04:58:12 +07:00
|
|
|
|
2021-07-20 12:24:58 -05:00
|
|
|
if(DEFINED arg_UNPARSED_ARGUMENTS)
|
|
|
|
message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED arg_TARGETS)
|
|
|
|
set(arg_TARGETS "")
|
|
|
|
endif()
|
2020-05-12 04:58:12 +07:00
|
|
|
|
2021-07-20 12:24:58 -05:00
|
|
|
vcpkg_find_acquire_program(NINJA)
|
2020-05-12 04:58:12 +07:00
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
2021-07-20 12:24:58 -05:00
|
|
|
z_vcpkg_build_ninja_build("${TARGET_TRIPLET}-dbg" "${arg_TARGETS}")
|
2020-05-12 04:58:12 +07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
2021-07-20 12:24:58 -05:00
|
|
|
z_vcpkg_build_ninja_build("${TARGET_TRIPLET}-rel" "${arg_TARGETS}")
|
2020-05-12 04:58:12 +07:00
|
|
|
endif()
|
2020-12-01 13:37:26 -08:00
|
|
|
endfunction()
|