Skip to content

Commit

Permalink
Stop CMake from cleaning root test data (celeritas-project#1516)
Browse files Browse the repository at this point in the history
* CMake generated script to check if root test data is missing and update it
* Changed CI commands to force regeneration of root test data
* Changed to have root test data not be a dependency, but rather a post-build custom command
  • Loading branch information
hhollenb authored and sethrj committed Jan 14, 2025
1 parent b446ad5 commit d56cb7e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/celeritas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,18 @@ celeritas_add_test(user/StepCollector.test.cc
# DATA UPDATE
#-----------------------------------------------------------------------------#

set(_root_data)
add_custom_target(update-root-test-data
COMMENT "Regenerate ROOT test data"
)

if(CELERITAS_USE_Geant4 AND CELERITAS_USE_ROOT)
foreach(_filename "four-steel-slabs" "simple-cms" "lar-sphere")
set(_gdml "${PROJECT_SOURCE_DIR}/test/geocel/data/${_filename}.gdml")
set(_basename "${CMAKE_CURRENT_SOURCE_DIR}/data/${_filename}")
set(_output "${_basename}.root")
add_custom_command(
OUTPUT "${_output}"
TARGET update-root-test-data
POST_BUILD
DEPENDS
celer-export-geant
"${_gdml}"
Expand All @@ -432,13 +436,7 @@ if(CELERITAS_USE_Geant4 AND CELERITAS_USE_ROOT)
"--gen-test"
VERBATIM
)
list(APPEND _root_data "${_output}")
endforeach()
endif()

add_custom_target(update-root-test-data
COMMENT "Regenerate ROOT test data"
DEPENDS ${_root_data}
)

#-----------------------------------------------------------------------------#

0 comments on commit d56cb7e

Please sign in to comment.