diff --git a/cmake/modules/RootConfiguration.cmake b/cmake/modules/RootConfiguration.cmake index 7055457189e9d..3599c528af80f 100644 --- a/cmake/modules/RootConfiguration.cmake +++ b/cmake/modules/RootConfiguration.cmake @@ -159,11 +159,6 @@ set(builddavix ${value${davix}}) set(davixlibdir ${DAVIX_LIBRARY_DIR}) set(davixlib ${DAVIX_LIBRARY}) set(davixincdir ${DAVIX_INCLUDE_DIR}) -if(davix) - set(hasdavix define) -else() - set(hasdavix undef) -endif() set(buildnetxng ${value${xrootd}}) @@ -171,11 +166,6 @@ 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}) @@ -322,167 +312,14 @@ endif() # set(setresuid undef) CHECK_CXX_SOURCE_COMPILES("#include 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(ROOT_EXPERIMENTAL_SIMD_PIN_AVX_ABI) - set(experimentalsimdpinavxabi define) -else() - set(experimentalsimdpinavxabi 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 (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, @@ -562,9 +399,94 @@ 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) +add_library(RConfigureDefs INTERFACE) # temporary target, do not link against it, just for bw-compatible header generation +# Note: if this is modified, modify also RConfigure.h.in for backward compatibility +if (gnuinstall) + target_compile_definitions(RConfigureDefs INTERFACE + ROOTPREFIX=${prefix} + ROOTBINDIR=${bindir} + ROOTLIBDIR=${libdir} + ROOTETCDIR=${etcdir} + ROOTDATADIR=${datadir} + ROOTDOCDIR=${docdir} + ROOTMACRODIR=${macrodir} + ROOTTUTDIR=${tutdir} + ROOTSRCDIR=${srcdir} + ROOTICONPATH=${iconpath} + TTFFONTDIR=${ttffontdir} + ) +endif() + +target_compile_definitions(RConfigureDefs INTERFACE + ROOT__ARCHITECTURE=${architecture} + EXTRAICONPATH=$,\"${extraiconpath}\",\"\"> + ROOT__cplusplus=${__cplusplus} + $<$:R__HAS_SETRESUID> + $<$:R__HAS_MATHMORE> + $<$:R__HAS_PTHREAD> + $<$:R__HAS_XFT> + $<$:R__HAS_CLAD> + $<$:R__HAS_COCOA> + $<$:R__HAS_VDT> + $<$:R__HAS_STD_EXPERIMENTAL_SIMD> + $<$:R__EXPERIMENTAL_SIMD_PIN_AVX_ABI> + $<$:R__USE_CXXMODULES> + $<$:R__USE_LIBCXX> + $<$:R__HAS_ATTRIBUTE_ALWAYS_INLINE> + $<$:R__HAS_ATTRIBUTE_NOINLINE> + $<$:R__USE_IMT> + $<$:R__COMPLETE_MEM_TERMINATION> + $<$:R__HAS_CEFWEB> + $<$:R__HAS_QT6WEB> + $<$:R__HAS_DAVIX> + $<$:R__HAS_CURL> + $<$:R__HAS_DATAFRAME> + $<$:R__HAS_ROOT7> + $<$:R__LESS_INCLUDES> + R__HARDWARE_INTERFERENCE_SIZE=${hardwareinterferencesize} + $<$:R__HAS_ZLIB_NG> + $<$:R__HAS_TMVACPU> + $<$:R__HAS_TMVAGPU> + $<$:R__HAS_CUDNN> + $<$:R__HAS_PYMVA> + $<$:R__HAS_URING> + $<$:R__HAS_GEOM> + $<$:-Zc:__cplusplus> +) + +file(GENERATE + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ginclude/RConfigure.h + CONTENT +"#ifndef ROOT_RConfigure +#define ROOT_RConfigure + +#define $,REPLACE,=, >,\n#define > + +#if defined(__cplusplus) && (__cplusplus != ROOT__cplusplus) +# define R__STR(x) #x +# define R__XSTR(x) R__STR(x) +# pragma message(__FILE__ \": Warning: The C++ standard in this build (\" R__XSTR(__cplusplus) \") does not match ROOT configuration (\" R__XSTR(ROOT__cplusplus) \"); this might cause unexpected issues.\") +# if defined(_MSC_VER) +# pragma message(__FILE__ \": Warning: And please make sure you are using the -Zc:__cplusplus compilation flag\") +# endif +# undef R__XSTR +# undef R__STR +#endif + +#endif +" + NEWLINE_STYLE UNIX +) install(FILES ${CMAKE_BINARY_DIR}/ginclude/RConfigure.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +# Public target interface against which to link +add_library(ROOTdefs INTERFACE) +target_compile_definitions(ROOTdefs INTERFACE +ROOT_RConfigure # so that including the mirror header RConfigure.h is inocuous if linking against this target +) +target_link_library(ROOTdefs INTERFACE RConfigureDefs) + + #---Configure and install various files---------------------------------------------------------------------- execute_Process(COMMAND hostname OUTPUT_VARIABLE BuildNodeInfo OUTPUT_STRIP_TRAILING_WHITESPACE ) diff --git a/config/RConfigure.in b/config/RConfigure.in deleted file mode 100644 index 2b2370256b4ed..0000000000000 --- a/config/RConfigure.in +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef ROOT_RConfigure -#define ROOT_RConfigure - -/* Configurations file for @architecture@ */ - -#cmakedefine R__HAVE_CONFIG - -#ifdef R__HAVE_CONFIG -#define ROOTPREFIX "@prefix@" -#define ROOTBINDIR "@bindir@" -#define ROOTLIBDIR "@libdir@" -#define ROOTETCDIR "@etcdir@" -#define ROOTDATADIR "@datadir@" -#define ROOTDOCDIR "@docdir@" -#define ROOTMACRODIR "@macrodir@" -#define ROOTTUTDIR "@tutdir@" -#define ROOTSRCDIR "@srcdir@" -#define ROOTICONPATH "@iconpath@" -#define TTFFONTDIR "@ttffontdir@" -#endif - -#define EXTRAICONPATH "@extraiconpath@" - -#define ROOT__cplusplus @__cplusplus@ -#if defined(__cplusplus) && (__cplusplus != ROOT__cplusplus) -# if defined(_MSC_VER) -# pragma message(__FILE__ ": Warning: The C++ standard in this build does not match ROOT configuration (@__cplusplus@); this might cause unexpected issues. And please make sure you are using the -Zc:__cplusplus compilation flag") -# else -# warning "The C++ standard in this build does not match ROOT configuration (@__cplusplus@); this might cause unexpected issues" -# endif -#endif - -#@setresuid@ R__HAS_SETRESUID /**/ -#@hasmathmore@ R__HAS_MATHMORE /**/ -#@haspthread@ R__HAS_PTHREAD /**/ -#@hasxft@ R__HAS_XFT /**/ -#@hasclad@ R__HAS_CLAD /**/ -#@hascocoa@ R__HAS_COCOA /**/ -#@hasvdt@ R__HAS_VDT /**/ -#@hasstdexperimentalsimd@ R__HAS_STD_EXPERIMENTAL_SIMD /**/ -#@experimentalsimdpinavxabi@ R__EXPERIMENTAL_SIMD_PIN_AVX_ABI /**/ -#@usecxxmodules@ R__USE_CXXMODULES /**/ -#@uselibc++@ R__USE_LIBCXX /**/ -#@has_found_attribute_always_inline@ R__HAS_ATTRIBUTE_ALWAYS_INLINE /**/ -#@has_found_attribute_noinline@ R__HAS_ATTRIBUTE_NOINLINE /**/ -#@useimt@ R__USE_IMT /**/ -#@memory_term@ R__COMPLETE_MEM_TERMINATION /**/ -#@hascefweb@ R__HAS_CEFWEB /**/ -#@hasqt6webengine@ R__HAS_QT6WEB /**/ -#@hasdavix@ R__HAS_DAVIX /**/ -#@hascurl@ R__HAS_CURL /**/ -#@hasdataframe@ R__HAS_DATAFRAME /**/ -#@hasroot7@ R__HAS_ROOT7 /**/ -#@use_less_includes@ R__LESS_INCLUDES /**/ -#define R__HARDWARE_INTERFERENCE_SIZE @hardwareinterferencesize@ /*Determined at CMake configure to be stable across all TUs*/ - -#@usezlibng@ R__HAS_ZLIB_NG /**/ - -#@hastmvacpu@ R__HAS_TMVACPU /**/ -#@hastmvagpu@ R__HAS_TMVAGPU /**/ -#@hastmvacudnn@ R__HAS_CUDNN /**/ -#@haspymva@ R__HAS_PYMVA /**/ - -#@hasuring@ R__HAS_URING /**/ - -#@hasgeom@ R__HAS_GEOM /**/ - -#endif