diff --git a/.github/workflows/root-ci-config/buildconfig/alma10-minimal-asan.txt b/.github/workflows/root-ci-config/buildconfig/alma10-minimal-asan.txt index d9e43b53bbff4..f3145072ecbf7 100644 --- a/.github/workflows/root-ci-config/buildconfig/alma10-minimal-asan.txt +++ b/.github/workflows/root-ci-config/buildconfig/alma10-minimal-asan.txt @@ -4,6 +4,7 @@ asan=ON ccache=ON builtin_civetweb=ON builtin_vdt=ON +daos_mock=ON fail-on-missing=ON minimal=ON roottest=ON diff --git a/.github/workflows/root-ci-config/buildconfig/alma10-minimal.txt b/.github/workflows/root-ci-config/buildconfig/alma10-minimal.txt index 972e8b6d27e27..eebec3b02395e 100644 --- a/.github/workflows/root-ci-config/buildconfig/alma10-minimal.txt +++ b/.github/workflows/root-ci-config/buildconfig/alma10-minimal.txt @@ -1,6 +1,7 @@ ccache=ON builtin_civetweb=ON builtin_vdt=ON +daos_mock=ON fail-on-missing=ON minimal=ON roottest=ON diff --git a/.github/workflows/root-ci-config/buildconfig/global.txt b/.github/workflows/root-ci-config/buildconfig/global.txt index 7051228f34bf4..74bb7b6cfc7e3 100644 --- a/.github/workflows/root-ci-config/buildconfig/global.txt +++ b/.github/workflows/root-ci-config/buildconfig/global.txt @@ -36,6 +36,7 @@ coverage=OFF cuda=OFF curl=ON daos=OFF +daos_mock=ON dataframe=ON davix=ON dcache=OFF @@ -81,6 +82,7 @@ test_distrdf_pyspark=ON test_roofit_hs3testsuite=ON test_tmva_sofie=ON testing=ON +testsupport=OFF tmva-cpu=ON tmva-gpu=OFF tmva-cudnn=OFF diff --git a/.github/workflows/root-ci-config/buildconfig/windows10.txt b/.github/workflows/root-ci-config/buildconfig/windows10.txt index eb33f67625d12..04127bcd889e0 100644 --- a/.github/workflows/root-ci-config/buildconfig/windows10.txt +++ b/.github/workflows/root-ci-config/buildconfig/windows10.txt @@ -19,6 +19,7 @@ builtin_xxhash=ON builtin_zlib=ON builtin_zstd=ON ccache=OFF +daos_mock=OFF davix=OFF fortran=OFF llvm13_broken_tests=OFF diff --git a/.github/workflows/root-ci.yml b/.github/workflows/root-ci.yml index a7820f201a3f4..30797b89a14e6 100644 --- a/.github/workflows/root-ci.yml +++ b/.github/workflows/root-ci.yml @@ -418,7 +418,7 @@ jobs: overrides: ["CMAKE_BUILD_TYPE=Debug"] - image: alma10 - image: ubuntu22 - overrides: ["imt=Off", "CMAKE_BUILD_TYPE=Debug"] + overrides: ["imt=Off", "tmva-cpu=OFF", "CMAKE_BUILD_TYPE=Debug"] - image: ubuntu2404 overrides: ["CMAKE_BUILD_TYPE=Debug"] - image: ubuntu2604 diff --git a/.github/workflows/root-docs-ci.yml b/.github/workflows/root-docs-ci.yml index 1cd64060689c3..fa3f3864cf8bd 100644 --- a/.github/workflows/root-docs-ci.yml +++ b/.github/workflows/root-docs-ci.yml @@ -98,7 +98,7 @@ jobs: - name: Apply option overrides env: - OVERRIDES: "testing=Off roottest=Off" + OVERRIDES: "testing=Off", "roottest=Off", "daos_mock=Off" CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/alma9.txt' shell: bash run: | diff --git a/README/ReleaseNotes/v642/index.md b/README/ReleaseNotes/v642/index.md index bf531a7d43f3b..ae6f74a49fcf6 100644 --- a/README/ReleaseNotes/v642/index.md +++ b/README/ReleaseNotes/v642/index.md @@ -44,6 +44,7 @@ The following people have contributed to this new version: Note that `all=ON` enables several of these options, so building with `-Dall=ON` now requires all of their dependencies to be installed, or the unwanted ones to be disabled explicitly. Build options that are enabled by default, such as `pyroot`, `opengl`, `xml`, `sqlite`, `davix`, `curl`, `tmva-cpu` or `tpython` are not affected: they are still disabled automatically when their dependencies are missing. * The option `fail-on-missing=OFF` will no longer be honored for CMake ROOT build options that have easy-to-install dependencies (e.g. via homebrew or apt-get), such as those required by options `cfitsio`, `civetweb`, `fftw3`, `imt`, `mathmore`, `nlohmann_json`, `tmva-cpu`, `unuran`, `vdt` or `xrootd`. Before, associated `builtin_option` was automatically turned ON (or the opt-in feature turned to OFF), now, user has to install system package or manually set `builtin_option` to `ON` or opt-in feature to `OFF`. +* Irrespective of the value of `fail-on-missing`, all ROOT build options that are contradictory or are missing a dependency will now raise an error rather than letting the build system to automatically turn features OFF or ON. A helpful error message will be printed stating what packages need to be installed or what build flags need to be changed. * The method `RooRealVar::removeRange()` and the corresponding method in `RooErrorVar` that were deprecated in ROOT 6.40 are now removed. * The overloads of `RooAbsReal::createChi2()` and `RooAbsReal::chi2FitTo()` that take unbinned **RooDataSet** data objects were deprecated in ROOT 6.40 and are now removed. * The **RooStats::HybridPlot** class and the related **HybridResult::GetPlot** method were deprecated in ROOT 6.40 and are now removed. diff --git a/cmake/modules/CheckCompiler.cmake b/cmake/modules/CheckCompiler.cmake index c09183ffed443..2590fba0da006 100644 --- a/cmake/modules/CheckCompiler.cmake +++ b/cmake/modules/CheckCompiler.cmake @@ -51,6 +51,8 @@ if(fortran) endif() if(NOT CMAKE_Fortran_COMPILER) message(SEND_ERROR "No Fortran compiler found. Please make sure it's installed, or disable ROOT's Fortran features with '-Dfortran=OFF'") + list(APPEND MISSING_PACKAGES 'gfortran') + list(APPEND HOTFIX_BUILD_FLAGS -Dfortran=OFF) endif() else() set(CMAKE_Fortran_COMPILER CMAKE_Fortran_COMPILER-NOTFOUND) diff --git a/cmake/modules/RootBuildOptions.cmake b/cmake/modules/RootBuildOptions.cmake index 8a7e3692257bc..c4c6515e56398 100644 --- a/cmake/modules/RootBuildOptions.cmake +++ b/cmake/modules/RootBuildOptions.cmake @@ -120,6 +120,7 @@ ROOT_BUILD_OPTION(coverage OFF "Enable compile flags for coverage testing") ROOT_BUILD_OPTION(cuda OFF "Enable support for CUDA (requires CUDA toolkit >= 7.5)") ROOT_BUILD_OPTION(curl ON "Enable support for HTTP(S) through libcurl") ROOT_BUILD_OPTION(daos OFF "Enable RNTuple support for Intel DAOS") +ROOT_BUILD_OPTION(daos_mock OFF "Use libdaos_mock for RNTuple, use only for testing. Mutually exclusive with daos") ROOT_BUILD_OPTION(dataframe ON "Enable ROOT RDataFrame") ROOT_BUILD_OPTION(davix ON "Enable support for Davix (HTTP/WebDAV access)") ROOT_BUILD_OPTION(dcache OFF "Enable support for dCache (requires libdcap from DESY)") @@ -155,14 +156,14 @@ ROOT_BUILD_OPTION(roofit_multiprocess OFF "Build RooFit::MultiProcess and multi- ROOT_BUILD_OPTION(root7 ON "Build ROOT 7 experimental components of ROOT") ROOT_BUILD_OPTION(runtime_cxxmodules ON "Enable runtime support for C++ modules") ROOT_BUILD_OPTION(shadowpw OFF "Enable support for shadow passwords") -ROOT_BUILD_OPTION(shared ON "Use shared 3rd party libraries if possible") +ROOT_BUILD_OPTION(shared ON "Use shared 3rd party libraries if possible (OFF not supported on Windows)") ROOT_BUILD_OPTION(soversion OFF "Set version number in sonames for shared libraries. Not recommended, as the pcm and rootmap files do not (yet) support versioning and always point to the non-versioned shared libraries.") ROOT_BUILD_OPTION(spectrum ON "Enable support for TSpectrum") ROOT_BUILD_OPTION(sqlite ON "Enable support for SQLite") ROOT_BUILD_OPTION(ssl ON "Enable support for SSL encryption via OpenSSL") ROOT_BUILD_OPTION(test_distrdf_dask OFF "Enable distributed RDataFrame tests that use dask") ROOT_BUILD_OPTION(test_distrdf_pyspark OFF "Enable distributed RDataFrame tests that use pyspark") -ROOT_BUILD_OPTION(testsupport OFF "Build the ROOT::TestSupport library required to use all features of ROOT_ADD_GTEST and similar macros (requires gtest at build time)") +ROOT_BUILD_OPTION(testsupport OFF "Build the ROOT::TestSupport library required to use ROOT_ADD_GTEST and similar macros by downstream users (requires gtest at build time). Even if OFF, this library is still built if testing=ON") ROOT_BUILD_OPTION(thisroot_scripts ON "Build scripts like thisroot.{sh, fish, etc.} that set environment paths for using ROOT. Usually not needed when building ROOT for the distribution with a package manager.") ROOT_BUILD_OPTION(tmva ON "Build TMVA multi variate analysis library") ROOT_BUILD_OPTION(tmva-cpu ON "Build TMVA with CPU support for deep learning (requires BLAS)") @@ -188,11 +189,11 @@ option(clingtest "Enable cling tests (Note: that this makes llvm/clang symbols v option(fail-on-missing "Fail at configure time if a required package cannot be found" OFF) option(gminimal "Enable only required options by default, but include X11/Cocoa" OFF) option(minimal "Enable only required options by default" OFF) -option(rootbench "Build rootbench if rootbench exists in root or if it is a sibling directory (implies testing=ON)" OFF) -option(roottest "Build roottest (implies testing=ON)" OFF) +option(rootbench "Build rootbench if rootbench exists in root or if it is a sibling directory (requires testing=ON)" OFF) +option(roottest "Build roottest (requires testing=ON)" OFF) option(test_roofit_hs3testsuite "Setup and use the HS3 conformance test suite (requires network)" OFF) option(test_tmva_sofie "Enable SOFIE tests (requires BLAS library that can be found with CMake's FindBLAS)" ON) -option(testing "Enable testing with CTest" OFF) +option(testing "Enable testing with CTest and GTest" OFF) option(asan "Build ROOT with address sanitizer instrumentation (see core/sanitizer for details)" OFF) option(_wheel_build "ROOT is being packaged as a wheel, do not install .dist-info metadata" OFF) @@ -332,45 +333,49 @@ endif() #---Define at moment the options with the selected default values------------------------------ ROOT_APPLY_OPTIONS() -#---roottest option implies testing -if(roottest OR rootbench) - set(testing ON CACHE BOOL "" FORCE) +#---roottest/rootbench options require testing +if (roottest AND NOT testing) + message(SEND_ERROR "-Droottest=ON requires -Dtesting=ON") + list(APPEND HOTFIX_BUILD_FLAGS -Dtesting=ON) endif() - -#---testing implies testsupport -if(testing) - set(testsupport ON CACHE BOOL "" FORCE) -endif() - -#---ensure that the cuda option is sound -if(cuda AND NOT CMAKE_CUDA_COMPILER) - message(FATAL_ERROR "Option cuda=On, but CMAKE_CUDA_COMPILER='${CMAKE_CUDA_COMPILER}'") +if (rootbench AND NOT testing) + message(SEND_ERROR "-Drootbench=ON requires -Dtesting=ON") + list(APPEND HOTFIX_BUILD_FLAGS -Dtesting=ON) endif() #---running HS3 test suite requires both testing and pyroot, but testing globally disables tests if(testing AND test_roofit_hs3testsuite AND NOT pyroot) - message(FATAL_ERROR "-Dtest_roofit_hs3testsuite=ON requires both -Dtesting=ON and -Dpyroot=ON)") + message(SEND_ERROR "-Dtest_roofit_hs3testsuite=ON requires both -Dtesting=ON and -Dpyroot=ON)") + list(APPEND HOTFIX_BUILD_FLAGS -Dpyroot=ON) endif() if(unfold AND NOT xml) - message(STATUS "Cannot enable unfold without enabling xml: unfold is disabled.") - set(unfold OFF) + message(SEND_ERROR "Cannot enable unfold without enabling -Dxml=ON.") + list(APPEND HOTFIX_BUILD_FLAGS -Dxml=ON) endif() if (NOT builtin_cling) if (builtin_clang OR builtin_llvm) message(WARNING "No need to build internal llvm or clang. Consider turning builtin_clang=Off and builtin_llvm=Off") + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_clang=OFF) + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_llvm=OFF) endif() endif(NOT builtin_cling) if(NOT http AND webgui) - message(WARNING "Cannot build WebGui components without HTTP: webgui is disabled.") - set(webgui OFF) + message(SEND_ERROR "Cannot build WebGui components without HTTP: enable -Dhttp=ON or set -Dwebgui=OFF.") + list(APPEND HOTFIX_BUILD_FLAGS -Dwebgui=OFF) endif() if(NOT webgui) - set(qt6web OFF CACHE BOOL "Disabled because webgui not build" FORCE) - set(cefweb OFF CACHE BOOL "Disabled because webgui not build" FORCE) + if(qt6web) + message(SEND_ERROR "Cannot build qt6web without webgui and http: enable -Dwebgui=ON -Dhttp=ON or set -Dqt6web=OFF.") + list(APPEND HOTFIX_BUILD_FLAGS -Dqt6web=OFF) + endif() + if(qt6web) + message(SEND_ERROR "Cannot build cefweb without webgui and http: enable -Dwebgui=ON -Dhttp=ON or set -Dcefweb=OFF.") + list(APPEND HOTFIX_BUILD_FLAGS -Dcefweb=OFF) + endif() endif() #---Removed options------------------------------------------------------------ diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake index c0a2b1cb65eb7..14774cf9cb072 100644 --- a/cmake/modules/SearchInstalledSoftware.cmake +++ b/cmake/modules/SearchInstalledSoftware.cmake @@ -7,8 +7,6 @@ #---------------------------------------------------------------------------- # macro ROOT_CHECK_CONNECTION(option) # Try to download a file to check internet connection. -# If fail-on-missing=ON is set, a failed connection check will cause a fatal -# configuration error. # Input variables: # option: # A hint to the user on which option to set to avoid the part of the @@ -44,10 +42,7 @@ macro(ROOT_CHECK_CONNECTION option) set(NO_CONNECTION FALSE) else() # Error - if(fail-on-missing) - message(FATAL_ERROR "No internet connection. Please check your connection, set '-D${option}' or disable 'fail-on-missing' to automatically disable options requiring internet access. You can also bypass the connection check with -Dcheck_connection=OFF.") - endif() - message(STATUS "Checking internet connectivity - failed: will not automatically download external dependencies. You can bypass the connection check with -Dcheck_connection=OFF.") + message(WARNING "No internet connection. Please check your connection, set '-D${option}' or disable 'fail-on-missing' to automatically disable options requiring internet access. You can also bypass the connection check with -Dcheck_connection=OFF.") set(NO_CONNECTION TRUE) endif() endif() @@ -69,7 +64,12 @@ endmacro() # Building Clad requires an internet connection, if we're not side-loading the source directory if(clad AND NOT DEFINED CLAD_SOURCE_DIR) - ROOT_CHECK_CONNECTION_AND_DISABLE_OPTION("clad") + ROOT_CHECK_CONNECTION("clad") + if(NO_CONNECTION) + message(SEND_ERROR "No internet connection, check it or disable the 'clad' option") + list(APPEND MISSING_PACKAGES 'clad') + list(APPEND HOTFIX_BUILD_FLAGS -Dclad=OFF) + endif() endif() #---Check for installed packages depending on the build options/components enabled -- @@ -100,7 +100,7 @@ macro(ROOT_FIND_REQUIRED_DEP PACKAGE_NAME BUILTIN_CONFIG_OPTION) "Please install it in the system (preferred), set the corresponding CMake search variable, " "or opt in to downloading and auto-build it from externally provided source tarball using '-D${BUILTIN_CONFIG_OPTION}=ON'.") list(APPEND MISSING_PACKAGES ${PACKAGE_NAME}) - list(APPEND HOTFIX_BUILD_FLAGS '-D${BUILTIN_CONFIG_OPTION}=ON') + list(APPEND HOTFIX_BUILD_FLAGS -D${BUILTIN_CONFIG_OPTION}=ON) endif() endif() endmacro() @@ -143,7 +143,7 @@ if(opengl) ROOT_FIND_REQUIRED_DEP(FTGL builtin_ftgl) elseif(builtin_ftgl) message(SEND_ERROR "FTGL features enabled with \"builtin_ftgl=ON\" require \"opengl=ON\"") - list(APPEND HOTFIX_BUILD_FLAGS '-Dopengl=ON') + list(APPEND HOTFIX_BUILD_FLAGS -Dopengl=ON) endif() foreach(suffix FOUND INCLUDE_DIR INCLUDE_DIRS LIBRARY LIBRARIES VERSION) unset(OPENSSL_${suffix} CACHE) @@ -156,15 +156,15 @@ if(ssl) if(NOT OPENSSL_FOUND) message(SEND_ERROR "OpenSSL found but missing required component SSL. Install it on the system (preferred), or explicitly request the builtin version. Or turn off ssl option.") list(APPEND MISSING_PACKAGES 'OpenSSL') - list(APPEND HOTFIX_BUILD_FLAGS '-Dssl=OFF') + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_openssl=ON) endif() else() ROOT_CHECK_CONNECTION("builtin_openssl=OFF") if(NO_CONNECTION) message(SEND_ERROR "No internet connection, disable the 'ssl' and 'builtin_openssl' options") list(APPEND MISSING_PACKAGES 'OpenSSL') - list(APPEND HOTFIX_BUILD_FLAGS '-Dssl=OFF') - list(APPEND HOTFIX_BUILD_FLAGS '-Dbuiltin_openssl=OFF') + list(APPEND HOTFIX_BUILD_FLAGS -Dssl=OFF) + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_openssl=OFF) endif() endif() else() @@ -172,7 +172,7 @@ if(ssl) if(NOT OPENSSL_FOUND) message(SEND_ERROR "OpenSSL found but missing required component SSL. Install it on the system (preferred), or explicitly request the builtin version. Or turn off ssl option.") list(APPEND MISSING_PACKAGES 'OpenSSL') - list(APPEND HOTFIX_BUILD_FLAGS '-Dssl=OFF') + list(APPEND HOTFIX_BUILD_FLAGS -Dssl=OFF) endif() endif() endif() @@ -203,7 +203,7 @@ if(xrootd) # Must go after SSL if("${XROOTD_${component}_LIBRARIES}" STREQUAL "XROOTD_${component}_LIBRARIES-NOTFOUND") message(SEND_ERROR "XROOTD found but missing component ${component}. Install missing package on your system (preferred). " "Alternatively, you can also enable the option 'builtin_xrootd' to build XROOTD internally; or turn off xrootd.") - list(APPEND HOTFIX_BUILD_FLAGS '-Dxrootd=OFF') + list(APPEND HOTFIX_BUILD_FLAGS -Dxrootd=OFF) endif() endforeach() endif() @@ -212,12 +212,12 @@ endif() if(builtin_xrootd) if(NOT ssl AND NOT builtin_openssl) message(SEND_ERROR "Building XRootD ('builtin_xrootd'=On) requires ssl support.") - list(APPEND HOTFIX_BUILD_FLAGS '-Dssl=ON') + list(APPEND HOTFIX_BUILD_FLAGS -Dssl=ON) endif() endif() if(xrootd AND NOT builtin_xrootd AND builtin_openssl) message(SEND_ERROR "Non-builtin XROOTD must not be used with builtin OpenSSL. If you want to use non-builtin XROOTD, please use the system OpenSSL") - list(APPEND HOTFIX_BUILD_FLAGS '-Dxrootd=OFF') + list(APPEND HOTFIX_BUILD_FLAGS -Dxrootd=OFF) endif() if(imt) ROOT_FIND_REQUIRED_DEP(TBB builtin_tbb 2020) @@ -234,12 +234,12 @@ if(imt) int main() { return 0; }" tbb_exception_result) if(NOT tbb_exception_result) message(SEND_ERROR "Found TBB uses tbb::captured_exception, not suitable for ROOT!, enable 'builtin_tbb' option or turn off 'imt'") - list(APPEND HOTFIX_BUILD_FLAGS '-Dbuiltin_tbb=ON') + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_tbb=ON) endif() endif() elseif(builtin_tbb) message(SEND_ERROR "TBB features enabled with \"builtin_tbb=ON\" require \"imt=ON\"") - list(APPEND HOTFIX_BUILD_FLAGS '-Dimt=ON') + list(APPEND HOTFIX_BUILD_FLAGS -Dimt=ON) endif() # Double package name call, needs special manual treatment, cannot call ROOT_FIND_REQUIRED_DEP: @@ -259,13 +259,18 @@ if(NOT builtin_pcre) "Please install it in the system (preferred), set the corresponding CMake search variable, " "or opt in to downloading and auto-build it from externally provided source tarball using '-Dbuiltin_pcre=ON'.") list(APPEND MISSING_PACKAGES PCRE2) - list(APPEND HOTFIX_BUILD_FLAGS '-Dbuiltin_pcre=ON') + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_pcre=ON) endif() endif() endif() if(mathmore OR (tmva-cpu AND use_gsl_cblas)) if(builtin_gsl) - ROOT_CHECK_CONNECTION_AND_DISABLE_OPTION("builtin_gsl") + ROOT_CHECK_CONNECTION("builtin_gsl") + if(NO_CONNECTION) + message(SEND_ERROR "No internet connection, check it or disable the 'builtin_gsl' option") + list(APPEND MISSING_PACKAGES 'GSL') + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_gsl=OFF) + endif() endif() message(STATUS "Looking for GSL") ROOT_FIND_REQUIRED_DEP(GSL builtin_gsl 1.10) @@ -295,6 +300,11 @@ if(NOT "${HOTFIX_BUILD_FLAGS}" STREQUAL "") message(FATAL_ERROR "${HOTFIX_BUILD_FLAGS_MESSAGE}") endif() +# Now that builtins have passed this synchronization point, let's collect in a second pass +# additional error messages that can appear when using contradictory flags +unset(MISSING_PACKAGES) +unset(HOTFIX_BUILD_FLAGS_MESSAGE) + #---On MacOSX, try to find frameworks after standard libraries or headers------------ set(CMAKE_FIND_FRAMEWORK LAST) @@ -302,6 +312,7 @@ set(CMAKE_FIND_FRAMEWORK LAST) if(NOT shared) if(WINDOWS) message(FATAL_ERROR "Option \"shared=Off\" not supported on Windows!") + list(APPEND HOTFIX_BUILD_FLAGS -Dshared=ON) else() message("Preferring static libraries.") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;${CMAKE_FIND_LIBRARY_SUFFIXES}") @@ -364,10 +375,13 @@ endif() # library is needed for builds on Apple with Cocoa graphics if(cocoa) if(APPLE) - set(x11 OFF CACHE BOOL "Disabled because cocoa requested (${x11_description})" FORCE) + if (x11) + message(SEND_ERROR "x11 (${x11_description}) and cocoa cannot be enabled simultaneously. Set -Dx11=OFF") + list(APPEND HOTFIX_BUILD_FLAGS -Dx11=OFF) + endif() else() - message(STATUS "Cocoa option can only be enabled on MacOSX platform") - set(cocoa OFF CACHE BOOL "Disabled because only available on MacOSX (${cocoa_description})" FORCE) + message(SEND_ERROR "Cocoa option can only be enabled on MacOSX platform. Set -Dcocoa=OFF") + list(APPEND HOTFIX_BUILD_FLAGS -Dcocoa=OFF) endif() endif() @@ -419,8 +433,8 @@ endif() #---Check for all kind of graphics includes needed by libAfterImage-------------------- if(asimage) if(NOT x11 AND NOT cocoa AND NOT WIN32) - message(STATUS "Switching off 'asimage' because neither 'x11' nor 'cocoa' are enabled") - set(asimage OFF CACHE BOOL "Disabled because neither x11 nor cocoa are enabled (${asimage_description})" FORCE) + message(SEND_ERROR "'asimage' needs either 'x11' or 'cocoa' enabled. Set -Dasimage=OFF") + list(APPEND HOTFIX_BUILD_FLAGS -Dasimage=OFF) endif() endif() if(asimage) @@ -515,13 +529,12 @@ if(opengl OR cocoa) find_package(OpenGL) endif() if(NOT OPENGL_FOUND OR NOT OPENGL_GLU_FOUND) - if(fail-on-missing) - message(SEND_ERROR "OpenGL package (with GLU) not found and opengl option required") - elseif(cocoa) - message(FATAL_ERROR "OpenGL package (with GLU) not found and opengl option required for \"cocoa=ON\"") + if(cocoa AND NOT opengl) + message(SEND_ERROR "OpenGL package (with GLU) not found and opengl option required for \"cocoa=ON\". Set -Dcocoa=OFF") + list(APPEND HOTFIX_BUILD_FLAGS -Dcocoa=OFF) else() - message(STATUS "OpenGL (with GLU) not found. Switching off opengl option") - set(opengl OFF CACHE BOOL "Disabled because OpenGL (with GLU) not found (${opengl_description})" FORCE) + message(SEND_ERROR "OpenGL package (with GLU) not found and opengl option required. Set -Dopengl=OFF") + list(APPEND HOTFIX_BUILD_FLAGS -Dopengl=OFF) endif() endif() endif() @@ -529,8 +542,8 @@ endif() # in case when -Dall=ON -Dx11=OFF, we will just disable opengl. if(NOT WIN32 AND NOT APPLE) if(opengl AND NOT x11) - message(STATUS "OpenGL was disabled, since it is requires x11 on Linux") - set(opengl OFF CACHE BOOL "OpenGL requires x11" FORCE) + message(SEND_ERROR "OpenGL requires x11 on Linux, either disable opengl or set -Dx11=ON") + list(APPEND HOTFIX_BUILD_FLAGS -Dx11=ON) endif() endif() # The opengl flag enables the graf3d features that depend on OpenGL, and these @@ -538,6 +551,7 @@ endif() # asimage is off. See also: https://github.com/root-project/root/issues/16250 if(opengl AND NOT asimage) message(SEND_ERROR "OpenGL features enabled with \"opengl=ON\" require \"asimage=ON\"") + list(APPEND HOTFIX_BUILD_FLAGS -Dasimage=ON) endif() #---Check for gl2ps ------------------------------------------------------------------ @@ -550,7 +564,9 @@ if(gviz) message(STATUS "Looking for Graphviz") find_package(Graphviz) if(NOT GRAPHVIZ_FOUND) - message(SEND_ERROR "Graphviz libraries not found while -Dgviz=On.") + message(SEND_ERROR "Graphviz libraries not found while -Dgviz=ON. Install them on the system or set -Dgviz=OFF") + list(APPEND MISSING_PACKAGES 'Graphviz') + list(APPEND HOTFIX_BUILD_FLAGS -Dgviz=OFF) endif() endif() @@ -559,12 +575,9 @@ if(xml) message(STATUS "Looking for LibXml2") find_package(LibXml2) if(NOT LIBXML2_FOUND) - if(fail-on-missing) - message(SEND_ERROR "LibXml2 libraries not while -Dxml=ON") - else() - message(STATUS "LibXml2 not found. Switching off xml option") - set(xml OFF CACHE BOOL "Disabled because LibXml2 not found (${xml_description})" FORCE) - endif() + message(SEND_ERROR "LibXml2 libraries not while -Dxml=ON. Install them on the system or set -Dxml=OFF") + list(APPEND MISSING_PACKAGES 'LibXml2') + list(APPEND HOTFIX_BUILD_FLAGS -Dxml=OFF) endif() endif() @@ -578,7 +591,9 @@ if(fcgi) message(STATUS "Looking for FastCGI") find_package(FastCGI) if(NOT FASTCGI_FOUND) - message(SEND_ERROR "FastCGI library not found while -Dfcgi=On") + message(SEND_ERROR "FastCGI library not found while -Dfcgi=ON. Install it on the system or set -Dfcgi=OFF") + list(APPEND MISSING_PACKAGES 'FastCGI') + list(APPEND HOTFIX_BUILD_FLAGS -Dfcgi=OFF) endif() endif() @@ -600,14 +615,16 @@ if(http AND NOT builtin_civetweb) if(COMPILE_RESULT) message(STATUS "Detected civetweb feature mask: ${CIVETWEB_FEATURES}") else() - message(FATAL_ERROR "Could not run civetweb features: ${BUILD_LOG}") + message(SEND_ERROR "Could not run civetweb features: ${BUILD_LOG}. Try fixing the install or use builtin_civetweb=ON or switch `-Dhttp=OFF`") + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_civetweb=ON) endif() math(EXPR CIVETWEB_HAS_WEBSOCKET "(${CIVETWEB_FEATURES} >> 4) & 0x1") math(EXPR CIVETWEB_HAS_ZLIB "(${CIVETWEB_FEATURES} >> 9) & 0x1") math(EXPR CIVETWEB_HAS_X_DOM_SOCKET "(${CIVETWEB_FEATURES} >> 11) & 0x1") message(STATUS "civetweb websocket ; zlib ; xdomsocket support: ${CIVETWEB_HAS_WEBSOCKET} ; ${CIVETWEB_HAS_ZLIB} ; ${CIVETWEB_HAS_X_DOM_SOCKET}") else() - message(FATAL_ERROR "Could not check for civetweb features: ${CIVETWEB_FEATURE_API_LOG}") + message(SEND_ERROR "Could not check for civetweb features: ${CIVETWEB_FEATURE_API_LOG}. Try fixing the install or use builtin_civetweb=ON") + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_civetweb=ON) endif() if(NOT "${CIVETWEB_HAS_WEBSOCKET}" STREQUAL "1" OR NOT "${CIVETWEB_HAS_ZLIB}" STREQUAL "1" OR NOT "${CIVETWEB_HAS_X_DOM_SOCKET}" STREQUAL "1") @@ -617,6 +634,7 @@ if(http AND NOT builtin_civetweb) unset(${var} CACHE) endforeach() message(SEND_ERROR "System-wide civetweb found but does not include websocket or zlib or xdomsocket components (-DCIVETWEB_ENABLE_WEBSOCKETS=ON -DCIVETWEB_ENABLE_ZLIB=ON -DCIVETWEB_ENABLE_X_DOM_SOCKET=ON). Set `-Dbuiltin_civetweb=ON` as workaround or switch `-Dhttp=OFF`.") + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_civetweb=ON) endif() endif() endif() @@ -629,12 +647,9 @@ if(sqlite) message(STATUS "Looking for SQLite") find_package(Sqlite) if(NOT SQLITE_FOUND) - if(fail-on-missing) - message(SEND_ERROR "SQLite libraries not found while -Dsqlite=ON") - else() - message(STATUS "SQLite not found. Switching off sqlite option") - set(sqlite OFF CACHE BOOL "Disabled because SQLite not found (${sqlite_description})" FORCE) - endif() + message(SEND_ERROR "SQLite libraries not found while -Dsqlite=ON. Install them on the system or set -Dsqlite=OFF") + list(APPEND MISSING_PACKAGES 'SQLite') + list(APPEND HOTFIX_BUILD_FLAGS -Dsqlite=OFF) endif() endif() @@ -643,29 +658,45 @@ if(pythia8) message(STATUS "Looking for Pythia8") find_package(Pythia8) if(NOT PYTHIA8_FOUND) - message(SEND_ERROR "Pythia8 libraries not found while -Dpythia8=ON") + message(SEND_ERROR "Pythia8 libraries not found while -Dpythia8=ON. Install them on the system or set -Dpythia8=OFF") + list(APPEND MISSING_PACKAGES 'Pythia8') + list(APPEND HOTFIX_BUILD_FLAGS -Dpythia8=OFF) endif() endif() #---Check for FFTW3------------------------------------------------------------------- if(builtin_fftw3) - ROOT_CHECK_CONNECTION_AND_DISABLE_OPTION("builtin_fftw3") + ROOT_CHECK_CONNECTION("builtin_fftw3") + if(NO_CONNECTION) + message(SEND_ERROR "No internet connection, check it or disable the 'builtin_fftw3' option") + list(APPEND MISSING_PACKAGES 'fftw3') + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_fftw3=OFF) + endif() endif() if(builtin_fftw3) add_subdirectory(builtins/fftw3) - set(fftw3 ON CACHE BOOL "Enabled because builtin_fftw3 requested (${fftw3_description})" FORCE) + if (NOT fftw3) + message(SEND_ERROR "builtin_fftw3=ON is incompatible with fftw3=OFF. Set -Dfftw3=ON") + list(APPEND HOTFIX_BUILD_FLAGS -Dfftw3=ON) + endif() endif() #---Check for fitsio------------------------------------------------------------------- if(fitsio OR builtin_cfitsio) if(builtin_cfitsio) - ROOT_CHECK_CONNECTION_AND_DISABLE_OPTION("builtin_cfitsio") + ROOT_CHECK_CONNECTION("builtin_cfitsio") + if(NO_CONNECTION) + message(SEND_ERROR "No internet connection, check it or disable the 'builtin_cfitsio' option") + list(APPEND MISSING_PACKAGES 'CFITSIO') + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_cfitsio=OFF) + endif() endif() if(builtin_cfitsio) add_library(CFITSIO::CFITSIO STATIC IMPORTED GLOBAL) add_subdirectory(builtins/cfitsio) if(NOT fitsio) - set(fitsio ON CACHE BOOL "Enabled because builtin_cfitsio requested (${fitsio_description})" FORCE) + message(SEND_ERROR "builtin_cfitsio=ON is incompatible with fitsio=OFF. Set -Dfitsio=ON") + list(APPEND HOTFIX_BUILD_FLAGS -Dfitsio=ON) endif() endif() endif() @@ -674,8 +705,8 @@ endif() if(shadowpw) if(NOT EXISTS /etc/shadow) #---TODO--The test always succeeds because the actual file is protected if(NOT CMAKE_SYSTEM_NAME MATCHES Linux) - message(STATUS "Support Shadow password not found. Switching off shadowpw option") - set(shadowpw OFF CACHE BOOL "Disabled because /etc/shadow not found (${shadowpw_description})" FORCE) + message(SEND_ERROR "Support Shadow password not found. Switch off shadowpw option -Dshadowpw=OFF") + list(APPEND HOTFIX_BUILD_FLAGS -Dshadowpw=OFF) endif() endif() endif() @@ -698,10 +729,15 @@ if(builtin_xrootd) ROOT_CHECK_CONNECTION("builtin_xrootd=OFF") if(NO_CONNECTION) message(SEND_ERROR "No internet connection. Please check your connection, or disable the 'builtin_xrootd'" - " option") + " option and 'xrootd' options.") + list(APPEND HOTFIX_BUILD_FLAGS -Dxrootd=OFF) + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_xrootd=OFF) endif() add_subdirectory(builtins/xrootd) - set(xrootd ON CACHE BOOL "Enabled because builtin_xrootd requested (${xrootd_description})" FORCE) + if (NOT xrootd) + message(SEND_ERROR "builtin_xrootd=ON is incompatible with xrootd=OFF (${xrootd_description}). Set xrootd=ON") + list(APPEND HOTFIX_BUILD_FLAGS -Dxrootd=ON) + endif() endif() # Backward compatibility for XRootD (e.g. \"/usr/local/mpich\"). Or disable option 'mpi'") + list(APPEND MISSING_PACKAGES 'MPI') + list(APPEND HOTFIX_BUILD_FLAGS -Dmpi=OFF) endif() endif() @@ -1065,19 +1137,26 @@ if (roofit_multiprocess) set(CMAKE_FIND_PACKAGE_PREFER_CONFIG_ORIGINAL_VALUE ${CMAKE_FIND_PACKAGE_PREFER_CONFIG}) set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) - # The fail-on-missing branching is not implemented, and we always look for - # ZeroMQ and cppzmq with REQUIRED to fail configuration if not available. - # That's because the roofit_multiprocess option can only be deliberately - # enabled by the user with roofit_multiprocess=ON, in which case it would - # be frustrating to get it auto-disabled on missing dependencies. - find_package(ZeroMQ 4.3.5 REQUIRED) + # We always look for ZeroMQ and cppzmq with REQUIRED to fail configuration if not available. + find_package(ZeroMQ 4.3.5) + if (NOT ZeroMQ_FOUND) + message(SEND_ERROR "ZeroMQ not found. Install it or disable option 'roofit_multiprocess'") + list(APPEND MISSING_PACKAGES 'ZeroMQ') + list(APPEND HOTFIX_BUILD_FLAGS -Droofit_multiprocess=OFF) + endif() # Reset default find_package mode set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ${CMAKE_FIND_PACKAGE_PREFER_CONFIG_ORIGINAL_VALUE}) unset(CMAKE_FIND_PACKAGE_PREFER_CONFIG_ORIGINAL_VALUE) message(STATUS "Looking for ZeroMQ C++ bindings (cppzmq)") - find_package(cppzmq REQUIRED) + find_package(cppzmq) + if (NOT cppzmq_FOUND) + message(SEND_ERROR "cppzmq not found. Install it or disable option 'roofit_multiprocess'") + list(APPEND MISSING_PACKAGES 'cppzmq') + list(APPEND HOTFIX_BUILD_FLAGS -Droofit_multiprocess=OFF) + endif() + endif (roofit_multiprocess) #---Check for googletest--------------------------------------------------------------- @@ -1085,10 +1164,10 @@ if (testing OR testsupport) if (builtin_gtest) ROOT_CHECK_CONNECTION("testing=OFF") if(NO_CONNECTION) - message(STATUS "No internet connection, disabling the 'testing', 'testsupport' and 'builtin_gtest' options") - set(testing OFF CACHE BOOL "Disabled because there is no internet connection" FORCE) - set(testsupport OFF CACHE BOOL "Disabled because there is no internet connection" FORCE) - set(builtin_gtest OFF CACHE BOOL "Disabled because there is no internet connection" FORCE) + message(STATUS "No internet connection, check connection or disable the 'testing', 'testsupport' and 'builtin_gtest' options") + list(APPEND HOTFIX_BUILD_FLAGS -Dtesting=OFF) + list(APPEND HOTFIX_BUILD_FLAGS -Dtestsupport=OFF) + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_gtest=OFF) else() add_subdirectory(builtins/gtest) endif() @@ -1099,7 +1178,11 @@ if (testing OR testsupport) # Verify that all GTest subcomponents are installed foreach(LIBNAME gtest_main gmock_main gtest gmock) if(NOT TARGET GTest::${LIBNAME} AND NOT TARGET ${LIBNAME}) - message(SEND_ERROR "Missing installation of GTest subcomponent ${LIBNAME}") + message(SEND_ERROR "Missing installation of GTest subcomponent ${LIBNAME}. Install it or disable testing and testsupport.") + list(APPEND MISSING_PACKAGES '${LIBNAME}') + list(APPEND HOTFIX_BUILD_FLAGS -Dtesting=OFF) + list(APPEND HOTFIX_BUILD_FLAGS -Dtestsupport=OFF) + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_gtest=OFF) endif() endforeach() # Starting from cmake 3.23, the GTest targets will have stable names. @@ -1115,8 +1198,8 @@ endif() if(webgui AND NOT builtin_openui5) ROOT_CHECK_CONNECTION("builtin_openui5=ON") if(NO_CONNECTION) - message(STATUS "No internet connection, switching to 'builtin_openui5' option") - set(builtin_openui5 ON CACHE BOOL "Enabled because there is no internet connection" FORCE) + message(SEND_ERROR "No internet connection, check it or switch ON the 'builtin_openui5' option") + list(APPEND HOTFIX_BUILD_FLAGS -Dbuiltin_openui5=ON) endif() endif() @@ -1252,12 +1335,49 @@ endif() # Needed to run tests of the distributed RDataFrame module that use pyspark. # The functionality has been tested with pyspark 2.4 and above. if(test_distrdf_pyspark) - find_package(PySpark 2.4 REQUIRED) + find_package(PySpark 2.4) + if (NOT PySpark_FOUND) + message(SEND_ERROR "PySpark not found. Install it or disable option 'test_distrdf_pyspark'") + list(APPEND MISSING_PACKAGES 'PySpark') + list(APPEND HOTFIX_BUILD_FLAGS -Dtest_distrdf_pyspark=OFF) + endif() endif() #------------------------------------------------------------------------------------ # Check if the dask package is installed on the system. # Needed to run tests of the distributed RDataFrame module that use dask. if(test_distrdf_dask) - find_package(Dask 2022.08.1 REQUIRED) + find_package(Dask 2022.08.1) + if (NOT Dask_FOUND) + message(SEND_ERROR "Dask not found. Install it or disable option 'test_distrdf_pyspark'") + list(APPEND MISSING_PACKAGES 'Dask') + list(APPEND HOTFIX_BUILD_FLAGS -Dtest_distrdf_dask=OFF) + endif() +endif() + +if(webgui AND qt6web) + find_package(Qt6 COMPONENTS Core WebEngineCore WebEngineWidgets CONFIG) + if(NOT Qt6_FOUND) + message(SEND_ERROR "Could NOT find Qt6 (WebEngineCore, WebEngineWidgets), install missing packages on the system or disable option 'qt6web'") + list(APPEND MISSING_PACKAGES 'Qt6 WebEngineCore WebEngineWidgets') + list(APPEND HOTFIX_BUILD_FLAGS -Dqt6web=OFF) + endif() +endif() + +if(NOT "${MISSING_PACKAGES}" STREQUAL "") + list(REMOVE_DUPLICATES MISSING_PACKAGES) + message(SEND_ERROR "The following packages need to be installed system-wide to build ROOT: ${MISSING_PACKAGES}") +endif() +if(NOT "${HOTFIX_BUILD_FLAGS}" STREQUAL "") + list(REMOVE_DUPLICATES HOTFIX_BUILD_FLAGS) + set(HOTFIX_BUILD_FLAGS_MESSAGE "Alternatively, a hotfix would be to add these flags to your CMake call:\n") + + foreach(_item IN LISTS HOTFIX_BUILD_FLAGS) + string(APPEND HOTFIX_BUILD_FLAGS_MESSAGE " ${_item} \\\n") + endforeach() + + # Remove final trailing backslash and newline + string(REGEX REPLACE "\\\\\n$" "" HOTFIX_BUILD_FLAGS_MESSAGE "${HOTFIX_BUILD_FLAGS_MESSAGE}") + + message(FATAL_ERROR "${HOTFIX_BUILD_FLAGS_MESSAGE}") endif() diff --git a/core/testsupport/CMakeLists.txt b/core/testsupport/CMakeLists.txt index eaa1b032e0451..b001897a0986f 100644 --- a/core/testsupport/CMakeLists.txt +++ b/core/testsupport/CMakeLists.txt @@ -4,7 +4,7 @@ # higher than kInfo are issued by tests. # Stephan Hageboeck, CERN, 2022 -if(NOT testsupport) +if(NOT testsupport AND NOT testing) return() endif() diff --git a/gui/qt6webdisplay/CMakeLists.txt b/gui/qt6webdisplay/CMakeLists.txt index c70ac93bb61cf..340240c399364 100644 --- a/gui/qt6webdisplay/CMakeLists.txt +++ b/gui/qt6webdisplay/CMakeLists.txt @@ -8,12 +8,6 @@ # CMakeLists.txt file for building ROOT gui/qt6webdisplay package ############################################################################ -find_package(Qt6 COMPONENTS Core WebEngineCore WebEngineWidgets CONFIG) - -if(NOT Qt6_FOUND) - message(SEND_ERROR "Could NOT find Qt6 (WebEngineCore, WebEngineWidgets), install missing packages on the system or disable option 'qt6web'") -endif() - set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)