forked from R3BRootGroup/R3BRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
675 lines (592 loc) · 24.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
##############################################################################
# Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH #
# Copyright (C) 2019-2023 Members of R3B Collaboration #
# #
# This software is distributed under the terms of the #
# GNU General Public Licence (GPL) version 3, #
# copied verbatim in the file "LICENSE". #
# #
# In applying this license GSI does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
##############################################################################
# The name of our project is “R3BROOT”. CMakeLists files in this project can refer to the root
# source directory of the project as ${R3BROOT_SOURCE_DIR} or as ${CMAKE_SOURCE_DIR} and to the root
# binary directory of the project as ${R3BROOT_BINARY_DIR} or ${CMAKE_BINARY_DIR}. This difference
# is is important for the base classes which are in R3BROOT and PANDAROOT.
if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "In-source builds are not supported, please, create a folder build.")
endif()
# Check if cmake has the required version
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
# set cmake policies
cmake_policy(VERSION 3.15...3.23)
# Set name of our project to "R3BROOT". Has to be done after check of cmake version
project(R3BROOT LANGUAGES C CXX Fortran)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/macros")
message(STATUS " ")
message(ERROR " macros repository is missing in the R3BRoot source directory\ncd ${CMAKE_SOURCE_DIR}\ngit clone -b dev https://github.com/R3BRootGroup/macros.git")
message(STATUS " ")
endif(NOT EXISTS "${PROJECT_SOURCE_DIR}/macros")
# Check for needed environment variables
IF(NOT DEFINED ENV{SIMPATH})
MESSAGE(FATAL_ERROR "You did not define the environment variable SIMPATH which is nedded to find the external packages. Please set this variable and execute cmake again.")
ENDIF(NOT DEFINED ENV{SIMPATH})
SET(SIMPATH $ENV{SIMPATH})
IF(NOT DEFINED ENV{FAIRROOTPATH})
MESSAGE(FATAL_ERROR "You did not define the environment variable FAIRROOTPATH which is needed to find FairRoot. Please set this variable and execute cmake again.")
ENDIF(NOT DEFINED ENV{FAIRROOTPATH})
SET(FAIRROOTPATH $ENV{FAIRROOTPATH})
STRING(REGEX MATCHALL "[^:]+" PATH $ENV{PATH})
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH})
Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks")
# Set option(s)
option(BUILD_GEOMETRY "Build all ROOT geometries" ON)
option(USE_PATH_INFO "Information from PATH and LD_LIBRARY_PATH are used." OFF)
option(WITH_UCESB "Build UCESB" OFF)
option(WITH_EPICS "Build EPICS" OFF)
option(WITH_ACTAR "Build ACTAR" OFF)
option(WITH_SOFIA "Build SOFIA" OFF)
option(WITH_NeuLAND_DNN "Build NeuLAND DNN" OFF)
option(WITH_GTPC "Build GTPC" OFF)
option(WITH_FRS "Build FRS" OFF)
option(WITH_ASYEOS "Build ASYEOS" OFF)
option(BUILD_C3W "Build C3W" OFF)
find_package(FairCMakeModules 1.0.0 QUIET)
if(FairCMakeModules_FOUND)
include(FairFindPackage2)
else()
message(STATUS "Could not find FairCMakeModules. "
"It is recommended to install https://github.com/FairRootGroup/FairCMakeModules")
endif()
if(COMMAND find_package2)
find_package2(PUBLIC FairRoot VERSION 18.6.4 QUIET)
else()
find_package(FairRoot)
endif()
# FairRoot_VERSION is eventually set by find_package, for now let's set it explicitly
execute_process(
COMMAND ${FAIRROOTPATH}/bin/fairroot-config --version
COMMAND sed "s/^v//"
OUTPUT_VARIABLE FairRoot_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if( "${FairRoot_VERSION}" VERSION_LESS 18.2.1 )
Message(FATAL_ERROR "Incompatible FairRoot version detected: ${FairRoot_VERSION}. R3BRoot requires FairRoot v18.2.1 or later")
else()
message(STATUS "You seem to be using FairRoot ${FairRoot_VERSION}.")
endif()
# added a variable to point to r3broot path in the system
set(R3BROOTPATH ${CMAKE_INSTALL_PREFIX})
if(SIMPATH)
set(CMAKE_PREFIX_PATH ${SIMPATH} ${CMAKE_PREFIX_PATH})
endif()
# Load some basic macros which are needed later on
include(FairMacros)
list(APPEND required_root_components RIO)
list(APPEND optional_root_components opengl)
list(APPEND optional_root_components gdml vmc)
find_package2(PUBLIC ROOT VERSION 6.16.00 REQUIRED
COMPONENTS ${required_root_components}
OPTIONAL_COMPONENTS ${optional_root_components})
if("${ROOT_vmc_FOUND}" MATCHES "no")
find_package2(PUBLIC VMC REQUIRED)
set(VMCLIB VMCLibrary)
else()
set(VMCLIB VMC)
endif()
include(R3BMacros)
include(WriteConfigFile_r3b)
include(WriteEnvCache)
include(Dart)
include(CheckCompiler)
include(ROOTMacros)
find_package2(PUBLIC FairLogger VERSION 1.6.0 REQUIRED)
foreach(dep IN LISTS FairLogger_PACKAGE_DEPENDENCIES)
if(NOT dep STREQUAL "Boost")
find_package2(PUBLIC ${dep} REQUIRED VERSION ${FairLogger_${dep}_VERSION})
endif()
endforeach()
if("${FairRoot_VERSION}" VERSION_GREATER 18.6.4 )
find_package2(PUBLIC FairMQ VERSION 1.4.0 REQUIRED)
find_package2(PUBLIC DDS)
If(FAIRSOFT_EXTERN)
set(BOOST_ROOT ${SIMPATH})
set(GSL_DIR ${SIMPATH})
Else(FAIRSOFT_EXTERN)
set(BOOST_ROOT ${SIMPATH}/basics/boost)
set(GSL_DIR ${SIMPATH}/basics/gsl)
EndIf(FAIRSOFT_EXTERN)
if(NOT DEFINED Boost_NO_SYSTEM_PATHS)
Set(Boost_NO_SYSTEM_PATHS TRUE)
endif()
if(NOT DEFINED Boost_NO_BOOST_CMAKE AND CMAKE_VERSION VERSION_LESS 3.15)
Set(Boost_NO_BOOST_CMAKE TRUE)
endif()
if(Boost_NO_BOOST_CMAKE)
# If an older version of boost is found both of the variables below are
# cached and in a second cmake run, a good boost version is found even
# if the version is to old.
# To overcome this problem both variables are cleared before checking
# for boost.
Unset(Boost_INCLUDE_DIR CACHE)
Unset(Boost_LIBRARY_DIRS CACHE)
endif()
list(APPEND boost_dependencies thread system timer program_options random filesystem chrono exception iostreams regex serialization log atomic)
find_package2(PUBLIC Boost
VERSION 1.67
COMPONENTS ${boost_dependencies}
ADD_REQUIREMENTS_OF FairMQ
)
# If (FairMQ_FOUND AND Boost_FOUND)
# add_subdirectory(base/MQ)
# add_subdirectory(parmq)
# Else ()
# Message(STATUS "base/MQ and parmq will not be built, because FairMQ and/or Boost was not found.")
# EndIf ()
else()
set(Boost_NO_SYSTEM_PATHS TRUE)
set(Boost_NO_BOOST_CMAKE TRUE)
If(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
set(BOOST_ROOT ${SIMPATH})
set(GSL_DIR ${SIMPATH})
Else(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
set(BOOST_ROOT ${SIMPATH}/basics/boost)
set(GSL_DIR ${SIMPATH}/basics/gsl)
EndIf(${ROOT_LIBRARY_DIR} MATCHES /lib/root)
unset(Boost_INCLUDE_DIR CACHE)
unset(Boost_LIBRARY_DIRS CACHE)
find_package2(PUBLIC Boost
VERSION 1.67 ${FairMQ_Boost_VERSION}
COMPONENTS thread system timer program_options random filesystem chrono exception iostreams regex serialization log log_setup atomic date_time ${FairMQ_Boost_COMPONENTS}
REQUIRED
)
Endif()
find_package2(PUBLIC Pythia6)
find_package2(PUBLIC Pythia8)
find_package2(PUBLIC Protobuf)
find_package2(PUBLIC msgpack)
find_package2(PUBLIC Flatbuffers)
find_package2(PUBLIC Geant3)
find_package2(PUBLIC Geant4)
find_package2(PUBLIC VGM)
find_package2(PUBLIC Geant4VMC)
find_package2(PUBLIC IWYU)
find_package2(PUBLIC GSL)
find_package2(PUBLIC Git)
set (Git_VERSION ${GIT_VERSION_STRING})
string(REPLACE "git" " " Git_ROOT ${GIT_EXECUTABLE} )
# Check the compiler and set the compile and link flags
check_compiler()
if(DEFINED ENV{WERROR} AND "$ENV{WERROR}")
message(STATUS "Will compile with -Werror. ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wformat-security -Werror -Wno-sign-compare -Wno-reorder -Wno-unused-variable -Wno-unused-but-set-variable -Wfatal-errors")
else()
if (NOT APPLE)
message(STATUS "Set env WERROR to 1 to enable -Werror. If origin/dev compiles on your platform with that option, it is definitly a good idea to do that.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wformat-security -Wno-sign-compare -Wno-reorder -Wno-unused-variable -Wno-unused-but-set-variable")
endif()
endif()
set(CMAKE_CXX_FLAGS "-D_GLIBCXX_ASSERTIONS ${CMAKE_CXX_FLAGS}" )
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # used by clang-tidy
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
set(INCLUDE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/include")
set(VMCWORKDIR ${CMAKE_SOURCE_DIR})
if(USE_PATH_INFO)
set(PATH $ENV{PATH})
if(APPLE)
set(LD_LIBRARY_PATH $ENV{DYLD_LIBRARY_PATH})
else(APPLE)
set(LD_LIBRARY_PATH $ENV{LD_LIBRARY_PATH})
endif(APPLE)
endif(USE_PATH_INFO)
# Check if the user wants to build the project in the source directory
check_out_of_source_build()
# Check if we are on an UNIX system. If not stop with an error message
if(NOT UNIX)
message(FATAL_ERROR "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. If you want to go on please edit the CMakeLists.txt in the source directory.")
endif(NOT UNIX)
# Check if the external packages are installed into a separate install directory
if (COMMAND check_external_package_install_dir)
check_external_package_install_dir()
endif()
if(Boost_FOUND)
set(Boost_Avail 1)
else(Boost_FOUND)
set(Boost_Avail 0)
endif(Boost_FOUND)
find_package2(PUBLIC yaml-cpp)
# Workaround missing exported include directories
# Upstream has fixed this in https://github.com/jbeder/yaml-cpp/commit/ab5f9259a4e67d3fe0e4832bd407a9e596e2d884 (since 0.6.3)
if(yaml-cpp_FOUND)
get_filename_component(YAML_CPP_INCLUDE_DIR "${YAML_CPP_INCLUDE_DIR}" REALPATH BASE_DIR "/")
endif()
if( yaml-cpp_FOUND
AND TARGET yaml-cpp
AND EXISTS YAML_CPP_INCLUDE_DIR
AND yaml-cpp_VERSION VERSION_LESS 0.6.3
)
set_target_properties(yaml-cpp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${YAML_CPP_INCLUDE_DIR}"
)
endif()
include(${CMAKE_SOURCE_DIR}/cmake/scripts/fetchGTest.cmake)
SetBasicVariables()
# Set the library version in the main CMakeLists.txt
set(R3BROOT_MAJOR_VERSION 0)
set(R3BROOT_MINOR_VERSION 0)
set(R3BROOT_PATCH_VERSION 0)
set(R3BROOT_VERSION "${FairRoot_VERSION}")
if(NOT DEFINED ROOT_FOUND_VERSION)
set(ROOT_FOUND_VERSION "${found_vers}")
endif()
message("ROOT_FOUND_VERSION = ${ROOT_FOUND_VERSION}")
set(FAIRROOT_LIBRARY_PROPERTIES
${FAIRROOT_LIBRARY_PROPERTIES}
VERSION
"${R3BROOT_VERSION}"
SOVERSION
"${R3BROOT_VERSION}")
string(COMPARE EQUAL
"${CMAKE_GENERATOR}"
"Xcode"
IS_XCODE)
set(R3BLIBDIR ${CMAKE_BINARY_DIR}/lib)
if(${IS_XCODE})
set(LD_LIBRARY_PATH ${R3BLIBDIR}/RELWITHDEBINFO ${R3BLIBDIR} ${LD_LIBRARY_PATH})
else(${IS_XCODE})
set(LD_LIBRARY_PATH ${R3BLIBDIR} ${LD_LIBRARY_PATH})
endif(${IS_XCODE})
find_package(ucesb)
if(ucesb_FOUND)
set(WITH_UCESB ON)
SET(UCESBPATH $ENV{UCESB_DIR})
set(ucesb_summary "${BGreen}YES${CR} ${BMagenta}${UCESBPATH}${CR}")
set(LD_LIBRARY_PATH ${ucesb_LIBRARY_DIR} ${LD_LIBRARY_PATH})
else(ucesb_FOUND)
message(WARNING "${BMagenta}No UCESB configured. You will not be able to unpack lmd files. Set UCESB_DIR"
" to a ucesb installation to fix this.${CR}")
endif(ucesb_FOUND)
find_package(EPICS)
if(EPICS_FOUND)
set(WITH_EPICS ON)
set(epics_summary "${BGreen}YES${CR} ${BMagenta}${EPICS_LIBRARY_DIR}${CR}")
set(LD_LIBRARY_PATH ${EPICS_LIBRARY_DIR} ${LD_LIBRARY_PATH})
else(EPICS_FOUND)
set(epics_summary "${BYellow}NO${CR}")
endif(EPICS_FOUND)
find_package(Atima)
if(Atima_FOUND)
set(atima_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/atima/${CR}")
else(Atima_FOUND)
set(atima_summary "${BYellow}NO${CR}")
endif(Atima_FOUND)
find_package(Garfield)
if(GARFIELD_FOUND)
message("Building ACTAR framework...")
set(WITH_ACTAR ON)
set(actar_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/actar/${CR}")
set(LD_LIBRARY_PATH ${GARFIELD_LIBRARY_DIR} ${LD_LIBRARY_PATH})
else(GARFIELD_FOUND)
set(actar_summary "${BYellow}NO${CR}")
endif(GARFIELD_FOUND)
if(EXISTS "${R3BROOT_SOURCE_DIR}/sofia/")
message("Building SOFIA framework...")
set(WITH_SOFIA ON)
add_definitions(-DSOFIA)
set(sofia_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/sofia/${CR}")
else(EXISTS "${R3BROOT_SOURCE_DIR}/sofia/")
message("${BYellow}SOFIA framework not found${CR}")
set(sofia_summary "${BYellow}NO${CR}")
endif(EXISTS "${R3BROOT_SOURCE_DIR}/sofia/")
if(EXISTS "${R3BROOT_SOURCE_DIR}/NeuLAND_DNN/")
message("Building NeuLAND DNN framework...")
set(WITH_NeuLAND_DNN ON)
set(neuland_dnn_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/NeuLAND_DNN/${CR}")
add_definitions(-DNEULAND_DNN)
else(EXISTS "${R3BROOT_SOURCE_DIR}/NeuLAND_DNN/")
message("${BYellow}NeuLAND_DNN framework not found${CR}")
set(neuland_dnn_summary "${BYellow}NO${CR}")
endif(EXISTS "${R3BROOT_SOURCE_DIR}/NeuLAND_DNN/")
if(EXISTS "${R3BROOT_SOURCE_DIR}/glad-tpc/")
message("Building GLAD-TPC detector...")
set(WITH_GTPC ON)
set(gladtpc_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/glad-tpc/${CR}")
add_definitions(-DGTPC)
else(EXISTS "${R3BROOT_SOURCE_DIR}/glad-tpc/")
message("${BYellow}GLAD-TPC framework not found${CR}")
set(gladtpc_summary "${BYellow}NO${CR}")
endif(EXISTS "${R3BROOT_SOURCE_DIR}/glad-tpc/")
if(EXISTS "${R3BROOT_SOURCE_DIR}/frs/")
message("Building FRS framework...")
set(WITH_FRS ON)
set(frs_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/frs/${CR}")
add_definitions(-DFRS)
else(EXISTS "${R3BROOT_SOURCE_DIR}/frs/")
message("${BYellow}FRS framework not found${CR}")
set(frs_summary "${BYellow}NO${CR}")
endif(EXISTS "${R3BROOT_SOURCE_DIR}/frs/")
if(EXISTS "${R3BROOT_SOURCE_DIR}/asyeos/")
message("Building ASYEOS framework...")
set(WITH_ASYEOS ON)
set(asyeos_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/asyeos/${CR}")
add_definitions(-DASYEOS)
else(EXISTS "${R3BROOT_SOURCE_DIR}/asyeos/")
message("${BYellow}ASYEOS framework not found${CR}")
set(asyeos_summary "${BYellow}NO${CR}")
endif(EXISTS "${R3BROOT_SOURCE_DIR}/asyeos/")
configure_file(${CMAKE_SOURCE_DIR}/cmake/scripts/R3BRootConfigVersion.cmake.in "${CMAKE_BINARY_DIR}/R3BRootConfigVersion.cmake" @ONLY)
r3b_generate_version_info()
# Recurse into the given subdirectories. This does not actually cause another cmake executable to
# run. The same process will walk through the project's entire directory structure.
# FIXME in FairSoft / FairRoot
find_package(VMC QUIET)
set (BASE_INCLUDE_DIRECTORIES ${BASE_INCLUDE_DIRECTORIES} ${VMC_INCLUDE_DIRS})
if(MODULE)
add_subdirectory(${MODULE})
endif(MODULE)
if(NOT MODULE)
if(BUILD_GEOMETRY)
set(ROOTSYS ${SIMPATH})
set(unitgeo_summary "${BGreen} YES${CR} (default, disable with ${BMagenta}-DBUILD_GEOMETRY=OFF${CR})")
else()
set(unitgeo_summary "${BRed} NO${CR} (enable with ${BMagenta}-DBUILD_GEOMETRY=ON${CR})")
endif()
message(STATUS " ${BWhite}ROOT geometries${CR} ${unitgeo_summary}")
add_subdirectory(r3bbase)
if(WITH_UCESB)
add_subdirectory(r3bsource)
endif(WITH_UCESB)
if (WITH_EPICS)
add_subdirectory (epics)
endif (WITH_EPICS)
if (Atima_FOUND)
add_subdirectory (atima)
endif (Atima_FOUND)
add_subdirectory(passive)
add_subdirectory(glad)
add_subdirectory(xball)
add_subdirectory(dch)
add_subdirectory(fiber)
add_subdirectory(gfi)
add_subdirectory(mfi)
add_subdirectory(land)
#add_subdirectory(neuland)
add_subdirectory(los)
add_subdirectory(rolu)
add_subdirectory(sci2)
add_subdirectory(sci8)
add_subdirectory(sfib)
add_subdirectory(mtof)
add_subdirectory(tof)
add_subdirectory(tofi)
add_subdirectory(tofd)
add_subdirectory(ssd)
add_subdirectory(strawtubes)
add_subdirectory(music)
add_subdirectory(r3bdata)
add_subdirectory(field)
add_subdirectory(r3bgen)
add_subdirectory(lumon)
add_subdirectory(evtvis)
add_subdirectory(psp)
add_subdirectory(compilehelper)
add_subdirectory(tcal)
add_subdirectory(tracking)
add_subdirectory(analysis)
add_subdirectory(tracker_rene)
add_subdirectory(pdc)
add_subdirectory(califa)
add_subdirectory(rpc)
add_subdirectory(alpide)
add_subdirectory(mwpc)
add_subdirectory(twim)
add_subdirectory(musli)
if(WITH_ACTAR)
add_subdirectory(actar)
endif(WITH_ACTAR)
if(WITH_SOFIA)
add_subdirectory(sofia)
endif(WITH_SOFIA)
if(WITH_NeuLAND_DNN)
add_subdirectory(NeuLAND_DNN)
endif(WITH_NeuLAND_DNN)
if(WITH_GTPC)
add_subdirectory(glad-tpc)
endif(WITH_GTPC)
if(WITH_FRS)
add_subdirectory(frs)
endif(WITH_FRS)
if(WITH_ASYEOS)
add_subdirectory(asyeos)
endif(WITH_ASYEOS)
if(EXISTS "${PROJECT_SOURCE_DIR}/macros")
add_subdirectory(macros)
endif(EXISTS "${PROJECT_SOURCE_DIR}/macros")
endif(NOT MODULE)
# add_subdirectory(gconfig)
add_subdirectory(cmake)
If(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
Execute_Process(COMMAND ${GIT_EXECUTABLE} describe --tags
OUTPUT_VARIABLE R3BROOT_GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
Else()
Set(R3BROOT_GIT_VERSION v${R3BROOT_MAJOR_VERSION}.${R3BROOT_MINOR_VERSION}.${R3BROOT_PATCH_VERSION})
EndIf()
write_config_file(config.sh)
write_config_file(config.csh)
WRITE_CONFIG_FILE(config.sh_install)
WRITE_CONFIG_FILE(config.csh_install)
write_env_cache(env_cache.sh)
# Get rid of leftover c3w configuration
execute_process(COMMAND rm -f ${CMAKE_CURRENT_BINARY_DIR}/GNUmakefile
${CMAKE_CURRENT_BINARY_DIR}/c3w.sh)
if (EXISTS ${CMAKE_SOURCE_DIR}/c3w.conf)
set(BUILD_C3W ON)
set(c3w_summary "${BGreen}YES${CR} ${BMagenta}${R3BROOT_SOURCE_DIR}/util/c3w/${CR}")
add_subdirectory(util/c3w)
else()
set(c3w_summary "${BYellow}NO${CR}")
endif()
# Summary ######################################################################
if(CMAKE_CXX_FLAGS)
message(STATUS " ")
message(STATUS " ${Cyan}GLOBAL CXX FLAGS${CR} ${BGreen}${CMAKE_CXX_FLAGS}${CR}")
endif()
if(CMAKE_CONFIGURATION_TYPES)
message(STATUS " ")
message(STATUS " ${Cyan}BUILD TYPE CXX FLAGS${CR}")
string(TOUPPER "${CMAKE_BUILD_TYPE}" selected_type)
foreach(type IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER "${type}" type_upper)
if(type_upper STREQUAL selected_type)
pad("${type}" 18 " " type_padded)
message(STATUS "${BGreen}* ${type_padded}${CMAKE_CXX_FLAGS_${type_upper}}${CR}")
else()
pad("${type}" 18 " " type_padded)
message(STATUS " ${BWhite}${type_padded}${CR}${CMAKE_CXX_FLAGS_${type_upper}}")
endif()
unset(type_padded)
unset(type_upper)
endforeach()
message(STATUS " ")
message(STATUS " (Change the build type with ${BMagenta}-DCMAKE_BUILD_TYPE=...${CR})")
endif()
if(PROJECT_PACKAGE_DEPENDENCIES)
message(STATUS " ")
message(STATUS " ${Cyan}DEPENDENCY FOUND VERSION PREFIX${CR}")
foreach(dep IN LISTS PROJECT_PACKAGE_DEPENDENCIES)
if(${dep}_VERSION)
if(${dep} STREQUAL DDS)
set(version_str "${BGreen}${${dep}_MAJOR_VERSION}.${${dep}_MINOR_VERSION}${CR}")
elseif(${dep} STREQUAL Boost)
if(Boost_VERSION_MAJOR)
set(version_str "${BGreen}${${dep}_VERSION_MAJOR}.${${dep}_VERSION_MINOR}${CR}")
else()
set(version_str "${BGreen}${${dep}_MAJOR_VERSION}.${${dep}_MINOR_VERSION}${CR}")
endif()
else()
set(version_str "${BGreen}${${dep}_VERSION}${CR}")
endif()
else()
set(version_str "${BYellow}unknown${CR}")
endif()
if(PROJECT_${dep}_VERSION)
set(version_req_str " (>= ${PROJECT_${dep}_VERSION})")
endif()
pad(${dep} 20 " " dep_padded)
if(DISABLE_COLOR)
pad("${version_str}${version_req_str}" 25 " " version_padded)
else()
pad("${version_str}${version_req_str}" 25 " " version_padded COLOR 1)
endif()
set(prefix ${${dep}_PREFIX})
if(${dep} STREQUAL Boost)
if(TARGET Boost::headers)
get_target_property(boost_include Boost::headers INTERFACE_INCLUDE_DIRECTORIES)
else()
get_target_property(boost_include Boost::boost INTERFACE_INCLUDE_DIRECTORIES)
endif()
get_filename_component(prefix ${boost_include}/.. ABSOLUTE)
elseif(${dep} STREQUAL Protobuf)
get_filename_component(prefix ${Protobuf_INCLUDE_DIRS}/.. ABSOLUTE)
elseif(${dep} STREQUAL msgpack)
get_target_property(msgpack_include msgpackc INTERFACE_INCLUDE_DIRECTORIES)
get_filename_component(prefix ${msgpack_include}/.. ABSOLUTE)
elseif(${dep} STREQUAL Pythia6)
get_filename_component(prefix ${PYTHIA6_LIBRARY_DIR}/.. ABSOLUTE)
elseif(${dep} STREQUAL Pythia8)
get_filename_component(prefix ${PYTHIA8_LIB_DIR}/.. ABSOLUTE)
elseif(${dep} STREQUAL FairLogger)
if(FairLogger_PREFIX)
set(prefix ${FairLogger_PREFIX})
else()
set(prefix ${FairLogger_ROOT})
endif()
elseif(${dep} STREQUAL FairMQ)
if(FairMQ_PREFIX)
set(prefix ${FairMQ_PREFIX})
else()
set(prefix ${FairMQ_ROOT})
endif()
elseif(${dep} STREQUAL yaml-cpp)
get_filename_component(prefix ${YAML_CPP_INCLUDE_DIR}/.. ABSOLUTE)
elseif(${dep} STREQUAL Geant4VMC)
string(REPLACE ":" ";" geant4vmc_include ${Geant4VMC_INCLUDE_DIRS})
list(GET geant4vmc_include 0 geant4vmc_include)
get_filename_component(prefix ${geant4vmc_include}/../.. ABSOLUTE)
elseif(${dep} STREQUAL Geant3)
string(REPLACE ":" ";" geant3_include ${Geant3_INCLUDE_DIRS})
list(GET geant3_include 0 geant3_include)
get_filename_component(prefix ${geant3_include}/../.. ABSOLUTE)
elseif(${dep} STREQUAL Geant4)
list(GET Geant4_INCLUDE_DIRS 0 geant4_include)
get_filename_component(prefix ${geant4_include}/../.. ABSOLUTE)
elseif(${dep} STREQUAL VGM)
string(REPLACE ":" ";" vgm_include ${VGM_INCLUDE_DIRS})
list(GET vgm_include 0 vgm_include)
get_filename_component(prefix ${vgm_include}/.. ABSOLUTE)
elseif(${dep} STREQUAL ROOT)
set(prefix ${ROOT_INSTALL_DIR})
elseif(${dep} STREQUAL IWYU)
get_filename_component(prefix ${IWYU_BINARY}/.. ABSOLUTE)
elseif(${dep} STREQUAL yaml-cpp)
get_filename_component(prefix ${YAML_CPP_INCLUDE_DIR}/.. ABSOLUTE)
endif()
message(STATUS " ${BWhite}${dep_padded}${CR}${version_padded}${prefix}")
# if(${dep} STREQUAL Geant3)
# message(STATUS " G3SYS: ${Geant3_SYSTEM_DIR}")
# endif()
if(${dep} STREQUAL Geant4)
foreach(dataset IN LISTS Geant4_DATASETS)
pad(${Geant4_DATASET_${dataset}_ENVVAR} 20 " " envvar_padded LEFT)
message(STATUS " ${envvar_padded}: ${Geant4_DATASET_${dataset}_PATH}")
endforeach()
endif()
unset(version_str)
unset(version_padded)
unset(version_req_str)
endforeach()
endif()
# Summary frameworks ###########################################################
message(STATUS " ")
message(STATUS " ${Cyan}Building framework BUILT? BASEPATH${CR}")
message(STATUS " ${BWhite}UCESB${CR} ${ucesb_summary}")
message(STATUS " ${BWhite}ATIMA${CR} ${atima_summary}")
message(STATUS " ${BWhite}EPICS${CR} ${epics_summary}")
message(STATUS " ${BWhite}ACTAR${CR} ${actar_summary}")
message(STATUS " ${BWhite}SOFIA${CR} ${sofia_summary}")
message(STATUS " ${BWhite}FRS${CR} ${frs_summary}")
message(STATUS " ${BWhite}NeuLAND_DNN${CR} ${neuland_dnn_summary}")
message(STATUS " ${BWhite}GLAD-TPC${CR} ${gladtpc_summary}")
message(STATUS " ${BWhite}ASYEOS${CR} ${asyeos_summary}")
message(STATUS " ${BWhite}C3W${CR} ${c3w_summary}")
message(STATUS " ")
message(STATUS " ${Cyan}COMPONENT BUILT? INFO${CR}")
message(STATUS " ${BWhite}ROOT geometries${CR} ${unitgeo_summary}")
message(STATUS " ")
################################################################################