Skip to content

Commit

Permalink
gromacs: build with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
junghans committed Apr 29, 2023
1 parent c27ef39 commit 62eb712
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Formula/gromacs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class Gromacs < Formula
depends_on "gcc" # for OpenMP
depends_on "openblas"

fails_with :clang
on_macos do
depends_on "libomp"
end

fails_with gcc: "5"
fails_with gcc: "6"

Expand All @@ -35,24 +38,20 @@ def install
"CMAKE_INSTALL_DATADIR"

# Avoid superenv shim reference
gcc = Formula["gcc"]
cc = gcc.opt_bin/"gcc-#{gcc.any_installed_version.major}"
cxx = gcc.opt_bin/"g++-#{gcc.any_installed_version.major}"
inreplace "src/gromacs/gromacs-hints.in.cmake" do |s|
s.gsub! "@CMAKE_LINKER@", "/usr/bin/ld"
s.gsub! "@CMAKE_C_COMPILER@", cc
s.gsub! "@CMAKE_CXX_COMPILER@", cxx
s.gsub! "@CMAKE_C_COMPILER@", ENV.cc
s.gsub! "@CMAKE_CXX_COMPILER@", ENV.cxx
end

inreplace "src/buildinfo.h.cmakein" do |s|
s.gsub! "@BUILD_C_COMPILER@", cc
s.gsub! "@BUILD_CXX_COMPILER@", cxx
s.gsub! "@BUILD_C_COMPILER@", ENV.cc
s.gsub! "@BUILD_CXX_COMPILER@", ENV.cxx
end

inreplace "src/gromacs/gromacs-config.cmake.cmakein", "@GROMACS_CXX_COMPILER@", cxx
inreplace "src/gromacs/gromacs-config.cmake.cmakein", "@GROMACS_CXX_COMPILER@", ENV.cxx

args = %W[
-DGROMACS_CXX_COMPILER=#{cxx}
-DGMX_VERSION_STRING_OF_FORK=#{tap.user}
-DGMX_INSTALL_LEGACY_API=ON
]
Expand Down

0 comments on commit 62eb712

Please sign in to comment.