-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
60 lines (49 loc) · 2.28 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
project(SysYFCompiler)
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -Wall -g -pedantic")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# add macros to generate Bison & Flex Cpp code from grammar
# find_package(BISON REQUIRED)
# find_package(FLEX REQUIRED)
# BISON_TARGET(SysYParser ${CMAKE_CURRENT_SOURCE_DIR}/grammar/SysYParser.yy ${CMAKE_CURRENT_BINARY_DIR}/SysYParser.cpp
# COMPILE_FLAGS "-Wall -Wcounterexamples --defines=${CMAKE_CURRENT_BINARY_DIR}/SysYParser.h")
# FLEX_TARGET(SysYScanner ${CMAKE_CURRENT_SOURCE_DIR}/grammar/SysYScanner.ll ${CMAKE_CURRENT_BINARY_DIR}/SysYScanner.cpp
# COMPILE_FLAGS "--debug --c++")
# ADD_FLEX_BISON_DEPENDENCY(SysYScanner SysYParser)
# include generated files in project environment
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/ASTBuilder)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/ASTPrinter)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/Checker)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/ErrorReporter)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/Frontend)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/SysYFIR)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/SysYFIRBuilder)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/Optimize)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/Backend)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/ASTBuilder)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/ASTPrinter)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/Checker)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/ErrorReporter)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/Frontend)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/SysYFIR)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/SysYFIRBuilder)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/Optimize)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/Backend)
add_executable(
compiler
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
)
target_link_libraries(
compiler
Backend
SysYFPass
SysYFIRBuilder
IRLib
Driver
Checker
ASTPrinter
ErrReporter
)