-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
692 lines (649 loc) · 19.8 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
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
# - Top level CMakeLists.txt for BxDecay0 C++ library
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "${PROJECT_NAME} requires an out-of-source build.")
message(STATUS "Please remove these files from ${CMAKE_BINARY_DIR} first:")
message(STATUS " CMakeCache.txt")
message(STATUS " CMakeFiles")
message(STATUS "Once these files are removed, create a separate directory")
message(STATUS "and run CMake from there, pointing it to:")
message(STATUS " ${CMAKE_SOURCE_DIR}")
message(FATAL_ERROR "in-source build detected")
endif()
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(BxDecay0 VERSION 1.1.2)
# - Version of the original fortran Decay0
set(BxDecay0_DECAY0_VERSION "2020-04-20")
set(BxDecay0_TAG "BxDecay0-${BxDecay0_VERSION}")
# - Standard Modules
# For "BUILD_TESTING" option
include(CTest)
# Install directories
include(GNUInstallDirs)
# Require relative paths to support relocation
foreach(_dir BINDIR LIBDIR INCLUDEDIR DATAROOTDIR)
if(IS_ABSOLUTE "${CMAKE_INSTALL_${_dir}}")
message(FATAL_ERROR "Absolute path for CMAKE_INSTALL_${_dir} not allowed")
endif()
endforeach()
# Add a path for CMake config files
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake)
set(CMAKE_INSTALL_FULL_CMAKEDIR ${CMAKE_INSTALL_FULL_LIBDIR}/cmake)
# message(STATUS "**** CMAKE_INSTALL_FULL_LIBDIR = '${CMAKE_INSTALL_FULL_LIBDIR}'")
# message(STATUS "**** CMAKE_INSTALL_FULL_DATAROOTDIR = '${CMAKE_INSTALL_FULL_DATAROOTDIR}'")
set(BxDecay0_RESOURCE_DIR "${BxDecay0_TAG}/resources")
# message(STATUS "**** BxDecay0_RESOURCE_DIR = '${BxDecay0_RESOURCE_DIR}'")
file(RELATIVE_PATH BxDecay0_LIBDIR_TO_RESOURCEDIR
"${CMAKE_INSTALL_FULL_LIBDIR}"
"${CMAKE_INSTALL_FULL_DATAROOTDIR}/${BxDecay0_RESOURCE_DIR}")
file(RELATIVE_PATH BxDecay0_LIBDIR_TO_PREFIX
"${CMAKE_INSTALL_FULL_LIBDIR}"
"${CMAKE_INSTALL_PREFIX}")
# message(STATUS "**** BxDecay0_LIBDIR_TO_RESOURCEDIR = '${BxDecay0_LIBDIR_TO_RESOURCEDIR}'")
# message(STATUS "**** BxDecay0_LIBDIR_TO_PREFIX = '${BxDecay0_LIBDIR_TO_PREFIX}'")
# Option:
option(BXDECAY0_INSTALL_DBD_GA_DATA "Install BxDecay0 DBD gA process data" OFF)
# - Dependencies
find_package(GSL 2.4 REQUIRED)
# - Publish headers
configure_file(bxdecay0/version.h.in
${PROJECT_BINARY_DIR}/bxdecay0/version.h @ONLY)
configure_file(bxdecay0/config.h.in
${PROJECT_BINARY_DIR}/bxdecay0/config.h @ONLY)
string(RANDOM LENGTH 18 MANGLE_BINRELOC_MAIN)
set(MANGLE_BINRELOC "BXDECAY0MB${MANGLE_BINRELOC_MAIN}")
configure_file(bxdecay0/BinReloc.h.in ${PROJECT_BINARY_DIR}/bxdecay0/BinReloc.h @ONLY)
configure_file(bxdecay0/relocatable_lib.cc.in ${PROJECT_BINARY_DIR}/bxdecay0/relocatable_lib.cc @ONLY)
set(BxDecay0_HEADERS
${PROJECT_BINARY_DIR}/bxdecay0/version.h
${PROJECT_BINARY_DIR}/bxdecay0/config.h
bxdecay0/resource.h
bxdecay0/common.h
bxdecay0/divdif.h
bxdecay0/dgmlt1.h
bxdecay0/dgmlt2.h
bxdecay0/dshelp1.h
bxdecay0/dshelp2.h
bxdecay0/gauss.h
bxdecay0/tsimpr.h
bxdecay0/particle_utils.h
bxdecay0/particle.h
bxdecay0/i_random.h
bxdecay0/i_decay_generator.h
bxdecay0/std_random.h
bxdecay0/event.h
bxdecay0/positron.h
bxdecay0/electron.h
bxdecay0/gamma.h
bxdecay0/alpha.h
bxdecay0/gfang.h
bxdecay0/gdrot.h
bxdecay0/tgold.h
bxdecay0/plog69.h
bxdecay0/compton1.h
bxdecay0/compton.h
bxdecay0/moller1.h
bxdecay0/moller.h
bxdecay0/pair.h
bxdecay0/pairext1.h
bxdecay0/pairext.h
bxdecay0/beta2.h
bxdecay0/beta1.h
bxdecay0/beta.h
bxdecay0/beta_1fu.h
bxdecay0/fermi.h
bxdecay0/funbeta.h
bxdecay0/funbeta_1fu.h
bxdecay0/funbeta1.h
bxdecay0/funbeta2.h
bxdecay0/fe1_mods.h
bxdecay0/fe2_mods.h
bxdecay0/fe12_mods.h
bxdecay0/nucltransK.h
bxdecay0/nucltransKL.h
bxdecay0/nucltransKLM.h
bxdecay0/nucltransKLM_Pb.h
bxdecay0/bb.h
bxdecay0/bb_utils.h
bxdecay0/decay0_generator.h
bxdecay0/utils.h
bxdecay0/genbbsub.h
# Isotopes:
bxdecay0/PbAtShell.h
bxdecay0/Ac228.h
bxdecay0/Am241.h
bxdecay0/Ar39.h
bxdecay0/Ar42.h
bxdecay0/As79.h
bxdecay0/At214.h
bxdecay0/At214low.h
bxdecay0/Ba136low.h
bxdecay0/Ba138low.h
bxdecay0/Bi207.h
bxdecay0/Bi208.h
bxdecay0/Bi210.h
bxdecay0/Bi212.h
bxdecay0/Bi214.h
bxdecay0/C14.h
bxdecay0/Ca48.h
bxdecay0/Cd112low.h
bxdecay0/Cd113.h
bxdecay0/Co60.h
bxdecay0/Cs136.h
bxdecay0/Cs137.h
bxdecay0/Eu147.h
bxdecay0/Eu152.h
bxdecay0/Eu154.h
bxdecay0/Fe58low.h
bxdecay0/Gd146.h
bxdecay0/Gd156low.h
bxdecay0/Gd158low.h
bxdecay0/Ge70low.h
bxdecay0/Ge74low.h
bxdecay0/Hf180low.h
bxdecay0/Hf182.h
bxdecay0/Hg198low.h
bxdecay0/I126.h
bxdecay0/I133.h
bxdecay0/I134.h
bxdecay0/I135.h
bxdecay0/K40.h
bxdecay0/K42.h
bxdecay0/Kr81.h
bxdecay0/Kr82low.h
bxdecay0/Kr84low.h
bxdecay0/Kr85.h
bxdecay0/Mn54.h
bxdecay0/Mo94low.h
bxdecay0/Mo96low.h
bxdecay0/Na22.h
bxdecay0/Nb96.h
bxdecay0/Nd142low.h
bxdecay0/Ni64low.h
bxdecay0/Os186low.h
bxdecay0/Os190low.h
bxdecay0/P32.h
bxdecay0/Pa231.h
bxdecay0/Pa234m.h
bxdecay0/Pb210.h
bxdecay0/Pb211.h
bxdecay0/Pb212.h
bxdecay0/Pb214.h
bxdecay0/Pd104low.h
bxdecay0/Pd106low.h
bxdecay0/Pd108low.h
bxdecay0/Po210.h # Added on the 2020-07-17
bxdecay0/Po212.h
bxdecay0/Po214.h
bxdecay0/Po214low.h
bxdecay0/Po218.h # Added on the 2020-07-17
bxdecay0/Ra222.h
bxdecay0/Ra222low.h
bxdecay0/Ra226.h
bxdecay0/Ra228.h
bxdecay0/Rb87.h
bxdecay0/Rh106.h
bxdecay0/Rn218.h
bxdecay0/Rn218low.h
bxdecay0/Rn222.h # Added from 2020-07-17
bxdecay0/Ru100low.h
bxdecay0/Sb125.h
bxdecay0/Sb126.h
bxdecay0/Sb133.h
bxdecay0/Sc48.h
bxdecay0/Se76low.h
bxdecay0/Sm148low.h
bxdecay0/Sm150low.h
bxdecay0/Sn114low.h
bxdecay0/Sn116low.h
bxdecay0/Sn120low.h
bxdecay0/Sr90.h
bxdecay0/Ta182.h
bxdecay0/Te122low.h
bxdecay0/Te124low.h
bxdecay0/Te133.h
bxdecay0/Te133m.h
bxdecay0/Te134.h
bxdecay0/Th230.h # Added on the 2020-07-17
bxdecay0/Th234.h
bxdecay0/Ti48low.h
bxdecay0/Tl207.h
bxdecay0/Tl208.h
bxdecay0/U234.h # Added on the 2020-07-17
bxdecay0/U238.h # Added on the 2020-07-17
bxdecay0/Xe128low.h
bxdecay0/Xe129m.h
bxdecay0/Xe130low.h
bxdecay0/Xe131m.h
bxdecay0/Xe133.h
bxdecay0/Xe135.h
bxdecay0/Y88.h
bxdecay0/Y90.h
bxdecay0/Zn65.h
bxdecay0/Zr92low.h
bxdecay0/Zr96.h
bxdecay0/Dy162low.h # Added from 2018-12-05
bxdecay0/Dy164low.h # Added from 2018-12-05
bxdecay0/Er168low.h # Added from 2018-12-05
bxdecay0/Gd154low.h # Added from 2018-12-05
bxdecay0/Hf176low.h # Added from 2018-12-05
bxdecay0/Nd144low.h # Added from 2018-12-05
bxdecay0/Ta180mB.h # Added from 2018-12-05
bxdecay0/Ta180mEC.h # Added from 2018-12-05
bxdecay0/Yb170low.h # Added from 2018-12-05
bxdecay0/mdl_event_op.h # Added 2021-04-29
# Main wrapper class
bxdecay0/decay0_generator.h
bxdecay0/event_reader.h
)
configure_file(bxdecay0/resource.cc.in
${PROJECT_BINARY_DIR}/bxdecay0/resource.cc @ONLY)
include_directories("${PROJECT_SOURCE_DIR}/bxdecay0")
include_directories("${PROJECT_BINARY_DIR}/bxdecay0")
set(BxDecay0_SOURCES
bxdecay0/relocatable_lib.h
${PROJECT_BINARY_DIR}/bxdecay0/resource.cc
${PROJECT_BINARY_DIR}/bxdecay0/relocatable_lib.cc
${PROJECT_BINARY_DIR}/bxdecay0/BinReloc.h
bxdecay0/BinReloc.c
bxdecay0/divdif.cc
bxdecay0/dgmlt1.cc
bxdecay0/dgmlt2.cc
bxdecay0/dshelp1.cc
bxdecay0/dshelp2.cc
bxdecay0/gauss.cc
bxdecay0/tsimpr.cc
bxdecay0/particle_utils.cc
bxdecay0/particle.cc
bxdecay0/std_random.cc
bxdecay0/event.cc
bxdecay0/positron.cc
bxdecay0/electron.cc
bxdecay0/gamma.cc
bxdecay0/alpha.cc
bxdecay0/gfang.cc
bxdecay0/gdrot.cc
bxdecay0/tgold.cc
bxdecay0/plog69.cc
bxdecay0/compton1.cc
bxdecay0/compton.cc
bxdecay0/moller1.cc
bxdecay0/moller.cc
bxdecay0/pair.cc
bxdecay0/pairext.cc
bxdecay0/pairext1.cc
bxdecay0/fermi.cc
bxdecay0/funbeta.cc
bxdecay0/funbeta_1fu.cc
bxdecay0/funbeta1.cc
bxdecay0/funbeta2.cc
bxdecay0/beta2.cc
bxdecay0/beta1.cc
bxdecay0/beta.cc
bxdecay0/beta_1fu.cc
bxdecay0/fe1_mods.cc
bxdecay0/fe2_mods.cc
bxdecay0/fe12_mods.cc
bxdecay0/nucltransK.cc
bxdecay0/nucltransKL.cc
bxdecay0/nucltransKLM.cc
bxdecay0/nucltransKLM_Pb.cc
bxdecay0/bb.cc
bxdecay0/bb_utils.cc
bxdecay0/utils.cc
bxdecay0/genbbsub.cc
# Isotopes:
bxdecay0/PbAtShell.cc
bxdecay0/Ac228.cc
bxdecay0/Am241.cc
bxdecay0/Ar39.cc
bxdecay0/Ar42.cc
bxdecay0/As79.cc
bxdecay0/At214.cc
bxdecay0/At214low.cc
bxdecay0/Ba136low.cc
bxdecay0/Ba138low.cc
bxdecay0/Bi207.cc
bxdecay0/Bi208.cc
bxdecay0/Bi210.cc
bxdecay0/Bi212.cc
bxdecay0/Bi214.cc
bxdecay0/C14.cc
bxdecay0/Ca48.cc
bxdecay0/Cd112low.cc
bxdecay0/Cd113.cc
bxdecay0/Co60.cc
bxdecay0/Cs136.cc
bxdecay0/Cs137.cc
bxdecay0/Eu147.cc
bxdecay0/Eu152.cc
bxdecay0/Eu154.cc
bxdecay0/Fe58low.cc
bxdecay0/Gd146.cc
bxdecay0/Gd156low.cc
bxdecay0/Gd158low.cc
bxdecay0/Ge70low.cc
bxdecay0/Ge74low.cc
bxdecay0/Hf176low.cc
bxdecay0/Hf180low.cc
bxdecay0/Hf182.cc
bxdecay0/Hg198low.cc
bxdecay0/I126.cc
bxdecay0/I133.cc
bxdecay0/I134.cc
bxdecay0/I135.cc
bxdecay0/K40.cc
bxdecay0/K42.cc
bxdecay0/Kr81.cc
bxdecay0/Kr82low.cc
bxdecay0/Kr84low.cc
bxdecay0/Kr85.cc
bxdecay0/Mn54.cc
bxdecay0/Mo94low.cc
bxdecay0/Mo96low.cc
bxdecay0/Na22.cc
bxdecay0/Nb96.cc
bxdecay0/Nd142low.cc
bxdecay0/Ni64low.cc
bxdecay0/Os186low.cc
bxdecay0/Os190low.cc
bxdecay0/P32.cc
bxdecay0/Pa231.cc
bxdecay0/Pa234m.cc
bxdecay0/Pb210.cc
bxdecay0/Pb211.cc
bxdecay0/Pb212.cc
bxdecay0/Pb214.cc
bxdecay0/Pd104low.cc
bxdecay0/Pd106low.cc
bxdecay0/Pd108low.cc
bxdecay0/Po210.cc # Added on the 2020-07-17
bxdecay0/Po212.cc
bxdecay0/Po214.cc
bxdecay0/Po218.cc # Added on the 2020-07-17
bxdecay0/Po214low.cc
bxdecay0/Ra222.cc
bxdecay0/Ra222low.cc
bxdecay0/Ra226.cc
bxdecay0/Ra228.cc
bxdecay0/Rb87.cc
bxdecay0/Rh106.cc
bxdecay0/Rn218.cc
bxdecay0/Rn218low.cc
bxdecay0/Rn222.cc # Added from 2020-07-17
bxdecay0/Ru100low.cc
bxdecay0/Sb125.cc
bxdecay0/Sb126.cc
bxdecay0/Sb133.cc
bxdecay0/Sc48.cc
bxdecay0/Se76low.cc
bxdecay0/Sm148low.cc
bxdecay0/Sm150low.cc
bxdecay0/Sn114low.cc
bxdecay0/Sn116low.cc
bxdecay0/Sn120low.cc
bxdecay0/Sr90.cc
bxdecay0/Ta182.cc
bxdecay0/Te122low.cc
bxdecay0/Te124low.cc
bxdecay0/Te133.cc
bxdecay0/Te133m.cc
bxdecay0/Te134.cc
bxdecay0/Th230.cc # Added on the 2020-07-17
bxdecay0/Th234.cc
bxdecay0/Ti48low.cc
bxdecay0/Tl207.cc
bxdecay0/Tl208.cc
bxdecay0/U234.cc # Added on the 2020-07-17
bxdecay0/U238.cc # Added on the 2020-07-17
bxdecay0/Xe128low.cc
bxdecay0/Xe129m.cc
bxdecay0/Xe130low.cc
bxdecay0/Xe131m.cc
bxdecay0/Xe133.cc
bxdecay0/Xe135.cc
bxdecay0/Y88.cc
# bxdecay0/Y90.cc # Original version from Decay0
bxdecay0/Y90_1.cc # version 1.0.8 : Modified with a more realistic positron energy spectrum from internal pair production
bxdecay0/Zn65.cc
bxdecay0/Zr92low.cc
bxdecay0/Zr96.cc
bxdecay0/Dy162low.cc # Added from 2018-12-05
bxdecay0/Dy164low.cc # Added from 2018-12-05
bxdecay0/Er168low.cc # Added from 2018-12-05
bxdecay0/Gd154low.cc # Added from 2018-12-05
bxdecay0/Hf176low.cc # Added from 2018-12-05
bxdecay0/Nd144low.cc # Added from 2018-12-05
bxdecay0/Ta180mB.cc # Added from 2018-12-05
bxdecay0/Ta180mEC.cc # Added from 2018-12-05
bxdecay0/Yb170low.cc # Added from 2018-12-05
bxdecay0/mdl_event_op.cc # Added 2021-04-29
bxdecay0/decay0_generator.cc
bxdecay0/event_reader.cc
)
list(APPEND BxDecay0_HEADERS bxdecay0/dbd_gA.h)
list(APPEND BxDecay0_SOURCES bxdecay0/dbd_gA.cc)
# For now, use CMAKE_CXX_STANDARD to apply flag.
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# -- RPATH settings --
# set(CMAKE_SKIP_BUILD_RPATH FALSE)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
# # set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:$ORIGIN/")
# set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
# message(STATUS "************ CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
# message(STATUS "************ CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}")
# message(STATUS "************ CMAKE_INSTALL_FULL_LIBDIR = ${CMAKE_INSTALL_FULL_LIBDIR}")
# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
# if("${isSystemDir}" STREQUAL "-1")
# set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
# endif()
add_library(BxDecay0 SHARED ${BxDecay0_HEADERS} ${BxDecay0_SOURCES})
target_compile_definitions(BxDecay0 PRIVATE ENABLE_BINRELOC)
set_target_properties(BxDecay0 PROPERTIES COMPILE_DEFINITIONS ENABLE_BINRELOC)
set_target_properties(BxDecay0 PROPERTIES LINKER_LANGUAGE CXX)
# Ensure clients are aware of the minimum C++ standard we were compiled with
target_compile_features(BxDecay0 PUBLIC cxx_std_${CMAKE_CXX_STANDARD})
target_include_directories(BxDecay0
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
# GSL may be a private dep, only seems to appear in .cc files
target_link_libraries(BxDecay0 PUBLIC GSL::gsl)
set_target_properties(BxDecay0 PROPERTIES
SKIP_BUILD_RPATH FALSE
BUILD_WITH_INSTALL_RPATH FALSE
INSTALL_RPATH_USE_LINK_PATH TRUE)
if(UNIX AND NOT APPLE)
set_target_properties(BxDecay0
PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
)
endif()
install(FILES ${BxDecay0_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bxdecay0
)
install(TARGETS BxDecay0
EXPORT BxDecay0Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if (BXDECAY0_INSTALL_DBD_GA_DATA)
# Load datasets for dbd_gA process:
include(ExternalProject)
# Must have git-lfs to properly checkout
find_program(GIT_LFS_EXECUTABLE git-lfs DOC "Path to git-lfs executable")
if (NOT GIT_LFS_EXECUTABLE)
message(FATAL_ERROR "git-lfs is required to build/install gA data for bxdecay0")
endif()
ExternalProject_Add(bxdecay0data_dbd_gA
GIT_REPOSITORY "https://gitlab.in2p3.fr/francois.mauger/bxdecay0data.git"
GIT_TAG "1.0.1"
PREFIX "${CMAKE_BINARY_DIR}/bxdecay0data_dbd_gA"
# Trick: installing datasets in the BxDecay0 source directory:
INSTALL_DIR "${PROJECT_SOURCE_DIR}/resources/data"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DBXDECAY0DATA_WITH_DBD_GA=ON
)
else()
message(STATUS "Note: DBD gA phase space factor data files will not be installed")
message(STATUS "Note: You can locate them through the BXDECAY0_DBD_GA_DATA_DIR environment variable")
endif()
install(DIRECTORY ${PROJECT_SOURCE_DIR}/resources/description
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BxDecay0_TAG}/resources
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/resources/data
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BxDecay0_TAG}/resources
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/resources/samples
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BxDecay0_TAG}/resources
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/examples
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BxDecay0_TAG}
)
install(FILES ${PROJECT_SOURCE_DIR}/LICENSE.txt
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${BxDecay0_TAG}
)
if(BUILD_TESTING)
set(BxDecay0_TESTS
bxdecay0/testing/test_utils.cxx
bxdecay0/testing/test_resource.cxx
bxdecay0/testing/test_decay0.cxx
bxdecay0/testing/test_tsimpr.cxx
bxdecay0/testing/test_particle.cxx
bxdecay0/testing/test_std_random.cxx
bxdecay0/testing/test_event.cxx
bxdecay0/testing/test_positron.cxx
bxdecay0/testing/test_electron.cxx
bxdecay0/testing/test_gamma.cxx
bxdecay0/testing/test_alpha.cxx
bxdecay0/testing/test_pair.cxx
bxdecay0/testing/test_fermi.cxx
bxdecay0/testing/test_bb_utils.cxx
bxdecay0/testing/test_bb.cxx
bxdecay0/testing/test_genbbsub.cxx
bxdecay0/testing/test_decay0_generator.cxx
bxdecay0/testing/test_event_reader.cxx
)
message(STATUS "Appending DBD gA test...")
list(APPEND BxDecay0_TESTS bxdecay0/testing/test_dbd_gA.cxx)
set(_bxdecay0_TEST_ENVIRONMENT "BXDECAY0_RESOURCE_DIR=${PROJECT_SOURCE_DIR}/resources")
foreach(_testsource ${BxDecay0_TESTS})
get_filename_component(_testname "${_testsource}" NAME_WE)
set(_testname "bxdecay0-${_testname}")
add_executable(${_testname} ${_testsource})
target_link_libraries(${_testname} BxDecay0)
add_test(NAME ${_testname} COMMAND ${_testname})
set_property(TEST ${_testname}
APPEND PROPERTY ENVIRONMENT ${_bxdecay0_TEST_ENVIRONMENT}
)
endforeach()
endif()
add_executable(bxdecay0-run
programs/bxdecay0_driver.hpp
programs/bxdecay0_clparser.hpp
programs/bxdecay0_driver.cpp
programs/bxdecay0_clparser.cpp
programs/bxdecay0-run.cxx
)
set_target_properties(bxdecay0-run PROPERTIES
SKIP_BUILD_RPATH FALSE
BUILD_WITH_INSTALL_RPATH FALSE
INSTALL_RPATH_USE_LINK_PATH TRUE
)
if(UNIX AND NOT APPLE)
set_target_properties(bxdecay0-run
PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
)
endif()
# if("${isSystemDir}" STREQUAL "-1")
# set_target_properties(bxdecay0-run PROPERTIES
# SKIP_BUILD_RPATH FALSE
# BUILD_WITH_INSTALL_RPATH FALSE
# INSTALL_RPATH_USE_LINK_PATH TRUE
# INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") #
# # "$ORIGIN/../lib:$ORIGIN/")
# endif()
target_link_libraries(bxdecay0-run BxDecay0)
install(TARGETS bxdecay0-run
EXPORT BxDecay0Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
#-----------------------------------------------------------------------
# - Extensions
add_subdirectory(extensions)
# message(STATUS "DEBUG **** BxDecay0_WITH_GEANT4_EXTENSION=${BxDecay0_WITH_GEANT4_EXTENSION}")
#-----------------------------------------------------------------------
# Configure/Install support files
# bxdecay0-config program
file(RELATIVE_PATH BxDecay0_BINDIR_TO_PREFIX "${CMAKE_INSTALL_FULL_BINDIR}" "${CMAKE_INSTALL_PREFIX}")
# message(STATUS "DEBUG **** BxDecay0_BINDIR_TO_PREFIX = '${BxDecay0_BINDIR_TO_PREFIX}'")
configure_file(bxdecay0-config.in
${PROJECT_BINARY_DIR}/bxdecay0-config
@ONLY)
install(FILES
${PROJECT_BINARY_DIR}/bxdecay0-config
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS
OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
# - PkgConfig
configure_file(cmake/bxdecay0.pc.in
"${PROJECT_BINARY_DIR}/cmake/bxdecay0.pc"
@ONLY)
install(FILES "${PROJECT_BINARY_DIR}/cmake/bxdecay0.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/
)
# - CMake
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/BxDecay0ConfigVersion.cmake"
VERSION ${BxDecay0_VERSION}
COMPATIBILITY SameMajorVersion
)
# Build tree
# targets...
export(EXPORT BxDecay0Targets
NAMESPACE BxDecay0::
FILE "${PROJECT_BINARY_DIR}/BxDecay0Targets.cmake"
)
# config file...
set(BxDecay0_CONFIG_INCLUDEDIR "${PROJECT_SOURCE_DIR}")
configure_package_config_file(cmake/BxDecay0Config.cmake.in
"${PROJECT_BINARY_DIR}/BxDecay0Config.cmake"
INSTALL_DESTINATION "."
INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
PATH_VARS BxDecay0_CONFIG_INCLUDEDIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
# Install Tree
# targets...
install(EXPORT BxDecay0Targets
NAMESPACE BxDecay0::
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/BxDecay0
)
set(BxDecay0_CONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
configure_package_config_file(cmake/BxDecay0Config.cmake.in
"${PROJECT_BINARY_DIR}/cmake/BxDecay0Config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}/BxDecay0"
PATH_VARS BxDecay0_CONFIG_INCLUDEDIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
install(FILES
${PROJECT_BINARY_DIR}/BxDecay0ConfigVersion.cmake
${PROJECT_BINARY_DIR}/cmake/BxDecay0Config.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/BxDecay0
)
# - end