forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#1873 from glachancecmaisonneuve/buildins…
…tallcmakescriptsfix Fix for BUILD_ARGS being always added in non ninja build (vcpkg_build_cmake,vcpkg_install_cmake)
- Loading branch information
Showing
12 changed files
with
160 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# vcpkg_build_cmake | ||
|
||
Build a cmake project. | ||
|
||
## Usage: | ||
```cmake | ||
vcpkg_build_cmake([DISABLE_PARALLEL] [TARGET <target>]) | ||
``` | ||
|
||
## Parameters: | ||
### DISABLE_PARALLEL | ||
The underlying buildsystem will be instructed to not parallelize | ||
|
||
### TARGET | ||
The target passed to the cmake build command (`cmake --build . --target <target>`). If not specified, no target will | ||
be passed. | ||
|
||
## Notes: | ||
This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md). | ||
You can use the alias [`vcpkg_install_cmake()`](vcpkg_configure_cmake.md) function if your CMake script supports the | ||
"install" target | ||
|
||
## Examples: | ||
|
||
* [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) | ||
* [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) | ||
* [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) | ||
* [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) | ||
|
||
## Source | ||
[scripts/cmake/vcpkg_build_cmake.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_build_cmake.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# vcpkg_from_bitbucket | ||
|
||
Download and extract a project from Bitbucket. | ||
Enables support for installing HEAD `vcpkg.exe install --head <port>`. | ||
|
||
## Usage: | ||
```cmake | ||
vcpkg_from_bitbucket( | ||
OUT_SOURCE_PATH <SOURCE_PATH> | ||
REPO <Microsoft/cpprestsdk> | ||
[REF <v2.0.0>] | ||
[SHA512 <45d0d7f8cc350...>] | ||
[HEAD_REF <master>] | ||
) | ||
``` | ||
|
||
## Parameters: | ||
### OUT_SOURCE_PATH | ||
Specifies the out-variable that will contain the extracted location. | ||
|
||
This should be set to `SOURCE_PATH` by convention. | ||
|
||
### REPO | ||
The organization or user and repository on GitHub. | ||
|
||
### REF | ||
A stable git commit-ish (ideally a tag) that will not change contents. **This should not be a branch.** | ||
|
||
For repositories without official releases, this can be set to the full commit id of the current latest master. | ||
|
||
If `REF` is specified, `SHA512` must also be specified. | ||
|
||
### SHA512 | ||
The SHA512 hash that should match the archive (https://bitbucket.com/${REPO}/get/${REF}.tar.gz). | ||
|
||
This is most easily determined by first setting it to `1`, then trying to build the port. The error message will contain the full hash, which can be copied back into the portfile. | ||
|
||
### HEAD_REF | ||
The unstable git commit-ish (ideally a branch) to pull for `--head` builds. | ||
|
||
For most projects, this should be `master`. The chosen branch should be one that is expected to be always buildable on all supported platforms. | ||
|
||
## Notes: | ||
At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present. | ||
|
||
This exports the `VCPKG_HEAD_VERSION` variable during head builds. | ||
|
||
## Examples: | ||
|
||
* [blaze](https://github.com/Microsoft/vcpkg/blob/master/ports/blaze/portfile.cmake) | ||
|
||
## Source | ||
[scripts/cmake/vcpkg_from_bitbucket.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_from_bitbucket.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,76 @@ | ||
## # vcpkg_build_cmake | ||
## | ||
## Build a cmake project. | ||
## | ||
## ## Usage: | ||
## ```cmake | ||
## vcpkg_build_cmake([DISABLE_PARALLEL] [TARGET <target>]) | ||
## ``` | ||
## | ||
## ## Parameters: | ||
## ### DISABLE_PARALLEL | ||
## The underlying buildsystem will be instructed to not parallelize | ||
## | ||
## ### TARGET | ||
## The target passed to the cmake build command (`cmake --build . --target <target>`). If not specified, no target will | ||
## be passed. | ||
## | ||
## ## Notes: | ||
## This command should be preceeded by a call to [`vcpkg_configure_cmake()`](vcpkg_configure_cmake.md). | ||
## You can use the alias [`vcpkg_install_cmake()`](vcpkg_configure_cmake.md) function if your CMake script supports the | ||
## "install" target | ||
## | ||
## ## Examples: | ||
## | ||
## * [zlib](https://github.com/Microsoft/vcpkg/blob/master/ports/zlib/portfile.cmake) | ||
## * [cpprestsdk](https://github.com/Microsoft/vcpkg/blob/master/ports/cpprestsdk/portfile.cmake) | ||
## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) | ||
## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) | ||
function(vcpkg_build_cmake) | ||
cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) | ||
cmake_parse_arguments(_bc "DISABLE_PARALLEL" "TARGET;LOGFILE_ROOT" "" ${ARGN}) | ||
|
||
set(MSVC_EXTRA_ARGS | ||
"/p:VCPkgLocalAppDataDisabled=true" | ||
"/p:UseIntelMKL=No" | ||
) | ||
|
||
# Specifies the architecture of the toolset, NOT the architecture of the produced binary | ||
# This can help libraries that cause the linker to run out of memory. | ||
# https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory | ||
if (_bc_MSVC_64_TOOLSET) | ||
list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64") | ||
if(NOT _bc_LOGFILE_ROOT) | ||
set(_bc_LOGFILE_ROOT "build") | ||
endif() | ||
|
||
if (NOT _bc_DISABLE_PARALLEL) | ||
list(APPEND MSVC_EXTRA_ARGS "/m") | ||
if(_VCPKG_CMAKE_GENERATOR MATCHES "Ninja") | ||
set(BUILD_ARGS "-v") # verbose output | ||
if (_bc_DISABLE_PARALLEL) | ||
list(APPEND BUILD_ARGS "-j1") | ||
endif() | ||
elseif(_VCPKG_CMAKE_GENERATOR MATCHES "Visual Studio") | ||
set(BUILD_ARGS | ||
"/p:VCPkgLocalAppDataDisabled=true" | ||
"/p:UseIntelMKL=No" | ||
) | ||
if (NOT _bc_DISABLE_PARALLEL) | ||
list(APPEND BUILD_ARGS "/m") | ||
endif() | ||
elseif(_VCPKG_CMAKE_GENERATOR MATCHES "NMake") | ||
# No options are currently added for nmake builds | ||
else() | ||
message(FATAL_ERROR "Unrecognized GENERATOR setting from vcpkg_configure_cmake(). Valid generators are: Ninja, Visual Studio, and NMake Makefiles") | ||
endif() | ||
|
||
if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) | ||
set(BUILD_ARGS -v) # verbose output | ||
if(_bc_TARGET) | ||
set(TARGET_PARAM "--target" ${_bc_TARGET}) | ||
else() | ||
set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) | ||
set(TARGET_PARAM) | ||
endif() | ||
|
||
message(STATUS "Build ${TARGET_TRIPLET}-rel") | ||
vcpkg_execute_required_process( | ||
COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${BUILD_ARGS} | ||
COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} | ||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel | ||
LOGNAME build-${TARGET_TRIPLET}-rel | ||
LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-rel | ||
) | ||
message(STATUS "Build ${TARGET_TRIPLET}-rel done") | ||
|
||
message(STATUS "Build ${TARGET_TRIPLET}-dbg") | ||
vcpkg_execute_required_process( | ||
COMMAND ${CMAKE_COMMAND} --build . --config Debug -- ${BUILD_ARGS} | ||
COMMAND ${CMAKE_COMMAND} --build . --config Debug ${TARGET_PARAM} -- ${BUILD_ARGS} | ||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg | ||
LOGNAME build-${TARGET_TRIPLET}-dbg | ||
LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-dbg | ||
) | ||
message(STATUS "Build ${TARGET_TRIPLET}-dbg done") | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters