2017-11-11 22:32:30 +01:00
|
|
|
cmake_minimum_required(VERSION 2.8.12)
|
|
|
|
|
project(CodeCompiler)
|
|
|
|
|
|
|
|
|
|
# Configuration
|
|
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
# LLVM
|
2017-11-12 01:38:50 +01:00
|
|
|
find_package(LLVM REQUIRED CONFIG)
|
|
|
|
|
llvm_map_components_to_libnames(llvm_libs support core irreader)
|
|
|
|
|
|
|
|
|
|
# Boost
|
|
|
|
|
SET(Boost_USE_STATIC_LIBS ON)
|
|
|
|
|
find_package(Boost REQUIRED COMPONENTS program_options)
|
2017-11-11 22:32:30 +01:00
|
|
|
|
|
|
|
|
## Version
|
|
|
|
|
INCLUDE("CMakeVersion.txt")
|
|
|
|
|
|
|
|
|
|
## Compiling
|
|
|
|
|
# Source Files
|
|
|
|
|
SET(SOURCE
|
|
|
|
|
"source/main.cpp"
|
2017-11-13 02:16:17 +01:00
|
|
|
"source/lexer.hpp"
|
|
|
|
|
"source/lexer.cpp"
|
|
|
|
|
"source/parser.hpp"
|
|
|
|
|
"source/parser.cpp"
|
|
|
|
|
"source/compiler.hpp"
|
|
|
|
|
"source/compiler.cpp"
|
2017-11-11 22:32:30 +01:00
|
|
|
)
|
|
|
|
|
SET(DATA
|
2017-11-12 01:38:50 +01:00
|
|
|
"CMakeVersion.txt"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Definitions
|
|
|
|
|
ADD_DEFINITIONS(
|
|
|
|
|
${LLVM_DEFINITIONS}
|
2017-11-11 22:32:30 +01:00
|
|
|
)
|
|
|
|
|
|
2017-11-12 01:38:50 +01:00
|
|
|
# Directories
|
2017-11-11 22:32:30 +01:00
|
|
|
INCLUDE_DIRECTORIES(
|
|
|
|
|
"${PROJECT_SOURCE_DIR}/source"
|
|
|
|
|
"${PROJECT_BINARY_DIR}"
|
2017-11-12 01:38:50 +01:00
|
|
|
${LLVM_INCLUDE_DIRS}
|
|
|
|
|
${Boost_INCLUDE_DIRS}
|
|
|
|
|
)
|
|
|
|
|
LINK_DIRECTORIES(
|
|
|
|
|
${LLVM_LIBRARY_DIRS}
|
|
|
|
|
${Boost_LIBRARY_DIRS}
|
2017-11-11 22:32:30 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Building
|
2017-11-12 01:38:50 +01:00
|
|
|
ADD_EXECUTABLE(cc
|
|
|
|
|
${SOURCE}
|
|
|
|
|
${DATA}
|
|
|
|
|
)
|
2017-11-11 22:32:30 +01:00
|
|
|
|
|
|
|
|
# Linking
|
2017-11-12 01:38:50 +01:00
|
|
|
TARGET_LINK_LIBRARIES(cc
|
|
|
|
|
${Boost_LIBRARIES}
|
|
|
|
|
${llvm_libs}
|
2017-11-11 22:32:30 +01:00
|
|
|
)
|