diff options
author | Evan Lojewski <github@meklort.com> | 2020-03-07 10:28:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-07 10:28:03 -0700 |
commit | 9e3b0e4a415eb5a08d99cac2bb0b080125a4f431 (patch) | |
tree | 61fbfa3563abf14815eb7d2b277cda51f1f38130 | |
parent | 76512623e565670feede5da44822fd4ce093ba2b (diff) | |
download | bcm5719-ortega-9e3b0e4a415eb5a08d99cac2bb0b080125a4f431.tar.gz bcm5719-ortega-9e3b0e4a415eb5a08d99cac2bb0b080125a4f431.zip |
build: Autodetect appropriate cmake binary and generator. (#56)
-rwxr-xr-x | build.sh | 55 |
1 files changed, 47 insertions, 8 deletions
@@ -3,7 +3,7 @@ ### ### @file build.sh ### -### @project +### @project bcm5719 ### ### @brief Top level build script. ### @@ -43,12 +43,51 @@ ### @endcond ################################################################################ -rm -rf build -mkdir build +GENERATOR= +BUILD_DIR=build -cd build +if [ ! -x "$CMAKE" ] +then + CMAKE=`which cmake3` + if [ ! -x "$CMAKE" ] + then + CMAKE=`which cmake` + if [ ! -x "$CMAKE" ] + then + echo "ERROR: Unable to locate cmake." + exit -1 + fi + fi +fi -cmake .. -G Ninja -cmake --build . -cmake --build . --target package -cmake --build . --target package_source +NINJA=`which ninja-build` +if [ -x "$NINJA" ] +then + GENERATOR=-GNinja +else + NINJA=`which ninja` + if [ -x "$NINJA" ] + then + GENERATOR=-GNinja + else + echo "WARNING: Unable to locate ninja." + fi +fi + +echo "Using cmake: $CMAKE $GENERATOR" + +set -e + +# Clean out the build folder. +"$CMAKE" -E remove_directory "$BUILD_DIR" +"$CMAKE" -E make_directory "$BUILD_DIR" + +cd "$BUILD_DIR" + +# Do the build +"$CMAKE" .. $GENERATOR +"$CMAKE" --build . + +# Generate release packages. +"$CMAKE" --build . --target package +"$CMAKE" --build . --target package_source |