Skip to content

Commit 4cafa1e

Browse files
committed
Merge tk-1001-2 into tk-cutfade, resolving conflicts in audio_mixer.cpp
2 parents caf59da + c0ceb77 commit 4cafa1e

File tree

29 files changed

+303
-974
lines changed

29 files changed

+303
-974
lines changed

BUILDING.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ You can figure out which files you need by looking at each of the `ExternalProje
3838

3939
1. Install Visual Studio 2022.
4040

41-
3. `git clone --single-branch --branch master https://github.com/CasparCG/server casparcg-server-master`
41+
2. `git clone --single-branch --branch master https://github.com/CasparCG/server casparcg-server-master`
4242

43-
4. Open the cloned folder in Visual Studio.
43+
3. Open the cloned folder in Visual Studio.
4444

45-
5. Build All and ensure it builds successfully
45+
4. Build All and ensure it builds successfully
4646

4747
# Linux
4848

@@ -83,7 +83,8 @@ Before beginning, check the build options section below, to decide if you want t
8383
4. If using system CEF (default & recommended), `sudo add-apt-repository ppa:casparcg/ppa` and `sudo apt-get install casparcg-cef-131-dev`
8484
5. `mkdir build && cd build`
8585
6. `cmake ../src` You can add any of the build options from below to this command
86-
7. `make -j8`
86+
7. `cmake --build . --parallel`
87+
8. `cmake --install . --prefix staging`
8788

8889
If all goes to plan, a folder called 'staging' has been created with everything you need to run CasparCG server.
8990

@@ -96,3 +97,5 @@ If all goes to plan, a folder called 'staging' has been created with everything
9697
-DUSE_SYSTEM_CEF=OFF - (Linux only, default ON) use the version of CEF from your OS. This expects to be using builds from https://launchpad.net/~casparcg/+archive/ubuntu/ppa
9798

9899
-DDIAG_FONT_PATH - Specify an alternate path/font to use for the DIAG window. On linux, this will often want to be set to an absolute path of a font
100+
101+
-DCASPARCG_BINARY_NAME=casparcg-server - (Linux only) generate the executable with the specified name. This also reconfigures the install target to be a bit more friendly with system package managers.

src/CMakeModules/Bootstrap_Linux.cmake

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ endif()
1414
set(ENABLE_HTML ON CACHE BOOL "Enable CEF and HTML producer")
1515
set(USE_STATIC_BOOST OFF CACHE BOOL "Use shared library version of Boost")
1616
set(USE_SYSTEM_CEF ON CACHE BOOL "Use the version of cef from your OS (only tested with Ubuntu)")
17+
set(CASPARCG_BINARY_NAME "casparcg" CACHE STRING "Custom name of the binary to build (this disables some install files)")
1718

1819
# Determine build (target) platform
1920
SET (PLATFORM_FOLDER_NAME "linux")
@@ -28,21 +29,31 @@ MARK_AS_ADVANCED (CMAKE_INSTALL_PREFIX)
2829
if (USE_STATIC_BOOST)
2930
SET (Boost_USE_STATIC_LIBS ON)
3031
endif()
31-
FIND_PACKAGE (Boost 1.74.0 COMPONENTS system thread chrono filesystem log_setup log locale regex date_time coroutine REQUIRED)
32-
FIND_PACKAGE (FFmpeg REQUIRED)
33-
FIND_PACKAGE (OpenGL REQUIRED COMPONENTS OpenGL GLX)
34-
FIND_PACKAGE (GLEW REQUIRED)
35-
FIND_PACKAGE (TBB REQUIRED)
36-
FIND_PACKAGE (OpenAL REQUIRED)
37-
FIND_PACKAGE (SFML 2 COMPONENTS graphics window system REQUIRED)
38-
FIND_PACKAGE (X11 REQUIRED)
32+
find_package(Boost 1.74.0 COMPONENTS system thread chrono filesystem log_setup log locale regex date_time coroutine REQUIRED)
33+
find_package(FFmpeg REQUIRED)
34+
find_package(OpenGL REQUIRED COMPONENTS OpenGL GLX)
35+
find_package(GLEW REQUIRED)
36+
find_package(TBB REQUIRED)
37+
find_package(OpenAL REQUIRED)
38+
find_package(SFML 2 COMPONENTS graphics window REQUIRED)
39+
find_package(X11 REQUIRED)
40+
41+
# support for Ubuntu 22.04
42+
if (NOT TARGET OpenAL::OpenAL)
43+
add_library(OpenAL::OpenAL INTERFACE IMPORTED)
44+
target_include_directories(OpenAL::OpenAL INTERFACE ${OPENAL_INCLUDE_DIR})
45+
target_link_libraries(OpenAL::OpenAL INTERFACE ${OPENAL_LIBRARY})
46+
endif()
3947

