From 5614d154fab9d318dbcdd55e72b3047aca3a59ca Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Wed, 29 Oct 2025 15:38:21 +0100 Subject: [PATCH 01/24] GRIDEDIT-2016 updated zlib from v1.2.13 to 'v1.2.13 --- scripts/install_netcdf_static.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_netcdf_static.ps1 b/scripts/install_netcdf_static.ps1 index 87d39dd641..82576947c3 100644 --- a/scripts/install_netcdf_static.ps1 +++ b/scripts/install_netcdf_static.ps1 @@ -35,7 +35,7 @@ Param( [Parameter(Mandatory = $true)] [string] $InstallDir, [Parameter(Mandatory = $false)] [ValidateSet('Release', 'Debug', 'RelWithDebInfo')] [string] $BuildType = 'Release', [Parameter(Mandatory = $false)] [hashtable]$GitTags = @{ ` - zlib = 'v1.2.13'; ` + zlib = 'v1.3.1'; ` curl = 'curl-7_88_1'; ` hdf5 = 'hdf5-1_14_0'; ` netcdf_c = 'v4.9.1' From 96e4378a621465caa2cb544c27e80fafb3ae21f2 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Wed, 29 Oct 2025 15:46:23 +0100 Subject: [PATCH 02/24] GRIDEDIT-2016 removed setting custom xCode version. will fall back on the default version installed on the macOS runner. --- .github/workflows/build-and-test-workflow.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 8e9d8cf5cc..51bf73b68c 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -35,10 +35,6 @@ jobs: with: fetch-depth: 0 - - name: Set Xcode version - if: inputs.platform == 'macos-14' || inputs.platform == 'macos-15' - run: sudo xcode-select -s /Applications/Xcode_14.1.app/Contents/Developer - # Step: Set paths - name: Set paths id: paths From ba89c88d3de8c1d791ecebf8ffb80b2717859975 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Thu, 30 Oct 2025 14:35:15 +0100 Subject: [PATCH 03/24] GRIDEDIT-2016 Updated google test framework from 1.13 to 1.17 --- cmake/fetch_content.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/fetch_content.cmake b/cmake/fetch_content.cmake index 8bb0d21d9e..645e38931c 100644 --- a/cmake/fetch_content.cmake +++ b/cmake/fetch_content.cmake @@ -5,7 +5,7 @@ if(ENABLE_UNIT_TESTING) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG v1.13.0) + GIT_TAG v1.17.0) FetchContent_GetProperties(googletest) if(NOT googletest_POPULATED) From f9f330d32f0dd494d1d35ce7e43b3dbbb02b1023 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Thu, 30 Oct 2025 15:38:30 +0100 Subject: [PATCH 04/24] GRIDEDIT-2016 Added support for the (Apple)clang compiler on MacOS. While also keeping support for GCC on MacOS. --- cmake/compiler_config.cmake | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/cmake/compiler_config.cmake b/cmake/compiler_config.cmake index 76d86a0cc6..beea542aee 100644 --- a/cmake/compiler_config.cmake +++ b/cmake/compiler_config.cmake @@ -9,22 +9,43 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Add compiler-specific options and definitions per supported platform -if (UNIX) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +if(APPLE) + # macOS: support AppleClang / Clang (system toolchain). GCC may also be supported but Clang is preferred. + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + message(STATUS "Configuring build for macOS with ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER_VERSION}).") + # Common warning and visibility flags + add_compile_options("-fvisibility=hidden;-Wall;-Wextra;-pedantic;-Werror;-Wno-unused-function") + # Be lenient for Eigen (deprecated enum conversion) on arm64 + if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64") + add_compile_options($<$:-Wno-deprecated-enum-enum-conversion>) + endif() + # Optimization / debug flags + add_compile_options("$<$:-O2>") + add_compile_options("$<$:-g>") + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # Fallback: allow GNU on macOS if explicitly selected + message(STATUS "Configuring build for macOS with GNU ${CMAKE_CXX_COMPILER_VERSION}.") add_compile_options("-fvisibility=hidden;-Werror;-Wall;-Wextra;-pedantic;-Wno-unused-function") - - if(APPLE AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")) + if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64") # CMake automatically sets -Xarch_arm64 (for clang) but gcc doesn't support it unset(_CMAKE_APPLE_ARCHS_DEFAULT) - # Be lenient on macos with arm64 toolchain to prevent Eigen -Werror=deprecated-enum-enum-conversion error add_compile_options($<$:-Wno-deprecated-enum-enum-conversion>) - # Suppress notes related to ABI changes add_compile_options($<$:-Wno-psabi>) endif() add_compile_options("$<$:-O2>") add_compile_options("$<$:-g>") else() - message(FATAL_ERROR "Unsupported compiler. Only GNU is supported under Linux. Found ${CMAKE_CXX_COMPILER_ID}.") + message(FATAL_ERROR "Unsupported compiler on macOS. Supported: AppleClang/Clang or GNU. Found ${CMAKE_CXX_COMPILER_ID}.") + endif() +elseif(UNIX) + # Linux: require GNU + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message(STATUS "Configuring build for Linux with GNU ${CMAKE_CXX_COMPILER_VERSION}.") + add_compile_options("-fvisibility=hidden;-Werror;-Wall;-Wextra;-pedantic;-Wno-unused-function") + add_compile_options("$<$:-O2>") + add_compile_options("$<$:-g>") + else() + message(FATAL_ERROR "Unsupported compiler on Linux. Only GNU is supported. Found ${CMAKE_CXX_COMPILER_ID}.") endif() elseif(WIN32) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") @@ -37,7 +58,7 @@ elseif(WIN32) message(FATAL_ERROR "Unsupported compiler. Only MSVC is supported under Windows. Found ${CMAKE_CXX_COMPILER_ID}.") endif() else() - message(FATAL_ERROR "Unsupported platform. Only Linux and Windows are supported.") + message(FATAL_ERROR "Unsupported platform. Only macOS, Linux and Windows are supported.") endif() # CMAKE_SOURCE_DIR is passed to the src in order to strip it out of the path of srcs where exceptions may occur From 91c162b44921b9817fd31b72b951659b44b087bf Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 09:28:18 +0100 Subject: [PATCH 05/24] GRIDEDIT-2016 switched MacOS builds from gcc12 to clang. --- .github/workflows/build-and-test-workflow.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 51bf73b68c..118dbe5ff2 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -14,18 +14,9 @@ on: jobs: build: - # Build platform runs-on: ${{ inputs.platform }} - name: ${{ inputs.platform }}-${{ inputs.build_type }} - # The default compiler on macos is clang, switch to gcc. Specifying the version is necessary. - # It seems like gcc and g++ are symbolic links to the default clang and clang++ compilers, respectively. - # CMAKE_CXX_COMPILER_ID will evaluate to AppleClang rather than GNU on macos. - env: - CC: gcc-12 - CXX: g++-12 - # Build steps steps: # Step: Checkout @@ -35,6 +26,15 @@ jobs: with: fetch-depth: 0 + # Step: Set compiler (use system Clang for all macOS versions) + - name: Set compiler (macOS Clang) + if: runner.os == 'macOS' + run: | + echo "Using system Clang for ${{ inputs.platform }}" + echo "CC=clang" >> "$GITHUB_ENV" + echo "CXX=clang++" >> "$GITHUB_ENV" + echo "Configured Clang toolchain: $(clang --version | head -n 1)" + # Step: Set paths - name: Set paths id: paths From f0121ccab023dff5d78abb814477bfb64a897c89 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 14:09:07 +0100 Subject: [PATCH 06/24] GRIDEDIT-2016 updated cache key. this will result in a new cache being generated in github actions. --- .github/workflows/build-and-test-workflow.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 118dbe5ff2..78541eaa1c 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -56,8 +56,8 @@ jobs: uses: actions/cache/restore@v3 id: restore-cached-external-dependencies with: - key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key - restore-keys: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key + key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v2 + restore-keys: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v2 path: ${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c # Step: Build and install user-provided dependencies, executes only if no cache restored @@ -76,7 +76,7 @@ jobs: uses: actions/cache/save@v3 if: steps.restore-cached-external-dependencies.outputs.cache-hit != 'true' with: - key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key + key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v2 path: ${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c # Step: CMake configuration From 3c300930858ef1d4afcc3e5e21d20d2d6f8c7466 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 14:17:13 +0100 Subject: [PATCH 07/24] GRIDEDIT-2016 added build step to validate that the contents of the restored cache is not empty --- .github/workflows/build-and-test-workflow.yml | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 78541eaa1c..77dbf188c8 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -60,9 +60,20 @@ jobs: restore-keys: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v2 path: ${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c + # Step: Check if netCDF cache directory already has contents (defensive guard) + - name: Check if netCDF cache is populated + id: check-nc-cache + run: | + netcdf_dir="${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c" + if [ -d "$netcdf_dir" ] && [ "$(ls -A "$netcdf_dir" 2>/dev/null)" ]; then + echo "has-deps=true" >> "$GITHUB_OUTPUT" + else + echo "has-deps=false" >> "$GITHUB_OUTPUT" + fi + # Step: Build and install user-provided dependencies, executes only if no cache restored - name: Build and install user-provided dependencies - if: steps.restore-cached-external-dependencies.outputs.cache-hit != 'true' + if: steps.check-nc-cache.outputs.has-deps == 'false' # NetCDF Dependencies m4, curl, and openssl are provided by the build machine run: > pwsh ${{ github.workspace }}/scripts/install_netcdf_static.ps1 @@ -89,6 +100,13 @@ jobs: -DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c -DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }} + cmake + -S /Users/runner/work/MeshKernel/MeshKernel + -B /Users/runner/work/MeshKernel/MeshKernel/build + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_PREFIX_PATH=/Users/runner/work/MeshKernel/MeshKernel/external_dependencies/netcdf-c/install/netcdf-c + -DCMAKE_INSTALL_PREFIX=/Users/runner/work/MeshKernel/MeshKernel/install + # Step: CMake build - name: Build run: cmake --build ${{ steps.paths.outputs.build_dir }} --config ${{ inputs.build_type }} -j 4 From ee22af0535fdf90f9e829b2ecb9f21344720a11f Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 14:43:02 +0100 Subject: [PATCH 08/24] GRIDEDIT-2016 added steps to install openMP on macOS agents. --- .github/workflows/build-and-test-workflow.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 77dbf188c8..7a17bf0467 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -51,6 +51,20 @@ jobs: sudo apt-get install libboost-all-dev doxygen fi + # Step: Install OpenMP for macOS + - name: Install OpenMP for macOS + if: runner.os == 'macOS' + run: brew install libomp + + # Step: Set OpenMP environment variables (persist for later steps) + - name: Set OpenMP environment variables + if: runner.os == 'macOS' + run: | + BREW_PREFIX=$(brew --prefix libomp) + echo "LDFLAGS=-L${BREW_PREFIX}/lib" >> "$GITHUB_ENV" + echo "CPPFLAGS=-I${BREW_PREFIX}/include" >> "$GITHUB_ENV" + echo "OpenMP flags set: LDFLAGS=$LDFLAGS CPPFLAGS=$CPPFLAGS" + # Step: Restore cached user-provided dependencies - name: Restore cached user-provided dependencies uses: actions/cache/restore@v3 From 43767c0e5af6bf1cf97226a902fa9120b9a95c65 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 14:46:29 +0100 Subject: [PATCH 09/24] GRIDEDIT-2016 removed cmake call that should not have been committed --- .github/workflows/build-and-test-workflow.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 7a17bf0467..92aadeda65 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -114,13 +114,6 @@ jobs: -DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c -DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }} - cmake - -S /Users/runner/work/MeshKernel/MeshKernel - -B /Users/runner/work/MeshKernel/MeshKernel/build - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_PREFIX_PATH=/Users/runner/work/MeshKernel/MeshKernel/external_dependencies/netcdf-c/install/netcdf-c - -DCMAKE_INSTALL_PREFIX=/Users/runner/work/MeshKernel/MeshKernel/install - # Step: CMake build - name: Build run: cmake --build ${{ steps.paths.outputs.build_dir }} --config ${{ inputs.build_type }} -j 4 From dddf391a95f22dfce862c42f9ae291922561423c Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 14:48:33 +0100 Subject: [PATCH 10/24] GRIDEDIT-2016 added flags to cmake to find OpenMP for Clang --- .github/workflows/build-and-test-workflow.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 92aadeda65..e74b26cd53 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -113,6 +113,10 @@ jobs: -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c -DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }} + -DCMAKE_C_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" + -DCMAKE_CXX_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" + -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/libomp/lib -lomp" + # Step: CMake build - name: Build From 374522fb6d9c854aa086f125c4c9198177cf62b8 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 14:55:14 +0100 Subject: [PATCH 11/24] GRIDEDIT-2016 removed macos runner check during openMP configuration --- .github/workflows/build-and-test-workflow.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index e74b26cd53..1cc0a39c10 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -51,19 +51,15 @@ jobs: sudo apt-get install libboost-all-dev doxygen fi - # Step: Install OpenMP for macOS - - name: Install OpenMP for macOS - if: runner.os == 'macOS' + # Step: Install OpenMP + - name: Install OpenMP run: brew install libomp - # Step: Set OpenMP environment variables (persist for later steps) + # Step: Set OpenMP environment variables - name: Set OpenMP environment variables - if: runner.os == 'macOS' run: | - BREW_PREFIX=$(brew --prefix libomp) - echo "LDFLAGS=-L${BREW_PREFIX}/lib" >> "$GITHUB_ENV" - echo "CPPFLAGS=-I${BREW_PREFIX}/include" >> "$GITHUB_ENV" - echo "OpenMP flags set: LDFLAGS=$LDFLAGS CPPFLAGS=$CPPFLAGS" + echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib" >> $GITHUB_ENV + echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV # Step: Restore cached user-provided dependencies - name: Restore cached user-provided dependencies From 8d39d3e9f8ff16b7f7148708b8a6b13d3552f033 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 15:01:24 +0100 Subject: [PATCH 12/24] GRIDEDIT-2016 change locations of openMP --- .github/workflows/build-and-test-workflow.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 1cc0a39c10..d16eed9248 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -109,10 +109,9 @@ jobs: -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c -DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }} - -DCMAKE_C_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" - -DCMAKE_CXX_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" - -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/opt/libomp/lib -lomp" - + -DCMAKE_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" + -DCMAKE_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" + -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp" # Step: CMake build - name: Build From 0b3f70f91d8481d9c6e9e5ad804fd8f89281435c Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 15:12:45 +0100 Subject: [PATCH 13/24] GRIDEDIT-2016 updated compiler settings for traingle.c file, add checks for clang compiler. --- extern/triangle/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extern/triangle/CMakeLists.txt b/extern/triangle/CMakeLists.txt index 8d9cb93fc6..d2a45126a5 100644 --- a/extern/triangle/CMakeLists.txt +++ b/extern/triangle/CMakeLists.txt @@ -38,10 +38,11 @@ target_compile_definitions( ) # platform-specific compiler options and definitions for disabling warnings -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(${target_name} PRIVATE "-w") -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(${target_name} PRIVATE "/w") +# Use the C compiler ID because this target is pure C. Disable warnings for GCC and Clang. +if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") + target_compile_options(${target_name} PRIVATE -w) +elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC") + target_compile_options(${target_name} PRIVATE /w) endif() # group the sources and headers in IDE project generation From 88594de732e13a6ec60da45ac3ba2203b882c8fd Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 15:40:08 +0100 Subject: [PATCH 14/24] GRIDEDIT-2016 Implemented GCC-only guards around the problematic #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" so Clang/AppleClang on macOS no longer sees an unsupported warning group. --- libs/MeshKernel/include/MeshKernel/Constants.hpp | 5 +++-- libs/MeshKernel/include/MeshKernel/ProjectionConversions.hpp | 5 +++-- .../include/MeshKernel/Utilities/LinearAlgebra.hpp | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/MeshKernel/include/MeshKernel/Constants.hpp b/libs/MeshKernel/include/MeshKernel/Constants.hpp index 96c5de1731..8cd340b685 100644 --- a/libs/MeshKernel/include/MeshKernel/Constants.hpp +++ b/libs/MeshKernel/include/MeshKernel/Constants.hpp @@ -33,14 +33,15 @@ #include #include -#if defined(__linux__) || defined(__APPLE__) +#if defined(__GNUC__) && !defined(__clang__) +// GCC only: suppress -Wmaybe-uninitialized (not recognized by Clang / AppleClang) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include -#if defined(__linux__) || defined(__APPLE__) +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif diff --git a/libs/MeshKernel/include/MeshKernel/ProjectionConversions.hpp b/libs/MeshKernel/include/MeshKernel/ProjectionConversions.hpp index 92465a7a4b..cf2c049da8 100644 --- a/libs/MeshKernel/include/MeshKernel/ProjectionConversions.hpp +++ b/libs/MeshKernel/include/MeshKernel/ProjectionConversions.hpp @@ -29,7 +29,8 @@ #include -#if defined(__linux__) || defined(__APPLE__) +#if defined(__GNUC__) && !defined(__clang__) +// GCC only: suppress -Wmaybe-uninitialized (Clang/AppleClang doesn't support it) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif @@ -39,7 +40,7 @@ #include #undef BOOST_ALLOW_DEPRECATED_HEADERS -#if defined(__linux__) || defined(__APPLE__) +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif diff --git a/libs/MeshKernel/include/MeshKernel/Utilities/LinearAlgebra.hpp b/libs/MeshKernel/include/MeshKernel/Utilities/LinearAlgebra.hpp index 0acf1301a0..91472e4204 100644 --- a/libs/MeshKernel/include/MeshKernel/Utilities/LinearAlgebra.hpp +++ b/libs/MeshKernel/include/MeshKernel/Utilities/LinearAlgebra.hpp @@ -30,14 +30,15 @@ #include "MeshKernel/Definitions.hpp" #include "MeshKernel/Exceptions.hpp" -#ifdef __linux__ +#if defined(__GNUC__) && !defined(__clang__) +// GCC only: suppress -Wmaybe-uninitialized (Clang does not have this warning group) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif #include #include -#ifdef __linux__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif From f0aa660b8d2e29177d01780dcfd93bb9a9070a4d Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 15:58:15 +0100 Subject: [PATCH 15/24] GRIDEDIT-2016 set clang specific compiler flags. --- libs/MeshKernel/include/MeshKernel/LandBoundaries.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/MeshKernel/include/MeshKernel/LandBoundaries.hpp b/libs/MeshKernel/include/MeshKernel/LandBoundaries.hpp index bba2dd4265..7134f58a35 100644 --- a/libs/MeshKernel/include/MeshKernel/LandBoundaries.hpp +++ b/libs/MeshKernel/include/MeshKernel/LandBoundaries.hpp @@ -35,6 +35,11 @@ #include +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdefaulted-function-deleted" +#endif + namespace meshkernel { class Polygons; @@ -246,3 +251,7 @@ namespace meshkernel }; } // namespace meshkernel + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif \ No newline at end of file From 35857b13e2caddabd88a6649ed6ae492cac580cd Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 16:30:54 +0100 Subject: [PATCH 16/24] GRIDEDIT-2016 fixing clang compilation issues. --- libs/MeshKernel/src/Mesh2D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/MeshKernel/src/Mesh2D.cpp b/libs/MeshKernel/src/Mesh2D.cpp index e92a23c76c..d4fe095fae 100644 --- a/libs/MeshKernel/src/Mesh2D.cpp +++ b/libs/MeshKernel/src/Mesh2D.cpp @@ -2117,7 +2117,7 @@ std::vector Mesh2D::NodeMaskFromPolygon(const Polygons& polygon, bool insid for (UInt i = 0; i < nodeMask.size(); ++i) { - auto isInPolygon = nodePolygonIndices[i]; + bool isInPolygon = static_cast(nodePolygonIndices[i]); if (!inside) { isInPolygon = !isInPolygon; From 9908180f38c419e436eed01465c91b994eae434d Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 17:20:08 +0100 Subject: [PATCH 17/24] GRIDEDIT-2016 removed unused variable Mesh2DtoCurvilinear.n_maxNumRowsColumns --- libs/MeshKernel/include/MeshKernel/Mesh2DToCurvilinear.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/MeshKernel/include/MeshKernel/Mesh2DToCurvilinear.hpp b/libs/MeshKernel/include/MeshKernel/Mesh2DToCurvilinear.hpp index 6bb123151c..9415467032 100644 --- a/libs/MeshKernel/include/MeshKernel/Mesh2DToCurvilinear.hpp +++ b/libs/MeshKernel/include/MeshKernel/Mesh2DToCurvilinear.hpp @@ -211,8 +211,7 @@ namespace meshkernel {1, 0}, {0, 1}}}; ///< increments for the new nodes depending on the node direction - const int n_maxNumRowsColumns = 1000000; ///< The maximum number of allowed rows or columns - + MatrixWithNegativeIndices m_mapping; ///< Unstructured node indices in the curvilinear grid }; From 7a778c4c6c8c13a559faac0e2f5f2281f0fbf1c9 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 17:24:41 +0100 Subject: [PATCH 18/24] GRIDEDIT-2016 Be more linient for Eigen --- cmake/compiler_config.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/compiler_config.cmake b/cmake/compiler_config.cmake index beea542aee..312139a98a 100644 --- a/cmake/compiler_config.cmake +++ b/cmake/compiler_config.cmake @@ -15,10 +15,8 @@ if(APPLE) message(STATUS "Configuring build for macOS with ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER_VERSION}).") # Common warning and visibility flags add_compile_options("-fvisibility=hidden;-Wall;-Wextra;-pedantic;-Werror;-Wno-unused-function") - # Be lenient for Eigen (deprecated enum conversion) on arm64 - if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64") - add_compile_options($<$:-Wno-deprecated-enum-enum-conversion>) - endif() + # Be lenient for Eigen (deprecated enum conversion) on all macOS Clang builds + add_compile_options($<$:-Wno-deprecated-enum-enum-conversion>) # Optimization / debug flags add_compile_options("$<$:-O2>") add_compile_options("$<$:-g>") From 96908286042d29a15f736bad39a4573245414434 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 31 Oct 2025 17:37:22 +0100 Subject: [PATCH 19/24] GRIDEDIT-2016 Updated Eigen to V5.0.0 --- cmake/fetch_content.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/fetch_content.cmake b/cmake/fetch_content.cmake index 645e38931c..87c9de375a 100644 --- a/cmake/fetch_content.cmake +++ b/cmake/fetch_content.cmake @@ -89,7 +89,7 @@ if(${USE_LIBFMT}) FetchContent_Declare( Eigen GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git - GIT_TAG 21cd3fe20990a5ac1d683806f605110962aac3f1 + GIT_TAG 549bf8c75b6aae071cde2f28aa48f16ee3ae60b0 ) FetchContent_GetProperties(Eigen) From def6a18dcf5ef3075586589ba50112b7ff197f73 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 14 Nov 2025 13:26:49 +0100 Subject: [PATCH 20/24] GRIDEDIT-2016 removed gcc install from macOS --- .github/workflows/build-and-test-workflow.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index c812c74776..53065c6cd3 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -19,14 +19,6 @@ jobs: # Build steps steps: - # Step: Install GCC (macOS only) - - name: Install GCC - if: startsWith(runner.os, 'macOS') - run: | - brew install gcc@12 - echo "CC=$(brew --prefix)/bin/gcc-12" >> $GITHUB_ENV - echo "CXX=$(brew --prefix)/bin/g++-12" >> $GITHUB_ENV - # Step: Checkout - name: Checkout uses: actions/checkout@v4 From aeee639c9e42c1b6445e9389903b13eacd88488a Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 14 Nov 2025 15:13:24 +0100 Subject: [PATCH 21/24] GRIDEDIT-2016 removing unused variables. --- tools/test_utils/src/MakeCurvilinearGrids.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/test_utils/src/MakeCurvilinearGrids.cpp b/tools/test_utils/src/MakeCurvilinearGrids.cpp index a059fa5193..7d045bc00c 100644 --- a/tools/test_utils/src/MakeCurvilinearGrids.cpp +++ b/tools/test_utils/src/MakeCurvilinearGrids.cpp @@ -25,7 +25,6 @@ size_t CurvilinearGridCountValidNodes(meshkernelapi::CurvilinearGrid const& curv size_t CurvilinearGridCountValidNodes(meshkernel::CurvilinearGrid const& curvilinearGrid) { size_t validNodes = 0; - size_t index = 0; for (meshkernel::UInt n = 0; n < curvilinearGrid.NumN(); ++n) { for (meshkernel::UInt m = 0; m < curvilinearGrid.NumM(); ++m) @@ -34,7 +33,6 @@ size_t CurvilinearGridCountValidNodes(meshkernel::CurvilinearGrid const& curvili { validNodes++; } - index++; } } return validNodes; From 7317cdcaf7a350644714f681ba74fda01233dfc4 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 14 Nov 2025 15:29:04 +0100 Subject: [PATCH 22/24] GRIDEDIT-2016 changed cache key. force rebuild of cached dependencies. --- .github/workflows/build-and-test-workflow.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 53065c6cd3..2072844133 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -66,8 +66,7 @@ jobs: uses: actions/cache/restore@v4 id: restore-cached-external-dependencies with: - key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v4 - restore-keys: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v4 + key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v5 path: ${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c # Step: Check if netCDF cache directory already has contents (defensive guard) @@ -97,7 +96,7 @@ jobs: uses: actions/cache/save@v4 if: steps.check-nc-cache.outputs.has-deps == 'false' with: - key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v4 + key: ${{ inputs.platform }}-${{ inputs.build_type }}-cache-key-v5 path: ${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c # Step: CMake configuration From e2bf3c5f86627935cbcb7ca91285c4e4aa4128b6 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 14 Nov 2025 17:05:35 +0100 Subject: [PATCH 23/24] GRIDEDIT-2016 add verbose logging to cmake config. --- .github/workflows/build-and-test-workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 2072844133..2b4bd4577c 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -108,8 +108,9 @@ jobs: -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c -DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }} + -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" - -DCMAKE_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" + -DCMAKE_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include -v" -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp" # Step: CMake build From 368299c18260e512f2012bd5f70eeb997092a416 Mon Sep 17 00:00:00 2001 From: Scott Willcox Date: Fri, 14 Nov 2025 17:16:29 +0100 Subject: [PATCH 24/24] GRIDEDIT-2016 adding logging to better detect linking problems. --- .github/workflows/build-and-test-workflow.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test-workflow.yml b/.github/workflows/build-and-test-workflow.yml index 2b4bd4577c..a0c368eadd 100644 --- a/.github/workflows/build-and-test-workflow.yml +++ b/.github/workflows/build-and-test-workflow.yml @@ -60,6 +60,10 @@ jobs: run: | echo "LDFLAGS=-L/opt/homebrew/opt/libomp/lib" >> $GITHUB_ENV echo "CPPFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV + echo "Debug: Checking OpenMP installation:" + ls -la /opt/homebrew/opt/libomp/lib/ || echo "OpenMP lib directory not found" + ls -la /opt/homebrew/opt/libomp/include/ || echo "OpenMP include directory not found" + file /opt/homebrew/opt/libomp/lib/libomp.dylib || echo "libomp.dylib not found" # Step: Restore cached user-provided dependencies - name: Restore cached user-provided dependencies @@ -109,13 +113,20 @@ jobs: -DCMAKE_PREFIX_PATH=${{ steps.paths.outputs.ext_deps_dir }}/netcdf-c/install/netcdf-c -DCMAKE_INSTALL_PREFIX=${{ steps.paths.outputs.install_dir }} -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_OSX_ARCHITECTURES=arm64 + -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" + -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" + -DOpenMP_C_LIB_NAMES="omp" + -DOpenMP_CXX_LIB_NAMES="omp" + -DOpenMP_omp_LIBRARY="/opt/homebrew/opt/libomp/lib/libomp.dylib" -DCMAKE_C_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include" -DCMAKE_CXX_FLAGS="-Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include -v" - -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp" + -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp -Wl,-v" + -DCMAKE_SHARED_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -lomp -Wl,-v" # Step: CMake build - name: Build - run: cmake --build ${{ steps.paths.outputs.build_dir }} --config ${{ inputs.build_type }} -j 4 + run: cmake --build ${{ steps.paths.outputs.build_dir }} --config ${{ inputs.build_type }} -j 4 --verbose # Step: Test # Works if runner.os == 'Linux' or runner.os == 'macOS'