-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
66 lines (54 loc) · 2.2 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
# Copyright (c) 2015 Andrew Sutton
# All rights reserved
# Project configuration
cmake_minimum_required(VERSION 3.1)
project(beaker VERSION 0.0 LANGUAGES C CXX)
enable_testing()
foreach(component MAJOR MINOR PATCH TWEAK)
if(PROJECT_VERSION_${component} STREQUAL "")
set(PROJECT_VERSION_${component} 0)
endif()
endforeach()
set(BEAKER_PACKAGE_NAME ${PROJECT_NAME})
set(BEAKER_PACKAGE_TARNAME ${BEAKER_PACKAGE_NAME})
set(BEAKER_PACKAGE_VERSION ${PROJECT_VERSION})
set(BEAKER_PACKAGE_STRING "${BEAKER_PACKAGE_NAME} ${BEAKER_PACKAGE_VERSION}")
set(BEAKER_PACKAGE_BUGREPORT "https://github.com/asutton/beaker/issues")
set(BEAKER_PACKAGE_URL "https://github.com/asutton/beaker")
set(BEAKER_VERSION ${PROJECT_VERSION})
set(BEAKER_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(BEAKER_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(BEAKER_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(BEAKER_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
# Boost dependencies
find_package(Boost 1.55.0 REQUIRED COMPONENTS system filesystem program_options)
# LLVM dependencies
find_package(LLVM 3.6 REQUIRED CONFIG)
llvm_map_components_to_libnames(LLVM_LIBRARIES core)
# FIXME: The discovery of additional tools should probably
# be a runtime configuration issue. That is, we should use
# the environment or a configuration library to register the
# availability of tools and then select among those based
# on the requested compilation task.
#
# For now this is probably fine.
find_program(LLVM_IR_COMPILER llc HINTS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
# Use the discovered or configured build tools
# within Beaker. Note that the native compiler is
# also used as the frontend to the native linker
# since that will guarantee that we get the C
# runtime in the output.
#
# TODO: Actually use the low-level tools and link
# only against the minimal Beaker runtime.
set(BEAKER_NATIVE_COMPILER ${CMAKE_C_COMPILER})
set(BEAKER_NATIVE_ARCHIVER ${CMAKE_AR})
# Compiler configuration
set(CMAKE_CXX_FLAGS "-Wall -std=c++1y")
# TODO: Remove when 'lingo' submodule is updated.
include_directories(lingo)
if(NOT TARGET check)
add_custom_target(check COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target test)
endif()
add_subdirectory(lingo)
add_subdirectory(beaker)