2019-10-01 11:05:21 -07:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
|
|
|
project(compiler)
|
|
|
|
|
|
|
|
find_package(BISON)
|
|
|
|
find_package(FLEX)
|
|
|
|
bison_target(parser
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/parser.y
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
|
|
|
|
COMPILE_FLAGS "-d")
|
|
|
|
flex_target(scanner
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/scanner.l
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp)
|
|
|
|
add_flex_bison_dependency(scanner parser)
|
|
|
|
|
|
|
|
add_executable(compiler
|
|
|
|
ast.cpp ast.hpp definition.cpp
|
2019-10-01 14:34:38 -07:00
|
|
|
type_env.cpp type_env.hpp
|
2019-10-01 11:05:21 -07:00
|
|
|
env.cpp env.hpp
|
|
|
|
type.cpp type.hpp
|
|
|
|
error.cpp error.hpp
|
2019-10-01 23:23:52 -07:00
|
|
|
binop.cpp binop.hpp
|
2019-10-09 22:46:17 -07:00
|
|
|
instruction.cpp instruction.hpp
|
2019-10-01 11:05:21 -07:00
|
|
|
${BISON_parser_OUTPUTS}
|
|
|
|
${FLEX_scanner_OUTPUTS}
|
|
|
|
main.cpp
|
|
|
|
)
|
|
|
|
target_include_directories(compiler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
target_include_directories(compiler PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|