-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
35 lines (29 loc) · 1.46 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
cmake_minimum_required(VERSION 3.10.3)
project(polymer)
set(CMAKE_CXX_STANDARD 11)
set(LLVM_DIR $ENV{LLVM})
message(STATUS "Searching for LLVM library dependencies in 'LLVM' environment variable...")
find_package(LLVM CONFIG)
if (LLVM_FOUND)
message(STATUS "LLVM cmake dependency found in ${LLVM_DIR}")
message(STATUS "LLVM version ${LLVM_PACKAGE_VERSION}")
if (LLVM_VERSION_MAJOR LESS 6 OR LLVM_VERSION_MAJOR GREATER 6)
message(WARNING "Xenon requires LLVM version 6")
else ()
add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(LLVM_LIBS all)
message(STATUS "LLVM libraries: ${LLVM_LIBS}")
message(STATUS "LLVM includes: ${LLVM_INCLUDE_DIR}")
endif ()
else ()
message(WARNING "Project may not compile without LLVM being found...")
endif ()
set(POLYMER_LIB_HEADERS include/polymer/polymer.h include/polymer/base/llvm.h include/polymer/base/types.h include/polymer/parsing/token.h include/polymer/base/source_file.h)
set(POLYMER_LIB_SOURCES lib/base/llvm.cc lib/parsing/token.cc lib/base/source_file.cc)
add_library(polymerLib STATIC ${POLYMER_LIB_SOURCES} ${POLYMER_LIB_HEADERS})
target_include_directories(polymerLib PUBLIC include ${LLVM_INCLUDE_DIR})
target_link_libraries(polymerLib PUBLIC ${LLVM_LIBS})
set(POLYMER_SOURCES src/polymer.cc)
add_executable(polymer ${POLYMER_SOURCES})
target_include_directories(polymer PUBLIC include ${LLVM_INCLUDE_DIR})
target_link_libraries(polymer PUBLIC polymerLib)