diff --git a/.github/workflows/root-ci-config/build_root.py b/.github/workflows/root-ci-config/build_root.py index 9462d0f2ab36a..14390ba90ea1d 100755 --- a/.github/workflows/root-ci-config/build_root.py +++ b/.github/workflows/root-ci-config/build_root.py @@ -59,7 +59,7 @@ def main(): # the target branch in the ROOT repository using base_ref and head_ref: # - The base_ref is e.g. "master" or "v6-38-00-patches" # - The head_ref for PRs is formatted as : e.g. "refs/pull/20742/head:cppyy_fixup" - if not ":" in args.head_ref: + if ":" not in args.head_ref: build_utils.print_error(f"This has been identified as a PR build. However, the head-ref is {args.head_ref}.") branch_in_fork = args.head_ref.split(":")[-1] if branch_in_fork == args.base_ref: @@ -85,7 +85,7 @@ def main(): if "minimal" in platform_options and platform_options["minimal"] == "ON": options_dict = platform_options - print(f"Minimal build detected in the platform options. Ignoring global configuration.") + print("Minimal build detected in the platform options. Ignoring global configuration.") else: options_dict.update(platform_options) print(f"Build option overrides for {args.platform_config}:") @@ -413,26 +413,13 @@ def cmake_configure(options, buildtype): options = f"{options} -DROOT_COMPILEDATA_IGNORE_BUILD_NODE_CHANGES=ON" result = subprocess_with_log(f""" - cmake -S '{srcdir}' -B '{builddir}' -DCMAKE_BUILD_TYPE={buildtype} {options} + cmake --fresh -S '{srcdir}' -B '{builddir}' -DCMAKE_BUILD_TYPE={buildtype} {options} """) if result != 0: die(result, "Failed cmake generation step") -@github_log_group("Dump existing configuration") -def cmake_dump_config(): - # Print CMake cached config - srcdir = os.path.join(WORKDIR, "src") - builddir = os.path.join(WORKDIR, "build") - result = subprocess_with_log(f""" - cmake -S '{srcdir}' -B '{builddir}' -N -L - """) - - if result != 0: - die(result, "Failed cmake cache print step") - - @github_log_group("Dump requested build configuration") def dump_requested_config(options): print(f"\nBUILD OPTIONS: {options}") @@ -460,10 +447,7 @@ def build(options, buildtype): if result != 0: die(result, "Failed to create build directory") - if not os.path.exists(os.path.join(WORKDIR, "build", "CMakeCache.txt")): - cmake_configure(options, buildtype) - else: - cmake_dump_config() + cmake_configure(options, buildtype) dump_requested_config(options) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7945ee63a3078..68354572d3301 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -469,6 +469,15 @@ if(MSVC) endif() if(runtime_cxxmodules) + if(NOT ROOT_CONFIGURED_FROM_CACHE) + # When using cmake --fresh (or changing the toolchain), remove possibly stale pcms that are not tracked by CMake + set(ROOT_CONFIGURED_FROM_CACHE True CACHE BOOL "Shows if ROOT is configured from an existing CMake cache") + mark_as_advanced(ROOT_CONFIGURED_FROM_CACHE) + file(GLOB_RECURSE left_over_pcms ${CMAKE_BINARY_DIR}/*.pcm) + if(left_over_pcms) + file(REMOVE ${left_over_pcms}) + endif() + endif() # Dummy target that does nothing, we don't need a PCH for modules. # Onepcm target has all dependencies needed for allDict.cxx.pch, which allow # to test hsimple.C after all C++ modules are updated.