-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
executable file
·56 lines (44 loc) · 1.37 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
cmake_minimum_required(VERSION 2.6)
project(jiyu)
find_package (Threads)
set(LLVM_DIR "${PROJECT_SOURCE_DIR}/llvm/lib/cmake/llvm/")
find_package(LLVM REQUIRED CONFIG)
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DENV32)
else()
add_definitions(-DENV64)
endif()
#include_directories()
set (JIYU_SRCS
src/main.cpp
src/parser.cpp
src/lexer.cpp
src/compiler.cpp
src/llvm.cpp
src/sema.cpp
src/copier.cpp
src/os_support.cpp
)
if (UNIX AND NOT APPLE)
set(LINUX TRUE)
endif ()
# compiler options
if (WIN32)
# @Cleanup is there an easier way to get the CRT that LLVM was configured to use?
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MT")
else()
add_definitions(-Wno-writable-strings --std=c++11 -g -fno-rtti -Wall -Wextra -pedantic -Wno-unused-parameter)
endif()
if (APPLE)
add_definitions(-DMACOSX -DUNIX)
endif()
if (LINUX)
add_definitions(-DLINUX -DUNIX)
endif ()
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(LLVM_LIBS ${LLVM_TARGETS_TO_BUILD} asmparser asmprinter passes orcjit)
add_executable(jiyu ${JIYU_SRCS})
target_link_libraries(jiyu ${CMAKE_THREAD_LIBS_INIT} ${LLVM_LIBS})