diff --git a/README.md b/README.md index 47a1d8b..e5105a1 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,10 @@ This will download the following dependenceis: To build the project, just use the `build` alias or invoke the `build.sh` script from the project's base directory. -`build` and `build.sh` accept the environment variables `CXX` and `CXXFLAGS`. -`CXXFLAGS` must at least specify the C++ version. +`build` and `build.sh` accept the environment variables `CXX`, `CXXFLAGS`, and `SINGLE`. + +- `CXXFLAGS` must at least specify the C++ version. +- Set `SINGLE` to `yes` to run the build script in single-threaded mode. To clean out the build or dependency directories, use `clean` and `clean_dependencies` or their corresponding scripts respectively. diff --git a/scripts/build.sh b/scripts/build.sh index f363fcf..e02b832 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -15,6 +15,13 @@ # version 3 along with this program. # If not, see https://www.gnu.org/licenses/agpl-3.0.en.html +if [ "$(tr '[:upper:]' '[:lower:]' <<< $SINGLE)" = "yes" ]; then + echo "Running build script in single-threaded mode." + WAIT_ANYWAY="wait" +else + WAIT_ANYWAY="" +fi + if [ -z "$CXX" ]; then CXX="c++" fi @@ -45,6 +52,7 @@ for lib in $(find ./src/lib -name "*.cpp"); do COMPILE_COMMAND="$CXX_WITH_FLAGS -fPIC -shared -o $(sed -e 's/^.\/src/.\/bin/;s/cpp$/so/' <<< $lib) $lib" echo $COMPILE_COMMAND $COMPILE_COMMAND & + $WAIT_ANYWAY done wait @@ -69,6 +77,7 @@ COMPILE_COMMANDS=( for command in ${!COMPILE_COMMANDS[@]}; do echo "${COMPILE_COMMANDS[command]}" ${COMPILE_COMMANDS[command]} & + $WAIT_ANYWAY done wait diff --git a/setupenv.bashrc b/setupenv.bashrc index ed0a332..a026ec3 100644 --- a/setupenv.bashrc +++ b/setupenv.bashrc @@ -29,7 +29,7 @@ function run_tests { function build { pushd "$PROJECT_BASE_DIR" >/dev/null 2>&1 - CXX="$CXX" CXXFLAGS="$CXXFLAGS" scripts/build.sh + SINGLE="$SINGLE" CXX="$CXX" CXXFLAGS="$CXXFLAGS" scripts/build.sh popd >/dev/null 2>&1 }