4048
if (ENABLE_HTML)
4149
if (USE_SYSTEM_CEF)
4250
set(CEF_LIB_PATH "/usr/lib/casparcg-cef-131")
43-
set(CEF_INCLUDE_PATH "/usr/include/casparcg-cef-131")
4451

45-
set(CEF_LIB
52+
add_library(CEF::CEF INTERFACE IMPORTED)
53+
target_include_directories(CEF::CEF INTERFACE
54+
"/usr/include/casparcg-cef-131"
55+
)
56+
target_link_libraries(CEF::CEF INTERFACE
4657
"-Wl,-rpath,${CEF_LIB_PATH} ${CEF_LIB_PATH}/libcef.so"
4758
"${CEF_LIB_PATH}/libcef_dll_wrapper.a"
4859
)
@@ -61,22 +72,35 @@ if (ENABLE_HTML)
6172
ExternalProject_Get_Property(cef SOURCE_DIR)
6273
ExternalProject_Get_Property(cef BINARY_DIR)
6374

64-
# Note: All of these must be referenced in the BUILD_BYPRODUCTS above, to satisfy ninja
65-
set(CEF_LIB
75+
add_library(CEF::CEF INTERFACE IMPORTED)
76+
target_include_directories(CEF::CEF INTERFACE
77+
"${SOURCE_DIR}"
78+
)
79+
target_link_libraries(CEF::CEF INTERFACE
80+
# Note: All of these must be referenced in the BUILD_BYPRODUCTS above, to satisfy ninja
6681
"${SOURCE_DIR}/Release/libcef.so"
6782
"${BINARY_DIR}/libcef_dll_wrapper/libcef_dll_wrapper.a"
6883
)
6984

70-
set(CEF_INCLUDE_PATH "${SOURCE_DIR}")
71-
set(CEF_BIN_PATH "${SOURCE_DIR}/Release")
72-
set(CEF_RESOURCE_PATH "${SOURCE_DIR}/Resources")
85+
install(DIRECTORY ${SOURCE_DIR}/Resources/locales TYPE LIB)
86+
install(FILES ${SOURCE_DIR}/Resources/chrome_100_percent.pak TYPE LIB)
87+
install(FILES ${SOURCE_DIR}/Resources/chrome_200_percent.pak TYPE LIB)
88+
install(FILES ${SOURCE_DIR}/Resources/icudtl.dat TYPE LIB)
89+
install(FILES ${SOURCE_DIR}/Resources/resources.pak TYPE LIB)
90+
91+
install(FILES ${SOURCE_DIR}/Release/chrome-sandbox TYPE LIB)
92+
install(FILES ${SOURCE_DIR}/Release/libcef.so TYPE LIB)
93+
install(FILES ${SOURCE_DIR}/Release/libEGL.so TYPE LIB)
94+
install(FILES ${SOURCE_DIR}/Release/libGLESv2.so TYPE LIB)
95+
install(FILES ${SOURCE_DIR}/Release/libvk_swiftshader.so TYPE LIB)
96+
install(FILES ${SOURCE_DIR}/Release/libvulkan.so.1 TYPE LIB)
97+
install(FILES ${SOURCE_DIR}/Release/snapshot_blob.bin TYPE LIB)
98+
install(FILES ${SOURCE_DIR}/Release/v8_context_snapshot.bin TYPE LIB)
99+
install(FILES ${SOURCE_DIR}/Release/vk_swiftshader_icd.json TYPE LIB)
73100
endif()
74101
endif ()
75102

76103
SET (BOOST_INCLUDE_PATH "${Boost_INCLUDE_DIRS}")
77-
SET (TBB_INCLUDE_PATH "${TBB_INCLUDE_DIRS}")
78-
SET (GLEW_INCLUDE_PATH "${GLEW_INCLUDE_DIRS}")
79-
SET (SFML_INCLUDE_PATH "${SFML_INCLUDE_DIR}")
80104
SET (FFMPEG_INCLUDE_PATH "${FFMPEG_INCLUDE_DIRS}")
81105

82106
LINK_DIRECTORIES("${FFMPEG_LIBRARY_DIRS}")

src/CMakeModules/Bootstrap_Windows.cmake

Lines changed: 74 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cmake_minimum_required (VERSION 3.16)
22

33
include(ExternalProject)
4+
include(FetchContent)
45

56
if(POLICY CMP0135)
67
cmake_policy(SET CMP0135 NEW)
@@ -33,6 +34,17 @@ function(casparcg_add_runtime_dependency_dir FILE_TO_COPY)
3334
set(CASPARCG_RUNTIME_DEPENDENCIES_DEBUG_DIRS "${CASPARCG_RUNTIME_DEPENDENCIES_DEBUG_DIRS}" "${FILE_TO_COPY}" CACHE INTERNAL "")
3435
endif()
3536
endfunction()
37+
function(casparcg_add_runtime_dependency_from_target TARGET)
38+
get_target_property(_runtime_lib_name ${TARGET} IMPORTED_LOCATION_RELEASE)
39+
if (NOT "${_runtime_lib_name}" STREQUAL "")
40+
set(CASPARCG_RUNTIME_DEPENDENCIES_RELEASE "${CASPARCG_RUNTIME_DEPENDENCIES_RELEASE}" "${_runtime_lib_name}" CACHE INTERNAL "")
41+
endif()
42+
43+
get_target_property(_runtime_lib_name ${TARGET} IMPORTED_LOCATION_DEBUG)
44+
if (NOT "${_runtime_lib_name}" STREQUAL "")
45+
set(CASPARCG_RUNTIME_DEPENDENCIES_DEBUG "${CASPARCG_RUNTIME_DEPENDENCIES_DEBUG}" "${_runtime_lib_name}" CACHE INTERNAL "")
46+
endif()
47+
endfunction()
3648

3749
casparcg_add_runtime_dependency("${PROJECT_SOURCE_DIR}/shell/casparcg.config")
3850

@@ -65,7 +77,7 @@ else ()
6577
--with-libraries=regex
6678
--with-libraries=system
6779
--with-libraries=thread
68-
BUILD_COMMAND ./b2 install debug release --prefix=${BOOST_INSTALL_DIR} link=static threading=multi runtime-link=shared -j ${CONFIG_CPU_COUNT}
80+
BUILD_COMMAND ./b2 install debug release --prefix=${BOOST_INSTALL_DIR} link=static threading=multi runtime-link=shared -j ${CONFIG_CPU_COUNT}
6981
INSTALL_COMMAND ""
7082
)
7183
set(BOOST_INCLUDE_PATH "${BOOST_INSTALL_DIR}/include/boost-1_74")
@@ -101,69 +113,59 @@ casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/swscale-8.dll")
101113
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/ffmpeg.exe")
102114
casparcg_add_runtime_dependency("${FFMPEG_BIN_PATH}/ffprobe.exe")
103115

116+
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
117+
104118
set(EXTERNAL_CMAKE_ARGS "")
105-
if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
119+
if (is_multi_config)
106120
set(EXTERNAL_CMAKE_ARGS "-DCMAKE_BUILD_TYPE:STRING=$<CONFIG>")
121+
else()
122+
set(EXTERNAL_CMAKE_ARGS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}")
107123
endif ()
108124

109125
# TBB
110-
casparcg_add_external_project(tbb)
111-
ExternalProject_Add(tbb
126+
FetchContent_Declare(tbb
112127
URL ${CASPARCG_DOWNLOAD_MIRROR}/tbb/oneapi-tbb-2021.1.1-win.zip
113128
URL_HASH MD5=51bf49044d477dea67670abd92f8814c
114129
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
115-
CONFIGURE_COMMAND ""
116-
BUILD_COMMAND ""
117-
INSTALL_COMMAND ""
118130
)
119-
ExternalProject_Get_Property(tbb SOURCE_DIR)
120-
set(TBB_INCLUDE_PATH "${SOURCE_DIR}/include")
121-
set(TBB_BIN_PATH "${SOURCE_DIR}/redist/intel64/vc14")
122-
link_directories("${SOURCE_DIR}/lib/intel64/vc14")
123-
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb12.dll" "Release")
124-
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbb12_debug.dll" "Debug")
125-
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc.dll" "Release")
126-
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_debug.dll" "Debug")
127-
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy.dll" "Release")
128-
casparcg_add_runtime_dependency("${TBB_BIN_PATH}/tbbmalloc_proxy_debug.dll" "Debug")
131+
FetchContent_MakeAvailable(tbb)
132+
133+
list(APPEND CMAKE_PREFIX_PATH ${tbb_SOURCE_DIR}/lib/cmake/tbb)
134+
find_package(tbb REQUIRED)
135+
136+
casparcg_add_runtime_dependency_from_target(TBB::tbb)
137+
casparcg_add_runtime_dependency_from_target(TBB::tbbmalloc)
138+
casparcg_add_runtime_dependency_from_target(TBB::tbbmalloc_proxy)
129139

130140
# GLEW
131-
casparcg_add_external_project(glew)
132-
ExternalProject_Add(glew
141+
FetchContent_Declare(glew
133142
URL ${CASPARCG_DOWNLOAD_MIRROR}/glew/glew-2.2.0-win32.zip
134143
URL_HASH MD5=1feddfe8696c192fa46a0df8eac7d4bf
135144
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
136-
CONFIGURE_COMMAND ""
137-
BUILD_COMMAND ""
138-
INSTALL_COMMAND ""
139145
)
140-
ExternalProject_Get_Property(glew SOURCE_DIR)
141-
set(GLEW_INCLUDE_PATH ${SOURCE_DIR}/include)
142-
set(GLEW_BIN_PATH ${SOURCE_DIR}/bin/Release/x64)
143-
link_directories(${SOURCE_DIR}/lib/Release/x64)
144-
add_definitions( -DGLEW_NO_GLU )
145-
casparcg_add_runtime_dependency("${GLEW_BIN_PATH}/glew32.dll")
146+
FetchContent_MakeAvailable(glew)
147+
148+
add_library(GLEW::glew INTERFACE IMPORTED)
149+
target_include_directories(GLEW::glew INTERFACE ${glew_SOURCE_DIR}/include)
150+
target_link_directories(GLEW::glew INTERFACE ${glew_SOURCE_DIR}/lib/Release/x64)
151+
target_link_libraries(GLEW::glew INTERFACE glew32)
152+
casparcg_add_runtime_dependency("${glew_SOURCE_DIR}/bin/Release/x64/glew32.dll")
146153

147154
# SFML
148-
casparcg_add_external_project(sfml)
149-
ExternalProject_Add(sfml
150-
URL ${CASPARCG_DOWNLOAD_MIRROR}/sfml/SFML-2.4.2-windows-vc14-64-bit.zip
151-
URL_HASH MD5=8a2f747335fa21a7a232976daa9031ac
155+
FetchContent_Declare(sfml
156+
URL ${CASPARCG_DOWNLOAD_MIRROR}/sfml/SFML-2.6.2-windows-vc17-64-bit.zip
157+
URL_HASH MD5=dee0602d6f94d1843eef4d7568d2c23d
152158
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
153-
CONFIGURE_COMMAND ""
154-
BUILD_COMMAND ""
155-
INSTALL_COMMAND ""
156159
)
157-
ExternalProject_Get_Property(sfml SOURCE_DIR)
158-
set(SFML_INCLUDE_PATH ${SOURCE_DIR}/include)
159-
set(SFML_BIN_PATH "${SOURCE_DIR}/bin")
160-
link_directories(${SOURCE_DIR}/lib)
161-
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-graphics-d-2.dll" "Debug")
162-
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-graphics-2.dll" "Release")
163-
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-window-d-2.dll" "Debug")
164-
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-window-2.dll" "Release")
165-
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-system-d-2.dll" "Debug")
166-
casparcg_add_runtime_dependency("${SFML_BIN_PATH}/sfml-system-2.dll" "Release")
160+
FetchContent_MakeAvailable(sfml)
161+
162+
list(APPEND CMAKE_PREFIX_PATH ${sfml_SOURCE_DIR}/lib/cmake/SFML)
163+
# set(SFML_STATIC_LIBRARIES TRUE)
164+
find_package(SFML 2 COMPONENTS graphics window REQUIRED)
165+
166+
casparcg_add_runtime_dependency_from_target(sfml-graphics)
167+
casparcg_add_runtime_dependency_from_target(sfml-window)
168+
casparcg_add_runtime_dependency_from_target(sfml-system)
167169

168170
#ZLIB
169171
casparcg_add_external_project(zlib)
@@ -178,27 +180,26 @@ ExternalProject_Get_Property(zlib SOURCE_DIR)
178180
ExternalProject_Get_Property(zlib BINARY_DIR)
179181
set(ZLIB_INCLUDE_PATH "${SOURCE_DIR};${BINARY_DIR}")
180182

181-
if (CMAKE_GENERATOR MATCHES "Visual Studio")
183+
if (is_multi_config)
182184
link_directories(${BINARY_DIR}/Release)
183185
else()
184186
link_directories(${BINARY_DIR})
185187
endif()
186188

187-
# OPENAL
188-
casparcg_add_external_project(openal)
189-
ExternalProject_Add(openal
189+
# OpenAL
190+
FetchContent_Declare(openal
190191
URL ${CASPARCG_DOWNLOAD_MIRROR}/openal/openal-soft-1.19.1-bin.zip
191192
URL_HASH MD5=b78ef1ba26f7108e763f92df6bbc3fa5
192193
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
193-
BUILD_IN_SOURCE 1
194-
CONFIGURE_COMMAND ""
195-
BUILD_COMMAND ${CMAKE_COMMAND} -E copy bin/Win64/soft_oal.dll bin/Win64/OpenAL32.dll
196-
INSTALL_COMMAND ""
197194
)
198-
ExternalProject_Get_Property(openal SOURCE_DIR)
199-
set(OPENAL_INCLUDE_PATH "${SOURCE_DIR}/include")
200-
link_directories("${SOURCE_DIR}/libs/Win64")
201-
casparcg_add_runtime_dependency("${SOURCE_DIR}/bin/Win64/OpenAL32.dll")
195+
FetchContent_MakeAvailable(openal)
196+
file(COPY_FILE ${openal_SOURCE_DIR}/bin/Win64/soft_oal.dll ${openal_SOURCE_DIR}/bin/Win64/OpenAL32.dll)
197+
198+
add_library(OpenAL::OpenAL INTERFACE IMPORTED)
199+
target_include_directories(OpenAL::OpenAL INTERFACE ${openal_SOURCE_DIR}/include)
200+
target_link_directories(OpenAL::OpenAL INTERFACE ${openal_SOURCE_DIR}/libs/Win64)
201+
target_link_libraries(OpenAL::OpenAL INTERFACE OpenAL32)
202+
casparcg_add_runtime_dependency("${openal_SOURCE_DIR}/bin/Win64/OpenAL32.dll")
202203

203204
# flash template host
204205
casparcg_add_external_project(flashtemplatehost)
@@ -219,7 +220,6 @@ set(TEMPLATE_HOST_PATH "${SOURCE_DIR}")
219220
set(LIBERATION_FONTS_BIN_PATH "${PROJECT_SOURCE_DIR}/shell/liberation-fonts")
220221
casparcg_add_runtime_dependency("${LIBERATION_FONTS_BIN_PATH}/LiberationMono-Regular.ttf")
221222

222-
message("TEST ${EXTERNAL_CMAKE_ARGS}")
223223
# CEF
224224
if (ENABLE_HTML)
225225
casparcg_add_external_project(cef)
@@ -233,30 +233,33 @@ if (ENABLE_HTML)
233233
ExternalProject_Get_Property(cef SOURCE_DIR)
234234
ExternalProject_Get_Property(cef BINARY_DIR)
235235

236+
add_library(CEF::CEF INTERFACE IMPORTED)
237+
add_dependencies(CEF::CEF cef)
238+
target_include_directories(CEF::CEF INTERFACE
239+
"${SOURCE_DIR}"
240+
)
236241

237-
set(CEF_INCLUDE_PATH ${SOURCE_DIR})
238242
set(CEF_RESOURCE_PATH ${SOURCE_DIR}/Resources)
239243
set(CEF_BIN_PATH ${SOURCE_DIR}/Release)
240-
link_directories(${SOURCE_DIR}/Release)
241-
link_directories(${BINARY_DIR}/libcef_dll_wrapper)
242-
243-
if (CMAKE_GENERATOR MATCHES "Visual Studio")
244-
set(CEF_LIB
245-
libcef
246-
optimized Release/libcef_dll_wrapper
247-
debug Debug/libcef_dll_wrapper)
244+
245+
if (is_multi_config)
246+
target_link_libraries(CEF::CEF INTERFACE
247+
${SOURCE_DIR}/Release/libcef.lib
248+
optimized ${BINARY_DIR}/libcef_dll_wrapper/Release/libcef_dll_wrapper.lib
249+
debug ${BINARY_DIR}/libcef_dll_wrapper/Debug/libcef_dll_wrapper.lib)
248250
else()
249-
set(CEF_LIB
250-
libcef
251-
libcef_dll_wrapper)
251+
link_directories(${SOURCE_DIR}/Release ${BINARY_DIR}/libcef_dll_wrapper)
252+
target_link_libraries(CEF::CEF INTERFACE
253+
libcef.lib
254+
libcef_dll_wrapper.lib)
252255
endif()
253256

254257
casparcg_add_runtime_dependency_dir("${CEF_RESOURCE_PATH}/locales")
255258
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/chrome_100_percent.pak")
256259
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/chrome_200_percent.pak")
257260
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/resources.pak")
258261
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/icudtl.dat")
259-
262+
260263
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/snapshot_blob.bin")
261264
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/v8_context_snapshot.bin")
262265
casparcg_add_runtime_dependency("${CEF_BIN_PATH}/libcef.dll")

0 commit comments

Comments
 (0)