-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
62 lines (54 loc) · 1.46 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 3.8)
project("LameCC")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_BUILD_TYPE Release)
include_directories("third-party/json/single_include")
include_directories("third-party/rang/include")
aux_source_directory(./src DIR_SRCS)
add_executable(LameCC ${DIR_SRCS})
if(CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
find_package(LLVM_DEBUG REQUIRED CONFIG)
elseif(CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
find_package(LLVM REQUIRED CONFIG)
endif()
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
# Set your project compile flags.
# E.g. if using the C++ header files
# you will need to enable C++11 support
# for your compiler.
include_directories(${LLVM_INCLUDE_DIRS})
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
add_definitions(${LLVM_DEFINITIONS_LIST})
add_compile_definitions(NOMINMAX)
# Find the libraries that correspond to the LLVM components
# that we wish to use
if (LLVM_LINK_LLVM_DYLIB)
set(LLVM_LIBS LLVM)
else()
llvm_map_components_to_libnames(LLVM_LIBS
AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsDescs
AllTargetsInfos
Analysis
AsmParser
AsmPrinter
CodeGen
Core
IRReader
MC
MIRParser
Remarks
ScalarOpts
SelectionDAG
Support
Target
TargetParser
TransformUtils
Vectorize)
endif()
target_link_libraries(LameCC
PRIVATE
${LLVM_LIBS}
)