-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
257 lines (223 loc) · 6.29 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#
#
# INPUTs:
# ANGLE_ROOT: Absolute path to ANGLE source
cmake_minimum_required(VERSION 2.8.12)
project(ANGLE C CXX)
if(APPLE)
enable_language(OBJC OBJCXX)
endif()
if(NOT ANGLE_ROOT)
message(FATAL_ERROR "ANGLE_ROOT is not defined")
endif()
if(NOT EXISTS ${ANGLE_ROOT})
message(FATAL_ERROR "ANGLE_ROOT is not found (${ANGLE_ROOT})")
endif()
if(NOT CHROMIUM_ZLIB_ROOT)
message(FATAL_ERROR "CHROMIUM_ZLIB is not defined")
endif()
if(NOT EXISTS ${CHROMIUM_ZLIB_ROOT})
message(FATAL_ERROR "CHROMIUM_ZLIB is not found (${CHROMIUM_ZLIB_ROOT})")
endif()
if(NOT ANGLE_BACKEND)
set(ANGLE_BACKEND DirectX)
endif()
include(./angle-srcs.cmake)
set(srcs)
if(ANGLE_VULKAN_HEADERS_ROOT)
include_directories(${ANGLE_VULKAN_HEADERS_ROOT}/include)
endif()
if(ANGLE_SPIRV_HEADERS_ROOT)
include_directories(${ANGLE_SPIRV_HEADERS_ROOT}/include)
endif()
if(ANGLE_SPIRV_TOOLS_ROOT)
include_directories(${ANGLE_SPIRV_TOOLS_ROOT}/include)
endif()
if(ANGLE_GLSLANG_ROOT)
include_directories(${ANGLE_GLSLANG_ROOT})
endif()
if(ANGLE_VOLK_ROOT)
include_directories(${ANGLE_VOLK_ROOT})
endif()
if(ANGLE_SPIRV_CROSS_ROOT)
include_directories(${ANGLE_SPIRV_CROSS_ROOT})
endif()
list(APPEND srcs
${angle_fe_translator_srcs}
${angle_fe_preprocessor_srcs}
${angle_fe_translator_lib_common_srcs}
${angle_common_srcs}
${angle_libangle_srcs}
${angle_egl_srcs}
${angle_image_util_srcs}
${angle_libglesv2_srcs})
if(${ANGLE_BACKEND} STREQUAL Vulkan)
list(APPEND srcs
${angle_fe_translator_lib_vulkan_srcs}
${angle_libangle_vulkan_common_srcs}
)
elseif(${ANGLE_BACKEND} STREQUAL Metal)
list(APPEND srcs
${angle_fe_translator_lib_vulkan_srcs}
${angle_fe_translator_lib_metal_srcs}
)
else()
list(APPEND srcs
${angle_fe_translator_lib_hlsl_srcs}
${angle_libangle_d3d_common_srcs}
#${angle_libangle_d3d_9_srcs}
${angle_libangle_d3d_11_srcs})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
# Assume UWP
list(APPEND srcs
${angle_common_win_srcs}
${angle_common_winrt_srcs}
${angle_libangle_d3d_11_winrt_srcs})
add_definitions(
-D_SCL_SECURE_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS)
elseif(WIN32)
list(APPEND srcs
${angle_common_win_srcs}
${angle_common_win32_srcs}
${angle_systeminfo_srcs})
if(${ANGLE_BACKEND} STREQUAL Vulkan)
list(APPEND srcs
${angle_libangle_vulkan_win32_srcs})
else()
list(APPEND srcs
${angle_libangle_d3d_11_win32_srcs})
endif()
elseif(APPLE)
list(APPEND srcs
${angle_common_apple_srcs}
${angle_libangle_metal_mac_srcs}
)
add_definitions(
-Wno-nullability-completeness
-Wno-unguarded-availability
-fno-objc-arc
)
endif()
# Rebase sources
function(rebase_sources var)
set(srcs0)
foreach(s ${ARGN})
list(APPEND srcs0 ${ANGLE_ROOT}/${s})
endforeach()
set(${var} ${srcs0} PARENT_SCOPE)
endfunction()
rebase_sources(srcs ${srcs})
# Common definitions
include_directories(
${ANGLE_ROOT}/src
${ANGLE_ROOT}/include
${ANGLE_ROOT}/src/common/third_party/base
${CMAKE_CURRENT_LIST_DIR}/angle_commit
${CMAKE_CURRENT_BINARY_DIR}/angle/includes)
if(${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
add_definitions(/wd4996) # FIXME:
endif()
if(WIN32)
add_definitions(-DANGLE_IS_WIN)
endif()
# Configurations
if(APPLE)
# FIXME: What BUILD.gn say?
set(CMAKE_CXX_STANDARD 14)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(
-DANGLE_TRANSLATOR_IMPLEMENTATION
-DLIBGLESV2_IMPLEMENTATION
-DLIBEGL_IMPLEMENTATION
-DLIBANGLE_IMPLEMENTATION
-DGL_GLEXT_PROROTYPES
-DEGL_EGLEXT_PROTOTYPES
)
# MSVCRT speicfic?
add_definitions(-DNOMINMAX)
# Backend selection
if(${ANGLE_BACKEND} STREQUAL Vulkan)
add_definitions(-DANGLE_ENABLE_VULKAN)
add_definitions(-DANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS=1
-DANGLE_ENABLE_VULKAN_GPU_TRACE_EVENTS=1)
if(WIN32)
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
endif()
if(ANGLE_VOLK_ROOT)
list(APPEND srcs ${ANGLE_VOLK_ROOT}/volk.c)
add_definitions(-DANGLE_SHARED_LIBVULKAN=1)
endif()
if(ANGLE_VMA_ROOT)
list(APPEND srcs vma_gen.cpp)
include_directories(${ANGLE_VMA_ROOT}/src)
endif()
elseif(${ANGLE_BACKEND} STREQUAL Metal)
add_definitions(-DANGLE_ENABLE_METAL)
rebase_sources(_vulkan_fe_srcs
${angle_fe_translator_lib_vulkan_srcs})
set_source_files_properties(
${_vulkan_fe_srcs}
PROPERTIES
COMPILE_DEFINITIONS "ANGLE_ENABLE_VULKAN")
else()
add_definitions(-DANGLE_ENABLE_HLSL)
#add_definitions(-DANGLE_ENABLE_D3D9) # Requires d3d9
add_definitions(-DANGLE_ENABLE_D3D11) # Requires dxguid
endif()
# FIXME: 32bit??
set(sixtyfour ON)
if(sixtyfour)
add_definitions(-DANGLE_IS_64_BIT_CPU)
else()
add_definitions(-DANGLE_IS_32_BIT_CPU)
endif()
# FIXME: Correct?
add_definitions(
"-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }"
)
add_definitions(
"-DANGLE_VK_MOCK_ICD_JSON=\"\""
"-DANGLE_VK_LAYERS_DIR=\"\""
)
# Headers required for User
# Definitions required for User
add_definitions(
# Use static-link
-DANGLE_EXPORT=
-DEGLAPI=
-DGL_API=
-DGL_APIENTRY=
-DGL_APICALL=
# zlib
-DCPU_NO_SIMD
-DCHROMIUM_ZLIB_NO_CHROMECONF
)
set(chromium_zlib_srcs
${CHROMIUM_ZLIB_ROOT}/adler32.c
${CHROMIUM_ZLIB_ROOT}/compress.c
${CHROMIUM_ZLIB_ROOT}/cpu_features.c
${CHROMIUM_ZLIB_ROOT}/crc32.c
${CHROMIUM_ZLIB_ROOT}/deflate.c
${CHROMIUM_ZLIB_ROOT}/gzclose.c
${CHROMIUM_ZLIB_ROOT}/gzlib.c
${CHROMIUM_ZLIB_ROOT}/gzread.c
${CHROMIUM_ZLIB_ROOT}/gzwrite.c
${CHROMIUM_ZLIB_ROOT}/infback.c
${CHROMIUM_ZLIB_ROOT}/inffast.c
${CHROMIUM_ZLIB_ROOT}/inflate.c
${CHROMIUM_ZLIB_ROOT}/inftrees.c
${CHROMIUM_ZLIB_ROOT}/trees.c
${CHROMIUM_ZLIB_ROOT}/uncompr.c
${CHROMIUM_ZLIB_ROOT}/zutil.c
${CHROMIUM_ZLIB_ROOT}/google/compression_utils_portable.cc
)
include_directories(
${CHROMIUM_ZLIB_ROOT}
${CHROMIUM_ZLIB_ROOT}/google)
add_library(angle_static STATIC ${srcs}
${chromium_zlib_srcs})