-
Notifications
You must be signed in to change notification settings - Fork 268
/
Bootstrap_Windows.cmake
271 lines (248 loc) · 10.9 KB
/
Bootstrap_Windows.cmake
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
cmake_minimum_required (VERSION 3.16)
include(ExternalProject)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
set(BOOST_USE_PRECOMPILED ON CACHE BOOL "Use precompiled boost")
set(CASPARCG_RUNTIME_DEPENDENCIES_RELEASE "" CACHE INTERNAL "")
set(CASPARCG_RUNTIME_DEPENDENCIES_DEBUG "" CACHE INTERNAL "")
set(CASPARCG_RUNTIME_DEPENDENCIES_RELEASE_DIRS "" CACHE INTERNAL "")
set(CASPARCG_RUNTIME_DEPENDENCIES_DEBUG_DIRS "" CACHE INTERNAL "")
function(casparcg_add_runtime_dependency FILE_TO_COPY)
if ("${ARGV1}" STREQUAL "Release" OR NOT ARGV1)
set(CASPARCG_RUNTIME_DEPENDENCIES_RELEASE "${CASPARCG_RUNTIME_DEPENDENCIES_RELEASE}" "${FILE_TO_COPY}" CACHE INTERNAL "")
endif()
if ("${ARGV1}" STREQUAL "Debug" OR NOT ARGV1)
set(CASPARCG_RUNTIME_DEPENDENCIES_DEBUG "${CASPARCG_RUNTIME_DEPENDENCIES_DEBUG}" "${FILE_TO_COPY}" CACHE INTERNAL "")
endif()
endfunction()
function(casparcg_add_runtime_dependency_dir FILE_TO_COPY)
if ("${ARGV1}" STREQUAL "Release" OR NOT ARGV1)
set(CASPARCG_RUNTIME_DEPENDENCIES_RELEASE_DIRS "${CASPARCG_RUNTIME_DEPENDENCIES_RELEASE_DIRS}" "${FILE_TO_COPY}" CACHE INTERNAL "")
endif()
if ("${ARGV1}" STREQUAL "Debug" OR NOT ARGV1)
set(CASPARCG_RUNTIME_DEPENDENCIES_DEBUG_DIRS "${CASPARCG_RUNTIME_DEPENDENCIES_DEBUG_DIRS}" "${FILE_TO_COPY}" CACHE INTERNAL "")
endif()
endfunction()
casparcg_add_runtime_dependency("${PROJECT_SOURCE_DIR}/shell/casparcg.config")
# BOOST
casparcg_add_external_project(boost)
if (BOOST_USE_PRECOMPILED)
ExternalProject_Add(boost
URL ${CASPARCG_DOWNLOAD_MIRROR}/boost/boost_1_74_0-win32-x64-debug-release.zip
URL_HASH MD5=8d379b0da9a5ae50a3980d2fc1a24d34
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(boost SOURCE_DIR)
set(BOOST_INCLUDE_PATH "${SOURCE_DIR}/include/boost-1_74")
link_directories("${SOURCE_DIR}/lib")
else ()
set(BOOST_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/boost-install)
ExternalProject_Add(boost
URL ${CASPARCG_DOWNLOAD_MIRROR}/boost/boost_1_74_0.zip
URL_HASH MD5=df1456965493f05952b7c06205688ae9
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./bootstrap.bat
--with-libraries=filesystem
--with-libraries=locale
--with-libraries=log
--with-libraries=log_setup
--with-libraries=regex
--with-libraries=system
--with-libraries=thread
BUILD_COMMAND ./b2 install debug release --prefix=${BOOST_INSTALL_DIR} link=static threading=multi runtime-link=shared -j ${CONFIG_CPU_COUNT}
INSTALL_COMMAND ""
)
set(BOOST_INCLUDE_PATH "${BOOST_INSTALL_DIR}/include/boost-1_74")
link_directories("${BOOST_INSTALL_DIR}/lib")
endif ()
add_definitions( -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE )
add_definitions( -DBOOST_COROUTINES_NO_DEPRECATION_WARNING )
add_definitions( -DBOOST_LOCALE_HIDE_AUTO_PTR )
# FFMPEG
casparcg_add_external_project(ffmpeg-lib)
ExternalProject_Add(ffmpeg-lib
URL ${CASPARCG_DOWNLOAD_MIRROR}/ffmpeg/ffmpeg-7.0.2-full_build-shared.7z
URL_HASH MD5=c5127aeed36a9a86dd3b84346be182f8
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(ffmpeg-lib SOURCE_DIR)
set(FFMPEG_INCLUDE_PATH "${SOURCE_DIR}/include")
set(FFMPEG_BIN_PATH "${SOURCE_DIR}/bin")
link_directories("${SOURCE_DIR}/lib")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/avcodec-61.dll")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/avdevice-61.dll")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/avfilter-10.dll")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/avformat-61.dll")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/avutil-59.dll")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/postproc-58.dll")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/swresample-5.dll")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/swscale-8.dll")
# for scanner:
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/ffmpeg.exe")
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/ffprobe.exe")
# TBB
casparcg_add_external_project(tbb)
ExternalProject_Add(tbb
URL ${CASPARCG_DOWNLOAD_MIRROR}/tbb/oneapi-tbb-2021.1.1-win.zip
URL_HASH MD5=51bf49044d477dea67670abd92f8814c
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(tbb SOURCE_DIR)
set(TBB_INCLUDE_PATH "${SOURCE_DIR}/include")
set(TBB_BIN_PATH "${SOURCE_DIR}/redist/intel64/vc14")
link_directories("${SOURCE_DIR}/lib/intel64/vc14")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb12.dll" "Release")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb12_debug.dll" "Debug")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc.dll" "Release")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_debug.dll" "Debug")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy.dll" "Release")
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy_debug.dll" "Debug")
# GLEW
casparcg_add_external_project(glew)
ExternalProject_Add(glew
URL ${CASPARCG_DOWNLOAD_MIRROR}/glew/glew-2.2.0-win32.zip
URL_HASH MD5=1feddfe8696c192fa46a0df8eac7d4bf
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(glew SOURCE_DIR)
set(GLEW_INCLUDE_PATH ${SOURCE_DIR}/include)
set(GLEW_BIN_PATH ${SOURCE_DIR}/bin/Release/x64)
link_directories(${SOURCE_DIR}/lib/Release/x64)
add_definitions( -DGLEW_NO_GLU )
casparcg_add_runtime_dependency("${GLEW_BIN_PATH}/glew32.dll")
# SFML
casparcg_add_external_project(sfml)
ExternalProject_Add(sfml
URL ${CASPARCG_DOWNLOAD_MIRROR}/sfml/SFML-2.4.2-windows-vc14-64-bit.zip
URL_HASH MD5=8a2f747335fa21a7a232976daa9031ac
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(sfml SOURCE_DIR)
set(SFML_INCLUDE_PATH ${SOURCE_DIR}/include)
set(SFML_BIN_PATH "${SOURCE_DIR}/bin")
link_directories(${SOURCE_DIR}/lib)
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-graphics-d-2.dll" "Debug")
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-graphics-2.dll" "Release")
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-window-d-2.dll" "Debug")
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-window-2.dll" "Release")
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-system-d-2.dll" "Debug")
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-system-2.dll" "Release")
# FREEIMAGE
casparcg_add_external_project(freeimage)
ExternalProject_Add(freeimage
URL ${CASPARCG_DOWNLOAD_MIRROR}/freeimage/FreeImage319-r1909.zip
URL_HASH MD5=c19087de6b42c7e17f71c6c8d4ad158d
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(freeimage SOURCE_DIR)
set(FREEIMAGE_INCLUDE_PATH "${SOURCE_DIR}/Dist/x64")
set(FREEIMAGE_BIN_PATH "${FREEIMAGE_INCLUDE_PATH}")
link_directories("${FREEIMAGE_INCLUDE_PATH}")
casparcg_add_runtime_dependency("${FREEIMAGE_INCLUDE_PATH}/FreeImage.dll")
#ZLIB
casparcg_add_external_project(zlib)
ExternalProject_Add(zlib
URL ${CASPARCG_DOWNLOAD_MIRROR}/zlib/zlib-1.3.tar.gz
URL_HASH MD5=60373b133d630f74f4a1f94c1185a53f
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(zlib SOURCE_DIR)
ExternalProject_Get_Property(zlib BINARY_DIR)
set(ZLIB_INCLUDE_PATH "${SOURCE_DIR};${BINARY_DIR}")
link_directories(${BINARY_DIR}/Release)
# OPENAL
casparcg_add_external_project(openal)
ExternalProject_Add(openal
URL ${CASPARCG_DOWNLOAD_MIRROR}/openal/openal-soft-1.19.1-bin.zip
URL_HASH MD5=b78ef1ba26f7108e763f92df6bbc3fa5
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} -E copy bin/Win64/soft_oal.dll bin/Win64/OpenAL32.dll
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(openal SOURCE_DIR)
set(OPENAL_INCLUDE_PATH "${SOURCE_DIR}/include")
link_directories("${SOURCE_DIR}/libs/Win64")
casparcg_add_runtime_dependency("${SOURCE_DIR}/bin/Win64/OpenAL32.dll")
# flash template host
casparcg_add_external_project(flashtemplatehost)
ExternalProject_Add(flashtemplatehost
URL ${CASPARCG_DOWNLOAD_MIRROR}/flash-template-host/flash-template-host-files.zip
URL_HASH MD5=360184ce21e34d585d1d898fdd7a6bd8
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(flashtemplatehost SOURCE_DIR)
set(TEMPLATE_HOST_PATH "${SOURCE_DIR}")
# casparcg_add_runtime_dependency_dir("${TEMPLATE_HOST_PATH}")
# LIBERATION_FONTS
set(LIBERATION_FONTS_BIN_PATH "${PROJECT_SOURCE_DIR}/shell/liberation-fonts")
casparcg_add_runtime_dependency("${LIBERATION_FONTS_BIN_PATH}/LiberationMono-Regular.ttf")
# CEF
if (ENABLE_HTML)
casparcg_add_external_project(cef)
ExternalProject_Add(cef
URL ${CASPARCG_DOWNLOAD_MIRROR}/cef/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_windows64_minimal.tar.bz2
URL_HASH MD5=cff21bce81bada2a9e5f0afbec0858f0
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CMAKE_ARGS -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD
INSTALL_COMMAND ""
PATCH_COMMAND git apply ${CASPARCG_PATCH_DIR}/cef117.patch
)
ExternalProject_Get_Property(cef SOURCE_DIR)
ExternalProject_Get_Property(cef BINARY_DIR)
set(CEF_INCLUDE_PATH ${SOURCE_DIR})
set(CEF_BIN_PATH ${SOURCE_DIR}/Release)
set(CEF_RESOURCE_PATH ${SOURCE_DIR}/Resources)
link_directories(${SOURCE_DIR}/Release)
link_directories(${BINARY_DIR}/libcef_dll_wrapper)
casparcg_add_runtime_dependency_dir("${CEF_RESOURCE_PATH}/locales")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/chrome_100_percent.pak")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/chrome_200_percent.pak")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/resources.pak")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/icudtl.dat")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/snapshot_blob.bin")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/v8_context_snapshot.bin")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/libcef.dll")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/chrome_elf.dll")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/d3dcompiler_47.dll")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/libEGL.dll")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/libGLESv2.dll")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/vk_swiftshader.dll")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/vk_swiftshader_icd.json")
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/vulkan-1.dll")
endif ()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT casparcg)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-DCASPAR_SOURCE_PREFIX="${CMAKE_CURRENT_SOURCE_DIR}")
add_definitions(-D_WIN32_WINNT=0x601)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa /Zi /W4 /WX /MP /fp:fast /Zm192 /FIcommon/compiler/vs/disable_silly_warnings.h")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D TBB_USE_ASSERT=1 /D TBB_USE_DEBUG /bigobj")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /Ot /Gy /bigobj")