Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[circle-mlir/ext] Add llvm-project build #14721

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions circle-mlir/externals/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
abseil-cpp
flatbuffers
llvm-project
22 changes: 22 additions & 0 deletions circle-mlir/externals/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ set(FB_BUILD_DIR "${EXTERNALS_BUILD_INST_DIR}/flatbuffers-build")
set(FB_INSTALL_DIR "${EXTERNALS_BUILD_INST_DIR}/flatbuffers-install")
set(AC_BUILD_DIR "${EXTERNALS_BUILD_INST_DIR}/abseil-cpp-build")
set(AC_INSTALL_DIR "${EXTERNALS_BUILD_INST_DIR}/abseil-cpp-install")
set(LP_BUILD_DIR "${EXTERNALS_BUILD_INST_DIR}/llvm-project-build")
set(LP_INSTALL_DIR "${EXTERNALS_BUILD_INST_DIR}/llvm-project-install")

# build flatbuffers
ExternalProject_Add(externals-flatbuffers
Expand All @@ -48,3 +50,23 @@ ExternalProject_Add(externals-abseil-cpp
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_STANDARD_REQUIRED=ON
)

# build MLIR of LLVM
# from https://github.com/onnx/onnx-mlir/blob/main/docs/BuildOnLinuxOSX.md
ExternalProject_Add(externals-llvm-project
GIT_REPOSITORY "https://github.com/llvm/llvm-project.git"
GIT_TAG "91088978d712cd7b33610c59f69d87d5a39e3113"
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/llvm-project"
SOURCE_SUBDIR "llvm"
BINARY_DIR "${LP_BUILD_DIR}"
INSTALL_DIR "${LP_INSTALL_DIR}"
CMAKE_ARGS -DLLVM_ENABLE_PROJECTS=mlir
-DLLVM_TARGETS_TO_BUILD=host
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX='${LP_INSTALL_DIR}'
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_ENABLE_RTTI=ON
# NOTE externals-flatbuffers externals-abseil-cpp are added to DEPENDS only
# to build in sequence and actually do not dependent on build.
DEPENDS externals-flatbuffers externals-abseil-cpp
)
Loading