diff --git a/CMakeLists.txt b/CMakeLists.txt index 257fab7c4..f677b4d46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,8 +48,8 @@ if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR set(DEBUG_CHECK_ASSERTIONS "1") set(LIBROM_FLAGS "${LIBROM_FLAGS} -Wall") endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBROM_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBROM_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT} ${LIBROM_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT} ${LIBROM_FLAGS}" CACHE STRING "" FORCE) if (CMAKE_HOST_APPLE) # Fix linker flags for OSX to use classic linker on XCode 15.0+: diff --git a/README.md b/README.md index f17655f05..90cb54d91 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,11 @@ Compilation options: - -a: Compile a special build for the LLNL codebase: Ardra - -d: Compile in debug mode. +- -f: Specify additional compiler flags - -m: Compile with MFEM (required to run the libROM examples) +- -g: Compile MFEM with GSLib (requires -m) +- -r: Compile unit tests (requires Googletest) +- -s: Compile and use a local SCALAPACK - -t: Use your own cmake/toolchain - -u: Update all of libROM's dependencies. @@ -92,7 +96,9 @@ Docker container [`librom_env`](https://ghcr.io/llnl/librom/librom_env) provides # libROM CI -libROM leverages GitHub Actions for CI. The CI currently applies only to commits to pull requests. Unit tests run for all PR commits. Upon the addition of the `LGTM` label, both the unit tests and regression tests run. While the `LGTM` label is still present, all subsequent commits run both unit tests and regression tests. +libROM leverages GitHub Actions for CI. The CI currently applies only to commits to pull requests. Unit tests run for all PR commits. Upon the addition of the `LGTM` label, both the unit tests and regression tests run. While the `LGTM` label is still present, all subsequent commits run both unit tests and regression tests. + +To compile and run unit tests locally, build using the `-r` option to `compile.sh` or with `-DENABLE_TESTS=ON`. Building the unit tests will require Googletest to be installed. Unit tests can be run using `ctest` from the root build directory. # License diff --git a/scripts/compile.sh b/scripts/compile.sh index 9e43a3a3f..445406d16 100755 --- a/scripts/compile.sh +++ b/scripts/compile.sh @@ -27,6 +27,8 @@ UPDATE_LIBS=false INSTALL_SCALAPACK=false MFEM_USE_GSLIB="Off" MFEM_USE_LAPACK="Off" +ENABLE_TESTS="Off" +LIBROM_FLAGS="" cleanup_dependencies() { pushd . @@ -46,7 +48,7 @@ cleanup_dependencies() { # Get options -while getopts "ah:dh:gh:lh:mh:t:uh:sh" o; +while getopts "ah:dh:gh:lh:mh:t:uh:sh:rh:f:" o; do case "${o}" in a) @@ -73,6 +75,12 @@ do s) INSTALL_SCALAPACK=true ;; + r) + ENABLE_TESTS="On" + ;; + f) + LIBROM_FLAGS=${OPTARG} + ;; *) echo "Unknown option." exit 1 @@ -152,7 +160,9 @@ if [ "$(uname)" == "Darwin" ]; then cmake ${REPO_PREFIX} \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DUSE_MFEM=${USE_MFEM} \ - -DMFEM_USE_GSLIB=${MFEM_USE_GSLIB} + -DMFEM_USE_GSLIB=${MFEM_USE_GSLIB} \ + -DENABLE_TESTS=${ENABLE_TESTS} \ + -DLIBROM_FLAGS="${LIBROM_FLAGS}" check_result $? librom-config make check_result $? librom-build @@ -166,7 +176,9 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DUSE_MFEM=${USE_MFEM} \ - -DMFEM_USE_GSLIB=${MFEM_USE_GSLIB} + -DMFEM_USE_GSLIB=${MFEM_USE_GSLIB} \ + -DENABLE_TESTS=${ENABLE_TESTS} \ + -DLIBROM_FLAGS="${LIBROM_FLAGS}" check_result $? librom-config make -j8 check_result $? librom-build