forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (64 loc) · 2.3 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#----------------------------------*-CMake-*----------------------------------#
# Copyright 2023-2024 UT-Battelle, LLC, and other Celeritas developers.
# See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#-----------------------------------------------------------------------------#
set(SOURCES
demo-rasterizer.cc
)
set(_rasterizer_libs
Celeritas::corecel
Celeritas::geocel
Celeritas::orange
nlohmann_json::nlohmann_json
)
if(CELERITAS_CORE_GEO STREQUAL "ORANGE")
list(APPEND _rasterizer_libs Celeritas::orange)
elseif(CELERITAS_CORE_GEO STREQUAL "VecGeom")
list(APPEND _rasterizer_libs VecGeom::vecgeom)
elseif(CELERITAS_CORE_GEO STREQUAL "Geant4")
celeritas_get_g4libs(_g4_geo_libs geometry)
list(APPEND _rasterizer_libs ${_g4_geo_libs})
endif()
add_executable(demo-rasterizer ${SOURCES})
celeritas_target_link_libraries(demo-rasterizer ${_rasterizer_libs})
#-----------------------------------------------------------------------------#
# TESTS
#-----------------------------------------------------------------------------#
if(NOT BUILD_TESTING)
return()
endif()
set(_driver "${CMAKE_CURRENT_SOURCE_DIR}/simple-driver.py")
set(_model "${CELER_APP_DATA_DIR}/simple-cms.gdml")
set(_env
"CELERITAS_DEMO_EXE=$<TARGET_FILE:demo-rasterizer>"
"CELER_DISABLE_PARALLEL=1"
)
#-----------------------------------------------------------------------------#
function(celer_app_test ext)
set(_labels app nomemcheck)
set(_extra_props)
set(_extra_env "CELER_TEST_EXT=${ext}")
if(ext STREQUAL "gpu")
list(APPEND _labels "gpu")
set(_extra_props RESOURCE_LOCK gpu)
if(CELER_DISABLE_DEVICE)
list(APPEND _extra_props DISABLED true)
endif()
elseif(ext STREQUAL "cpu")
list(APPEND _extra_env "CELER_DISABLE_DEVICE=1")
endif()
add_test(NAME "app/demo-rasterizer:${ext}"
COMMAND "${CELER_PYTHON}" "${_driver}" "${_model}"
)
set_tests_properties("app/demo-rasterizer:${ext}" PROPERTIES
ENVIRONMENT "${_env};${_extra_env}"
REQUIRED_FILES "${_driver};${_gdml_inp}"
LABELS "${_labels}"
${_props} ${_extra_props}
)
endfunction()
#-----------------------------------------------------------------------------#
celer_app_test("gpu")
celer_app_test("cpu")
#-----------------------------------------------------------------------------#