Skip to content

Commit

Permalink
Merge pull request #2217 from DARMA-tasking/2214-refactor-configure-o…
Browse files Browse the repository at this point in the history
…ptions-in-build-system

2214: Move all CMake's options to `configure_options.cmake` file
  • Loading branch information
lifflander authored Dec 12, 2023
2 parents 1aa5a8d + e39f3b7 commit 588a5c9
Show file tree
Hide file tree
Showing 30 changed files with 150 additions and 277 deletions.
54 changes: 11 additions & 43 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ if(NOT CMAKE_CXX_STANDARD)
endif()
message(STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}")

option(CODE_COVERAGE "Enable coverage reporting" OFF)

set(MPI_EXTRA_FLAGS "" CACHE STRING "Flags to pass to mpirun/mpiexec")
string(REPLACE " " ";" MPI_EXTRA_FLAGS_LIST "${MPI_EXTRA_FLAGS}")
message(STATUS "Running tests and examples with additional MPI flags = ${MPI_EXTRA_FLAGS_LIST}")
Expand All @@ -64,50 +62,24 @@ include(cmake/link_vt.cmake)
# Load packages that are required for core VT build
include(cmake/load_packages.cmake)

include(cmake/check_compiler.cmake)

option(vt_gold_linker_enabled "Build VT using the `gold' linker" ON)

option(vt_unity_build_enabled "Build VT with Unity/Jumbo mode enabled" OFF)

if (vt_unity_build_enabled)
message(STATUS "Building VT in Unity/Jumbo build mode")
endif()

# Option included here, handled in define_build_modes.cmake so libfort can be
# included correspondingly
option(vt_diagnostics_enabled "Build VT with performance metrics/stats" ON)

if (vt_diagnostics_enabled)
# Default libfort ON if diagnostics are enabled
option(vt_libfort_enabled "Build VT with fort library enabled" ON)
else()
option(vt_libfort_enabled "Build VT with fort library enabled" OFF)
endif()

option(vt_mimalloc_enabled "Build VT with mimalloc" OFF)
option(vt_mimalloc_static "Build VT with mimalloc using static linking" ON)
option(vt_asan_enabled "Build VT with address sanitizer" OFF)
option(vt_ubsan_enabled "Build VT with undefined behavior sanitizer" OFF)
option(vt_werror_enabled "Build VT with -Werror enabled" OFF)
# Some options use TPL information (whether Perl was found etc.)
include(cmake/configure_options.cmake)

include(cmake/check_compiler.cmake)
include(cmake/nvcc_no_deprecated_gpu_targets.cmake)
include(cmake/load_bundled_libraries.cmake)

option(vt_trace_only "Build VT with trace-only mode enabled" OFF)
if (vt_trace_only)
message(STATUS "Building additional target for VT in trace-only mode")
endif()

# Primary VT build
add_subdirectory(src)

if(vt_no_color_enabled)
target_compile_definitions(${VIRTUAL_TRANSPORT_LIBRARY} PUBLIC VT_NO_COLOR_ENABLED)
endif()
#
# Test prep - ensures examples can be registered as tests.
#
option(VT_BUILD_TESTS "Build VT tests" ON)

