Skip to content

Commit

Permalink
feat: third-party licenses are automatically exported.
Browse files Browse the repository at this point in the history
fix: tests were missing the catch2 setup
  • Loading branch information
Franz R. Sattler committed Dec 31, 2024
1 parent d7aacdf commit 595f685
Show file tree
Hide file tree
Showing 7 changed files with 960 additions and 55 deletions.
8 changes: 4 additions & 4 deletions DiFfRG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ install(
# Wrap up
# ##############################################################################

set(CPM_PACKAGE_deal.II_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/dealii)
set(CPM_PACKAGE_sundials_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/sundials)
set(CPM_PACKAGE_boost_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/boost)

# Add CPMLicenses for disclaimers
CPMAddPackage(
NAME CPMLicenses.cmake
GITHUB_REPOSITORY cpm-cmake/CPMLicenses.cmake
VERSION 0.0.5
)

set(deal.II_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/dealii)
set(sundials_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/sundials)
set(boost_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../external/boost)

message("deal.II source directory: ${deal.II_SOURCE_DIR}")

message("packages: ${CPM_PACKAGES};deal.II;sundials;boost")
Expand Down
8 changes: 5 additions & 3 deletions DiFfRG/cmake/setup_build_system.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ find_package(deal.II 9.5.0 REQUIRED HINTS ${DEAL_II_DIR}
deal_ii_initialize_cached_variables()

# Find TBB
find_package(TBB REQUIRED)
find_package(TBB 2022.0.0 REQUIRED HINTS ${BUNDLED_DIR}/oneTBB_install)
message(STATUS "TBB dir: ${TBB_DIR}")

# Find OpenMP
Expand Down Expand Up @@ -95,7 +95,7 @@ endif()
# Find GSL
find_package(GSL)
if(NOT GSL_FOUND)
cpmaddpackage(
cpmfindpackage(
NAME
gsl
GITHUB_REPOSITORY
Expand All @@ -105,6 +105,7 @@ if(NOT GSL_FOUND)
OPTIONS
"GSL_DISABLE_TESTS 1"
"DOCUMENTATION OFF")
add_library(GSL::gsl ALIAS gsl)
else()
message(STATUS "GSL found: ${GSL_INCLUDE_DIR}")
endif()
Expand Down Expand Up @@ -160,6 +161,7 @@ if(USE_CUDA AND CMAKE_CUDA_COMPILER)

if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES native)
message(WARNING "CMAKE_CUDA_ARCHITECTURES not set. Using native.")
endif()

set(CUDA_NVCC_FLAGS
Expand Down Expand Up @@ -188,7 +190,7 @@ if(USE_CUDA AND CMAKE_CUDA_COMPILER)
set_target_properties(${TARGET} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(${TARGET} PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
set_target_properties(${TARGET} PROPERTIES CUDA_ARCHITECTURES native)
set_target_properties(${TARGET} PROPERTIES CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES})

target_compile_options(
${TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:${CUDA_NVCC_FLAGS}>")
Expand Down
25 changes: 24 additions & 1 deletion DiFfRG/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,30 @@

include_directories(./)

find_package(Catch2 REQUIRED PATHS ../../external/Catch2_install)
# Find Catch2 Testing Framework
cpmaddpackage(
NAME
Catch2
GITHUB_REPOSITORY
catchorg/Catch2
VERSION
3.7.1
OPTIONS
"CATCH_INSTALL_DOCS OFF"
"CATCH_INSTALL_HELPERS OFF")

function(setup_test TARGET)
setup_target(${TARGET})
target_link_libraries(${TARGET} DiFfRG::DiFfRG Catch2::Catch2WithMain)
catch_discover_tests(${TARGET})
endfunction()

function(setup_benchmark TARGET)
setup_target(${TARGET})
target_link_libraries(${TARGET} DiFfRG::DiFfRG Catch2::Catch2WithMain)
endfunction()

list(APPEND CMAKE_MODULE_PATH ${lib_Catch2_SOURCE_DIR}/extras)
include(CTest)
include(Catch)

Expand Down
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
export CXX_FLAGS="-march=native -fPIC -flto=auto"
export C_FLAGS="-march=native -fPIC -flto=auto"
export CUDA_FLAGS=""
export CUDA_ARCHITECTURES="native"
export CUDA_ARCHITECTURES="all"

# Configure linker flags for the current machine. By default, we use the gold linker
export EXE_LINKER_FLAGS="-fuse-ld=gold"
Expand Down
20 changes: 2 additions & 18 deletions external/.gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
autodiff_build/
autodiff_install/
oneTBB_build/
oneTBB_install/
boost_build/
boost_install/
dealii_build/
dealii_install/
sundials_build/
sundials_install/
Catch2_build/
Catch2_install/
libInterpolate_build/
libInterpolate_install/
matplotplusplus_build/
matplotplusplus_install/
kokkos_build/
kokkos_install/
rmm_build/
rmm_install/
spdlog_build/
spdlog_install/
eigen_build/
eigen_install/
qmc_install/
thread-pool_install/
rapidcsv_build/
rapidcsv_install/
logs/
*.log
Loading

0 comments on commit 595f685

Please sign in to comment.