From 0097a30ad93b6ef8ad8532b8211066554d28df8a Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 10:41:03 +0200 Subject: [PATCH 01/38] fix ci --- .github/workflows/test_preparation.yml | 54 ++++++++++++++------------ .github/workflows/testsuite.yml | 2 +- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 95f2b3287d..2fee7d238b 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -65,10 +65,10 @@ jobs: fetch-depth: 0 - name: Update packages run: sudo apt-get update && sudo apt-get upgrade -y - # This seems to be necessary because of the docker container - # Install the command line processor jq to read the dependencies.json file - name: Install jq run: sudo apt-get install -y jq + # This seems to be necessary because of the docker container + # Install the command line processor jq to read the dependencies.json file - name: disable ownership checks run: git config --global --add safe.directory '*' - name: Get input vars @@ -84,7 +84,8 @@ jobs: # SC installation # - name: store sc folders in var - run: echo SC_BUILD=$PWD/sc/build >> $GITHUB_ENV + run: echo SC_SOURCE=$PWD/sc >> $GITHUB_ENV + && echo SC_BUILD=$PWD/sc/build >> $GITHUB_ENV && echo SC_DEBUG=$PWD/sc/build/Debug >> $GITHUB_ENV && echo SC_RELEASE=$PWD/sc/build/Release >> $GITHUB_ENV - name: Get sc commit hash and url from dependencies.json @@ -113,31 +114,33 @@ jobs: # The true at the end is to ignore errors that i.e. occur when the folders do not exist run: rm -r $SC_BUILD || true - name: make folders - run: mkdir -p $SC_DEBUG $SC_RELEASE $SC_BUILD + run: mkdir -p $SC_DEBUG $SC_RELEASE if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: install sc run: echo "Install sc" if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - ## sc debug - name: get sc source + ## minimal amount of history and fetches run: | - cd $SC_BUILD - if [ ! -d sc ]; then - git clone ${{ env.sc_url }} sc + if [ ! -d $SC_SOURCE ]; then + git init $SC_SOURCE + cd $SC_SOURCE + git remote add origin ${{ env.sc_url }} fi - cd sc - git fetch + cd $SC_SOURCE + git fetch --depth 1 origin ${{ env.sc_commit }} git checkout ${{ env.sc_commit }} if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + ## sc debug build - name: sc cmake debug - run: cd $SC_DEBUG && cmake $SC_BUILD/sc -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja + run: cd $SC_DEBUG && cmake $SC_SOURCE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: sc build debug run: cd $SC_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - ## sc release + ## sc release build - name: sc cmake release - run: cd $SC_RELEASE && cmake $SC_BUILD/sc -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SC_RELEASE/install -Dmpi=$MPI -GNinja + run: cd $SC_RELEASE && cmake $SC_SOURCE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SC_RELEASE/install -Dmpi=$MPI -GNinja if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: sc build release run: cd $SC_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install @@ -146,7 +149,8 @@ jobs: # P4EST # - name: store p4est folders in var - run: echo P4EST_BUILD=$PWD/p4est/build >> $GITHUB_ENV + run: echo P4EST_SOURCE=$PWD/p4est >> $GITHUB_ENV + && echo P4EST_BUILD=$PWD/p4est/build >> $GITHUB_ENV && echo P4EST_DEBUG=$PWD/p4est/build/Debug >> $GITHUB_ENV && echo P4EST_RELEASE=$PWD/p4est/build/Release >> $GITHUB_ENV - name: Get p4est commit hash and url from dependencies.json @@ -176,29 +180,31 @@ jobs: run: rm -r $P4EST_BUILD || true - name: make folders if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE $P4EST_BUILD + run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE - name: install p4est run: echo "Install p4est" if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: get p4est source + ## minimal amount of history and fetches run: | - cd $P4EST_BUILD - if [ ! -d p4est ]; then - git clone ${{ env.p4est_url }} p4est + if [ ! -d $P4EST_SOURCE ]; then + git init $P4EST_SOURCE + cd $P4EST_SOURCE + git remote add origin ${{ env.p4est_url }} fi - cd p4est - git fetch + cd $P4EST_SOURCE + git fetch --depth 1 origin ${{ env.p4est_commit }} git checkout ${{ env.p4est_commit }} - ## p4est debug + ## p4est debug build - name: p4est cmake debug - run: cd $P4EST_DEBUG && cmake $P4EST_BUILD/p4est -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja + run: cd $P4EST_DEBUG && cmake $P4EST_SOURCE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: p4est build debug run: cd $P4EST_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - ## p4est release + ## p4est release build - name: p4est cmake release - run: cd $P4EST_RELEASE && cmake $P4EST_BUILD/p4est -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$P4EST_RELEASE/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_RELEASE/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja + run: cd $P4EST_RELEASE && cmake $P4EST_SOURCE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$P4EST_RELEASE/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_RELEASE/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: p4est build release run: cd $P4EST_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index f4630b9cac..6c4996a584 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -120,7 +120,7 @@ jobs: with: MAKEFLAGS: ${{ matrix.MAKEFLAGS }} IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run - CACHE_COUNTER: 5 # Increase this number to force a new installation of sc and p4est and to update the cache once + CACHE_COUNTER: 6 # Increase this number to force a new installation of sc and p4est and to update the cache once MPI: ${{ matrix.MPI }} # Run parallel tests for sc and p4est with and without MPI From f3cce7acb4f8f18c3858986d5790e29a702d83c0 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 10:42:22 +0200 Subject: [PATCH 02/38] add newline at eof --- dependencies.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.json b/dependencies.json index feb09ca000..eed2b89b8e 100644 --- a/dependencies.json +++ b/dependencies.json @@ -30,4 +30,4 @@ } } ] -} \ No newline at end of file +} From da7660f957ec9f0484bf9be6bbfdbe39ef25633b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 10:57:47 +0200 Subject: [PATCH 03/38] simplify depends on cmake option by making it mandatory --- CMakeLists.txt | 23 ++++++----------------- dependencies.json | 1 + 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b73aa12c81..d847b69ee6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,34 +136,23 @@ string(JSON DEPS_COUNT LENGTH "${DEPS_JSON}" "dependencies") math(EXPR DEPS_RANGE "${DEPS_COUNT} - 1") foreach(INDEX RANGE ${DEPS_RANGE}) - # Check for an optional "depends_on_cmake_option" field - # Try to read the optional field without producing warnings; capture any error message. - string(JSON DEP_CMAKE_OPTION ERROR_VARIABLE JSON_ERR_MSG - GET "${DEPS_JSON}" "dependencies" ${INDEX} "depends_on_cmake_option") - if(JSON_ERR_MSG) - # Field missing or invalid: mark as error and clear the option value. - set(JSON_ERR 1) - set(DEP_CMAKE_OPTION "") - else() - set(JSON_ERR 0) - endif() - - # Extract common fields + # Extract fields string(JSON DEP_NAME GET "${DEPS_JSON}" "dependencies" ${INDEX} "name") + string(JSON DEP_CMAKE_OPTION GET "${DEPS_JSON}" "dependencies" ${INDEX} "depends_on_cmake_option") string(JSON DEP_TYPE GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "type") string(JSON DEP_URL GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "url") string(JSON DEP_REF GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "ref") string(JSON DEP_SHALLOW GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "shallow") - # If no error occurred and the field is non-empty, check the CMake option. - if(JSON_ERR EQUAL 0 AND NOT DEP_CMAKE_OPTION STREQUAL "") + # If the DEP_CMAKE_OPTION field is non-empty, check the CMake option. + if(NOT DEP_CMAKE_OPTION STREQUAL "") # If the named option variable does not exist in the CMake cache, warn and proceed. if(NOT DEFINED ${DEP_CMAKE_OPTION}) message(FATAL_ERROR "Loading dependency ${DEP_NAME} at index ${INDEX} references unknown CMake option '${DEP_CMAKE_OPTION}'. Aborting.") else() # If the named option is defined but set to ON, skip this dependency. if(${${DEP_CMAKE_OPTION}}) - message(STATUS "Skipping FetchContent-step for dependency ${DEP_NAME} because CMake option '${DEP_CMAKE_OPTION}' is ON") + message(STATUS "Skipping FetchContent-step for dependency ${DEP_NAME} because CMake option '${DEP_CMAKE_OPTION}' is '${${DEP_CMAKE_OPTION}}'") continue() endif() endif() @@ -318,7 +307,7 @@ else() - # Reactivate previous CMAKE_REQUIRED_FLAGS + # Reactivate previous CMAKE_REQUIRED_FLAGS set( CMAKE_REQUIRED_FLAGS "${T8CODE_OLD_CMAKE_REQUIRED_FLAGS}" ) unset( T8CODE_OLD_CMAKE_REQUIRED_FLAGS ) endif() diff --git a/dependencies.json b/dependencies.json index eed2b89b8e..6e3712693c 100644 --- a/dependencies.json +++ b/dependencies.json @@ -2,6 +2,7 @@ "dependencies": [ { "name": "googletest", + "depends_on_cmake_option": "", "source": { "type": "git", "url": "https://github.com/DLR-SC/googletest_mpi.git", From eb061dd35aabc3db5f4a121b65e33ac592e911d9 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 11:03:31 +0200 Subject: [PATCH 04/38] move dependencies into separate cmake script --- CMakeLists.txt | 66 ++--------------- cmake/dependencies.cmake | 78 ++++++++++++++++++++ dependencies.json => cmake/dependencies.json | 0 3 files changed, 83 insertions(+), 61 deletions(-) create mode 100644 cmake/dependencies.cmake rename dependencies.json => cmake/dependencies.json (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d847b69ee6..7bf726ed0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # t8code is a C library to manage a collection (a forest) of multiple # connected adaptive space-trees of general element types in parallel. # -# Copyright (C) 2025 the developers +# Copyright (C) 2026 the developers # # t8code is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,10 +35,6 @@ include( GNUInstallDirs) include( CTest ) include( CMakeDependentOption ) - -include(FetchContent) -set(FETCHCONTENT_QUIET FALSE) - option( T8CODE_BUILD_AS_SHARED_LIBRARY "Whether t8code should be built as a shared or a static library" ON ) option( T8CODE_BUILD_PEDANTIC "Compile t8code with `-pedantic` as done in the Github CI." OFF ) option( T8CODE_BUILD_WALL "Compile t8code with `-Wall` as done in the Github CI." OFF ) @@ -127,66 +123,14 @@ else() endif() mark_as_advanced( FORCE gtest_disable_mpi) - -# 1. Read and parse the JSON -file(READ "dependencies.json" DEPS_JSON) -# 2. Get the number of elements in the "dependencies" array -string(JSON DEPS_COUNT LENGTH "${DEPS_JSON}" "dependencies") -# 3. Loop through the array (subtract 1 because it's 0-indexed) -math(EXPR DEPS_RANGE "${DEPS_COUNT} - 1") - -foreach(INDEX RANGE ${DEPS_RANGE}) - # Extract fields - string(JSON DEP_NAME GET "${DEPS_JSON}" "dependencies" ${INDEX} "name") - string(JSON DEP_CMAKE_OPTION GET "${DEPS_JSON}" "dependencies" ${INDEX} "depends_on_cmake_option") - string(JSON DEP_TYPE GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "type") - string(JSON DEP_URL GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "url") - string(JSON DEP_REF GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "ref") - string(JSON DEP_SHALLOW GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "shallow") - - # If the DEP_CMAKE_OPTION field is non-empty, check the CMake option. - if(NOT DEP_CMAKE_OPTION STREQUAL "") - # If the named option variable does not exist in the CMake cache, warn and proceed. - if(NOT DEFINED ${DEP_CMAKE_OPTION}) - message(FATAL_ERROR "Loading dependency ${DEP_NAME} at index ${INDEX} references unknown CMake option '${DEP_CMAKE_OPTION}'. Aborting.") - else() - # If the named option is defined but set to ON, skip this dependency. - if(${${DEP_CMAKE_OPTION}}) - message(STATUS "Skipping FetchContent-step for dependency ${DEP_NAME} because CMake option '${DEP_CMAKE_OPTION}' is '${${DEP_CMAKE_OPTION}}'") - continue() - endif() - endif() - endif() - - message(STATUS "Configuring dependency: ${DEP_NAME} (Type: ${DEP_TYPE}, SHALLOW: ${DEP_SHALLOW})") - - #If Dep_SHALLOW is not a valid boolean, set it to FALSE and print a warning. - if(NOT DEP_SHALLOW STREQUAL "TRUE" AND NOT DEP_SHALLOW STREQUAL "FALSE") - message(STATUS "Invalid value for 'shallow' in dependency ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'true' or 'false'. Defaulting to 'false'.") - set(DEP_SHALLOW FALSE) - endif() - - # 2. Branch logic based on "type" - if(DEP_TYPE STREQUAL "git") - FetchContent_Declare( - ${DEP_NAME} - GIT_REPOSITORY ${DEP_URL} - GIT_TAG ${DEP_REF} - GIT_PROGRESS TRUE - GIT_SHALLOW ${DEP_SHALLOW} - ) - else() - message(WARNING "Unknown dependency type '${DEP_TYPE}' for ${DEP_NAME}") - endif() - - # 3. Populate the dependency - FetchContent_MakeAvailable(${DEP_NAME}) -endforeach() - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) mark_as_advanced( FORCE gtest_force_shared_crt) +# Populate the dependencies +include (cmake/dependencies.cmake) + + if( T8CODE_ENABLE_VTK ) find_package( VTK REQUIRED COMPONENTS IOXML CommonExecutionModel CommonDataModel diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake new file mode 100644 index 0000000000..9bc2fc2d61 --- /dev/null +++ b/cmake/dependencies.cmake @@ -0,0 +1,78 @@ +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2026 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +include(FetchContent) +set(FETCHCONTENT_QUIET FALSE) + + +# 1. Read and parse the JSON +file(READ "cmake/dependencies.json" DEPS_JSON) +# 2. Get the number of elements in the "dependencies" array +string(JSON DEPS_COUNT LENGTH "${DEPS_JSON}" "dependencies") +# 3. Loop through the array (subtract 1 because it's 0-indexed) +math(EXPR DEPS_RANGE "${DEPS_COUNT} - 1") + +foreach(INDEX RANGE ${DEPS_RANGE}) + # Extract fields + string(JSON DEP_NAME GET "${DEPS_JSON}" "dependencies" ${INDEX} "name") + string(JSON DEP_CMAKE_OPTION GET "${DEPS_JSON}" "dependencies" ${INDEX} "depends_on_cmake_option") + string(JSON DEP_TYPE GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "type") + string(JSON DEP_URL GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "url") + string(JSON DEP_REF GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "ref") + string(JSON DEP_SHALLOW GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "shallow") + + # If the DEP_CMAKE_OPTION field is non-empty, check the CMake option. + if(NOT DEP_CMAKE_OPTION STREQUAL "") + # If the named option variable does not exist in the CMake cache, warn and proceed. + if(NOT DEFINED ${DEP_CMAKE_OPTION}) + message(FATAL_ERROR "Loading dependency ${DEP_NAME} at index ${INDEX} references unknown CMake option '${DEP_CMAKE_OPTION}'. Aborting.") + else() + # If the named option is defined but set to ON, skip this dependency. + if(${${DEP_CMAKE_OPTION}}) + message(STATUS "Skipping FetchContent-step for dependency ${DEP_NAME} because CMake option '${DEP_CMAKE_OPTION}' is '${${DEP_CMAKE_OPTION}}'") + continue() + endif() + endif() + endif() + + message(STATUS "Configuring dependency: ${DEP_NAME} (Type: ${DEP_TYPE}, SHALLOW: ${DEP_SHALLOW})") + + #If Dep_SHALLOW is not a valid boolean, set it to FALSE and print a warning. + if(NOT DEP_SHALLOW STREQUAL "TRUE" AND NOT DEP_SHALLOW STREQUAL "FALSE") + message(STATUS "Invalid value for 'shallow' in dependency ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'true' or 'false'. Defaulting to 'false'.") + set(DEP_SHALLOW FALSE) + endif() + + # 2. Branch logic based on "type" + if(DEP_TYPE STREQUAL "git") + FetchContent_Declare( + ${DEP_NAME} + GIT_REPOSITORY ${DEP_URL} + GIT_TAG ${DEP_REF} + GIT_PROGRESS TRUE + GIT_SHALLOW ${DEP_SHALLOW} + ) + else() + message(WARNING "Unknown dependency type '${DEP_TYPE}' for ${DEP_NAME}") + endif() + + # 3. Populate the dependency + FetchContent_MakeAvailable(${DEP_NAME}) +endforeach() diff --git a/dependencies.json b/cmake/dependencies.json similarity index 100% rename from dependencies.json rename to cmake/dependencies.json From 000aa1a59fa3b125ffc782d8bd40f0e4b8f01eae Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 11:22:55 +0200 Subject: [PATCH 05/38] rename dependencies to thirdparty --- CMakeLists.txt | 13 +----- .../{dependencies.cmake => thirdparty.cmake} | 40 +++++++++++-------- cmake/{dependencies.json => thirdparty.json} | 2 +- 3 files changed, 27 insertions(+), 28 deletions(-) rename cmake/{dependencies.cmake => thirdparty.cmake} (56%) rename cmake/{dependencies.json => thirdparty.json} (97%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bf726ed0e..4fc3c69b83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,9 +126,8 @@ mark_as_advanced( FORCE gtest_disable_mpi) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) mark_as_advanced( FORCE gtest_force_shared_crt) - -# Populate the dependencies -include (cmake/dependencies.cmake) +# Populate the thirdparty libraries +include (cmake/thirdparty.cmake) if( T8CODE_ENABLE_VTK ) @@ -300,14 +299,6 @@ set(CMAKE_C_FLAGS "${ORIGINAL_C_FLAGS}" CACHE STRING "" FORCE) # End of workaround -# Mark all cmake options starting with FETCHCONTENT as advanced. -get_cmake_property(_cmake_vars VARIABLES) -foreach(_var ${_cmake_vars}) - if(_var MATCHES "^FETCHCONTENT_.*") - mark_as_advanced(${_var}) - endif() -endforeach() - add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/src ) if( T8CODE_BUILD_MESH_HANDLE ) diff --git a/cmake/dependencies.cmake b/cmake/thirdparty.cmake similarity index 56% rename from cmake/dependencies.cmake rename to cmake/thirdparty.cmake index 9bc2fc2d61..e65f193e50 100644 --- a/cmake/dependencies.cmake +++ b/cmake/thirdparty.cmake @@ -23,40 +23,40 @@ set(FETCHCONTENT_QUIET FALSE) # 1. Read and parse the JSON -file(READ "cmake/dependencies.json" DEPS_JSON) -# 2. Get the number of elements in the "dependencies" array -string(JSON DEPS_COUNT LENGTH "${DEPS_JSON}" "dependencies") +file(READ "cmake/thirdparty.json" DEPS_JSON) +# 2. Get the number of elements in the "thirdparty" array +string(JSON DEPS_COUNT LENGTH "${DEPS_JSON}" "thirdparty") # 3. Loop through the array (subtract 1 because it's 0-indexed) math(EXPR DEPS_RANGE "${DEPS_COUNT} - 1") foreach(INDEX RANGE ${DEPS_RANGE}) # Extract fields - string(JSON DEP_NAME GET "${DEPS_JSON}" "dependencies" ${INDEX} "name") - string(JSON DEP_CMAKE_OPTION GET "${DEPS_JSON}" "dependencies" ${INDEX} "depends_on_cmake_option") - string(JSON DEP_TYPE GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "type") - string(JSON DEP_URL GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "url") - string(JSON DEP_REF GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "ref") - string(JSON DEP_SHALLOW GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "shallow") + string(JSON DEP_NAME GET "${DEPS_JSON}" "thirdparty" ${INDEX} "name") + string(JSON DEP_CMAKE_OPTION GET "${DEPS_JSON}" "thirdparty" ${INDEX} "depends_on_cmake_option") + string(JSON DEP_TYPE GET "${DEPS_JSON}" "thirdparty" ${INDEX} "source" "type") + string(JSON DEP_URL GET "${DEPS_JSON}" "thirdparty" ${INDEX} "source" "url") + string(JSON DEP_REF GET "${DEPS_JSON}" "thirdparty" ${INDEX} "source" "ref") + string(JSON DEP_SHALLOW GET "${DEPS_JSON}" "thirdparty" ${INDEX} "source" "shallow") # If the DEP_CMAKE_OPTION field is non-empty, check the CMake option. if(NOT DEP_CMAKE_OPTION STREQUAL "") # If the named option variable does not exist in the CMake cache, warn and proceed. if(NOT DEFINED ${DEP_CMAKE_OPTION}) - message(FATAL_ERROR "Loading dependency ${DEP_NAME} at index ${INDEX} references unknown CMake option '${DEP_CMAKE_OPTION}'. Aborting.") + message(FATAL_ERROR "Loading thirdparty library ${DEP_NAME} at index ${INDEX} references unknown CMake option '${DEP_CMAKE_OPTION}'. Aborting.") else() - # If the named option is defined but set to ON, skip this dependency. + # If the named option is defined but set to ON, skip this thirdparty library. if(${${DEP_CMAKE_OPTION}}) - message(STATUS "Skipping FetchContent-step for dependency ${DEP_NAME} because CMake option '${DEP_CMAKE_OPTION}' is '${${DEP_CMAKE_OPTION}}'") + message(STATUS "Skipping FetchContent-step for thirdparty library ${DEP_NAME} because CMake option '${DEP_CMAKE_OPTION}' is '${${DEP_CMAKE_OPTION}}'") continue() endif() endif() endif() - message(STATUS "Configuring dependency: ${DEP_NAME} (Type: ${DEP_TYPE}, SHALLOW: ${DEP_SHALLOW})") + message(STATUS "Configuring thirdparty library: ${DEP_NAME} (Type: ${DEP_TYPE}, SHALLOW: ${DEP_SHALLOW})") #If Dep_SHALLOW is not a valid boolean, set it to FALSE and print a warning. if(NOT DEP_SHALLOW STREQUAL "TRUE" AND NOT DEP_SHALLOW STREQUAL "FALSE") - message(STATUS "Invalid value for 'shallow' in dependency ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'true' or 'false'. Defaulting to 'false'.") + message(STATUS "Invalid value for 'shallow' in thirdparty library ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'true' or 'false'. Defaulting to 'false'.") set(DEP_SHALLOW FALSE) endif() @@ -70,9 +70,17 @@ foreach(INDEX RANGE ${DEPS_RANGE}) GIT_SHALLOW ${DEP_SHALLOW} ) else() - message(WARNING "Unknown dependency type '${DEP_TYPE}' for ${DEP_NAME}") + message(WARNING "Unknown thirdparty library type '${DEP_TYPE}' for ${DEP_NAME}") endif() - # 3. Populate the dependency + # 3. Populate the thirdparty library FetchContent_MakeAvailable(${DEP_NAME}) endforeach() + +# Mark all cmake options starting with FETCHCONTENT as advanced. +get_cmake_property(_cmake_vars VARIABLES) +foreach(_var ${_cmake_vars}) + if(_var MATCHES "^FETCHCONTENT_.*") + mark_as_advanced(${_var}) + endif() +endforeach() diff --git a/cmake/dependencies.json b/cmake/thirdparty.json similarity index 97% rename from cmake/dependencies.json rename to cmake/thirdparty.json index 6e3712693c..f3e51f1df7 100644 --- a/cmake/dependencies.json +++ b/cmake/thirdparty.json @@ -1,5 +1,5 @@ { - "dependencies": [ + "thirdparty": [ { "name": "googletest", "depends_on_cmake_option": "", From 43d8e0472ddfe24b06aef6b0070f4d9eb954fc7c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 12:24:25 +0200 Subject: [PATCH 06/38] remove MakeAvailable() duplication and align fixes --- CMakeLists.txt | 131 +++++++++++++++++++++---------------------------- 1 file changed, 55 insertions(+), 76 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fc3c69b83..88c9605ddb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,13 +122,68 @@ else() set( gtest_disable_mpi ON CACHE BOOL "disable gtest mpi support" FORCE) endif() +############################################ ThirdParty ############################################ + +# Set some variables for the thirdparty libraries mark_as_advanced( FORCE gtest_disable_mpi) set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) mark_as_advanced( FORCE gtest_force_shared_crt) +set( P4EST_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) +set( P4EST_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} ) +set( SC_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) +set( SC_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} ) + +# When executing CMake tests for some thirdparty libraries like sc, i.e. check_c_source_compiles/check_cxx_source_compiles and others +# we need to ignore the -Werror option, since these tests often produce warnings (see check_mpicommshared.cmake from sc for example). +# If theses warnings are interpreted as errors, the test fails even though we want it to pass. +# This behaviour caused a serious bug and did not initialize our shared memory. See https://github.com/DLR-AMR/t8code/issues/1985. +set( T8CODE_OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}" ) +if (WIN32 AND NOT MINGW) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /w" ) +else() + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -w" ) +endif() + +# Do the same for the normal build flags to suppress warnings from the thirdparty library +set(ORIGINAL_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +set(ORIGINAL_C_FLAGS "${CMAKE_C_FLAGS}") +if (WIN32 AND NOT MINGW) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /w" CACHE STRING "" FORCE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /w" CACHE STRING "" FORCE) +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w" CACHE STRING "" FORCE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w" CACHE STRING "" FORCE) +endif() + +# Capture the list of variables before adding the thirdparty libraries to mark the added ones as advanced. +get_cmake_property(_vars_before_thirdparty VARIABLES ) # Populate the thirdparty libraries include (cmake/thirdparty.cmake) +# Capture the list of variables after adding the thirdparty libraries +get_cmake_property(_vars_after_thirdparty VARIABLES ) +# Compute the difference (new variables added by the libraries) +set( _new_thirdparty_vars) +foreach( _var IN LISTS _vars_after_thirdparty ) + if( NOT _var IN_LIST _vars_before_thirdparty ) + list( APPEND _new_thirdparty_vars ${_var} ) + endif() +endforeach() + +# Mark the new variables as advanced +mark_as_advanced( FORCE ${_new_thirdparty_vars} ) + +# Reactivate previous CMAKE_REQUIRED_FLAGS and CMAKE_C/CXX_FLAGS +set( CMAKE_REQUIRED_FLAGS "${T8CODE_OLD_CMAKE_REQUIRED_FLAGS}" ) +unset( T8CODE_OLD_CMAKE_REQUIRED_FLAGS ) +set(CMAKE_CXX_FLAGS "${ORIGINAL_CXX_FLAGS}" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS "${ORIGINAL_C_FLAGS}" CACHE STRING "" FORCE) +unset (ORIGINAL_CXX_FLAGS) +unset (ORIGINAL_C_FLAGS) + +############################################ End of ThirdParty ############################################ + if( T8CODE_ENABLE_VTK ) find_package( VTK REQUIRED COMPONENTS @@ -185,37 +240,6 @@ endif() if ( T8CODE_USE_SYSTEM_SC ) find_package( SC REQUIRED ) else() - set( SC_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) - set( SC_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} ) - - # When executing CMake tests for libsc, i.e. check_c_source_compiles/check_cxx_source_compiles and others - # we need to ignore the -Werror option, since these tests often produce warnings (see check_mpicommshared.cmake for example). - # If theses warnings are interpreted as errors, the test fails even though we want it to pass. - # This behaviour caused a serious bug and did not initialize our shared memory. See https://github.com/DLR-AMR/t8code/issues/1985. - set( T8CODE_OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}" ) - if (WIN32 AND NOT MINGW) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /w" ) - else() - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -w" ) - endif() - - # Capture the list of variables before adding the subdirectory to mark the added ones as advanced. - get_cmake_property(_vars_before_sc VARIABLES ) - - FetchContent_MakeAvailable(sc) - # Capture the list of variables after adding the subdirectory - get_cmake_property(_vars_after_sc VARIABLES ) - # Compute the difference (new variables added by the subdirectory) - set( _new_sc_vars) - foreach( _var IN LISTS _vars_after_sc ) - if( NOT _var IN_LIST _vars_before_sc ) - list( APPEND _new_sc_vars ${_var} ) - endif() - endforeach() - - # Mark the new variables as advanced - mark_as_advanced( FORCE ${_new_sc_vars} ) - ########################## Fix for OpenMPI ############################################ # OpenMPI sometimes has a mismatch between their C and CXX interface which produces a warning in SC. # The warning makes t8codes build fail when Werror is activated. This fix checks if t8code @@ -247,58 +271,13 @@ else() message(WARNING "mpi.h not found!") endif() ########################## End of fix for OpenMPI ############################################ - - - - # Reactivate previous CMAKE_REQUIRED_FLAGS - set( CMAKE_REQUIRED_FLAGS "${T8CODE_OLD_CMAKE_REQUIRED_FLAGS}" ) - unset( T8CODE_OLD_CMAKE_REQUIRED_FLAGS ) endif() if ( T8CODE_USE_SYSTEM_P4EST ) find_package( P4EST REQUIRED ) -else() - set( P4EST_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) - set( P4EST_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} ) - - # Capture the list of variables before adding the subdirectory to mark the added ones as advanced. - get_cmake_property( _vars_before_p4est VARIABLES ) - - FetchContent_MakeAvailable(p4est) - # Capture the list of variables after adding the subdirectory - get_cmake_property( _vars_after_p4est VARIABLES ) - - # Compute the difference (new variables added by the subdirectory) - set( _new_p4est_vars ) - foreach( _var IN LISTS _vars_after_p4est ) - if( NOT _var IN_LIST _vars_before_p4est ) - list( APPEND _new_p4est_vars ${_var} ) - endif() - endforeach() - - # Mark the new variables as advanced - mark_as_advanced( FORCE ${_new_p4est_vars}) endif() -# Workaround: Suppress warnings for googletests, so it does not compromise the usage of -WError for t8code. -# ----------- -# 1. Save original flags -set(ORIGINAL_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -set(ORIGINAL_C_FLAGS "${CMAKE_C_FLAGS}") - -# 2. Suppress warnings for GoogleTest build -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w" CACHE STRING "" FORCE) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w" CACHE STRING "" FORCE) - -FetchContent_MakeAvailable( googletest ) - -# 3. Restore original flags -set(CMAKE_CXX_FLAGS "${ORIGINAL_CXX_FLAGS}" CACHE STRING "" FORCE) -set(CMAKE_C_FLAGS "${ORIGINAL_C_FLAGS}" CACHE STRING "" FORCE) - -# End of workaround - add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/src ) if( T8CODE_BUILD_MESH_HANDLE ) From 84b85ee8718113b609d2da02649039c78bd61c68 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 12:25:48 +0200 Subject: [PATCH 07/38] added jq to docker image instead of installing it in the ci --- .github/workflows/test_preparation.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 2fee7d238b..5e27673834 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -65,8 +65,6 @@ jobs: fetch-depth: 0 - name: Update packages run: sudo apt-get update && sudo apt-get upgrade -y - - name: Install jq - run: sudo apt-get install -y jq # This seems to be necessary because of the docker container # Install the command line processor jq to read the dependencies.json file - name: disable ownership checks From 4118df9bb4bfdbdeaeeb418f6eb2232fcd09d162 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 12:36:29 +0200 Subject: [PATCH 08/38] Reapply "Improvement: Implement FetchContent" This reverts commit 9c31d89cffbf367aeec2ce34bc49f16fe20f363b. --- .github/workflows/test_preparation.yml | 60 +++++++--- .../test_t8code_w_shipped_submodules.yml | 4 - .github/workflows/testsuite.yml | 2 +- .gitmodules | 8 -- CMakeLists.txt | 111 ++++++++++++++---- NEWS.md | 9 ++ dependencies.json | 33 ++++++ p4est | 1 - sc | 1 - 9 files changed, 177 insertions(+), 52 deletions(-) delete mode 100644 .gitmodules create mode 100644 dependencies.json delete mode 160000 p4est delete mode 160000 sc diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 5d273c4259..95f2b3287d 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -66,12 +66,11 @@ jobs: - name: Update packages run: sudo apt-get update && sudo apt-get upgrade -y # This seems to be necessary because of the docker container + # Install the command line processor jq to read the dependencies.json file + - name: Install jq + run: sudo apt-get install -y jq - name: disable ownership checks run: git config --global --add safe.directory '*' - - name: init submodules - run: git submodule init - - name: update submodules - run: git submodule update - name: Get input vars run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" && export IGNORE_CACHE="${{ inputs.IGNORE_CACHE }}" @@ -88,8 +87,12 @@ jobs: run: echo SC_BUILD=$PWD/sc/build >> $GITHUB_ENV && echo SC_DEBUG=$PWD/sc/build/Debug >> $GITHUB_ENV && echo SC_RELEASE=$PWD/sc/build/Release >> $GITHUB_ENV - - name: Get sc commit hash - run: hash=`git rev-parse HEAD:sc` && echo sc_commit=$hash >> $GITHUB_ENV + - name: Get sc commit hash and url from dependencies.json + run: | + hash=$(jq -r '.dependencies[] | select(.name=="SC") .source.ref' dependencies.json) + echo sc_commit=$hash >> $GITHUB_ENV + url=$(jq -r '.dependencies[] | select(.name=="SC") .source.url' dependencies.json) + echo sc_url=$url >> $GITHUB_ENV - name: Check cache for previous sc installation id: sc_cmake_cache uses: actions/cache@v5 @@ -110,21 +113,31 @@ jobs: # The true at the end is to ignore errors that i.e. occur when the folders do not exist run: rm -r $SC_BUILD || true - name: make folders - run: mkdir -p $SC_DEBUG $SC_RELEASE + run: mkdir -p $SC_DEBUG $SC_RELEASE $SC_BUILD if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: install sc run: echo "Install sc" if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## sc debug + - name: get sc source + run: | + cd $SC_BUILD + if [ ! -d sc ]; then + git clone ${{ env.sc_url }} sc + fi + cd sc + git fetch + git checkout ${{ env.sc_commit }} + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: sc cmake debug - run: cd $SC_DEBUG && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja + run: cd $SC_DEBUG && cmake $SC_BUILD/sc -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: sc build debug run: cd $SC_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## sc release - name: sc cmake release - run: cd $SC_RELEASE && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SC_RELEASE/install -Dmpi=$MPI -GNinja + run: cd $SC_RELEASE && cmake $SC_BUILD/sc -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$SC_RELEASE/install -Dmpi=$MPI -GNinja if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: sc build release run: cd $SC_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install @@ -136,8 +149,12 @@ jobs: run: echo P4EST_BUILD=$PWD/p4est/build >> $GITHUB_ENV && echo P4EST_DEBUG=$PWD/p4est/build/Debug >> $GITHUB_ENV && echo P4EST_RELEASE=$PWD/p4est/build/Release >> $GITHUB_ENV - - name: Get p4est commit hash - run: hash=`git rev-parse HEAD:p4est` && echo p4est_commit=$hash >> $GITHUB_ENV + - name: Get p4est commit hash and url from dependencies.json + run: | + hash=$(jq -r '.dependencies[] | select(.name=="P4EST") .source.ref' dependencies.json) + echo p4est_commit=$hash >> $GITHUB_ENV + url=$(jq -r '.dependencies[] | select(.name=="P4EST") .source.url' dependencies.json) + echo p4est_url=$url >> $GITHUB_ENV - name: Check cache for previous p4est installation id: p4est_cmake_cache uses: actions/cache@v5 @@ -153,26 +170,35 @@ jobs: - name: Cache info if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} run: echo No cache found or cache will be ignored. IGNORE_CACHE=$IGNORE_CACHE - - name: install p4est - run: echo "Install p4est" - if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: if ignore cache, delete folders if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} # The true at the end is to ignore errors that i.e. occur when the folders do not exist run: rm -r $P4EST_BUILD || true - name: make folders if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE + run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE $P4EST_BUILD + - name: install p4est + run: echo "Install p4est" + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: get p4est source + run: | + cd $P4EST_BUILD + if [ ! -d p4est ]; then + git clone ${{ env.p4est_url }} p4est + fi + cd p4est + git fetch + git checkout ${{ env.p4est_commit }} ## p4est debug - name: p4est cmake debug - run: cd $P4EST_DEBUG && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja + run: cd $P4EST_DEBUG && cmake $P4EST_BUILD/p4est -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: p4est build debug run: cd $P4EST_DEBUG && ninja $MAKEFLAGS && ninja $MAKEFLAGS install if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## p4est release - name: p4est cmake release - run: cd $P4EST_RELEASE && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$P4EST_RELEASE/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja + run: cd $P4EST_RELEASE && cmake $P4EST_BUILD/p4est -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$P4EST_RELEASE/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_RELEASE/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: p4est build release run: cd $P4EST_RELEASE && ninja $MAKEFLAGS && ninja $MAKEFLAGS install diff --git a/.github/workflows/test_t8code_w_shipped_submodules.yml b/.github/workflows/test_t8code_w_shipped_submodules.yml index 0f3801c84b..4e3db49124 100644 --- a/.github/workflows/test_t8code_w_shipped_submodules.yml +++ b/.github/workflows/test_t8code_w_shipped_submodules.yml @@ -62,10 +62,6 @@ jobs: # This seems to be necessary because of the docker container - name: disable ownership checks run: git config --global --add safe.directory '*' - - name: init submodules - run: git submodule init - - name: update submodules - run: git submodule update - name: Get input vars run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" && export MPI="${{ inputs.MPI }}" diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 631f7f48e8..f4630b9cac 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -120,7 +120,7 @@ jobs: with: MAKEFLAGS: ${{ matrix.MAKEFLAGS }} IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run - CACHE_COUNTER: 0 # Increase this number to force a new installation of sc and p4est and to update the cache once + CACHE_COUNTER: 5 # Increase this number to force a new installation of sc and p4est and to update the cache once MPI: ${{ matrix.MPI }} # Run parallel tests for sc and p4est with and without MPI diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 5281fdb8b3..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,8 +0,0 @@ -[submodule "p4est"] - path = p4est - url = https://github.com/cburstedde/p4est.git - ignore = dirty -[submodule "sc"] - path = sc - url = https://github.com/cburstedde/libsc.git - ignore = dirty diff --git a/CMakeLists.txt b/CMakeLists.txt index c7e010ad3a..b73aa12c81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ # along with t8code; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -cmake_minimum_required( VERSION 3.16 ) +cmake_minimum_required( VERSION 3.19 ) include( cmake/GitProjectVersion.cmake ) include( FetchContent ) @@ -35,17 +35,9 @@ include( GNUInstallDirs) include( CTest ) include( CMakeDependentOption ) -FetchContent_Declare( - googletest - GIT_REPOSITORY "https://github.com/DLR-SC/googletest_mpi.git" - GIT_TAG 98bfff426b057400268a00f97677d749a9e25096 #v1.17.0_mpi - GIT_PROGRESS TRUE - GIT_SHALLOW TRUE - ) - -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -mark_as_advanced( FORCE gtest_force_shared_crt) +include(FetchContent) +set(FETCHCONTENT_QUIET FALSE) option( T8CODE_BUILD_AS_SHARED_LIBRARY "Whether t8code should be built as a shared or a static library" ON ) option( T8CODE_BUILD_PEDANTIC "Compile t8code with `-pedantic` as done in the Github CI." OFF ) @@ -129,13 +121,82 @@ if( T8CODE_ENABLE_MPI ) if( NOT MPIEXEC_EXECUTABLE ) message( FATAL_ERROR "MPIEXEC was not found" ) endif() - set( SC_ENABLE_MPI ON ) + set( SC_ENABLE_MPI ON CACHE BOOL "enable mpi support in libsc" FORCE) else() set( gtest_disable_mpi ON CACHE BOOL "disable gtest mpi support" FORCE) endif() mark_as_advanced( FORCE gtest_disable_mpi) +# 1. Read and parse the JSON +file(READ "dependencies.json" DEPS_JSON) +# 2. Get the number of elements in the "dependencies" array +string(JSON DEPS_COUNT LENGTH "${DEPS_JSON}" "dependencies") +# 3. Loop through the array (subtract 1 because it's 0-indexed) +math(EXPR DEPS_RANGE "${DEPS_COUNT} - 1") + +foreach(INDEX RANGE ${DEPS_RANGE}) + # Check for an optional "depends_on_cmake_option" field + # Try to read the optional field without producing warnings; capture any error message. + string(JSON DEP_CMAKE_OPTION ERROR_VARIABLE JSON_ERR_MSG + GET "${DEPS_JSON}" "dependencies" ${INDEX} "depends_on_cmake_option") + if(JSON_ERR_MSG) + # Field missing or invalid: mark as error and clear the option value. + set(JSON_ERR 1) + set(DEP_CMAKE_OPTION "") + else() + set(JSON_ERR 0) + endif() + + # Extract common fields + string(JSON DEP_NAME GET "${DEPS_JSON}" "dependencies" ${INDEX} "name") + string(JSON DEP_TYPE GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "type") + string(JSON DEP_URL GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "url") + string(JSON DEP_REF GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "ref") + string(JSON DEP_SHALLOW GET "${DEPS_JSON}" "dependencies" ${INDEX} "source" "shallow") + + # If no error occurred and the field is non-empty, check the CMake option. + if(JSON_ERR EQUAL 0 AND NOT DEP_CMAKE_OPTION STREQUAL "") + # If the named option variable does not exist in the CMake cache, warn and proceed. + if(NOT DEFINED ${DEP_CMAKE_OPTION}) + message(FATAL_ERROR "Loading dependency ${DEP_NAME} at index ${INDEX} references unknown CMake option '${DEP_CMAKE_OPTION}'. Aborting.") + else() + # If the named option is defined but set to ON, skip this dependency. + if(${${DEP_CMAKE_OPTION}}) + message(STATUS "Skipping FetchContent-step for dependency ${DEP_NAME} because CMake option '${DEP_CMAKE_OPTION}' is ON") + continue() + endif() + endif() + endif() + + message(STATUS "Configuring dependency: ${DEP_NAME} (Type: ${DEP_TYPE}, SHALLOW: ${DEP_SHALLOW})") + + #If Dep_SHALLOW is not a valid boolean, set it to FALSE and print a warning. + if(NOT DEP_SHALLOW STREQUAL "TRUE" AND NOT DEP_SHALLOW STREQUAL "FALSE") + message(STATUS "Invalid value for 'shallow' in dependency ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'true' or 'false'. Defaulting to 'false'.") + set(DEP_SHALLOW FALSE) + endif() + + # 2. Branch logic based on "type" + if(DEP_TYPE STREQUAL "git") + FetchContent_Declare( + ${DEP_NAME} + GIT_REPOSITORY ${DEP_URL} + GIT_TAG ${DEP_REF} + GIT_PROGRESS TRUE + GIT_SHALLOW ${DEP_SHALLOW} + ) + else() + message(WARNING "Unknown dependency type '${DEP_TYPE}' for ${DEP_NAME}") + endif() + + # 3. Populate the dependency + FetchContent_MakeAvailable(${DEP_NAME}) +endforeach() + +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +mark_as_advanced( FORCE gtest_force_shared_crt) + if( T8CODE_ENABLE_VTK ) find_package( VTK REQUIRED COMPONENTS @@ -157,6 +218,15 @@ if( T8CODE_ENABLE_OCC ) endif (OpenCASCADE_FOUND) endif( T8CODE_ENABLE_OCC ) +if( T8CODE_ENABLE_NETCDF ) + find_package( NetCDF REQUIRED ) + if(NetCDF_FOUND) + message("Found NetCDF") + include(cmake/CheckNetCDFPar.cmake) + endif (NetCDF_FOUND) +endif( T8CODE_ENABLE_NETCDF ) + + # Override default for this libsc option set( BUILD_SHARED_LIBS ON CACHE BOOL "Build libsc as a shared library" ) @@ -199,10 +269,8 @@ else() # Capture the list of variables before adding the subdirectory to mark the added ones as advanced. get_cmake_property(_vars_before_sc VARIABLES ) - list( APPEND CMAKE_MESSAGE_CONTEXT "sc" ) - add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/sc ) - list( POP_BACK CMAKE_MESSAGE_CONTEXT ) - add_library(SC INTERFACE) + + FetchContent_MakeAvailable(sc) # Capture the list of variables after adding the subdirectory get_cmake_property(_vars_after_sc VARIABLES ) # Compute the difference (new variables added by the subdirectory) @@ -248,11 +316,14 @@ else() endif() ########################## End of fix for OpenMPI ############################################ + + # Reactivate previous CMAKE_REQUIRED_FLAGS set( CMAKE_REQUIRED_FLAGS "${T8CODE_OLD_CMAKE_REQUIRED_FLAGS}" ) unset( T8CODE_OLD_CMAKE_REQUIRED_FLAGS ) endif() + if ( T8CODE_USE_SYSTEM_P4EST ) find_package( P4EST REQUIRED ) else() @@ -261,11 +332,11 @@ else() # Capture the list of variables before adding the subdirectory to mark the added ones as advanced. get_cmake_property( _vars_before_p4est VARIABLES ) - list( APPEND CMAKE_MESSAGE_CONTEXT "p4est" ) - add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/p4est ) - list( POP_BACK CMAKE_MESSAGE_CONTEXT ) + + FetchContent_MakeAvailable(p4est) # Capture the list of variables after adding the subdirectory get_cmake_property( _vars_after_p4est VARIABLES ) + # Compute the difference (new variables added by the subdirectory) set( _new_p4est_vars ) foreach( _var IN LISTS _vars_after_p4est ) @@ -275,7 +346,7 @@ else() endforeach() # Mark the new variables as advanced - mark_as_advanced( FORCE ${_new_p4est_vars} ) + mark_as_advanced( FORCE ${_new_p4est_vars}) endif() # Workaround: Suppress warnings for googletests, so it does not compromise the usage of -WError for t8code. diff --git a/NEWS.md b/NEWS.md index 0dab757cb9..636293ff8d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,12 @@ +# Updated dependencies + +We have switched from a submodules approach to a FetchContent approach for our dependencies towards p4est and sc. If you don't have already installed p4est and sc, calling cmake will install the right branch from their github. If you have p4est and sc installed already and want to use that version no further code will be downloaded. If your current configuration is to the internal p4est and sc installation you don't need to update your workflow. The submodules of p4est and sc should be removed with this update. Instead they will be downloaded and installed in the _deps folder in your build folder. +If you use a separate installation of p4est and sc it is important to set the boolean CMake Options "T8CODE_USE_SYSTEM_P4EST" and "T8CODE_USE_SYSTEM_SC". It prevents the triggering of the automatic installation of the libraries. +Our recommendation is to delete any existing sc/ and p4est/ folders and use the automatically downloaded FetchContent. +For further information have a look at our [Installation Guide](https://github.com/DLR-AMR/t8code/wiki/Installation). +For devs: Further dependencies can be managed in our dependencies.json. + + # Updated contribution workflow. The team of main-developers of t8code and contributors to t8code is getting bigger and we needed an improved workflow to manage all of our contributions. diff --git a/dependencies.json b/dependencies.json new file mode 100644 index 0000000000..feb09ca000 --- /dev/null +++ b/dependencies.json @@ -0,0 +1,33 @@ +{ + "dependencies": [ + { + "name": "googletest", + "source": { + "type": "git", + "url": "https://github.com/DLR-SC/googletest_mpi.git", + "ref": "98bfff426b057400268a00f97677d749a9e25096", + "shallow": "TRUE" + } + }, + { + "name": "SC", + "depends_on_cmake_option": "T8CODE_USE_SYSTEM_SC", + "source": { + "type": "git", + "url": "https://github.com/cburstedde/libsc.git", + "ref": "f8c5099bd5ad553c1bf6e34dc7b6c290f3cc3cca", + "shallow": "TRUE" + } + }, + { + "name": "P4EST", + "depends_on_cmake_option": "T8CODE_USE_SYSTEM_P4EST", + "source": { + "type": "git", + "url": "https://github.com/cburstedde/p4est.git", + "ref": "2296a990d8b6b54731a63be0ba5bc17b08cd1f3d", + "shallow": "TRUE" + } + } + ] +} \ No newline at end of file diff --git a/p4est b/p4est deleted file mode 160000 index 8399186d4e..0000000000 --- a/p4est +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8399186d4ea214361ce0d183b9bbd340a417075e diff --git a/sc b/sc deleted file mode 160000 index 1b127f01c5..0000000000 --- a/sc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1b127f01c5e472039e938f61201ae0611fb25bad From 48e5ac53cfe1149a8946dc3f794a537c964efa67 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 12:49:54 +0200 Subject: [PATCH 09/38] remove comment --- .github/workflows/test_preparation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 5e27673834..2a42641485 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -66,7 +66,6 @@ jobs: - name: Update packages run: sudo apt-get update && sudo apt-get upgrade -y # This seems to be necessary because of the docker container - # Install the command line processor jq to read the dependencies.json file - name: disable ownership checks run: git config --global --add safe.directory '*' - name: Get input vars From 449bf65cb61f7d79e51fcd77ae3015ea0c360a6b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 12:53:02 +0200 Subject: [PATCH 10/38] increase counter [run ci] --- .github/workflows/testsuite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 6c4996a584..ddbd9b5c03 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -120,7 +120,7 @@ jobs: with: MAKEFLAGS: ${{ matrix.MAKEFLAGS }} IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run - CACHE_COUNTER: 6 # Increase this number to force a new installation of sc and p4est and to update the cache once + CACHE_COUNTER: 7 # Increase this number to force a new installation of sc and p4est and to update the cache once MPI: ${{ matrix.MPI }} # Run parallel tests for sc and p4est with and without MPI From 9250bb97373a50a345266c80ecdc4aeafc5e9c36 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 12:56:15 +0200 Subject: [PATCH 11/38] rename dependency file in ci [run ci] --- .github/workflows/test_preparation.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 2a42641485..319148de78 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -85,11 +85,11 @@ jobs: && echo SC_BUILD=$PWD/sc/build >> $GITHUB_ENV && echo SC_DEBUG=$PWD/sc/build/Debug >> $GITHUB_ENV && echo SC_RELEASE=$PWD/sc/build/Release >> $GITHUB_ENV - - name: Get sc commit hash and url from dependencies.json + - name: Get sc commit hash and url from thirdparty.json run: | - hash=$(jq -r '.dependencies[] | select(.name=="SC") .source.ref' dependencies.json) + hash=$(jq -r '.thirdparty[] | select(.name=="SC") .source.ref' thirdparty.json) echo sc_commit=$hash >> $GITHUB_ENV - url=$(jq -r '.dependencies[] | select(.name=="SC") .source.url' dependencies.json) + url=$(jq -r '.thirdparty[] | select(.name=="SC") .source.url' thirdparty.json) echo sc_url=$url >> $GITHUB_ENV - name: Check cache for previous sc installation id: sc_cmake_cache @@ -150,11 +150,11 @@ jobs: && echo P4EST_BUILD=$PWD/p4est/build >> $GITHUB_ENV && echo P4EST_DEBUG=$PWD/p4est/build/Debug >> $GITHUB_ENV && echo P4EST_RELEASE=$PWD/p4est/build/Release >> $GITHUB_ENV - - name: Get p4est commit hash and url from dependencies.json + - name: Get p4est commit hash and url from thirdparty.json run: | - hash=$(jq -r '.dependencies[] | select(.name=="P4EST") .source.ref' dependencies.json) + hash=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.ref' thirdparty.json) echo p4est_commit=$hash >> $GITHUB_ENV - url=$(jq -r '.dependencies[] | select(.name=="P4EST") .source.url' dependencies.json) + url=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.url' thirdparty.json) echo p4est_url=$url >> $GITHUB_ENV - name: Check cache for previous p4est installation id: p4est_cmake_cache From 4c8a84b0b6dd798a4175e0e30854ed7c1cc6fa7c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 12:58:51 +0200 Subject: [PATCH 12/38] reintroduce deleted comment --- .github/workflows/test_preparation.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 319148de78..26e9b33ed4 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -106,6 +106,9 @@ jobs: - name: Cache info if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} run: echo No cache found or cache will be ignored. IGNORE_CACHE=$IGNORE_CACHE + - name: install p4est + run: echo "Install p4est" + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: if ignore cache, delete folders if: ${{ inputs.IGNORE_CACHE == 1 }} # The true at the end is to ignore errors that i.e. occur when the folders do not exist From d750d6829314c9c7bc061a64a1306b3719f9fbc1 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 13:01:28 +0200 Subject: [PATCH 13/38] remove reintroduced netcdf linkage --- CMakeLists.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88c9605ddb..b396441114 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,15 +205,6 @@ if( T8CODE_ENABLE_OCC ) endif (OpenCASCADE_FOUND) endif( T8CODE_ENABLE_OCC ) -if( T8CODE_ENABLE_NETCDF ) - find_package( NetCDF REQUIRED ) - if(NetCDF_FOUND) - message("Found NetCDF") - include(cmake/CheckNetCDFPar.cmake) - endif (NetCDF_FOUND) -endif( T8CODE_ENABLE_NETCDF ) - - # Override default for this libsc option set( BUILD_SHARED_LIBS ON CACHE BOOL "Build libsc as a shared library" ) From 762093d3eca52abaf54977817a214c103400c5c2 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 13:03:08 +0200 Subject: [PATCH 14/38] adapt path of thirdparty file in ci [run ci] --- .github/workflows/test_preparation.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 26e9b33ed4..1ec5c15565 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -87,9 +87,9 @@ jobs: && echo SC_RELEASE=$PWD/sc/build/Release >> $GITHUB_ENV - name: Get sc commit hash and url from thirdparty.json run: | - hash=$(jq -r '.thirdparty[] | select(.name=="SC") .source.ref' thirdparty.json) + hash=$(jq -r '.thirdparty[] | select(.name=="SC") .source.ref' cmake/thirdparty.json) echo sc_commit=$hash >> $GITHUB_ENV - url=$(jq -r '.thirdparty[] | select(.name=="SC") .source.url' thirdparty.json) + url=$(jq -r '.thirdparty[] | select(.name=="SC") .source.url' cmake/thirdparty.json) echo sc_url=$url >> $GITHUB_ENV - name: Check cache for previous sc installation id: sc_cmake_cache @@ -155,9 +155,9 @@ jobs: && echo P4EST_RELEASE=$PWD/p4est/build/Release >> $GITHUB_ENV - name: Get p4est commit hash and url from thirdparty.json run: | - hash=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.ref' thirdparty.json) + hash=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.ref' cmake/thirdparty.json) echo p4est_commit=$hash >> $GITHUB_ENV - url=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.url' thirdparty.json) + url=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.url' cmake/thirdparty.json) echo p4est_url=$url >> $GITHUB_ENV - name: Check cache for previous p4est installation id: p4est_cmake_cache From ad4c88e264e70f4f9bd74e9ba8605c8f44f282b8 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 13:20:09 +0200 Subject: [PATCH 15/38] fix ci runner bug [run ci] --- .github/workflows/test_preparation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 1ec5c15565..8972bd4bfa 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -128,7 +128,7 @@ jobs: git remote add origin ${{ env.sc_url }} fi cd $SC_SOURCE - git fetch --depth 1 origin ${{ env.sc_commit }} + git fetch --depth 1 origin HEAD git checkout ${{ env.sc_commit }} if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## sc debug build @@ -193,7 +193,7 @@ jobs: git remote add origin ${{ env.p4est_url }} fi cd $P4EST_SOURCE - git fetch --depth 1 origin ${{ env.p4est_commit }} + git fetch --depth 1 origin HEAD git checkout ${{ env.p4est_commit }} ## p4est debug build - name: p4est cmake debug From 0b08e59d2f83b41e745c9258daba8d5fb3eeef1b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 13:41:37 +0200 Subject: [PATCH 16/38] use checkout action instead of manual checkout [run ci] --- .github/workflows/test_preparation.yml | 35 ++++++++++---------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 8972bd4bfa..25be28fcd7 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -119,17 +119,12 @@ jobs: - name: install sc run: echo "Install sc" if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - - name: get sc source - ## minimal amount of history and fetches - run: | - if [ ! -d $SC_SOURCE ]; then - git init $SC_SOURCE - cd $SC_SOURCE - git remote add origin ${{ env.sc_url }} - fi - cd $SC_SOURCE - git fetch --depth 1 origin HEAD - git checkout ${{ env.sc_commit }} + - uses: actions/checkout@v6 + with: + repository: ${{ env.sc_url }} + ref: ${{ env.sc_commit }} + fetch_depth: 1 + path: ${{ env.SC_SOURCE }} if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## sc debug build - name: sc cmake debug @@ -184,17 +179,13 @@ jobs: - name: install p4est run: echo "Install p4est" if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - - name: get p4est source - ## minimal amount of history and fetches - run: | - if [ ! -d $P4EST_SOURCE ]; then - git init $P4EST_SOURCE - cd $P4EST_SOURCE - git remote add origin ${{ env.p4est_url }} - fi - cd $P4EST_SOURCE - git fetch --depth 1 origin HEAD - git checkout ${{ env.p4est_commit }} + - uses: actions/checkout@v6 + with: + repository: ${{ env.p4est_url }} + ref: ${{ env.p4est_commit }} + fetch_depth: 1 + path: ${{ env.P4EST_SOURCE }} + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## p4est debug build - name: p4est cmake debug run: cd $P4EST_DEBUG && cmake $P4EST_SOURCE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja From 50a1de97a510441793a38c47ce4b9dc2ceb381df Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 13:47:24 +0200 Subject: [PATCH 17/38] fix checkout [run ci] --- .github/workflows/test_preparation.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 25be28fcd7..cb192b8e03 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -121,9 +121,9 @@ jobs: if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - uses: actions/checkout@v6 with: - repository: ${{ env.sc_url }} + repository: cburstedde/libsc ref: ${{ env.sc_commit }} - fetch_depth: 1 + fetch-depth: 1 path: ${{ env.SC_SOURCE }} if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## sc debug build @@ -181,9 +181,9 @@ jobs: if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - uses: actions/checkout@v6 with: - repository: ${{ env.p4est_url }} + repository: cburstedde/p4est ref: ${{ env.p4est_commit }} - fetch_depth: 1 + fetch-depth: 1 path: ${{ env.P4EST_SOURCE }} if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## p4est debug build From 37f54fa1f0bc7f6fd870014bded7e7778076d202 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 13:51:54 +0200 Subject: [PATCH 18/38] move folder creation [run ci] --- .github/workflows/test_preparation.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index cb192b8e03..00f57bb740 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -113,9 +113,6 @@ jobs: if: ${{ inputs.IGNORE_CACHE == 1 }} # The true at the end is to ignore errors that i.e. occur when the folders do not exist run: rm -r $SC_BUILD || true - - name: make folders - run: mkdir -p $SC_DEBUG $SC_RELEASE - if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: install sc run: echo "Install sc" if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} @@ -126,6 +123,9 @@ jobs: fetch-depth: 1 path: ${{ env.SC_SOURCE }} if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: make folders + run: mkdir -p $SC_DEBUG $SC_RELEASE + if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} ## sc debug build - name: sc cmake debug run: cd $SC_DEBUG && cmake $SC_SOURCE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SC_DEBUG/install -Dmpi=$MPI -GNinja @@ -173,9 +173,6 @@ jobs: if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} # The true at the end is to ignore errors that i.e. occur when the folders do not exist run: rm -r $P4EST_BUILD || true - - name: make folders - if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE - name: install p4est run: echo "Install p4est" if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} @@ -186,6 +183,9 @@ jobs: fetch-depth: 1 path: ${{ env.P4EST_SOURCE }} if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + - name: make folders + if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} + run: mkdir -p $P4EST_DEBUG $P4EST_RELEASE ## p4est debug build - name: p4est cmake debug run: cd $P4EST_DEBUG && cmake $P4EST_SOURCE -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$P4EST_DEBUG/install -DP4EST_USE_SYSTEM_SC=ON -DSC_DIR=$SC_DEBUG/install/cmake -DP4EST_ENABLE_MPI=$MPI -GNinja From da96b615fbbfa671737e721cc3b0301d2ac446a1 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 14:00:07 +0200 Subject: [PATCH 19/38] remove redundant include --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b396441114..9aa19634f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,8 +21,6 @@ cmake_minimum_required( VERSION 3.19 ) include( cmake/GitProjectVersion.cmake ) -include( FetchContent ) -# All fetchcontent cmake options+ are marked as advanced below. project( T8CODE From 7a7843bd94b55327ef3836a08c231de772e99614 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 14:43:41 +0200 Subject: [PATCH 20/38] remove wrong comment --- .github/workflows/test_preparation.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 00f57bb740..ef826fa2b8 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -106,9 +106,6 @@ jobs: - name: Cache info if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} run: echo No cache found or cache will be ignored. IGNORE_CACHE=$IGNORE_CACHE - - name: install p4est - run: echo "Install p4est" - if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} - name: if ignore cache, delete folders if: ${{ inputs.IGNORE_CACHE == 1 }} # The true at the end is to ignore errors that i.e. occur when the folders do not exist From 254c5d57d8d1f66212111f4b7304ef4713637a3b Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 14:55:10 +0200 Subject: [PATCH 21/38] deactivate ci caching to debug the ci --- .github/workflows/testsuite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index ddbd9b5c03..d73c39fed5 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -119,7 +119,7 @@ jobs: - MAKEFLAGS: -j4 with: MAKEFLAGS: ${{ matrix.MAKEFLAGS }} - IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run + IGNORE_CACHE: true # Use this to force a new installation of sc and p4est for this specific workflow run CACHE_COUNTER: 7 # Increase this number to force a new installation of sc and p4est and to update the cache once MPI: ${{ matrix.MPI }} From 9961d39450f732dbce0ccbb90ead56ddcbc6f572 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Thu, 30 Apr 2026 15:18:50 +0200 Subject: [PATCH 22/38] [run ci] From 01bbd66a9497931ba4a985d25e43754035f3b31d Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 4 May 2026 09:58:13 +0200 Subject: [PATCH 23/38] fix advanced options from fetchcontent --- CMakeLists.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aa19634f5..d1cbf5b81a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,18 +159,22 @@ get_cmake_property(_vars_before_thirdparty VARIABLES ) # Populate the thirdparty libraries include (cmake/thirdparty.cmake) -# Capture the list of variables after adding the thirdparty libraries -get_cmake_property(_vars_after_thirdparty VARIABLES ) -# Compute the difference (new variables added by the libraries) -set( _new_thirdparty_vars) -foreach( _var IN LISTS _vars_after_thirdparty ) - if( NOT _var IN_LIST _vars_before_thirdparty ) - list( APPEND _new_thirdparty_vars ${_var} ) +# Capture the list of variables after adding thirdparty libraries +get_cmake_property(_vars_after_thirdparty VARIABLES) + +# Find variables that exist after but not before +set(_new_thirdparty_vars) +foreach(_var IN LISTS _vars_after_thirdparty) + list(FIND _vars_before_thirdparty "${_var}" _index) + if(_index EQUAL -1) + list(APPEND _new_thirdparty_vars ${_var}) endif() endforeach() # Mark the new variables as advanced -mark_as_advanced( FORCE ${_new_thirdparty_vars} ) +if(_new_thirdparty_vars) + mark_as_advanced(FORCE ${_new_thirdparty_vars}) +endif() # Reactivate previous CMAKE_REQUIRED_FLAGS and CMAKE_C/CXX_FLAGS set( CMAKE_REQUIRED_FLAGS "${T8CODE_OLD_CMAKE_REQUIRED_FLAGS}" ) From 9e1db72d011a39a566249d3c987ae3d3763ce770 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 4 May 2026 09:58:30 +0200 Subject: [PATCH 24/38] make options internal instead of advanced --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1cbf5b81a..bbad1bea7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,22 +110,20 @@ if( T8CODE_ENABLE_MPI ) else() find_package( MPI 3.0 COMPONENTS C REQUIRED ) endif() - set (gtest_disable_mpi OFF CACHE BOOL "disable gtest mpi support" FORCE) + set (gtest_disable_mpi OFF CACHE INTERNAL "disable gtest mpi support" FORCE) if( NOT MPIEXEC_EXECUTABLE ) message( FATAL_ERROR "MPIEXEC was not found" ) endif() - set( SC_ENABLE_MPI ON CACHE BOOL "enable mpi support in libsc" FORCE) + set( SC_ENABLE_MPI ON CACHE INTERNAL "enable mpi support in libsc" FORCE) else() - set( gtest_disable_mpi ON CACHE BOOL "disable gtest mpi support" FORCE) + set( gtest_disable_mpi ON CACHE INTERNAL "disable gtest mpi support" FORCE) endif() ############################################ ThirdParty ############################################ # Set some variables for the thirdparty libraries -mark_as_advanced( FORCE gtest_disable_mpi) -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -mark_as_advanced( FORCE gtest_force_shared_crt) +set(gtest_force_shared_crt ON CACHE INTERNAL "" FORCE) set( P4EST_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) set( P4EST_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} ) set( SC_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) From 05860a7414c1cde833ce8c6b2798c255b5a6da25 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 4 May 2026 10:55:18 +0200 Subject: [PATCH 25/38] remove git_progress due to buffer overflow --- cmake/thirdparty.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/thirdparty.cmake b/cmake/thirdparty.cmake index e65f193e50..320a7b5b10 100644 --- a/cmake/thirdparty.cmake +++ b/cmake/thirdparty.cmake @@ -66,7 +66,6 @@ foreach(INDEX RANGE ${DEPS_RANGE}) ${DEP_NAME} GIT_REPOSITORY ${DEP_URL} GIT_TAG ${DEP_REF} - GIT_PROGRESS TRUE GIT_SHALLOW ${DEP_SHALLOW} ) else() From 3b5e8d1cbff2184dd706adbf85601b1023da66a9 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 4 May 2026 10:59:24 +0200 Subject: [PATCH 26/38] enable cache and increase counter --- .github/workflows/testsuite.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index d73c39fed5..8bac4f031b 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -119,8 +119,8 @@ jobs: - MAKEFLAGS: -j4 with: MAKEFLAGS: ${{ matrix.MAKEFLAGS }} - IGNORE_CACHE: true # Use this to force a new installation of sc and p4est for this specific workflow run - CACHE_COUNTER: 7 # Increase this number to force a new installation of sc and p4est and to update the cache once + IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run + CACHE_COUNTER: 8 # Increase this number to force a new installation of sc and p4est and to update the cache once MPI: ${{ matrix.MPI }} # Run parallel tests for sc and p4est with and without MPI From 13709bba042234895adb3d337c600b55c318a6f2 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 May 2026 14:25:05 +0200 Subject: [PATCH 27/38] update fetchcontent news --- NEWS.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 636293ff8d..fd24645f27 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,7 @@ # Updated dependencies -We have switched from a submodules approach to a FetchContent approach for our dependencies towards p4est and sc. If you don't have already installed p4est and sc, calling cmake will install the right branch from their github. If you have p4est and sc installed already and want to use that version no further code will be downloaded. If your current configuration is to the internal p4est and sc installation you don't need to update your workflow. The submodules of p4est and sc should be removed with this update. Instead they will be downloaded and installed in the _deps folder in your build folder. -If you use a separate installation of p4est and sc it is important to set the boolean CMake Options "T8CODE_USE_SYSTEM_P4EST" and "T8CODE_USE_SYSTEM_SC". It prevents the triggering of the automatic installation of the libraries. -Our recommendation is to delete any existing sc/ and p4est/ folders and use the automatically downloaded FetchContent. +We have switched from a submodules approach to a FetchContent approach for our dependencies p4est and sc. If you use p4est and sc shipped with t8code, calling cmake will pull and add the right commit from github. You can also still link against your local installations. Either way you do not need to update your workflow. The submodules of p4est and sc should be removed with this update. Instead they will be downloaded and installed in the _deps folder in your build folder. +If you use a separate installation of p4est and sc it is important to set the boolean CMake Options "T8CODE_USE_SYSTEM_P4EST" and "T8CODE_USE_SYSTEM_SC" as before. It prevents the triggering of the automatic installation of the libraries. For further information have a look at our [Installation Guide](https://github.com/DLR-AMR/t8code/wiki/Installation). For devs: Further dependencies can be managed in our dependencies.json. @@ -246,7 +245,7 @@ Similarly, the following member variables have been renamed: # Renaming of macros T8_WITH_ to T8_ENABLE_ We renamed the macros T8_WITH_... to T8_ENABLE_... for consistency reasons with the related cmake options (T8CODE_ENABLE...) and other macros. We are currently working on an automatized way to check for wrong usages. -Moreover, we decided to always use #if instead of #ifdef with macros. The #if option allows for more complex conditions and explicitly setting a macro to 0, which is why we chose this option. An incorrect usage of #if and #ifdef is checked in the check_macros.sh script. +Moreover, we decided to always use #if instead of #ifdef with macros. The #if option allows for more complex conditions and explicitly setting a macro to 0, which is why we chose this option. An incorrect usage of #if and #ifdef is checked in the check_macros.sh script. # Update to MPI 3.0 @@ -280,4 +279,4 @@ For more details, see the pull request https://github.com/DLR-AMR/t8code/pull/19 # Documentation on readthedocs -To improve our documentation, to make it more searchable and to simplify the updating process of our documentation, we now host our documentation on readthedocs, see https://t8code.readthedocs.io/en/latest/ . You can also build it locally, if you have sphinx, breathe and exhale installed on your system. To do so, you have to set the dependent option `T8CODE_BUILD_DOCUMENTATION_SPHINX`. We hope to give you an improved way of searching through t8code and find the functions that you need even faster. +To improve our documentation, to make it more searchable and to simplify the updating process of our documentation, we now host our documentation on readthedocs, see https://t8code.readthedocs.io/en/latest/ . You can also build it locally, if you have sphinx, breathe and exhale installed on your system. To do so, you have to set the dependent option `T8CODE_BUILD_DOCUMENTATION_SPHINX`. We hope to give you an improved way of searching through t8code and find the functions that you need even faster. From edf250b612abe3eecee03cd6ee80d341162ab319 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 May 2026 14:27:05 +0200 Subject: [PATCH 28/38] capitalize github variable --- .github/workflows/test_preparation.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index ef826fa2b8..3b6cf7c845 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -88,7 +88,7 @@ jobs: - name: Get sc commit hash and url from thirdparty.json run: | hash=$(jq -r '.thirdparty[] | select(.name=="SC") .source.ref' cmake/thirdparty.json) - echo sc_commit=$hash >> $GITHUB_ENV + echo SC_COMMIT=$hash >> $GITHUB_ENV url=$(jq -r '.thirdparty[] | select(.name=="SC") .source.url' cmake/thirdparty.json) echo sc_url=$url >> $GITHUB_ENV - name: Check cache for previous sc installation @@ -99,7 +99,7 @@ jobs: ${{ env.SC_DEBUG }} ${{ env.SC_RELEASE }} # You can increase the counter at the end to force a new key and hence recomputing the cache - key: sc-cmake-MPI-${{ inputs.MPI }}-${{ env.sc_commit }}-${{ inputs.CACHE_COUNTER }} + key: sc-cmake-MPI-${{ inputs.MPI }}-${{ env.SC_COMMIT }}-${{ inputs.CACHE_COUNTER }} - name: Log that no cache was found run: echo USED_CACHE=0 >> $GITHUB_ENV if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' }} @@ -116,7 +116,7 @@ jobs: - uses: actions/checkout@v6 with: repository: cburstedde/libsc - ref: ${{ env.sc_commit }} + ref: ${{ env.SC_COMMIT }} fetch-depth: 1 path: ${{ env.SC_SOURCE }} if: ${{ steps.sc_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} @@ -148,7 +148,7 @@ jobs: - name: Get p4est commit hash and url from thirdparty.json run: | hash=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.ref' cmake/thirdparty.json) - echo p4est_commit=$hash >> $GITHUB_ENV + echo P4EST_COMMIT=$hash >> $GITHUB_ENV url=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.url' cmake/thirdparty.json) echo p4est_url=$url >> $GITHUB_ENV - name: Check cache for previous p4est installation @@ -159,7 +159,7 @@ jobs: ${{ env.P4EST_DEBUG }} ${{ env.P4EST_RELEASE }} # You can increase the counter at the end to force a new key and hence recomputing the cache - key: p4est-cmake-MPI-${{ inputs.MPI }}-${{ env.p4est_commit }}-${{ env.sc_commit }}-${{ inputs.CACHE_COUNTER }} + key: p4est-cmake-MPI-${{ inputs.MPI }}-${{ env.P4EST_COMMIT }}-${{ env.SC_COMMIT }}-${{ inputs.CACHE_COUNTER }} - name: Log that no cache was found run: echo USED_CACHE=0 >> $GITHUB_ENV if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' }} @@ -176,7 +176,7 @@ jobs: - uses: actions/checkout@v6 with: repository: cburstedde/p4est - ref: ${{ env.p4est_commit }} + ref: ${{ env.P4EST_COMMIT }} fetch-depth: 1 path: ${{ env.P4EST_SOURCE }} if: ${{ steps.p4est_cmake_cache.outputs.cache-hit != 'true' || inputs.IGNORE_CACHE == 1 }} From 541af75822af4c60f39617174044a6f860bf74af Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 May 2026 14:30:02 +0200 Subject: [PATCH 29/38] update comment --- cmake/thirdparty.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/thirdparty.cmake b/cmake/thirdparty.cmake index 320a7b5b10..84a9a8b1d2 100644 --- a/cmake/thirdparty.cmake +++ b/cmake/thirdparty.cmake @@ -40,7 +40,7 @@ foreach(INDEX RANGE ${DEPS_RANGE}) # If the DEP_CMAKE_OPTION field is non-empty, check the CMake option. if(NOT DEP_CMAKE_OPTION STREQUAL "") - # If the named option variable does not exist in the CMake cache, warn and proceed. + # If the named option variable does not exist in the CMake cache, abort. if(NOT DEFINED ${DEP_CMAKE_OPTION}) message(FATAL_ERROR "Loading thirdparty library ${DEP_NAME} at index ${INDEX} references unknown CMake option '${DEP_CMAKE_OPTION}'. Aborting.") else() From 388d966aeafcdb55e668e015d2c9d5b1017f26b0 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 May 2026 14:30:22 +0200 Subject: [PATCH 30/38] update comment --- cmake/thirdparty.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/thirdparty.cmake b/cmake/thirdparty.cmake index 84a9a8b1d2..0ec4b5de58 100644 --- a/cmake/thirdparty.cmake +++ b/cmake/thirdparty.cmake @@ -54,7 +54,7 @@ foreach(INDEX RANGE ${DEPS_RANGE}) message(STATUS "Configuring thirdparty library: ${DEP_NAME} (Type: ${DEP_TYPE}, SHALLOW: ${DEP_SHALLOW})") - #If Dep_SHALLOW is not a valid boolean, set it to FALSE and print a warning. + # If Dep_SHALLOW is not a valid boolean, set it to FALSE and print a warning. if(NOT DEP_SHALLOW STREQUAL "TRUE" AND NOT DEP_SHALLOW STREQUAL "FALSE") message(STATUS "Invalid value for 'shallow' in thirdparty library ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'true' or 'false'. Defaulting to 'false'.") set(DEP_SHALLOW FALSE) From adbab79226faff1bba913da776645a1a29cb9400 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 May 2026 14:38:11 +0200 Subject: [PATCH 31/38] capitalize TRUE and FALSE --- cmake/thirdparty.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/thirdparty.cmake b/cmake/thirdparty.cmake index 0ec4b5de58..b5911f97e9 100644 --- a/cmake/thirdparty.cmake +++ b/cmake/thirdparty.cmake @@ -56,7 +56,7 @@ foreach(INDEX RANGE ${DEPS_RANGE}) # If Dep_SHALLOW is not a valid boolean, set it to FALSE and print a warning. if(NOT DEP_SHALLOW STREQUAL "TRUE" AND NOT DEP_SHALLOW STREQUAL "FALSE") - message(STATUS "Invalid value for 'shallow' in thirdparty library ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'true' or 'false'. Defaulting to 'false'.") + message(STATUS "Invalid value for 'shallow' in thirdparty library ${DEP_NAME}: '${DEP_SHALLOW}'. Expected 'TRUE' or 'FALSE'. Defaulting to 'FALSE'.") set(DEP_SHALLOW FALSE) endif() From 211c9289c60c1fe68eee3d6218502e7219bf789d Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 May 2026 14:40:26 +0200 Subject: [PATCH 32/38] indent --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbad1bea7b..19a6cc69c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,7 @@ endif() ############################################ ThirdParty ############################################ # Set some variables for the thirdparty libraries -set(gtest_force_shared_crt ON CACHE INTERNAL "" FORCE) +set( gtest_force_shared_crt ON CACHE INTERNAL "" FORCE ) set( P4EST_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) set( P4EST_BUILD_TESTING ${T8CODE_BUILD_TPL_TESTS} ) set( SC_BUILD_EXAMPLES ${T8CODE_BUILD_TPL_EXAMPLES} ) From 0aef724f37079018afecc13e767db629d30cae0d Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 May 2026 14:44:51 +0200 Subject: [PATCH 33/38] remove redundant mark as advanced --- cmake/thirdparty.cmake | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cmake/thirdparty.cmake b/cmake/thirdparty.cmake index b5911f97e9..34e5b13110 100644 --- a/cmake/thirdparty.cmake +++ b/cmake/thirdparty.cmake @@ -75,11 +75,3 @@ foreach(INDEX RANGE ${DEPS_RANGE}) # 3. Populate the thirdparty library FetchContent_MakeAvailable(${DEP_NAME}) endforeach() - -# Mark all cmake options starting with FETCHCONTENT as advanced. -get_cmake_property(_cmake_vars VARIABLES) -foreach(_var ${_cmake_vars}) - if(_var MATCHES "^FETCHCONTENT_.*") - mark_as_advanced(${_var}) - endif() -endforeach() From 4a42b662cfe7bc075a38aafc4b808f3720d27f40 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 20 May 2026 12:39:51 +0200 Subject: [PATCH 34/38] [run ci] From e14dd5319b413111aae51089563ce8a093e5bb89 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 20 May 2026 12:44:11 +0200 Subject: [PATCH 35/38] [run ci] From 19b3077773f94b13451a0db9f3344b81431d0013 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 20 May 2026 12:57:13 +0200 Subject: [PATCH 36/38] add sc and p4est source to cache --- .github/workflows/test_preparation.yml | 6 ++---- .github/workflows/testsuite.yml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 3b6cf7c845..72b9f6a4c2 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -96,8 +96,7 @@ jobs: uses: actions/cache@v5 with: path: | - ${{ env.SC_DEBUG }} - ${{ env.SC_RELEASE }} + ${{ env.SC_SOURCE }} # You can increase the counter at the end to force a new key and hence recomputing the cache key: sc-cmake-MPI-${{ inputs.MPI }}-${{ env.SC_COMMIT }}-${{ inputs.CACHE_COUNTER }} - name: Log that no cache was found @@ -156,8 +155,7 @@ jobs: uses: actions/cache@v5 with: path: | - ${{ env.P4EST_DEBUG }} - ${{ env.P4EST_RELEASE }} + ${{ env.P4EST_SOURCE }} # You can increase the counter at the end to force a new key and hence recomputing the cache key: p4est-cmake-MPI-${{ inputs.MPI }}-${{ env.P4EST_COMMIT }}-${{ env.SC_COMMIT }}-${{ inputs.CACHE_COUNTER }} - name: Log that no cache was found diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml index 8bac4f031b..b3a691562a 100644 --- a/.github/workflows/testsuite.yml +++ b/.github/workflows/testsuite.yml @@ -120,7 +120,7 @@ jobs: with: MAKEFLAGS: ${{ matrix.MAKEFLAGS }} IGNORE_CACHE: false # Use this to force a new installation of sc and p4est for this specific workflow run - CACHE_COUNTER: 8 # Increase this number to force a new installation of sc and p4est and to update the cache once + CACHE_COUNTER: 9 # Increase this number to force a new installation of sc and p4est and to update the cache once MPI: ${{ matrix.MPI }} # Run parallel tests for sc and p4est with and without MPI From d65caecd501d7dc111047b8568f2056a36ed0249 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 20 May 2026 13:08:43 +0200 Subject: [PATCH 37/38] [run ci] From fa0a0ec5f74b558cd16ee663d4ef27a8c3fe9c77 Mon Sep 17 00:00:00 2001 From: Benedict <135045760+benegee@users.noreply.github.com> Date: Wed, 20 May 2026 13:53:52 +0200 Subject: [PATCH 38/38] Two more upper case GITHUB_ENV vars --- .github/workflows/test_preparation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_preparation.yml b/.github/workflows/test_preparation.yml index 72b9f6a4c2..d0314d7e44 100644 --- a/.github/workflows/test_preparation.yml +++ b/.github/workflows/test_preparation.yml @@ -90,7 +90,7 @@ jobs: hash=$(jq -r '.thirdparty[] | select(.name=="SC") .source.ref' cmake/thirdparty.json) echo SC_COMMIT=$hash >> $GITHUB_ENV url=$(jq -r '.thirdparty[] | select(.name=="SC") .source.url' cmake/thirdparty.json) - echo sc_url=$url >> $GITHUB_ENV + echo SC_URL=$url >> $GITHUB_ENV - name: Check cache for previous sc installation id: sc_cmake_cache uses: actions/cache@v5 @@ -149,7 +149,7 @@ jobs: hash=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.ref' cmake/thirdparty.json) echo P4EST_COMMIT=$hash >> $GITHUB_ENV url=$(jq -r '.thirdparty[] | select(.name=="P4EST") .source.url' cmake/thirdparty.json) - echo p4est_url=$url >> $GITHUB_ENV + echo P4EST_URL=$url >> $GITHUB_ENV - name: Check cache for previous p4est installation id: p4est_cmake_cache uses: actions/cache@v5