Commit 57aa3118 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added --with-ci-flags option to build scripts.

parent a4885bf9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ stages:
        - export CTEST_OUTPUT_ON_FAILURE=1
        - export CTEST_PARALLEL_LEVEL=4
        # enforce (more or less) warning-free builds
        - export CXXFLAGS="-Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=uninitialized -Wno-error=vla"
        #- export CXXFLAGS="-Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=uninitialized -Wno-error=vla"
        - mkdir -p "./builddir/$CI_JOB_NAME"
        - pushd "./builddir/$CI_JOB_NAME"
        - cmake ../..
@@ -64,6 +64,7 @@ stages:
                -DWITH_EXAMPLES=${WITH_EXAMPLES}
                -DWITH_TOOLS=${WITH_TOOLS}
                -DWITH_PYTHON=${WITH_PYTHON}
                -DWITH_CI_FLAGS=yes
        # "install" implies the "all" target
        - ninja ${NINJAFLAGS} install
        - if [[ ${WITH_TESTS} == "yes" ]]; then
+5 −0
Original line number Diff line number Diff line
@@ -96,6 +96,11 @@ set( CMAKE_SHARED_LINKER_FLAGS "" )
set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "-rdynamic" )
set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "" )

if( ${WITH_CI_FLAGS} )
   # enforce (more or less) warning-free builds
   set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=uninitialized -Wno-error=vla" )
endif()

# set additional Debug/Release options using generator expressions
# (that way we can exclude some options for specific targets, see https://stackoverflow.com/a/59734798 for details)
add_compile_options(
+4 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ WITH_EXAMPLES="yes"
WITH_PYTHON="yes"
WITH_TOOLS="yes"
WITH_BENCHMARKS="yes"
WITH_CI_FLAGS="no"

for option in "$@"
do
@@ -63,6 +64,7 @@ do
        --with-benchmarks=*              ) WITH_BENCHMARKS="${option#*=}" ;;
        --with-python=*                  ) WITH_PYTHON="${option#*=}" ;;
        --with-cxx-flags=*               ) WITH_CXX_FLAGS="${option#*=}" ;;
        --with-ci-flags=*                ) WITH_CI_FLAGS="${option#*=}" ;;
        *                                )
           echo "Unknown option ${option}. Use --help for more information."
           exit 1 ;;
@@ -93,6 +95,7 @@ if [[ ${HELP} == "yes" ]]; then
    echo "   --with-python=yes/no                  Compile the Python bindings. 'yes' by default."
    echo "   --with-benchmarks=yes/no              Compile the 'src/Benchmarks' directory. 'yes' by default."
    echo "   --with-cxx-flags=FLAGS                Additional flags for C++ compiler."
    echo "   --with-cxx-flags=yes/no               Turns on more strict C++ flags for CI. 'no' by default."
    echo "   --cmake=CMAKE                         Path to cmake. 'cmake' by default."
    echo "   --verbose                             It enables verbose build."
    echo "   --root-dir=PATH                       Path to the TNL source code root dir."
@@ -145,6 +148,7 @@ cmake_command=(
         -DWITH_PYTHON=${WITH_PYTHON}
         -DWITH_BENCHMARKS=${WITH_BENCHMARKS}
         -DWITH_CXX_FLAGS=${WITH_CXX_FLAGS}
         -DWITH_CI_FLAGS=${WITH_CI_FLAGS}
         -DDCMTK_DIR=${DCMTK_DIR}
)