-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
101 lines (82 loc) · 2.59 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
92
93
94
95
96
97
98
99
100
101
# The scully programming language
#
# Copyright (c) Peter Dahlberg, Markus Hauschild and Florian Sattler, 2013.
# Licensed under the GNU GPL v2.
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (scully)
SET (SCULLY_VERSION_MAJOR 0)
SET (SCULLY_VERSION_MINOR 2)
SET (SCULLY_VERSION_RELEASE 0)
SET (SCULLY_VERSION_EXTRA "WoC Caturday")
SET (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/inc)
SET (CMAKE_CXX_FLAGS "-std=c++11")
ADD_EXECUTABLE (lemon grammar/lemon.c)
ADD_EXECUTABLE (makeheaders grammar/makeheaders.c)
ADD_CUSTOM_COMMAND(
COMMAND cp
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/grammar/grammar.y ${CMAKE_CURRENT_BINARY_DIR}
COMMAND cp
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/grammar/lempar.c ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/lemon
ARGS -q -m ${CMAKE_CURRENT_BINARY_DIR}/grammar.y
# ARGS -q ${CMAKE_CURRENT_BINARY_DIR}/grammar.y
COMMAND rm
ARGS ${CMAKE_CURRENT_BINARY_DIR}/lempar.c
COMMAND rm
ARGS ${CMAKE_CURRENT_BINARY_DIR}/grammar.y
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/makeheaders
ARGS ${CMAKE_CURRENT_BINARY_DIR}/grammar.c
COMMAND mv
ARGS ${CMAKE_CURRENT_BINARY_DIR}/grammar.c ${CMAKE_CURRENT_BINARY_DIR}/grammar.cpp
DEPENDS lemon
DEPENDS makeheaders
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/grammar/grammar.y
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grammar.cpp
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/grammar.h
)
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_CURRENT_BINARY_DIR}/grammar.cpp GENERATED
)
OPTION (SCULLY_DEBUG "Create a debug build")
IF (SCULLY_DEBUG)
ADD_DEFINITIONS ("-g")
ENDIF (SCULLY_DEBUG)
SET(SCULLY_SOURCE
src/test.cpp
src/Token.cpp
src/libscully.c
src/AST/ASTElement.cpp
src/AST/ASTVisitor.cpp
src/AST/AssignmentExpression.cpp
src/AST/BinOpExpression.cpp
src/AST/CodeGenVisitor.cpp
src/AST/ConstantExpression.cpp
src/AST/LoadExpression.cpp
src/AST/Expression.cpp
src/AST/ExpressionStatement.cpp
src/AST/ForStatement.cpp
src/AST/FunctionCallExpression.cpp
src/AST/FunctionDefinition.cpp
src/AST/IfStatement.cpp
src/AST/ParameterList.cpp
src/AST/PrintVisitor.cpp
src/AST/ReturnStatement.cpp
src/AST/RandomForStatement.cpp
src/AST/RandomIfStatement.cpp
src/AST/Scope.cpp
src/AST/Statement.cpp
src/AST/StatementList.cpp
src/AST/Type.cpp
src/AST/VariableDefinition.cpp
src/AST/ValueList.cpp
src/AST/LoadExpression.cpp
src/AST/BinOp.cpp
${CMAKE_CURRENT_BINARY_DIR}/grammar.cpp
)
FIND_PACKAGE (LLVM REQUIRED)
ADD_DEFINITIONS (${LLVM_CFLAGS})
ADD_EXECUTABLE (scully ${SCULLY_SOURCE})
TARGET_LINK_LIBRARIES (scully ${LLVM_JIT_LIBS})
TARGET_LINK_LIBRARIES (scully ${LLVM_LFLAGS})