-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (39 loc) · 1.69 KB
/
CMakeLists.txt
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
CMAKE_MINIMUM_REQUIRED(VERSION 3.13.4)
PROJECT(heLLoVM LANGUAGES C CXX)
SET(CMAKE_C_STANDARD 99)
SET(CMAKE_CXX_STANDARD 14)
FIND_PACKAGE(LLVM REQUIRED CONFIG
PATHS
"/usr/lib/llvm-15/cmake"
"/usr/lib/llvm-14/cmake"
"/usr/lib/llvm-13/cmake"
"/usr/lib/llvm-12/cmake"
"/usr/lib/llvm-11/cmake"
"/usr/lib/llvm-10/cmake"
"/usr/lib/llvm-9/cmake")
MESSAGE(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
MESSAGE(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
SEPARATE_ARGUMENTS(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
ADD_DEFINITIONS(${LLVM_DEFINITIONS})
INCLUDE_DIRECTORIES(${LLVM_INCLUDE_DIRS})
ADD_EXECUTABLE(helfovm lo.cc)
ADD_EXECUTABLE(helfovmc lo.c)
ADD_EXECUTABLE(hellovm llo.cc)
ADD_EXECUTABLE(hellovmc llo.c mcjit.cc)
TARGET_LINK_DIRECTORIES(helfovm INTERFACE ${LLVM_LIBRARY_DIRS})
TARGET_LINK_DIRECTORIES(helfovmc INTERFACE ${LLVM_LIBRARY_DIRS})
TARGET_LINK_DIRECTORIES(hellovm INTERFACE ${LLVM_LIBRARY_DIRS})
TARGET_LINK_DIRECTORIES(hellovmc INTERFACE ${LLVM_LIBRARY_DIRS})
TARGET_LINK_LIBRARIES(helfovm -lLLVM-${LLVM_VERSION_MAJOR})
TARGET_LINK_LIBRARIES(helfovmc -lLLVM-${LLVM_VERSION_MAJOR})
TARGET_LINK_LIBRARIES(hellovm -lLLVM-${LLVM_VERSION_MAJOR})
TARGET_LINK_LIBRARIES(hellovmc -lLLVM-${LLVM_VERSION_MAJOR})
# llvm::orc::ExecutorProcessControl was introduced in LLVM 13.0.0
IF (NOT ${LLVM_PACKAGE_VERSION} VERSION_LESS "13.0.0")
ADD_EXECUTABLE(hellorc llo-orc.cc)
TARGET_LINK_DIRECTORIES(hellorc INTERFACE ${LLVM_LIBRARY_DIRS})
TARGET_LINK_LIBRARIES(hellorc -lLLVM-${LLVM_VERSION_MAJOR})
ADD_EXECUTABLE(hellorcc llo-orc.c orc.cc)
TARGET_LINK_DIRECTORIES(hellorcc INTERFACE ${LLVM_LIBRARY_DIRS})
TARGET_LINK_LIBRARIES(hellorcc -lLLVM-${LLVM_VERSION_MAJOR})
ENDIF()