Build script improvements. (#7914)

* Build script improvements.

Add NDEBUG for non-debug MacOS builds. I don't understand why, but on my system Release and RelWithDebugInfo builds were not defining NDEBUG, resulting in failing asserts and other sanity checks.

Add -jN flag to BuildLinux.sh. On my 4-core 8GB RAM system, passing -j4 allows building without a swap storm.

Improve README.md description of building on macOS.

* Merge branch 'main' into bug/macos-ndebug

* Merge branch 'main' into bug/macos-ndebug

* Merge branch 'SoftFever:main' into bug/macos-ndebug

* Improve CMake syntax. Mention Mac path to app.

* Merge branch 'main' into bug/macos-ndebug
This commit is contained in:
Seth LaForge 2025-03-29 05:21:44 -07:00 committed by GitHub
parent ed45bf425e
commit 782adafc39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 9 deletions

View file

@ -12,21 +12,24 @@ function check_available_memory_and_disk() {
MIN_DISK_KB=$((10 * 1024 * 1024))
if [ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]; then
echo -e "\nERROR: Orca Slicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (systen has only ${FREE_MEM_GB}G available)"
echo -e "\nERROR: Orca Slicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (system has only ${FREE_MEM_GB}G available)"
echo && free -h && echo
echo "Invoke with -r to skip ram and disk checks."
exit 2
fi
if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]]; then
echo -e "\nERROR: Orca Slicer Builder requires at least $(echo ${MIN_DISK_KB} |awk '{ printf "%.1fG\n", $1/1024/1024; }') (systen has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
echo -e "\nERROR: Orca Slicer Builder requires at least $(echo ${MIN_DISK_KB} |awk '{ printf "%.1fG\n", $1/1024/1024; }') (system has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
echo && df -h . && echo
echo "Invoke with -r to skip ram and disk checks."
exit 1
fi
}
function usage() {
echo "Usage: ./BuildLinux.sh [-1][-b][-c][-d][-i][-r][-s][-u]"
echo "Usage: ./BuildLinux.sh [-1][-b][-c][-d][-i][-r][-s][-u] [-j N]"
echo " -1: limit builds to 1 core (where possible)"
echo " -j N: limit builds to N cores (where possible)"
echo " -b: build in debug mode"
echo " -c: force a clean build"
echo " -d: build deps (optional)"
@ -40,11 +43,14 @@ function usage() {
}
unset name
while getopts ":1bcdghirsu" opt; do
while getopts ":1j:bcdghirsu" opt; do
case ${opt} in
1 )
export CMAKE_BUILD_PARALLEL_LEVEL=1
;;
j )
CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG
;;
b )
BUILD_DEBUG="1"
;;
@ -61,8 +67,8 @@ while getopts ":1bcdghirsu" opt; do
BUILD_IMAGE="1"
;;
r )
SKIP_RAM_CHECK="1"
;;
SKIP_RAM_CHECK="1"
;;
s )
BUILD_ORCA="1"
;;
@ -163,7 +169,7 @@ then
else
BUILD_ARGS="${BUILD_ARGS} -DBBL_RELEASE_TO_PUBLIC=1 -DBBL_INTERNAL_TESTING=0"
fi
echo -e "cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${PWD}/deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 ${BUILD_ARGS}"
echo -e "cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${PWD}/deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 -DORCA_TOOLS=ON ${BUILD_ARGS}"
cmake -S . -B build -G Ninja \
-DCMAKE_PREFIX_PATH="${PWD}/deps/build/destdir/usr/local" \
-DSLIC3R_STATIC=1 \