chore: build zamacompiler as an LLVM external proj

This commit is contained in:
youben11
2021-09-15 12:09:50 +01:00
committed by Ayoub Benaissa
parent 450925b7bf
commit 7a48900fae
5 changed files with 25 additions and 11 deletions

View File

@@ -1,14 +1,25 @@
build:
cmake -B build . \
cmake -B build -GNinja ${LLVM_PROJECT}/llvm/ \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=OFF \
-DLLVM_TARGETS_TO_BUILD="host" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
-DLLVM_DIR=${LLVM_PROJECT}/build/lib/cmake/llvm \
-DMLIR_DIR=${LLVM_PROJECT}/build/lib/cmake/mlir \
-DCONCRETE_FFI_RELEASE=${CONCRETE_PROJECT}/target/release
-DCONCRETE_FFI_RELEASE=${CONCRETE_PROJECT}/target/release \
-DLLVM_EXTERNAL_PROJECTS=zamalang \
-DLLVM_EXTERNAL_ZAMALANG_SOURCE_DIR=.
build-end-to-end-jit:
make -C build/ end_to_end_jit_test
build-end-to-end-jit: build
cmake --build build --target end_to_end_jit_test
zamacompiler:
make -C build/ zamacompiler
zamacompiler: build
cmake --build build --target zamacompiler
python-bindings: build
cmake --build build --target ZamalangBindingsPython
test-check: zamacompiler
${LLVM_PROJECT}/build/bin/llvm-lit -v tests/
@@ -18,5 +29,5 @@ test-end-to-end-jit: build-end-to-end-jit
test: test-check test-end-to-end-jit
test_python:
pytest -v tests/python
test-python: python-bindings
PYTHONPATH=${PYTHONPATH}:./build/tools/zamalang/python:./build/python LD_PRELOAD=./build/lib/libZamalangRuntime.so pytest -v tests/python

View File

@@ -1,6 +1,6 @@
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls -name Conversion)
add_public_tablegen_target(MLIRConversionPassIncGen)
add_public_tablegen_target(ZamalangConversionPassIncGen)
add_subdirectory(HLFHEToMidLFHE)

View File

@@ -4,4 +4,3 @@ mlir_tablegen(MANP.capi.h.inc -gen-pass-capi-header --prefix Analysis)
mlir_tablegen(MANP.capi.cpp.inc -gen-pass-capi-impl --prefix Analysis)
add_public_tablegen_target(MANPPassIncGen)
add_mlir_doc(MANP GeneralPasses ./ -gen-pass-doc)

View File

@@ -3,4 +3,7 @@ add_library(ZamalangRuntime SHARED
wrappers.c
)
target_link_libraries(ZamalangRuntime Concrete pthread m dl)
target_link_libraries(ZamalangRuntime Concrete pthread m dl)
install(TARGETS ZamalangRuntime EXPORT ZamalangRuntime)
install(EXPORT ZamalangRuntime DESTINATION "./")

View File

@@ -1,5 +1,6 @@
#include <llvm/Support/TargetSelect.h>
#include <llvm/Support/Error.h>
#include <mlir/Dialect/Linalg/Passes.h>
#include <mlir/Dialect/StandardOps/Transforms/Passes.h>
#include <mlir/Dialect/Tensor/Transforms/Passes.h>