diff --git a/CMakeLists.txt b/CMakeLists.txt index f17718a..1949b6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ limitations under the License. CMAKE_MINIMUM_REQUIRED(VERSION 3.12) -project(GaudiTutorial LANGUAGES CXX) +project(SoftwareTutorials LANGUAGES CXX) # please keep this layout for version setting, used by the automatic tagging script set(PACKAGE_VERSION_MAJOR 1) diff --git a/GaudiTutorial/CMakeLists.txt b/GaudiTutorial/CMakeLists.txt index d4028dd..345693a 100644 --- a/GaudiTutorial/CMakeLists.txt +++ b/GaudiTutorial/CMakeLists.txt @@ -16,20 +16,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ]] -add_subdirectory(EventStats) -add_subdirectory(MoliereRadiusFunctional) -add_subdirectory(RandomNoiseDigitizer) - -execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${PROJECT_SOURCE_DIR}/GaudiTutorial/data) -set(SIM_FILE ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root) +project(GaudiTutorial LANGUAGES CXX) -if(NOT EXISTS ${SIM_FILE}) - message(STATUS "Downloading simpleCalo_simulation.root ...") - execute_process( - COMMAND wget -O ${SIM_FILE} https://fccsw.web.cern.ch/fccsw/tutorials/DRD6_2025_Ancona/simpleCalo_simulation.root - ) -else() - message(STATUS "File already exists: ${SIM_FILE}, skipping download.") -endif() +add_subdirectory(EventStats) +add_subdirectory(MoliereRadiusFunctional) +add_subdirectory(RandomNoiseDigitizer) \ No newline at end of file diff --git a/GaudiTutorial/EventStats/CMakeLists.txt b/GaudiTutorial/EventStats/CMakeLists.txt index 91df01a..ab29bc2 100644 --- a/GaudiTutorial/EventStats/CMakeLists.txt +++ b/GaudiTutorial/EventStats/CMakeLists.txt @@ -17,14 +17,17 @@ See the License for the specific language governing permissions and limitations under the License. ]] file(GLOB _plugin_sources src/components/*.cpp) -gaudi_add_module(EventStatsPlugins + +set(PackageName EventStats) + +gaudi_add_module(${PackageName} SOURCES ${_plugin_sources} LINK Gaudi::GaudiKernel k4FWCore::k4FWCore EDM4HEP::edm4hep ) -install(TARGETS EventStatsPlugins +install(TARGETS ${PackageName} EXPORT ${CMAKE_PROJECT_NAME}Targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 37b910f..2c3200b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -17,39 +17,17 @@ See the License for the specific language governing permissions and limitations under the License. ]] -function(set_test_env _testname) - set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT - "ROOT_INCLUDE_PATH=$<$:$/../include>:$<$:$/../include>:$ENV{ROOT_INCLUDE_PATH}" - ) - - set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT - "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib64:${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}:${PROJECT_BINARY_DIR}/genConfDir/${PackageName}:<$:$>:$<$:$>:$<$:$>:$ENV{LD_LIBRARY_PATH}" - ) - - set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT - "PYTHONPATH=${CMAKE_BINARY_DIR}:${PROJECT_BINARY_DIR}/genConfDir:$ENV{PYTHONPATH}" - ) - - set_property(TEST ${_testname} APPEND PROPERTY ENVIRONMENT - "GAUDI_PLUGIN_PATH=${CMAKE_BINARY_DIR}/.plugins:${CMAKE_INSTALL_PREFIX}/lib64:$ENV{GAUDI_PLUGIN_PATH}" - ) - -endfunction() - add_test(NAME test_EventStats - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND k4run GaudiTutorial/EventStats/options/runEventStatsSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_eventStats.root) -set_test_env(test_EventStats) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMAND k4run GaudiTutorial/EventStats/options/runEventStatsSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_eventStats.root) add_test(NAME test_MoliereRadius - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND k4run GaudiTutorial/MoliereRadiusFunctional/options/runMoliereRadiusSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_moliereRadius.root) -set_test_env(test_MoliereRadius) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMAND k4run GaudiTutorial/MoliereRadiusFunctional/options/runMoliereRadiusSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_moliereRadius.root) add_test(NAME test_RandomNoiseDigitizer - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - COMMAND k4run GaudiTutorial/RandomNoiseDigitizer/options/runRandomNoiseDigitizerSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_noiseDigitizer.root) -set_test_env(test_MoliereRadius) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMAND k4run GaudiTutorial/RandomNoiseDigitizer/options/runRandomNoiseDigitizerSolution.py --IOSvc.Input ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root --IOSvc.Output ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_noiseDigitizer.root) # For LD_LIBRARY_PATH # ${PROJECT_BINARY_DIR} # The files .components and .confdb are here @@ -67,22 +45,46 @@ set_test_env(test_MoliereRadius) # See, for example: # https://github.com/key4hep/k4FWCore/blob/42497b71c23425a3a26648f30a1285a499dcda28/test/k4FWCoreTest/CMakeLists.txt#L71 + +execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory + ${PROJECT_SOURCE_DIR}/GaudiTutorial/data) + +set(SIM_FILE ${PROJECT_SOURCE_DIR}/GaudiTutorial/data/simpleCalo_simulation.root) + +if(NOT EXISTS ${SIM_FILE}) + message(STATUS "Downloading simpleCalo_simulation.root ...") + execute_process( + COMMAND wget -O ${SIM_FILE} https://fccsw.web.cern.ch/fccsw/tutorials/DRD6_2025_Ancona/simpleCalo_simulation.root + ) +else() + message(STATUS "File already exists: ${SIM_FILE}, skipping download.") +endif() + + get_filename_component(CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) set(test_environment "\ LD_LIBRARY_PATH=\ ${PROJECT_BINARY_DIR}:\ +${PROJECT_BINARY_DIR}/GaudiTutorial/EventStats:\ +${PROJECT_BINARY_DIR}/GaudiTutorial/MoliereRadiusFunctional:\ +${PROJECT_BINARY_DIR}/GaudiTutorial/RandomNoiseDigitizer:\ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}:\ ${CMAKE_CURRENT_BINARY_DIR}:\ ${CMAKE_CURRENT_BINARY_DIR}/genConfDir/${CURRENT_DIR_NAME}:\ $ENV{LD_LIBRARY_PATH};\ \ PYTHONPATH=\ +${PROJECT_BINARY_DIR}/GaudiTutorial/EventStats/genConfDir:\ +${PROJECT_BINARY_DIR}/GaudiTutorial/MoliereRadiusFunctional/genConfDir:\ +${PROJECT_BINARY_DIR}/GaudiTutorial/RandomNoiseDigitizer/genConfDir:\ ${PROJECT_BINARY_DIR}/${PROJECT_NAME}/genConfDir:\ ${CMAKE_CURRENT_BINARY_DIR}/genConfDir:\ $ENV{PYTHONPATH};\ -" -) +") get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS) set_tests_properties(${test_names} PROPERTIES ENVIRONMENT "${test_environment}") +message(STATUS "================ Test Environment ================") +message(STATUS "${test_environment}") +message(STATUS "=================================================") \ No newline at end of file