forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
169 lines (146 loc) · 4.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
cmake_minimum_required(VERSION 3.2)
project (CHAKRACORE)
function(clr_unknown_arch)
if (WIN32)
message(FATAL_ERROR "Only AMD64, ARM and I386 are supported")
else()
message(FATAL_ERROR "Only AMD64 and ARM are supported")
endif()
endfunction()
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_PLATFORM_UNIX 1)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
else()
clr_unknown_arch()
endif()
set(CLR_CMAKE_PLATFORM_LINUX 1)
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
add_definitions(-DPLATFORM_UNIX)
set(CLR_CMAKE_PLATFORM_UNIX 1)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
else()
clr_unknown_arch()
endif()
set(CLR_CMAKE_PLATFORM_DARWIN 1)
else()
clr_unknown_arch()
endif()
if(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
add_definitions(-D_M_X64_OR_ARM64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang
OR CMAKE_CXX_COMPILER_ID STREQUAL Clang
OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
# Color diagnostics for g++ and clang++
add_definitions("-fdiagnostics-color=always")
endif()
if(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DPLATFORM_UNIX=1)
if(CLR_CMAKE_PLATFORM_LINUX)
add_definitions(-D__LINUX__=1)
if(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
message("Detected Linux x86_64")
add_definitions(-DLINUX64)
else()
clr_unknown_arch()
endif(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64)
endif(CLR_CMAKE_PLATFORM_LINUX)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
set(IS_64BIT_BUILD 1)
add_definitions(-D_M_X64 -D_M_AMD64 -D_AMD64_)
endif(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
add_definitions(
-DUNICODE
-D_SAFECRT_USE_CPP_OVERLOADS=1
-D__STDC_WANT_LIB_EXT1__=1
-DDISABLE_JIT=1 # xplat-todo: enable the JIT for Linux
)
set(CMAKE_CXX_STANDARD 11)
# CC WARNING FLAGS
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-Wno-implicit-function-declaration"
)
# CXX WARNING FLAGS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-Wno-microsoft\
-Wno-unused-value\
-Wno-int-to-void-pointer-cast\
-Wno-invalid-offsetof\
-Wno-undefined-inline\
-Wno-inconsistent-missing-override\
-Wno-c++14-extensions\
-Wno-macro-redefined\
-Wno-ignored-pragmas\
-Wno-invalid-token-paste\
-Wno-format\
-Wno-invalid-noreturn\
-Wno-null-arithmetic\
-Wno-tautological-constant-out-of-range-compare\
-Wno-tautological-undefined-compare\
-Wno-address-of-temporary\
-Wno-null-conversion\
-Wno-return-type\
-Wno-switch\
-Wno-int-to-pointer-cast"
)
# notes..
# -Wno-address-of-temporary # vtinfo.h, VirtualTableInfo<T>::RegisterVirtualTable
# -Wno-null-conversion # Check shmemory.cpp and cs.cpp here...
# -Wno-return-type # switch unreachable code
# -Wno-switch # switch values not handled
# CXX COMPILER FLAGS
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-fdelayed-template-parsing"
)
# CXX / CC COMPILER FLAGS
add_compile_options(
-fms-extensions
-msse4.1
)
endif(CLR_CMAKE_PLATFORM_UNIX)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(
-DDBG=1
-DDEBUG=1
-D_DEBUG=1 # for PAL
-DDBG_DUMP=1
)
# xplat-todo: reenable this warning
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-Wno-writable-strings"
)
elseif(CMAKE_BUILD_TYPE STREQUAL Test)
add_definitions(
-DENABLE_DEBUG_CONFIG_OPTIONS=1
)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
if(IS_64BIT_BUILD)
add_definitions(
-DBIT64=1
-DSTACK_ALIGN=16
)
endif(IS_64BIT_BUILD)
if(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DFEATURE_PAL)
endif(CLR_CMAKE_PLATFORM_UNIX)
enable_language(ASM)
include_directories(
.
lib/Common
lib/Common/PlaceHolder
pal
pal/inc
pal/inc/rt
${ICU_INCLUDE_PATH}
)
add_subdirectory (pal)
# build the rest with NO_PAL_MINMAX and PAL_STDCPP_COMPAT
add_definitions(
-DNO_PAL_MINMAX
-DPAL_STDCPP_COMPAT
)
add_subdirectory (lib)
add_subdirectory (bin)