Skip to content

Commit 13f37fb

Browse files
authored
Merge pull request #204626 from Homebrew/flang-openmp
flang: support OpenMP, use shared libs on Linux
2 parents f7e0714 + 09aab3d commit 13f37fb

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

Formula/f/flang.rb

+15-7
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ class Flang < Formula
1212
end
1313

1414
bottle do
15-
sha256 cellar: :any, arm64_sequoia: "df43ebeecaa3fe9c72de26072406fd6cc35e5112e974505d2aefc6aa0333df0d"
16-
sha256 cellar: :any, arm64_sonoma: "a690f92f3e3928605457f23397e9cc6758eec62e68840fc626cedf5b2ab9b726"
17-
sha256 cellar: :any, arm64_ventura: "368ac4fc09a1863179ee89fc40ab0dd67e249ff543a99c4fec9a8cd7b878c740"
18-
sha256 cellar: :any, sonoma: "3e3681f074d46f677314bf884dc03122b413ceb8753bccddf68d9159b2848a5c"
19-
sha256 cellar: :any, ventura: "07ccb17e0ea3a50758b951e60c2ee10cf60c77e692d12df24f4e0745318a26eb"
20-
sha256 cellar: :any_skip_relocation, x86_64_linux: "b27f1b803d43b379afa64fa17d35c5f554486e831b19ce1fb2a79fe5144463da"
15+
rebuild 1
16+
sha256 cellar: :any, arm64_sequoia: "88cd183a3fd754f57ba8b4637ea0f7eebf9ca5f225fc5eb951377a705d3bf7d8"
17+
sha256 cellar: :any, arm64_sonoma: "9bf49edca702bfe6554da248bbdeb305d82c4068f75508852064ea13659f99ec"
18+
sha256 cellar: :any, arm64_ventura: "d9b25602d8deb833264d99dd4c4e051cf3e2dd44bfc3d41a3a1411555d4c89f2"
19+
sha256 cellar: :any, sonoma: "8429abc9db2a89890efa451c0a5a110021e7404d86291615e58805a015b956ff"
20+
sha256 cellar: :any, ventura: "be9edd442a2109b037409ab71af5ad00860e08ffe40f04f31f403db712465a37"
21+
sha256 cellar: :any_skip_relocation, x86_64_linux: "db66d721fd417bd732de221ad2d430da6f1195f949d310bb2c115ff4cec6b44d"
2122
end
2223

2324
depends_on "cmake" => :build
@@ -31,9 +32,12 @@ def flang_driver
3132
end
3233

3334
def install
35+
# Generate omp_lib.h and omp_lib.F90 to be used by flang build
36+
system "cmake", "-S", "openmp", "-B", "build/projects/openmp", *std_cmake_args
37+
3438
llvm = Formula["llvm"]
35-
# NOTE: Setting `BUILD_SHARED_LIBRARIES=ON` causes the just-built flang to throw ICE.
3639
args = %W[
40+
-DLLVM_TOOL_OPENMP_BUILD=ON
3741
-DCLANG_DIR=#{llvm.opt_lib}/cmake/clang
3842
-DFLANG_INCLUDE_TESTS=OFF
3943
-DFLANG_REPOSITORY_STRING=#{tap&.issues_url}
@@ -46,6 +50,8 @@ def install
4650
-DMLIR_DIR=#{llvm.opt_lib}/cmake/mlir
4751
]
4852
args << "-DFLANG_VENDOR_UTI=sh.brew.flang" if tap&.official?
53+
# FIXME: Setting `BUILD_SHARED_LIBS=ON` causes the just-built flang to throw ICE on macOS
54+
args << "-DBUILD_SHARED_LIBS=ON" if OS.linux?
4955

5056
ENV.append_to_cflags "-ffat-lto-objects" if OS.linux? # Unsupported on macOS.
5157
system "cmake", "-S", "flang", "-B", "build", *args, *std_cmake_args
@@ -127,6 +133,8 @@ def caveats
127133
system bin/flang_driver, "-v", "test.f90", "-o", "test"
128134
assert_equal "Done", shell_output("./test").chomp
129135

136+
return if OS.linux?
137+
130138
system "ar", "x", lib/"libFortranCommon.a"
131139
testpath.glob("*.o").each do |object_file|
132140
refute_match(/^LLVM (IR )?bitcode/, shell_output("file --brief #{object_file}"))

0 commit comments

Comments
 (0)