if (VT_BUILD_TESTS
if (vt_build_tests
AND "${CMAKE_PROJECT_NAME}" STREQUAL "${PROJECT_NAME}")
# CTest implies enable_testing() and defines the BUILD_TESTING option.
# The default of BUILD_TESTING is ON.
Expand All @@ -118,8 +90,6 @@ endif()
#
# Tools
#
option(vt_build_tools "Build VT tools" ON)

if (vt_build_tools)
message(
STATUS
Expand All @@ -137,9 +107,7 @@ endif()
#
# Examples
#
option(VT_BUILD_EXAMPLES "Build VT examples" ON)

if (VT_BUILD_EXAMPLES)
if (vt_build_examples)
message(
STATUS
"VT: building examples"
Expand All @@ -149,7 +117,7 @@ if (VT_BUILD_EXAMPLES)
add_subdirectory(examples)
else()
message(
STATUS "VT: NOT building examples because VT_BUILD_EXAMPLES is not set.\
STATUS "VT: NOT building examples because vt_build_examples is not set.\
Examples that are not built are NOT TESTED."
)
endif()
Expand All @@ -159,7 +127,7 @@ endif()
#

if (BUILD_TESTING
AND VT_BUILD_TESTS
AND vt_build_tests
AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
message(
STATUS
Expand All @@ -172,7 +140,7 @@ if (BUILD_TESTING
else()
message(
STATUS
"VT: NOT building tests because VT_BUILD_TESTS or BUILD_TESTING are not set"
"VT: NOT building tests because vt_build_tests or BUILD_TESTING are not set"
)
endif()

Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-10-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: clang-10
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-11-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: clang-11
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-12-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: clang-12
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-13-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: clang-13
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-14-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: clang-14
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 1
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-9-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: clang-9
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-clang-alpine-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: clang-13
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-10-ubuntu-openmpi-spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ variables:
HOST_COMPILER: gcc-10
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 0
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-10-ubuntu-openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: gcc-10
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 0
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-11-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: gcc-11
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 1
VT_CODE_COVERAGE: 1
VT_LB: 1
VT_TRACE: 1
VT_TRACE_RT: 1
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-12-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: gcc-12
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-8-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: gcc-8
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 1
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-gcc-9-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: gcc-9
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-intel-oneapi-icpc-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: icpc
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 0
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-intel-oneapi-icpx-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: icpx
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 1
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-nvidia-11-2-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: gcc-9
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 1
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/azure/azure-nvidia-12-ubuntu-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
HOST_COMPILER: gcc-9
BUILD_TYPE: release
ULIMIT_CORE: 0
CODE_COVERAGE: 0
VT_CODE_COVERAGE: 0
VT_LB: 1
VT_TRACE: 1
VT_TRACE_RT: 0
Expand Down
2 changes: 1 addition & 1 deletion ci/build_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \
-Dvt_fcontext_enabled="${VT_FCONTEXT_ENABLED:-0}" \
-Dvt_fcontext_build_tests_examples="${VT_FCONTEXT_BUILD_TESTS_EXAMPLES:-0}" \
-Dvt_rdma_tests_enabled="${VT_RDMA_TESTS_ENABLED:-1}" \
-DCODE_COVERAGE="${CODE_COVERAGE:-0}" \
-Dvt_code_coverage="${VT_CODE_COVERAGE:-0}" \
-DMI_INTERPOSE:BOOL=ON \
-DMI_OVERRIDE:BOOL=ON \
-Dvt_mpi_guards="${VT_MPI_GUARD_ENABLED:-0}" \
Expand Down
4 changes: 2 additions & 2 deletions ci/build_vt_sample.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ then
-Dkokkos_DISABLE:BOOL=1 \
-Dkokkos_kernels_DISABLE:BOOL=1 \
-Dvt_trace_only="1" \
-DVT_BUILD_EXAMPLES="0" \
-DVT_BUILD_TESTS="0" \
-Dvt_build_examples="0" \
-Dvt_build_tests="0" \
-DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-17}" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" \
Expand Down
6 changes: 3 additions & 3 deletions ci/ctest_job_script.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ endif()
if ( NOT DEFINED ENV{VT_RDMA_TESTS_ENABLED} )
set(ENV{VT_RDMA_TESTS_ENABLED} "1")
endif()
if ( NOT DEFINED ENV{CODE_COVERAGE} )
set(ENV{CODE_COVERAGE} "0")
if ( NOT DEFINED ENV{VT_CODE_COVERAGE} )
set(ENV{VT_CODE_COVERAGE} "0")
endif()
if ( NOT DEFINED ENV{VT_MPI_GUARD_ENABLED} )
set(ENV{VT_MPI_GUARD_ENABLED} "0")
Expand Down Expand Up @@ -137,7 +137,7 @@ set(configureOpts
"-Dvt_fcontext_enabled=$ENV{VT_FCONTEXT_ENABLED}"
"-Dvt_fcontext_build_tests_examples=$ENV{VT_FCONTEXT_BUILD_TESTS_EXAMPLES}"
"-Dvt_rdma_tests_enabled=$ENV{VT_RDMA_TESTS_ENABLED}"
"-DCODE_COVERAGE=$ENV{CODE_COVERAGE}"
"-Dvt_code_coverage=$ENV{VT_CODE_COVERAGE}"
"-DMI_INTERPOSE:BOOL=ON"
"-DMI_OVERRIDE:BOOL=ON"
"-Dvt_mpi_guards=$ENV{VT_MPI_GUARD_ENABLED}"
Expand Down
2 changes: 1 addition & 1 deletion ci/test_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pushd "$VT_BUILD"
# Don't run performance tests here (use label 'unit_test' or 'example')
ctest --output-on-failure -L 'unit_test|example' | tee cmake-output.log

if test "${CODE_COVERAGE:-0}" -eq 1
if test "${VT_CODE_COVERAGE:-0}" -eq 1
then
export CODECOV_TOKEN="$CODECOV_TOKEN"
lcov --capture --directory . --output-file coverage.info
Expand Down
Loading

0 comments on commit 588a5c9

Please sign in to comment.