Merge pull request #292 from rolk/292_fastbuild

Add possibility to skip building tests and examples
This commit is contained in:
Bård Skaflestad 2013-07-31 05:45:47 -07:00
commit 0e42c0e20c
2 changed files with 31 additions and 4 deletions

View File

@ -174,7 +174,10 @@ opm_cmake_config (${project})
include (OpmSatellites)
# example programs are found in the tutorials/ and examples/ directory
opm_compile_satellites (${project} examples "" "")
option (BUILD_EXAMPLES "Build the examples/ tree" ON)
if (BUILD_EXAMPLES)
opm_compile_satellites (${project} examples "" "")
endif (BUILD_EXAMPLES)
# infrastructure for testing
enable_testing ()
@ -196,8 +199,10 @@ if (COMMAND tests_hook)
endif (COMMAND tests_hook)
# make datafiles necessary for tests available in output directory
opm_data (tests datafiles "${tests_DIR}")
opm_compile_satellites (${project} tests "" "${tests_REGEXP}")
if (BUILD_TESTING)
opm_data (tests datafiles "${tests_DIR}")
opm_compile_satellites (${project} tests "" "${tests_REGEXP}")
endif (BUILD_TESTING)
# use this target to run all tests
add_custom_target (check

View File

@ -20,6 +20,8 @@ Optional Features:
--enable-debug build a non-optimized version of the library
[default=no]
--enable-lto use whole program optimization [default=no]
--disable-tests do not compile and enable unit tests [default=yes]
--disable-examples do not compile example programs [default=yes]
--disable-pch do not use precompiled headers (if buggy compiler)
--disable-silent-rules print every compilation statement as executed
--enable-system-debug put .debug files in global GDB debug dir
@ -106,6 +108,10 @@ silent_rules=
debug_loc=
#use_lto=" -DWHOLE_PROG_OPTIM=OFF"
use_lto=
#use_tests=" -DBUILD_TESTING=ON"
use_tests=
#use_samples=" -DBUILD_EXAMPLES=ON"
use_samples=
# default is to warn for unknown options, but this can be disabled
option_check=yes
@ -251,6 +257,14 @@ for OPT in "$@"; do
use_mpi=" -DUSE_MPI=OFF"
pkgname=""
;;
tests)
use_tests=" -DBUILD_TESTING=OFF"
pkgname=""
;;
examples)
use_samples=" -DBUILD_EXAMPLES=OFF"
pkgname=""
;;
agmg |\
ert |\
superlu)
@ -303,6 +317,14 @@ for OPT in "$@"; do
use_lto=" -DWHOLE_PROG_OPTIM=ON"
shared=""
;;
tests)
use_tests=" -DBUILD_TESTING=ON"
pkgname=""
;;
examples)
use_samples=" -DBUILD_EXAMPLES=ON"
pkgname=""
;;
# this flag is just for compatibility with the deprecation
# flag in DUNE, so we can build without warnings
fieldvector-size-is-method)
@ -351,7 +373,7 @@ for a in "${VARS[@]}"; do
done
# pass everything on to CMake
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto} ${FEATURES}"
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_tests}${use_samples} ${FEATURES}"
echo --- calling CMake ---
echo ${CMDLINE}
eval exec ${CMDLINE}