forked from Xilinx/mlir-aie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile-common
49 lines (40 loc) · 2.34 KB
/
makefile-common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Contains common definitions used across the Makefiles of all tutorials.
# MLIR-AIE install directory. If you have sourced utils/env_setup.sh before
# running make, the following should work to find the AIE install directory.
AIE_RUNTIME_LIB ?= $(shell realpath $(dir $(shell which aie-opt))/../runtime_lib)
AIE_INSTALL ?= $(AIE_RUNTIME_LIB)/aarch64
# VITIS related variables
VITIS_ROOT ?= $(shell realpath $(dir $(shell which vitis))/../)
VITIS_AIETOOLS_DIR ?= ${VITIS_ROOT}/aietools
VITIS_AIE_INCLUDE_DIR ?= ${VITIS_ROOT}/aietools/data/versal_prod/lib
VITIS_AIE2_INCLUDE_DIR ?= ${VITIS_ROOT}/aietools/data/aie_ml/lib
# An aarch64 sysroot is required for cross-compiling the host code. The default
# values of these variables assume that you have built a sysroot by running
# make in platforms/vck190_bare_prod, but you can use other aarch64 sysroots by
MLIR_AIE_SYSROOT ?= ${VITIS_ROOT}/gnu/aarch64/lin/aarch64-linux/aarch64-xilinx-linux/
# The libstdc++ version that is installed in the sysroot given above. This is
# used for include and library paths. If you built the sysroot with Vitis
# 2022.2 and PetaLinux 2022.2, libstdc++ 11.2.0 will be installed.
LIBCXX_VERSION ?= 12.2.0
# The following flags are passed to both AI core and host compilation for
# aiecc.py invocations.
AIECC_FLAGS += --sysroot=${MLIR_AIE_SYSROOT} --host-target=aarch64-linux-gnu
CHESSCC_FLAGS = -f -p me -P ${VITIS_AIE_INCLUDE_DIR} -I ${VITIS_AIETOOLS_DIR}/include
CHESS_FLAGS = -P ${VITIS_AIE_INCLUDE_DIR}
# The following additional flags are only applied for host code.
AIECC_HOST_FLAGS += \
-I$(AIE_INSTALL)/test_lib/include \
-I${AIE_INSTALL}/xaiengine/include \
--gcc-toolchain=${MLIR_AIE_SYSROOT}/usr \
-L$(AIE_INSTALL)/test_lib/lib -ltest_lib
# Add the
# necessary search paths for the sysroot so clang++ can find the aarch64
# includes and libraries. Some of these shouldn't be necessary, except that
# sysroot shipped with Vitis is slightly broken, so clang can't find things
# automatically just using --gcc-toolchain
AIECC_HOST_FLAGS += \
-I${MLIR_AIE_SYSROOT}/usr/include/c++/${LIBCXX_VERSION} \
-I${MLIR_AIE_SYSROOT}/usr/include/c++/${LIBCXX_VERSION}/aarch64-xilinx-linux \
-I${MLIR_AIE_SYSROOT}/usr/include \
-L${MLIR_AIE_SYSROOT}/usr/lib/aarch64-xilinx-linux/${LIBCXX_VERSION} \
-B${MLIR_AIE_SYSROOT}/usr/lib/aarch64-xilinx-linux/${LIBCXX_VERSION}