From 41c297b9ab603595e2c7bd4d6237312effc2b1a1 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Fri, 29 Dec 2017 21:44:04 -0500 Subject: [PATCH] set build type and use it to configure the compiler used --- Dockerfile | 4 ++-- scripts/preparation.linux.sh | 2 ++ scripts/run.linux.sh | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd5b4c26..dd947361 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,11 +36,11 @@ RUN apt -y install sudo zsh RUN apt -y dist-upgrade RUN mkdir -p build-sol2/Debug build-sol2/Release RUN chmod +x /sol2/scripts/preparation.linux.sh -RUN ["/usr/bin/env", "zsh", "-c", "./sol2/scripts/preparation.linux.sh"] +RUN ["/usr/bin/env", "zsh", "-c", "-x", "./sol2/scripts/preparation.linux.sh"] # CMD/ENTRYPOINT is different from RUN # these are done on a per-instantiation and essentially describe # the DEFAULT behavior of this container when its started, not what state it # gets "saved" in... # it only runs the last CMD/ENTRYPOINT as the default behavior: # multiple CMDs will not be respected -CMD ["/usr/bin/env", "zsh", "-c", "chmod +x /sol2/scripts/run.linux.sh && ./sol2/scripts/run.linux.sh"] +CMD ["/usr/bin/env", "zsh", "-c", "-x", "chmod +x /sol2/scripts/run.linux.sh && ./sol2/scripts/run.linux.sh"] diff --git a/scripts/preparation.linux.sh b/scripts/preparation.linux.sh index f9e03015..b0a0aa99 100644 --- a/scripts/preparation.linux.sh +++ b/scripts/preparation.linux.sh @@ -54,6 +54,7 @@ sudo apt -y install build-essential zsh ninja-build libreadline6 libreadline6-de if [ "$LLVM_VERSION" ] then # get and use LLVM + echo "========== detected LLVM_VERSION, attempting to install llvm version $LLVM_VERSION ==========" wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-16.04.tar.xz -O $LLVM_ARCHIVE_PATH mkdir ~/clang-$LLVM_VERSION tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 @@ -63,6 +64,7 @@ then elif [ "$GCC_VERSION" ] then # get and use GCC version that we desire + echo "========== detected GCC_VERSION, attempting to install gcc version $GCC_VERSION ==========" sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y sudo apt update sudo apt dist-upgrade diff --git a/scripts/run.linux.sh b/scripts/run.linux.sh index 05d88292..3208d520 100644 --- a/scripts/run.linux.sh +++ b/scripts/run.linux.sh @@ -1,12 +1,22 @@ +if [ "$LLVM_VERSION" ] +then + build_type=-DCMAKE_CXX_COMPILER\=clang++ -DCMAKE_C_COMPILER\=clang; +elif [ "$GCC_VERSION" ] +then + build_type=-DCMAKE_CXX_COMPILER\=g++ -DCMAKE_C_COMPILER\=gcc; +else + build_type=-DCMAKE_CXX_COMPILER\=g++ -DCMAKE_C_COMPILER\=gcc; +fi + cd build-sol2 cd Debug -cmake ../../sol2 -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON +cmake ../../sol2 -G Ninja -DCMAKE_BUILD_TYPE=Debug $build_type -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON cmake --build . --config Debug ctest -C Debug cd .. cd Release -cmake ../../sol2 -G Ninja -DCMAKE_BUILD_TYPE=Release -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON +cmake ../../sol2 -G Ninja -DCMAKE_BUILD_TYPE=Release $build_type -DLUA_VERSION="${LUA_VERSION}" -DBUILD_LUA=ON -DBUILD_LUA_AS_DLL=OFF -DTESTS=ON -DEXAMPLES=ON -DSINGLE=ON -DTESTS_EXAMPLES=ON -DTESTS_SINGLE=ON cmake --build . --config Release ctest -C Release cd ..