Build system: add single threaded mode
parent
51200e7d75
commit
3f6e74ed4e
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue