-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
91 lines (77 loc) · 2.44 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
project(jlc)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 17)
if(!MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(THREADS_PREFER_PTHREAD_FLAG ON)
endif()
set(bnfc_SOURCE
bnfc/Absyn.C
bnfc/Absyn.H
bnfc/Buffer.C
bnfc/Buffer.H
bnfc/Parser.C
bnfc/Lexer.C
bnfc/Parser.H
bnfc/ParserError.H
bnfc/Printer.C
bnfc/Printer.H
bnfc/Bison.H
)
set(jlc-lib_SOURCE ${bnfc_SOURCE}
src/Common/BaseVisitor.cpp
src/Common/BaseVisitor.h
src/Frontend/TypeChecker.cpp
src/Frontend/TypeInferrer.cpp
src/Frontend/TypeInferrer.h
src/Frontend/TypeChecker.h
src/Frontend/TypeCheckerEnv.h
src/Frontend/TypeCheckerEnv.cpp
src/Frontend/StatementChecker.h
src/Frontend/StatementChecker.cpp
src/Frontend/IndexChecker.h
src/Frontend/IndexChecker.cpp
src/Frontend/TypeError.h
src/LLVM-Backend/CodeGen.h
src/LLVM-Backend/CodeGen.cpp
src/LLVM-Backend/BinOpBuilder.cpp
src/LLVM-Backend/BinOpBuilder.h
src/LLVM-Backend/CodegenEnv.cpp
src/LLVM-Backend/CodegenEnv.h
src/LLVM-Backend/ExpBuilder.cpp
src/LLVM-Backend/ExpBuilder.h
src/LLVM-Backend/ProgramBuilder.cpp
src/LLVM-Backend/ProgramBuilder.h
src/LLVM-Backend/IndexBuilder.h
src/LLVM-Backend/IndexBuilder.cpp
src/Common/Util.h
src/Frontend/Parser.h)
find_package(LLVM CONFIG REQUIRED)
if(VERBOSE)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
message(STATUS "Include dirs in: ${LLVM_INCLUDE_DIRS}")
foreach(lib ${LLVM_AVAILABLE_LIBS})
message(STATUS ${lib})
endforeach()
foreach(def ${LLVM_DEFINITIONS})
message(STATUS ${def})
endforeach()
endif()
add_library(jlc-lib ${jlc-lib_SOURCE})
add_definitions(${LLVM_DEFINITIONS})
target_link_libraries(jlc-lib LLVM)
target_include_directories(jlc-lib
PUBLIC
${LLVM_INCLUDE_DIRS}
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/src
)
set_target_properties(jlc-lib PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_LIST_DIR}/bin/Debug/${PROJECT_NAME}
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_LIST_DIR}/bin/Release/${PROJECT_NAME}
)
add_executable(${PROJECT_NAME} src/Main.cpp)
target_link_libraries(${PROJECT_NAME} jlc-lib)
add_subdirectory(sandbox)
add_subdirectory(test)