diff --git a/.github/workflows/sync-version.yml b/.github/workflows/sync-version.yml index 5b84196..526f018 100644 --- a/.github/workflows/sync-version.yml +++ b/.github/workflows/sync-version.yml @@ -11,7 +11,7 @@ on: jobs: sync-version: - runs-on: ubuntu-latest + runs-on: ubuntu-26.04 steps: - name: generate GitHub App token diff --git a/.github/workflows/validate-formula.yml b/.github/workflows/validate-formula.yml index 1c32ef6..29b1408 100644 --- a/.github/workflows/validate-formula.yml +++ b/.github/workflows/validate-formula.yml @@ -10,7 +10,7 @@ on: jobs: validate-formula: - runs-on: ubuntu-latest + runs-on: ubuntu-26.04 steps: - name: Checkout repository diff --git a/Formula/power-grid-model.rb b/Formula/power-grid-model.rb index 05233ce..4ffcac3 100644 --- a/Formula/power-grid-model.rb +++ b/Formula/power-grid-model.rb @@ -5,46 +5,31 @@ class PowerGridModel < Formula desc "Python/C++ library for distribution power system analysis" homepage "https://lfenergy.org/projects/power-grid-model/" - url "https://github.com/PowerGridModel/power-grid-model/archive/refs/tags/v1.13.196.tar.gz" - sha256 "d42f484091b54e23ec0fc7bf6373c4f8524be0c86bef368a3e5ed9f06aaefe36" + url "https://github.com/PowerGridModel/power-grid-model/archive/refs/tags/v1.13.197.tar.gz" + sha256 "2d677450c70d92014541877eb4339cb56266b0d82a11cca541e5af99dd4e8630" license "MPL-2.0" head "https://github.com/PowerGridModel/power-grid-model.git", branch: "main" depends_on "boost" => :build depends_on "cmake" => :build depends_on "eigen" => :build - depends_on "gcc@14" => :build depends_on "msgpack-cxx" => :build depends_on "ninja" => :build depends_on "nlohmann-json" => :build + on_linux do + depends_on "gcc@16" => :build + end + + fails_with :gcc do + version "15" + cause "Use the same GCC version as in main PGM" + end + def install rm buildpath/"VERSION" (buildpath/"VERSION").write(version.to_s) - begin - system_gcc_version = Utils.safe_popen_read("gcc", "-dumpversion").strip.to_i - rescue - system_gcc_version = 0 - end - - user_cxx = ENV["CXX"].to_s - user_cc = ENV["CC"].to_s - using_non_gcc = (!user_cxx.empty? && user_cxx.exclude?("g++")) || - (!user_cc.empty? && user_cc.exclude?("gcc")) - - # If the user has not requested a non-GCC compiler and the system GCC version is less than 14, - # use the GCC 14 compiler from Homebrew. - # This minimum was added because we use some features in PGM not available in older versions of GCC. - if !using_non_gcc && system_gcc_version < 14 - gcc = Formula["gcc@14"] - system "cmake", "-GNinja", "-S", ".", "-B", "build", - "-DCMAKE_C_COMPILER=#{gcc.opt_bin}/gcc-14", - "-DCMAKE_CXX_COMPILER=#{gcc.opt_bin}/g++-14", - *std_cmake_args - else - system "cmake", "-GNinja", "-S", ".", "-B", "build", - *std_cmake_args - end + system "cmake", "-GNinja", "-S", ".", "-B", "build", *std_cmake_args system "cmake", "--build", "build" system "cmake", "--install", "build" end diff --git a/formula_generation/power-grid-model.rb.jinja b/formula_generation/power-grid-model.rb.jinja index 8c04298..7f72c61 100644 --- a/formula_generation/power-grid-model.rb.jinja +++ b/formula_generation/power-grid-model.rb.jinja @@ -13,38 +13,23 @@ class PowerGridModel < Formula depends_on "boost" => :build depends_on "cmake" => :build depends_on "eigen" => :build - depends_on "gcc@14" => :build depends_on "msgpack-cxx" => :build depends_on "ninja" => :build depends_on "nlohmann-json" => :build + on_linux do + depends_on "gcc@16" => :build + end + + fails_with :gcc do + version "15" + cause "Use the same GCC version as in main PGM" + end + def install rm buildpath/"VERSION" (buildpath/"VERSION").write(version.to_s) - begin - system_gcc_version = Utils.safe_popen_read("gcc", "-dumpversion").strip.to_i - rescue - system_gcc_version = 0 - end - - user_cxx = ENV["CXX"].to_s - user_cc = ENV["CC"].to_s - using_non_gcc = (!user_cxx.empty? && user_cxx.exclude?("g++")) || - (!user_cc.empty? && user_cc.exclude?("gcc")) - - # If the user has not requested a non-GCC compiler and the system GCC version is less than 14, - # use the GCC 14 compiler from Homebrew. - # This minimum was added because we use some features in PGM not available in older versions of GCC. - if !using_non_gcc && system_gcc_version < 14 - gcc = Formula["gcc@14"] - system "cmake", "-GNinja", "-S", ".", "-B", "build", - "-DCMAKE_C_COMPILER=#{gcc.opt_bin}/gcc-14", - "-DCMAKE_CXX_COMPILER=#{gcc.opt_bin}/g++-14", - *std_cmake_args - else - system "cmake", "-GNinja", "-S", ".", "-B", "build", - *std_cmake_args - end + system "cmake", "-GNinja", "-S", ".", "-B", "build", *std_cmake_args system "cmake", "--build", "build" system "cmake", "--install", "build" end