aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>2020-08-19 21:15:24 -0700
committerGitHub <noreply@github.com>2020-08-19 21:15:24 -0700
commitec4e0c393480b1b508874d5106ecb0db547962af (patch)
tree5c5ec856c6077c6471fbea7c3c38b51ad8963eff /scripts
parent5c056a65bb316f0114f536fdbb04f344b84d38c3 (diff)
downloadvcpkg-ec4e0c393480b1b508874d5106ecb0db547962af.tar.gz
vcpkg-ec4e0c393480b1b508874d5106ecb0db547962af.zip
[openmpi/vcpkg_build_make] Disable parallel build (#12975)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/vcpkg_build_make.cmake20
-rw-r--r--scripts/cmake/vcpkg_execute_build_process.cmake2
2 files changed, 20 insertions, 2 deletions
diff --git a/scripts/cmake/vcpkg_build_make.cmake b/scripts/cmake/vcpkg_build_make.cmake
index 545e6d765..c957fc628 100644
--- a/scripts/cmake/vcpkg_build_make.cmake
+++ b/scripts/cmake/vcpkg_build_make.cmake
@@ -24,6 +24,9 @@
## The target passed to the make build command (`./make <target>`). If not specified, the 'all' target will
## be passed.
##
+## ### DISABLE_PARALLEL
+## The underlying buildsystem will be instructed to not parallelize
+##
## ## Notes:
## This command should be preceeded by a call to [`vcpkg_configure_make()`](vcpkg_configure_make.md).
## You can use the alias [`vcpkg_install_make()`](vcpkg_configure_make.md) function if your CMake script supports the
@@ -36,7 +39,7 @@
## * [freexl](https://github.com/Microsoft/vcpkg/blob/master/ports/freexl/portfile.cmake)
## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake)
function(vcpkg_build_make)
- cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL" "LOGFILE_ROOT;BUILD_TARGET" "" ${ARGN})
+ cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL;DISABLE_PARALLEL" "LOGFILE_ROOT;BUILD_TARGET" "" ${ARGN})
if(NOT _bc_LOGFILE_ROOT)
set(_bc_LOGFILE_ROOT "build")
@@ -64,6 +67,7 @@ function(vcpkg_build_make)
find_program(MAKE make REQUIRED)
set(MAKE_COMMAND "${MAKE}")
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} -j ${VCPKG_CONCURRENCY} --trace -f Makefile ${_bc_BUILD_TARGET})
+ set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} -j 1 --trace -f Makefile ${_bc_BUILD_TARGET})
string(REPLACE " " "\\\ " _VCPKG_PACKAGE_PREFIX ${CURRENT_PACKAGES_DIR})
string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PACKAGE_PREFIX "${_VCPKG_PACKAGE_PREFIX}")
@@ -75,6 +79,7 @@ function(vcpkg_build_make)
set(MAKE_COMMAND "${MAKE}")
# Set make command and install command
set(MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j ${VCPKG_CONCURRENCY} -f Makefile ${_bc_BUILD_TARGET})
+ set(NO_PARALLEL_MAKE_OPTS ${_bc_MAKE_OPTIONS} V=1 -j 1 -f Makefile ${_bc_BUILD_TARGET})
set(INSTALL_OPTS -j ${VCPKG_CONCURRENCY} install DESTDIR=${CURRENT_PACKAGES_DIR})
endif()
@@ -118,14 +123,25 @@ function(vcpkg_build_make)
if(MAKE_BASH)
set(MAKE_CMD_LINE "${MAKE_COMMAND} ${MAKE_OPTS}")
+ set(NO_PARALLEL_MAKE_CMD_LINE "${MAKE_COMMAND} ${NO_PARALLEL_MAKE_OPTS}")
else()
set(MAKE_CMD_LINE ${MAKE_COMMAND} ${MAKE_OPTS})
+ set(NO_PARALLEL_MAKE_CMD_LINE ${MAKE_COMMAND} ${NO_PARALLEL_MAKE_OPTS})
endif()
+ if (_bc_DISABLE_PARALLEL)
+ vcpkg_execute_build_process(
+ COMMAND ${MAKE_BASH} ${MAKE_CMD_LINE}
+ WORKING_DIRECTORY "${WORKING_DIRECTORY}"
+ LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}"
+ )
+ else()
vcpkg_execute_build_process(
COMMAND ${MAKE_BASH} ${MAKE_CMD_LINE}
+ NO_PARALLEL_COMMAND ${MAKE_BASH} ${NO_PARALLEL_MAKE_CMD_LINE}
WORKING_DIRECTORY "${WORKING_DIRECTORY}"
LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}"
- )
+ )
+ endif()
if(_bc_ADD_BIN_TO_PATH)
set(ENV{PATH} "${_BACKUP_ENV_PATH}")
diff --git a/scripts/cmake/vcpkg_execute_build_process.cmake b/scripts/cmake/vcpkg_execute_build_process.cmake
index 7097fbf1b..98e3648d5 100644
--- a/scripts/cmake/vcpkg_execute_build_process.cmake
+++ b/scripts/cmake/vcpkg_execute_build_process.cmake
@@ -65,6 +65,8 @@ function(vcpkg_execute_build_process)
# The linker ran out of memory during execution. We will try continuing once more, with parallelism disabled.
OR err_contents MATCHES "Cannot create parent directory" OR err_contents MATCHES "Cannot write file"
# Multiple threads using the same directory at the same time cause conflicts, will try again.
+ OR err_contents MATCHES "Can't open"
+ # Multiple threads caused the wrong order of creating folders and creating files in folders
)
message(STATUS "Restarting Build without parallelism because memory exceeded")
set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-out-1.log")