-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (57 loc) · 2.9 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
cmake_minimum_required(VERSION 3.5)
project(sushiscript)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
set(SUSHI_TEST_DIR ${CMAKE_SOURCE_DIR}/test)
set(SUSHI_SRC_DIR ${CMAKE_SOURCE_DIR}/src)
set(SUSHI_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
include_directories(${SUSHI_HEADER_DIR})
include_directories(${CONAN_INCLUDE_DIRS})
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
file(GLOB_RECURSE SUSHI_LEXER_SRC ${SUSHI_SRC_DIR}/sushi/lexer/*.cpp)
file(GLOB LEXER_TEST_SRC ${SUSHI_TEST_DIR}/lexer/*.cpp)
file(GLOB_RECURSE SUSHI_PARSER_SRC ${SUSHI_SRC_DIR}/sushi/parser/*.cpp)
file(GLOB PARSER_TEST_SRC ${SUSHI_TEST_DIR}/parser/*.cpp)
file(GLOB_RECURSE SUSHI_SCOPE_SRC ${SUSHI_SRC_DIR}/sushi/scope/*.cpp)
file(GLOB_RECURSE SCOPE_TEST_SRC ${SUSHI_TEST_DIR}/scope/*.cpp
${SUSHI_TEST_DIR}/scope/visitor/*.cpp)
file(GLOB_RECURSE SUSHI_CODE_GEN_SRC
${SUSHI_SRC_DIR}/sushi/code-generation/*.cpp
${SUSHI_SRC_DIR}/sushi/code-generation/visitor/*.cpp)
file(GLOB_RECURSE CODE_GEN_TEST_SRC ${SUSHI_TEST_DIR}/code-generation/*.cpp)
file(GLOB_RECURSE SUSHI_PIPELINE_SRC
${SUSHI_SRC_DIR}/sushi/pipeline/*.cpp)
file(GLOB PIPELINE_TEST_SRC ${SUSHI_TEST_DIR}/pipeline/*.cpp)
file(GLOB_RECURSE SUSHI_SOURCES ${SUSHI_SRC_DIR}/sushi/*.cpp)
list(REMOVE_ITEM SUSHI_SOURCES
${SUSHI_SRC_DIR}/sushi/main.cpp
${SUSHI_SRC_DIR}/sushi/code-generation/code-generation.cpp)
file(GLOB TYPE_CHECK_TEST_SRC ${SUSHI_TEST_DIR}/type-check/*.cpp)
add_executable(sushi ${CMAKE_SOURCE_DIR}/src/main.cpp
${SUSHI_PARSER_SRC} ${SUSHI_LEXER_SRC} ${SUSHI_CODE_GEN_SRC}
${SUSHI_SCOPE_SRC} ${SUSHI_PIPELINE_SRC} ${SUSHI_SOURCES} )
add_executable(lexer-test ${LEXER_TEST_SRC} ${SUSHI_LEXER_SRC})
add_executable(parser-test ${PARSER_TEST_SRC} ${SUSHI_PARSER_SRC}
${SUSHI_LEXER_SRC} ${SUSHI_SCOPE_SRC})
add_executable(scope-test ${SCOPE_TEST_SRC} ${SUSHI_SCOPE_SRC}
${SUSHI_PARSER_SRC} ${SUSHI_LEXER_SRC})
add_executable(code-gen-test
${CODE_GEN_TEST_SRC} ${SUSHI_PARSER_SRC} ${SUSHI_LEXER_SRC}
${SUSHI_CODE_GEN_SRC} ${SUSHI_SCOPE_SRC} ${SUSHI_SOURCES})
add_executable(pipeline-test
${PIPELINE_TEST_SRC} ${SUSHI_PARSER_SRC} ${SUSHI_LEXER_SRC}
${SUSHI_CODE_GEN_SRC} ${SUSHI_SCOPE_SRC} ${SUSHI_PIPELINE_SRC}
${SUSHI_SOURCES})
add_executable(type-check-test ${SUSHI_PARSER_SRC} ${SUSHI_LEXER_SRC}
${SUSHI_CODE_GEN_SRC} ${SUSHI_SOURCES} ${TYPE_CHECK_TEST_SRC})
target_link_libraries(lexer-test ${CONAN_LIBS_GTEST})
target_link_libraries(parser-test ${CONAN_LIBS_GTEST})
target_link_libraries(scope-test ${CONAN_LIBS_GTEST})
target_link_libraries(code-gen-test ${CONAN_LIBS_GTEST})
target_link_libraries(pipeline-test ${CONAN_LIBS_GTEST})
target_link_libraries(type-check-test ${CONAN_LIBS_GTEST})
# set the install directory
set(CMAKE_INSTALL_PREFIX /usr/local)
install (TARGETS sushi RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)