-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathRootConfiguration.cmake
More file actions
812 lines (729 loc) · 28.2 KB
/
RootConfiguration.cmake
File metadata and controls
812 lines (729 loc) · 28.2 KB
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
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.
INCLUDE (CheckCXXSourceCompiles)
#---Define a function not to pollute the top level namespace with unneeded variables-----------------------
function(RootConfigure)
#---Define all sort of variables to bridge between the old Module.mk and the new CMake equivalents-----------
foreach(v 1 ON YES TRUE Y on yes true y)
set(value${v} yes)
endforeach()
foreach(v 0 OFF NO FALSE N IGNORE off no false n ignore)
set(value${v} no)
endforeach()
#set(ROOT_CONFIGARGS "")
set(top_srcdir ${CMAKE_SOURCE_DIR})
set(top_builddir ${CMAKE_BINARY_DIR})
set(architecture ${ROOT_ARCHITECTURE})
set(platform ${ROOT_PLATFORM})
set(host)
set(useconfig FALSE)
set(major ${ROOT_MAJOR_VERSION})
set(minor ${ROOT_MINOR_VERSION})
set(revis ${ROOT_PATCH_VERSION})
set(mkliboption "-v ${major} ${minor} ${revis} ")
set(cflags ${CMAKE_CXX_FLAGS})
set(ldflags ${CMAKE_CXX_LINK_FLAGS})
set(winrtdebug ${value${winrtdebug}})
set(exceptions ${value${exceptions}})
if(gnuinstall)
set(prefix ${CMAKE_INSTALL_PREFIX})
else()
set(prefix $(ROOTSYS))
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_SYSCONFDIR})
set(etcdir ${CMAKE_INSTALL_SYSCONFDIR})
else()
set(etcdir ${prefix}/${CMAKE_INSTALL_SYSCONFDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_BINDIR})
set(bindir ${CMAKE_INSTALL_BINDIR})
else()
set(bindir ${prefix}/${CMAKE_INSTALL_BINDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
set(libdir ${CMAKE_INSTALL_LIBDIR})
else()
set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR})
set(incdir ${CMAKE_INSTALL_INCLUDEDIR})
else()
set(incdir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_MANDIR})
set(mandir ${CMAKE_INSTALL_MANDIR})
else()
set(mandir ${prefix}/${CMAKE_INSTALL_MANDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_SYSCONFDIR})
set(plugindir ${CMAKE_INSTALL_SYSCONFDIR}/plugins)
else()
set(plugindir ${prefix}/${CMAKE_INSTALL_SYSCONFDIR}/plugins)
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_DATADIR})
set(datadir ${CMAKE_INSTALL_DATADIR})
else()
set(datadir ${prefix}/${CMAKE_INSTALL_DATADIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_FONTDIR})
set(ttffontdir ${CMAKE_INSTALL_FONTDIR})
else()
set(ttffontdir ${prefix}/${CMAKE_INSTALL_FONTDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_JSROOTDIR})
set(jsrootdir ${CMAKE_INSTALL_JSROOTDIR})
else()
set(jsrootdir ${prefix}/${CMAKE_INSTALL_JSROOTDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_OPENUI5DIR})
set(openui5dir ${CMAKE_INSTALL_OPENUI5DIR})
else()
set(openui5dir ${prefix}/${CMAKE_INSTALL_OPENUI5DIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_MACRODIR})
set(macrodir ${CMAKE_INSTALL_MACRODIR})
else()
set(macrodir ${prefix}/${CMAKE_INSTALL_MACRODIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_SRCDIR})
set(srcdir ${CMAKE_INSTALL_SRCDIR})
else()
set(srcdir ${prefix}/${CMAKE_INSTALL_SRCDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_ICONDIR})
set(iconpath ${CMAKE_INSTALL_ICONDIR})
else()
set(iconpath ${prefix}/${CMAKE_INSTALL_ICONDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_DOCDIR})
set(docdir ${CMAKE_INSTALL_DOCDIR})
else()
set(docdir ${prefix}/${CMAKE_INSTALL_DOCDIR})
endif()
if(IS_ABSOLUTE ${CMAKE_INSTALL_TUTDIR})
set(tutdir ${CMAKE_INSTALL_TUTDIR})
else()
set(tutdir ${prefix}/${CMAKE_INSTALL_TUTDIR})
endif()
set(buildx11 ${value${x11}})
set(x11libdir -L${X11_LIBRARY_DIR})
set(xpmlibdir -L${X11_LIBRARY_DIR})
set(xpmlib ${X11_Xpm_LIB})
set(thread yes)
set(enable_thread yes)
set(threadflag ${CMAKE_THREAD_FLAG})
set(threadlibdir)
set(threadlib ${CMAKE_THREAD_LIBS_INIT})
set(builtinfreetype ${value${builtin_freetype}})
set(builtinpcre ${value${builtin_pcre}})
set(builtinzlib ${value${builtin_zlib}})
set(zliblibdir ${ZLIB_LIBRARY_DIR})
set(zliblib ${ZLIB_LIBRARY})
set(zlibincdir ${ZLIB_INCLUDE_DIR})
set(builtinunuran ${value${builtin_unuran}})
set(unuranlibdir ${UNURAN_LIBRARY_DIR})
set(unuranlib ${UNURAN_LIBRARY})
set(unuranincdir ${UNURAN_INCLUDE_DIR})
set(buildgl ${value${opengl}})
set(opengllibdir ${OPENGL_LIBRARY_DIR})
set(openglulib ${OPENGL_glu_LIBRARY})
set(opengllib ${OPENGL_gl_LIBRARY})
set(openglincdir ${OPENGL_INCLUDE_DIR})
set(builtingl2ps ${value${builtin_gl2ps}})
set(gl2pslibdir ${GL2PS_LIBRARY_DIR})
set(gl2pslib ${GL2PS_LIBRARY})
set(gl2psincdir ${GL2PS_INCLUDE_DIR})
set(buildsqlite ${value${sqlite}})
set(sqlitelibdir ${SQLITE_LIBRARY_DIR})
set(sqlitelib ${SQLITE_LIBRARY})
set(sqliteincdir ${SQLITE_INCLUDE_DIR})
set(builddavix ${value${davix}})
set(davixlibdir ${DAVIX_LIBRARY_DIR})
set(davixlib ${DAVIX_LIBRARY})
set(davixincdir ${DAVIX_INCLUDE_DIR})
if(davix)
set(hasdavix define)
set(useoldwebfile no)
else()
set(hasdavix undef)
set(useoldwebfile yes)
endif()
set(buildnetxng ${value${xrootd}})
set(buildcurl ${value${curl}})
set(curllibdir ${CURL_LIBRARY_DIR})
set(curllib ${CURL_LIBRARY})
set(curlincdir ${CURL_INCLUDE_DIR})
if(curl)
set(hascurl define)
else()
set(hascurl undef)
endif()
set(builddcap ${value${dcap}})
set(dcaplibdir ${DCAP_LIBRARY_DIR})
set(dcaplib ${DCAP_LIBRARY})
set(dcapincdir ${DCAP_INCLUDE_DIR})
set(buildftgl ${value${builtin_ftgl}})
set(ftgllibdir ${FTGL_LIBRARY_DIR})
set(ftgllibs ${FTGL_LIBRARIES})
set(ftglincdir ${FTGL_INCLUDE_DIR})
set(buildarrow ${value${arrow}})
set(arrowlibdir ${ARROW_LIBRARY_DIR})
set(arrowlib ${ARROW_LIBRARY})
set(arrowincdir ${ARROW_INCLUDE_DIR})
set(buildasimage ${value${asimage}})
set(asextralib ${ASEXTRA_LIBRARIES})
set(asextralibdir)
set(asjpegincdir ${JPEG_INCLUDE_DIR})
set(aspngincdir ${PNG_INCLUDE_DIR})
set(astiffincdir ${TIFF_INCLUDE_DIR})
set(asgifincdir ${GIF_INCLUDE_DIR})
set(asimageincdir)
set(asimagelib)
set(asimagelibdir)
set(buildpythia8 ${value${pythia8}})
set(pythia8libdir ${PYTHIA8_LIBRARY_DIR})
set(pythia8lib ${PYTHIA8_LIBRARY})
set(pythia8cppflags)
set(buildfftw3 ${value${fftw3}})
set(fftw3libdir ${FFTW3_LIBRARY_DIR})
set(fftw3lib ${FFTW3_LIBRARY})
set(fftw3incdir ${FFTW3_INCLUDE_DIR})
set(buildfitsio ${value${fitsio}})
set(fitsiolibdir ${FITSIO_LIBRARY_DIR})
set(fitsiolib ${FITSIO_LIBRARY})
set(fitsioincdir ${FITSIO_INCLUDE_DIR})
set(buildgviz ${value${gviz}})
set(gvizlibdir ${GVIZ_LIBRARY_DIR})
set(gvizlib ${GVIZ_LIBRARY})
set(gvizincdir ${GVIZ_INCLUDE_DIR})
set(gvizcflags)
set(buildpython ${value${pyroot}})
set(pythonlibdir ${Python3_LIBRARY_DIR})
set(pythonlib ${Python3_LIBRARIES})
set(pythonincdir ${Python3_INCLUDE_DIRS})
set(pythonlibflags)
set(buildxml ${value${xml}})
set(xmllibdir ${LIBXML2_LIBRARY_DIR})
set(xmllib ${LIBXML2_LIBRARIES})
set(xmlincdir ${LIBXML2_INCLUDE_DIR})
set(buildxrd ${value${xrootd}})
set(xrdlibdir )
set(xrdincdir)
set(xrdaddopts)
set(extraxrdflags)
set(xrdversion)
set(alloclib)
set(alloclibdir)
set(ssllib ${OPENSSL_LIBRARIES})
set(ssllibdir)
set(sslincdir ${OPENSSL_INCLUDE_DIR})
set(sslshared)
set(gsllibs ${GSL_LIBRARIES})
set(gsllibdir)
set(gslincdir ${GSL_INCLUDE_DIR})
set(gslflags)
set(shadowpw ${value${shadowpw}})
set(buildmathmore ${value${mathmore}})
set(buildroofit ${value${roofit}})
set(buildunuran ${value${unuran}})
set(buildgdml ${value${gdml}})
set(buildhttp ${value${http}})
if(fcgi AND http)
set(usefastcgi yes)
set(fastcgiincdir ${FASTCGI_INCLUDE_DIR})
else()
set(usefastcgi no)
set(fcgiincdir)
endif()
set(buildtmva ${value${tmva}})
set(cursesincdir ${CURSES_INCLUDE_DIR})
set(curseslibdir)
set(curseslib ${CURSES_LIBRARIES})
set(curseshdr ${CURSES_HEADER_FILE})
set(buildeditline ${value${editline}})
set(cppunit)
find_program(PERL_EXECUTABLE perl)
set(perl ${PERL_EXECUTABLE})
find_program(CHROME_EXECUTABLE NAMES chrome.exe chromium chromium-browser chrome chrome-browser google-chrome-stable Google\ Chrome
HINTS /snap/bin
PATH_SUFFIXES "Google/Chrome/Application")
if(CHROME_EXECUTABLE)
if(WIN32)
set(chromemajor 100)
message(STATUS "Found Chrome browser executable ${CHROME_EXECUTABLE}, not testing the version")
else()
execute_process(COMMAND "${CHROME_EXECUTABLE}" --version
OUTPUT_VARIABLE CHROME_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "[0-9]+" CHROME_MAJOR_VERSION "${CHROME_VERSION}")
set(chromemajor ${CHROME_MAJOR_VERSION})
message(STATUS "Found Chrome browser executable ${CHROME_EXECUTABLE} major version ${CHROME_MAJOR_VERSION}")
endif()
set(chromeexe ${CHROME_EXECUTABLE})
endif()
if(WIN32)
find_program(EDGE_EXECUTABLE NAMES msedge.exe
PATH_SUFFIXES "Microsoft/Edge/Application")
if(EDGE_EXECUTABLE)
message(STATUS "Found Edge browser executable ${EDGE_EXECUTABLE}")
set(edgeexe ${EDGE_EXECUTABLE})
endif()
endif()
find_program(FIREFOX_EXECUTABLE NAMES firefox firefox-bin firefox.exe
HINTS /snap/bin
PATH_SUFFIXES "Mozilla Firefox")
if(FIREFOX_EXECUTABLE)
message(STATUS "Found Firefox browser executable ${FIREFOX_EXECUTABLE}")
set(firefoxexe ${FIREFOX_EXECUTABLE})
endif()
#---RConfigure-------------------------------------------------------------------------------------------------
# set(setresuid undef)
CHECK_CXX_SOURCE_COMPILES("#include <unistd.h>
int main() { uid_t r = 0, e = 0, s = 0; if (setresuid(r, e, s) != 0) { }; return 0;}" found_setresuid)
if(found_setresuid)
set(setresuid define)
else()
set(setresuid undef)
endif()
if(mathmore)
set(hasmathmore define)
else()
set(hasmathmore undef)
endif()
if(imt)
set(useimt define)
else()
set(useimt undef)
endif()
if(CMAKE_USE_PTHREADS_INIT)
set(haspthread define)
else()
set(haspthread undef)
endif()
if(x11)
set(hasxft define)
else()
set(hasxft undef)
endif()
if(lzma)
set(haslzmacompression define)
else()
set(haslzmacompression undef)
endif()
if(lz4)
set(haslz4compression define)
else()
set(haslz4compression undef)
endif()
if(clad)
set(hasclad define)
else()
set(hasclad undef)
endif()
if(cocoa)
set(hascocoa define)
else()
set(hascocoa undef)
endif()
if(vdt)
set(hasvdt define)
else()
set(hasvdt undef)
endif()
if(ROOT_HAVE_EXPERIMENTAL_SIMD)
set(hasstdexperimentalsimd define)
else()
set(hasstdexperimentalsimd undef)
endif()
if(dataframe)
set(hasdataframe define)
else()
set(hasdataframe undef)
endif()
if(dev)
set(use_less_includes define)
else()
set(use_less_includes undef)
endif()
if(root7)
set(hasroot7 define)
else()
set(hasroot7 undef)
endif()
if(ZLIB_NG)
set(usezlibng define)
else()
set(usezlibng undef)
endif()
if(runtime_cxxmodules)
set(usecxxmodules define)
else()
set(usecxxmodules undef)
endif()
if(libcxx)
set(uselibc++ define)
else()
set(uselibc++ undef)
endif()
if(gcctoolchain)
set(setgcctoolchain define)
else()
set(setgcctoolchain undef)
endif()
if(memory_termination)
set(memory_term define)
else()
set(memory_term undef)
endif()
if(cefweb)
set(hascefweb define)
else()
set(hascefweb undef)
endif()
if(qt6web)
set(hasqt6webengine define)
else()
set(hasqt6webengine undef)
endif()
if (tmva-cpu)
set(hastmvacpu define)
else()
set(hastmvacpu undef)
endif()
if (tmva-gpu)
set(hastmvagpu define)
else()
set(hastmvagpu undef)
endif()
if (tmva-cudnn)
set(hastmvacudnn define)
else()
set(hastmvacudnn undef)
endif()
if (tmva-pymva)
set(haspymva define)
else()
set(haspymva undef)
endif()
if (tmva-rmva)
set(hasrmva define)
else()
set(hasrmva undef)
endif()
if (uring)
set(hasuring define)
else()
set(hasuring undef)
endif()
if (geom)
set(hasgeom define)
else()
set(hasgeom undef)
endif()
CHECK_CXX_SOURCE_COMPILES("
inline __attribute__((always_inline)) bool TestBit(unsigned long f) { return f != 0; };
int main() { return TestBit(0); }" found_attribute_always_inline)
if(found_attribute_always_inline)
set(has_found_attribute_always_inline define)
else()
set(has_found_attribute_always_inline undef)
endif()
CHECK_CXX_SOURCE_COMPILES("
inline __attribute__((noinline)) bool TestBit(unsigned long f) { return f != 0; };
int main() { return TestBit(0); }" has_found_attribute_noinline)
if(has_found_attribute_noinline)
set(has_found_attribute_noinline define)
else()
set(has_found_attribute_noinline undef)
endif()
# The hardware interference size must be stable across all TUs in a ROOT build, so we need to save it in RConfigure.hxx
# Since it can vary for different compilers or tune settings, we cannot base the ABI on a value that might change,
# even be different between compiler and interpreter, or when ROOT is compiled on a different machine.
# For older CMake and when cross compiling, we simply fall back to 64
if(CMAKE_VERSION VERSION_GREATER 3.24 AND NOT CMAKE_CROSSCOMPILING)
set(test_interference_size "
#include <new>
#include <iostream>
int main() {
std::cout << std::hardware_destructive_interference_size << std::endl;
return 0;
}
")
try_run(HARDWARE_INTERF_RUN HARDWARE_INTERF_COMPILE
SOURCE_FROM_VAR test_interference_size.cxx test_interference_size
RUN_OUTPUT_VARIABLE hardwareinterferencesize)
endif()
if(NOT HARDWARE_INTERF_COMPILE OR NOT HARDWARE_INTERF_RUN EQUAL 0)
message(STATUS "Could not detect hardware_interference_size in C++. Falling back to 64.")
set(hardwareinterferencesize 64)
endif()
if(webgui)
set(root_canvas_class "TWebCanvas")
set(root_treeviewer_class "RTreeViewer")
set(root_geompainter_type "web")
set(root_jupyter_jsroot "on")
else()
set(root_canvas_class "TRootCanvas")
set(root_treeviewer_class "TTreeViewer")
set(root_geompainter_type "root")
set(root_jupyter_jsroot "off")
endif()
if(root7 AND webgui)
set(root_browser_class "ROOT::RWebBrowserImp")
else()
set(root_browser_class "TRootBrowser")
endif()
#---root-config----------------------------------------------------------------------------------------------
ROOT_GET_OPTIONS(features ENABLED)
set(features "cxx${CMAKE_CXX_STANDARD} ${features}")
set(configfeatures ${features})
set(configargs ${ROOT_CONFIGARGS})
set(configoptions ${ROOT_CONFIGARGS})
set(configstd ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION})
get_filename_component(altcc ${CMAKE_C_COMPILER} NAME)
get_filename_component(altcxx ${CMAKE_CXX_COMPILER} NAME)
get_filename_component(altf77 "${CMAKE_Fortran_COMPILER}" NAME)
get_filename_component(altld ${CMAKE_CXX_COMPILER} NAME)
set(pythonvers ${Python3_VERSION})
set(python${Python3_VERSION_MAJOR}vers ${Python3_VERSION})
#---RConfigure.h---------------------------------------------------------------------------------------------
if (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dM -E /dev/null OUTPUT_VARIABLE __cplusplus_PPout)
else()
try_compile(has__cplusplus "${CMAKE_BINARY_DIR}" SOURCES "${CMAKE_SOURCE_DIR}/config/__cplusplus.cxx"
OUTPUT_VARIABLE __cplusplus_PPout)
endif()
string(REGEX MATCH "__cplusplus[=| ]([0-9]+)" __cplusplus "${__cplusplus_PPout}")
set(__cplusplus ${CMAKE_MATCH_1}L)
# To mark the build tree. Important for automatic resolution of relative paths,
# for example to the include directory. Use custom target to ensure re-creation
# when someone deletes the marker.
set(build_tree_marker "${localruntimedir}/root-build-tree-marker")
add_custom_command(
OUTPUT "${build_tree_marker}"
COMMAND ${CMAKE_COMMAND} -E touch "${build_tree_marker}"
COMMENT "Ensuring that \"${build_tree_marker}\" exists"
)
add_custom_target(ensure_build_tree_marker ALL
DEPENDS "${build_tree_marker}"
)
configure_file(${PROJECT_SOURCE_DIR}/config/RConfigure.in ginclude/RConfigure.h NEWLINE_STYLE UNIX)
install(FILES ${CMAKE_BINARY_DIR}/ginclude/RConfigure.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
#---Configure and install various files----------------------------------------------------------------------
execute_Process(COMMAND hostname OUTPUT_VARIABLE BuildNodeInfo OUTPUT_STRIP_TRAILING_WHITESPACE )
configure_file(${CMAKE_SOURCE_DIR}/config/rootrc.in ${CMAKE_BINARY_DIR}/etc/system.rootrc @ONLY NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/config/rootauthrc.in ${CMAKE_BINARY_DIR}/etc/system.rootauthrc @ONLY NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/config/rootdaemonrc.in ${CMAKE_BINARY_DIR}/etc/system.rootdaemonrc @ONLY NEWLINE_STYLE UNIX)
# file used in TROOT.cxx, not need in include/ dir and not need to install
configure_file(${CMAKE_SOURCE_DIR}/config/RConfigOptions.in ginclude/RConfigOptions.h NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/config/mimes.unix.in ${CMAKE_BINARY_DIR}/etc/root.mimes NEWLINE_STYLE UNIX)
# We need to have class.rules during configuration time to avoid silent error during generation of dictionary:
# Error in <TClass::ReadRules()>: Cannot find rules
configure_file(${CMAKE_SOURCE_DIR}/etc/class.rules ${CMAKE_BINARY_DIR}/etc/class.rules COPYONLY)
#---Generate the ROOTConfig files to be used by CMake projects-----------------------------------------------
ROOT_GET_OPTIONS(ROOT_ALL_OPTIONS)
ROOT_GET_OPTIONS(ROOT_ENABLED_OPTIONS ENABLED)
configure_file(${CMAKE_SOURCE_DIR}/cmake/scripts/ROOTConfig-version.cmake.in
${CMAKE_BINARY_DIR}/ROOTConfig-version.cmake @ONLY NEWLINE_STYLE UNIX)
#---Compiler flags (because user apps are a bit dependent on them...)----------------------------------------
string(REGEX REPLACE "(^|[ ]*)-W[^ ]*" "" __cxxflags "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "(^|[ ]*)-W[^ ]*" "" __cflags "${CMAKE_C_FLAGS}")
if(MSVC)
string(REPLACE "-I${CMAKE_SOURCE_DIR}/cmake/win" "" __cxxflags "${__cxxflags}")
string(REPLACE "-I${CMAKE_SOURCE_DIR}/cmake/win" "" __cflags "${__cflags}")
endif()
string(REGEX REPLACE "(^|[ ]*)-W[^ ]*" "" __fflags "${CMAKE_Fortran_FLAGS}")
string(REGEX MATCHALL "(-Wp,)?-(D|U)[^ ]*" __defs "${CMAKE_CXX_FLAGS}")
set(ROOT_COMPILER_FLAG_HINTS "#
set(ROOT_DEFINITIONS \"${__defs}\")
set(ROOT_CXX_STANDARD ${CMAKE_CXX_STANDARD})
set(ROOT_CXX_FLAGS \"${__cxxflags}\")
set(ROOT_C_FLAGS \"${__cflags}\")
set(ROOT_fortran_FLAGS \"${__fflags}\")
set(ROOT_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}\")")
set(ROOT_BINDIR ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "")
#---To be used from the binary tree--------------------------------------------------------------------------
set(ROOT_INCLUDE_DIR_SETUP "
# ROOT configured for use from the build tree - absolute paths are used.
set(ROOT_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include)
")
set(ROOT_LIBRARY_DIR_SETUP "
# ROOT configured for use from the build tree - absolute paths are used.
set(ROOT_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib)
")
set(ROOT_BINDIR_SETUP "
# ROOT configured for use from the build tree - absolute paths are used.
set(ROOT_BINDIR ${CMAKE_BINARY_DIR}/bin)
")
# Deprecated value ROOT_BINARY_DIR
set(ROOT_BINARY_DIR_SETUP "
# Deprecated value, please don't use it and use ROOT_BINDIR instead.
set(ROOT_BINARY_DIR ${ROOT_BINDIR})
")
set(ROOT_CMAKE_DIR_SETUP "
# ROOT configured for use from the build tree - absolute paths are used.
set(ROOT_CMAKE_DIR ${CMAKE_SOURCE_DIR}/cmake)
")
get_property(exported_targets GLOBAL PROPERTY ROOT_EXPORTED_TARGETS)
export(TARGETS ${exported_targets} NAMESPACE ROOT:: FILE ${PROJECT_BINARY_DIR}/ROOTConfig-targets.cmake)
configure_file(${CMAKE_SOURCE_DIR}/cmake/scripts/ROOTConfig.cmake.in
${CMAKE_BINARY_DIR}/ROOTConfig.cmake @ONLY NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/cmake/scripts/RootUseFile.cmake.in
${CMAKE_BINARY_DIR}/ROOTUseFile.cmake @ONLY NEWLINE_STYLE UNIX)
#---To be used from the install tree--------------------------------------------------------------------------
# Need to calculate actual relative paths from CMAKEDIR to other locations
cmake_path(RELATIVE_PATH CMAKE_INSTALL_FULL_INCLUDEDIR BASE_DIRECTORY "${CMAKE_INSTALL_FULL_CMAKEDIR}" OUTPUT_VARIABLE ROOT_CMAKE_TO_INCLUDE_DIR)
cmake_path(RELATIVE_PATH CMAKE_INSTALL_FULL_LIBDIR BASE_DIRECTORY "${CMAKE_INSTALL_FULL_CMAKEDIR}" OUTPUT_VARIABLE ROOT_CMAKE_TO_LIB_DIR)
cmake_path(RELATIVE_PATH CMAKE_INSTALL_FULL_BINDIR BASE_DIRECTORY "${CMAKE_INSTALL_FULL_CMAKEDIR}" OUTPUT_VARIABLE ROOT_CMAKE_TO_BIN_DIR)
# '_' prefixed variables are used to construct the paths,
# while the normal variants evaluate to full paths at runtime
set(ROOT_INCLUDE_DIR_SETUP "
# ROOT configured for the install with relative paths, so use these
get_filename_component(_ROOT_INCLUDE_DIRS \"\${_thisdir}/${ROOT_CMAKE_TO_INCLUDE_DIR}\" REALPATH)
# resolve relative paths to absolute system paths
get_filename_component(ROOT_INCLUDE_DIRS \"\${_ROOT_INCLUDE_DIRS}\" REALPATH)
")
set(ROOT_LIBRARY_DIR_SETUP "
# ROOT configured for the install with relative paths, so use these
get_filename_component(_ROOT_LIBRARY_DIR \"\${_thisdir}/${ROOT_CMAKE_TO_LIB_DIR}\" REALPATH)
# resolve relative paths to absolute system paths
get_filename_component(ROOT_LIBRARY_DIR \"\${_ROOT_LIBRARY_DIR}\" REALPATH)
")
set(ROOT_BINDIR_SETUP "
# ROOT configured for the install with relative paths, so use these
get_filename_component(_ROOT_BINDIR \"\${_thisdir}/${ROOT_CMAKE_TO_BIN_DIR}\" REALPATH)
# resolve relative paths to absolute system paths
get_filename_component(ROOT_BINDIR \"\${_ROOT_BINDIR}\" REALPATH)
")
# Deprecated value ROOT_BINARY_DIR
set(ROOT_BINARY_DIR_SETUP "
# Deprecated value, please don't use it and use ROOT_BINDIR instead.
get_filename_component(ROOT_BINARY_DIR \"\${ROOT_BINDIR}\" REALPATH)
")
set(ROOT_CMAKE_DIR_SETUP "
## ROOT configured for the install with relative paths, so use these
get_filename_component(ROOT_CMAKE_DIR \"\${_thisdir}\" REALPATH)
")
# used by ROOTConfig.cmake from the build directory
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/RootMacros.cmake
${CMAKE_BINARY_DIR}/RootMacros.cmake COPYONLY)
# used by roottest to run tests against ROOT build
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/RootTestDriver.cmake
${CMAKE_BINARY_DIR}/RootTestDriver.cmake COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/cmake/scripts/ROOTConfig.cmake.in
${CMAKE_BINARY_DIR}/installtree/ROOTConfig.cmake @ONLY NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/cmake/scripts/RootUseFile.cmake.in
${CMAKE_BINARY_DIR}/installtree/ROOTUseFile.cmake @ONLY NEWLINE_STYLE UNIX)
install(FILES ${CMAKE_BINARY_DIR}/ROOTConfig-version.cmake
${CMAKE_BINARY_DIR}/installtree/ROOTUseFile.cmake
${CMAKE_BINARY_DIR}/installtree/ROOTConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
install(EXPORT ${CMAKE_PROJECT_NAME}Exports NAMESPACE ROOT:: FILE ROOTConfig-targets.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
#---Especial definitions for root-config et al.--------------------------------------------------------------
if(prefix STREQUAL "$(ROOTSYS)")
foreach(d prefix bindir libdir incdir etcdir tutdir mandir)
string(REPLACE "$(ROOTSYS)" "$ROOTSYS" ${d} ${${d}})
endforeach()
endif()
#---compiledata.h--------------------------------------------------------------------------------------------
# ROOTBUILD definition (it is defined in compiledata.h and used by ACLIC
# to decide whether (by default) to optimize or not optimize the user scripts.)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(ROOTBUILD "debug")
endif()
if(WIN32)
# We cannot use the compiledata.sh script for windows
configure_file(${CMAKE_SOURCE_DIR}/cmake/scripts/compiledata.win32.in ${CMAKE_BINARY_DIR}/ginclude/compiledata.h NEWLINE_STYLE UNIX)
else()
# Needed by ACLIC, while in ROOT we are using everywhere C++ standard via CMake features that are requested to build target
set(CMAKE_CXX_ACLIC_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}")
if(asan)
# Replace the semicolon with space so that the produced compiler invokation still makes sense
string (REPLACE ";" " " ASAN_EXTRA_CXX_FLAGS_STR "${ASAN_EXTRA_CXX_FLAGS}")
set(CMAKE_CXX_ACLIC_FLAGS "${CMAKE_CXX_ACLIC_FLAGS} ${ASAN_EXTRA_CXX_FLAGS_STR}")
endif()
if(ROOT_COMPILEDATA_IGNORE_BUILD_NODE_CHANGES)
# Only set the compiledata parameter if the CMake variable is 'true'
set(local_ROOT_COMPILEDATA_IGNORE_BUILD_NODE_CHANGES ${ROOT_COMPILEDATA_IGNORE_BUILD_NODE_CHANGES})
endif()
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/cmake/unix/compiledata.sh
${CMAKE_BINARY_DIR}/ginclude/compiledata.h "${CMAKE_CXX_COMPILER}"
"${CMAKE_CXX_FLAGS_RELEASE}" "${CMAKE_CXX_FLAGS_DEBUG}" "${CMAKE_CXX_ACLIC_FLAGS}"
"${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS}" "${CMAKE_EXE_LINKER_FLAGS}" "so"
"${libdir}" "-lCore" "-lRint" "" "" "${ROOT_ARCHITECTURE}" "${ROOTBUILD}"
"${local_ROOT_COMPILEDATA_IGNORE_BUILD_NODE_CHANGES}")
endif()
#---Get the values of ROOT_ALL_OPTIONS and CMAKE_CXX_FLAGS provided by the user in the command line
set(all_features ${ROOT_ALL_OPTIONS})
set(usercflags ${CMAKE_CXX_FLAGS-CACHED})
file(REMOVE ${CMAKE_BINARY_DIR}/installtree/root-config)
configure_file(${CMAKE_SOURCE_DIR}/config/root-config.in ${CMAKE_BINARY_DIR}/installtree/root-config @ONLY NEWLINE_STYLE UNIX)
if(thisroot_scripts)
configure_file(${CMAKE_SOURCE_DIR}/config/thisroot.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/thisroot.sh @ONLY NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/config/thisroot.csh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/thisroot.csh @ONLY NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/config/thisroot.fish ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/thisroot.fish @ONLY NEWLINE_STYLE UNIX)
list(APPEND list_of_thisroot_scripts thisroot.sh thisroot.csh thisroot.fish setxrd.csh)
endif()
configure_file(${CMAKE_SOURCE_DIR}/config/setxrd.csh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/setxrd.csh COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/setxrd.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/setxrd.sh COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/roots.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/roots @ONLY NEWLINE_STYLE UNIX)
configure_file(${CMAKE_SOURCE_DIR}/config/rootssh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rootssh @ONLY NEWLINE_STYLE UNIX)
if(WIN32)
if(thisroot_scripts)
configure_file(${CMAKE_SOURCE_DIR}/config/thisroot.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/thisroot.bat @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/thisroot.ps1 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/thisroot.ps1 @ONLY)
list(APPEND list_of_thisroot_scripts thisroot.bat thisroot.ps1)
endif()
configure_file(${CMAKE_SOURCE_DIR}/config/root.rc.in ${CMAKE_BINARY_DIR}/etc/root.rc @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/config/root-manifest.xml.in ${CMAKE_BINARY_DIR}/etc/root-manifest.xml @ONLY)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/win/w32pragma.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT headers)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/win/sehmap.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT headers)
endif()
#--Local root-configure
set(prefix $ROOTSYS)
set(bindir $ROOTSYS/bin)
set(libdir $ROOTSYS/lib)
set(incdir $ROOTSYS/include)
set(etcdir $ROOTSYS/etc)
set(tutdir $ROOTSYS/tutorials)
set(mandir $ROOTSYS/man)
configure_file(${CMAKE_SOURCE_DIR}/config/root-config.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/root-config @ONLY NEWLINE_STYLE UNIX)
if(MSVC)
configure_file(${CMAKE_SOURCE_DIR}/config/root-config.bat.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/root-config.bat @ONLY)
install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/root-config.bat
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if(DEFINED list_of_thisroot_scripts)
# Prepend runtime output directory to list of setup scripts
set(final_list_of_thisroot_scripts "")
foreach(script IN LISTS list_of_thisroot_scripts)
list(APPEND final_list_of_thisroot_scripts "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${script}")
endforeach()
install(FILES ${final_list_of_thisroot_scripts}
PERMISSIONS OWNER_WRITE OWNER_READ
GROUP_READ
WORLD_READ
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
install(FILES ${CMAKE_BINARY_DIR}/installtree/root-config
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/roots
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rootssh
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ
WORLD_EXECUTE WORLD_READ
DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_BINARY_DIR}/ginclude/RConfigOptions.h
${CMAKE_BINARY_DIR}/ginclude/compiledata.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_BINARY_DIR}/etc/root.mimes
${CMAKE_BINARY_DIR}/etc/system.rootrc
${CMAKE_BINARY_DIR}/etc/system.rootauthrc
${CMAKE_BINARY_DIR}/etc/system.rootdaemonrc
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR})
endfunction()
RootConfigure()