set build type and use it to configure the compiler used

This commit is contained in:
ThePhD 2017-12-29 21:44:04 -05:00
parent 1444d72b56
commit 41c297b9ab
3 changed files with 16 additions and 4 deletions

View File

@ -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"]

View File

@ -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

View File

@ -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 ..