Skip to content

Commit

Permalink
llvm: rebuild
Browse files Browse the repository at this point in the history
* llvm: add mlir
  - [x] Have you followed the [guidelines for contributing](https://github.com/Homebrew/homebrew-core/blob/HEAD/CONTRIBUTING.md)?
  - [x] Have you checked that there aren't other open [pull requests](https://github.com/Homebrew/homebrew-core/pulls) for the same formula update/change?
  - [ ] Have you built your formula locally with `brew install --build-from-source <formula>`, where `<formula>` is the name of the formula you're submitting?
  - [ ] Is your test running fine `brew test <formula>`, where `<formula>` is the name of the formula you're submitting?
  - [ ] Does your build pass `brew audit --strict <formula>` (after doing `brew install <formula>`)?

  There's been some interest in the flang compiler for llvm:

  Homebrew/discussions#143
  #63081

  It seems possible to build flang separately from llvm, but it appears to
  require having built mlir. See the flang [README](https://github.com/llvm/llvm-project/blob/master/flang/README.md).

  My laptop is too sadly underpowered to build llvm. I will try to devise
  a test if this is built successfully. I think I should also be able to
  add a separate formula for flang if this is successful.
* llvm: use cmake to invoke make indirectly
  Building llvm with mlir succeeded on my local machine with a similar
  procedure (except using ninja), so hopefully this works.
* llvm: add test for mlir

Closes #65223.

Signed-off-by: FX Coudert <[email protected]>
  • Loading branch information
carlocab authored and fxcoudert committed Nov 25, 2020
1 parent 41277ad commit 6c9f132
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Formula/llvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def install
lldb
openmp
polly
mlir
]
runtimes = %w[
compiler-rt
Expand Down Expand Up @@ -139,9 +140,9 @@ def install
llvmpath = buildpath/"llvm"
mkdir llvmpath/"build" do
system "cmake", "-G", "Unix Makefiles", "..", *(std_cmake_args + args)
system "make"
system "make", "install"
system "make", "install-xcode-toolchain" if MacOS::Xcode.installed?
system "cmake", "--build", "."
system "cmake", "--build", ".", "--target", "install"
system "cmake", "--build", ".", "--target", "install-xcode-toolchain" if MacOS::Xcode.installed?
end

# Install LLVM Python bindings
Expand Down Expand Up @@ -209,6 +210,15 @@ def caveats
}
EOS

# Testing mlir
(testpath/"test.mlir").write <<~EOS
func @bad_branch() {
br ^missing // expected-error {{reference to an undefined block}}
}
EOS

system "#{bin}/mlir-opt", "--verify-diagnostics", "test.mlir"

# Testing default toolchain and SDK location.
system "#{bin}/clang++", "-v",
"-std=c++11", "test.cpp", "-o", "test++"
Expand Down

0 comments on commit 6c9f132

Please sign in to comment.