From 314f99bf83483ce2eb55b3b658d499baeba5215a Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 19 Jul 2021 22:43:15 +0000 Subject: [PATCH 1/2] limit the number of cores during vcpkg bootstrap --- scripts/bootstrap.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index fdf57c9716d367..596341e61b1021 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -10,6 +10,7 @@ done vcpkgDisableMetrics="OFF" vcpkgUseSystem=false vcpkgAllowAppleClang=false +vcpkgLimitBuildMemory=false vcpkgBuildTests="OFF" for var in "$@" do @@ -17,6 +18,8 @@ do vcpkgDisableMetrics="ON" elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then vcpkgUseSystem=true + elif [ "$var" = "-limitBuildMemory" -o "$var" = "--limitBuildMemory" ]; then + vcpkgLimitBuildMemory=true elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then vcpkgAllowAppleClang=true elif [ "$var" = "-buildTests" ]; then @@ -29,6 +32,7 @@ do echo " -disableMetrics Do not build metrics reporting into the executable" echo " -useSystemBinaries Force use of the system utilities for building vcpkg" echo " -allowAppleClang Set VCPKG_ALLOW_APPLE_CLANG to build vcpkg in apple with clang anyway" + echo " -limitBuildMemory Force builds to use only a single core for compile and link operations while building vcpkg" exit 1 else echo "Unknown argument $var. Use '-help' for help." @@ -299,8 +303,13 @@ echo "Building vcpkg-tool..." rm -rf "$baseBuildDir" mkdir -p "$buildDir" vcpkgExtractArchive "$tarballPath" "$srcBaseDir" +cmakeConfigOptions="-DCMAKE_BUILD_TYPE=Release -G 'Ninja' -DCMAKE_MAKE_PROGRAM='$ninjaExe'" -(cd "$buildDir" && CXX="$CXX" "$cmakeExe" "$srcDir" -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DBUILD_TESTING=$vcpkgBuildTests" "-DVCPKG_DEVELOPMENT_WARNINGS=OFF" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1 +if [ "$vcpkgLimitBuildMemory" = "true" ] ; then + cmakeConfigOptions=" $cmakeConfigOptions '-DCMAKE_JOB_POOL_COMPILE:STRING=compile' '-DCMAKE_JOB_POOL_LINK:STRING=link' '-DCMAKE_JOB_POOLS:STRING=compile=1;link=1' " +fi + +(cd "$buildDir" && eval CXX="$CXX" "$cmakeExe" "$srcDir" $cmakeConfigOptions "-DBUILD_TESTING=$vcpkgBuildTests" "-DVCPKG_DEVELOPMENT_WARNINGS=OFF" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1 (cd "$buildDir" && "$cmakeExe" --build .) || exit 1 rm -rf "$vcpkgRootDir/vcpkg" From f75b32fadcbe006c299015ddfbc36a7e47151e7c Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Sun, 25 Jul 2021 19:23:19 +0000 Subject: [PATCH 2/2] Switch to VCPKG_MAX_CONCURRENCY --- scripts/bootstrap.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 596341e61b1021..d7a6182bd49726 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -10,7 +10,6 @@ done vcpkgDisableMetrics="OFF" vcpkgUseSystem=false vcpkgAllowAppleClang=false -vcpkgLimitBuildMemory=false vcpkgBuildTests="OFF" for var in "$@" do @@ -18,8 +17,6 @@ do vcpkgDisableMetrics="ON" elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then vcpkgUseSystem=true - elif [ "$var" = "-limitBuildMemory" -o "$var" = "--limitBuildMemory" ]; then - vcpkgLimitBuildMemory=true elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then vcpkgAllowAppleClang=true elif [ "$var" = "-buildTests" ]; then @@ -32,7 +29,6 @@ do echo " -disableMetrics Do not build metrics reporting into the executable" echo " -useSystemBinaries Force use of the system utilities for building vcpkg" echo " -allowAppleClang Set VCPKG_ALLOW_APPLE_CLANG to build vcpkg in apple with clang anyway" - echo " -limitBuildMemory Force builds to use only a single core for compile and link operations while building vcpkg" exit 1 else echo "Unknown argument $var. Use '-help' for help." @@ -305,8 +301,8 @@ mkdir -p "$buildDir" vcpkgExtractArchive "$tarballPath" "$srcBaseDir" cmakeConfigOptions="-DCMAKE_BUILD_TYPE=Release -G 'Ninja' -DCMAKE_MAKE_PROGRAM='$ninjaExe'" -if [ "$vcpkgLimitBuildMemory" = "true" ] ; then - cmakeConfigOptions=" $cmakeConfigOptions '-DCMAKE_JOB_POOL_COMPILE:STRING=compile' '-DCMAKE_JOB_POOL_LINK:STRING=link' '-DCMAKE_JOB_POOLS:STRING=compile=1;link=1' " +if [ "${VCPKG_MAX_CONCURRENCY}" != "" ] ; then + cmakeConfigOptions=" $cmakeConfigOptions '-DCMAKE_JOB_POOL_COMPILE:STRING=compile' '-DCMAKE_JOB_POOL_LINK:STRING=link' '-DCMAKE_JOB_POOLS:STRING=compile=$VCPKG_MAX_CONCURRENCY;link=$VCPKG_MAX_CONCURRENCY' " fi (cd "$buildDir" && eval CXX="$CXX" "$cmakeExe" "$srcDir" $cmakeConfigOptions "-DBUILD_TESTING=$vcpkgBuildTests" "-DVCPKG_DEVELOPMENT_WARNINGS=OFF" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1