Make Travis read the CXXFLAGS enviroment variable (#2366)

* try to make sure travis uses C++17

* fix unbound variable

* Update dlib/travis/build-and-test.sh

Co-authored-by: Davis E. King <davis@dlib.net>
This commit is contained in:
Adrià Arrufat 2021-05-12 09:08:49 +09:00 committed by GitHub
parent b99bec580b
commit 4a51017c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,11 +7,16 @@ if [ -n "${MATRIX_EVAL+set}" ]; then
eval "${MATRIX_EVAL}"
fi
CXX_FLAGS="-std=c++11"
if [ ! -z ${CXXFLAGS+set} ]; then
CXX_FLAGS="${CXXFLAGS}"
fi
# build dlib and tests
if [ "$VARIANT" = "test" ]; then
mkdir build
cd build
cmake ../dlib/test
cmake ../dlib/test -DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
cmake --build . --target dtest -- -j 2
./dtest --runall $DISABLED_TESTS
fi
@ -20,7 +25,7 @@ fi
if [ "$VARIANT" = "test-debug" ]; then
mkdir build
cd build
cmake ../dlib/test -DDLIB_ENABLE_ASSERTS=1
cmake ../dlib/test -DDLIB_ENABLE_ASSERTS=1 -DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
cmake --build . --target dtest -- -j 2
./dtest --runall $DISABLED_TESTS
fi
@ -28,14 +33,14 @@ fi
if [ "$VARIANT" = "dlib_all_source_cpp" ]; then
mkdir build
cd build
cmake ../dlib/test
cmake ../dlib/test -DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
cmake --build . --target dlib_all_source_cpp -- -j 2
fi
if [ "$VARIANT" = "tools" ]; then
mkdir build
cd build
cmake ../dlib/test/tools
cmake ../dlib/test/tools -DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
cmake --build . -- -j 2
fi
@ -44,37 +49,37 @@ fi
if [ "$VARIANT" = "old-cmake" ]; then
mkdir build
cd build
CMAKEDIR=../cmake
CMAKEDIR=../cmake -DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
$CMAKEDIR/2.8/bin/cmake ../dlib/test/tools
$CMAKEDIR/2.8/bin/cmake ../dlib/test/tools
$CMAKEDIR/2.8/bin/cmake --build . -- -j 2
rm -rf *
$CMAKEDIR/3.1/bin/cmake ../dlib/test/tools
$CMAKEDIR/3.1/bin/cmake ../dlib/test/tools
$CMAKEDIR/3.1/bin/cmake --build . -- -j 2
rm -rf *
$CMAKEDIR/3.5/bin/cmake ../dlib/test/tools
$CMAKEDIR/3.5/bin/cmake ../dlib/test/tools
$CMAKEDIR/3.5/bin/cmake --build . -- -j 2
# just to make sure there isn't anything funny about building standalone dlib
rm -rf *
$CMAKEDIR/2.8/bin/cmake ../dlib
$CMAKEDIR/2.8/bin/cmake ../dlib
$CMAKEDIR/2.8/bin/cmake --build . -- -j 2
fi
if [ "$VARIANT" = "examples" ]; then
mkdir build
cd build
cmake ../examples
cmake ../examples -DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
cmake --build . -- -j 1
fi
if [ "$VARIANT" = "examples-debug" ]; then
mkdir build
cd build
cmake ../examples -DDLIB_ENABLE_ASSERTS=1
cmake ../examples -DDLIB_ENABLE_ASSERTS=1 -DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
cmake --build . -- -j 1
fi
@ -83,4 +88,3 @@ if [ "$VARIANT" = "python-api" ]; then
pip uninstall numpy -y
python setup.py test --clean
fi