Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update CEF to 117 SOFIE-2162 #61

Merged
merged 6 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/linux-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ jobs:
libpostproc-dev \
libswresample-dev

- name: Extract docker dependencies
run: |
./tools/linux/ensure-base-images
sudo ./tools/linux/extract-deps-from-docker
env:
CI: 1

- name: Run build
run: |

Expand Down
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ _Note: if you ran docker with sudo, CasparCG server will not be able to run with
2. `git clone --single-branch --branch master https://github.com/CasparCG/server casparcg-server-master`
3. `cd casparcg-server-master`
4. Install dependencies, this can be done with `sudo ./tools/linux/install-dependencies`
5. Extract Boost, FFmpeg and CEF from the docker images via `sudo ./tools/linux/extract-deps-from-docker`. Alternatively these can be prepared manually by following the steps laid out in each Dockerfile
5. Extract Boost and FFmpeg from the docker images via `sudo ./tools/linux/extract-deps-from-docker`. Alternatively these can be prepared manually by following the steps laid out in each Dockerfile
6. `mkdir build && cd build`
7. `cmake ../src`
8. `make -j8`
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SET (CONFIG_VERSION_TAG "NRK-Dev")
option(ENABLE_HTML "Enable HTML module, require CEF" ON)

# Add custom cmake modules path
SET (CASPARCG_PATCH_DIR ${CMAKE_SOURCE_DIR}/CMakeModules/patches)
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)

if (MSVC)
Expand Down
32 changes: 26 additions & 6 deletions src/CMakeModules/Bootstrap_Linux.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required (VERSION 3.16)

include(ExternalProject)

# Determine build (target) platform
INCLUDE (PlatformIntrospection)
_DETERMINE_PLATFORM (CONFIG_PLATFORM)
Expand Down Expand Up @@ -47,8 +49,30 @@ FIND_PACKAGE (SFML 2 COMPONENTS graphics window system REQUIRED)
FIND_PACKAGE (X11 REQUIRED)

if (ENABLE_HTML)
SET(CEF_ROOT_DIR "/opt/cef" CACHE STRING "Path to CEF")
FIND_PACKAGE (CEF REQUIRED)
#casparcg_add_external_project(cef)
ExternalProject_Add(cef
URL https://cef-builds.spotifycdn.com/cef_binary_117.2.5%2Bgda4c36a%2Bchromium-117.0.5938.152_linux64_minimal.tar.bz2
URL_HASH SHA1=7e6c9cf591cf3b1dabe65a7611f5fc166df2ec1e
DOWNLOAD_DIR ${CASPARCG_DOWNLOAD_CACHE}
CMAKE_ARGS -DUSE_SANDBOX=Off
INSTALL_COMMAND ""
PATCH_COMMAND git apply ${CASPARCG_PATCH_DIR}/cef117.patch
BUILD_BYPRODUCTS
"<SOURCE_DIR>/Release/libcef.so"
"<BINARY_DIR>/libcef_dll_wrapper/libcef_dll_wrapper.a"
)
ExternalProject_Get_Property(cef SOURCE_DIR)
ExternalProject_Get_Property(cef BINARY_DIR)

# Note: All of these must be referenced in the BUILD_BYPRODUCTS above, to satisfy ninja
set(CEF_LIB
"${SOURCE_DIR}/Release/libcef.so"
"${BINARY_DIR}/libcef_dll_wrapper/libcef_dll_wrapper.a"
)

set(CEF_INCLUDE_PATH "${SOURCE_DIR}")
set(CEF_BIN_PATH "${SOURCE_DIR}/Release")
set(CEF_RESOURCE_PATH "${SOURCE_DIR}/Resources")
endif ()

SET (BOOST_INCLUDE_PATH "${Boost_INCLUDE_DIRS}")
Expand All @@ -58,10 +82,6 @@ SET (SFML_INCLUDE_PATH "${SFML_INCLUDE_DIR}")
SET (FFMPEG_INCLUDE_PATH "${FFMPEG_INCLUDE_DIRS}")
SET (FREEIMAGE_INCLUDE_PATH "${FreeImage_INCLUDE_DIRS}")

set(CEF_INCLUDE_PATH "${CEF_ROOT_DIR}")
set(CEF_BIN_PATH "${CEF_ROOT_DIR}/Release")
set(CEF_RESOURCE_PATH "${CEF_ROOT_DIR}/Resources")

SET_PROPERTY (GLOBAL PROPERTY USE_FOLDERS ON)

ADD_DEFINITIONS (-DSFML_STATIC)
Expand Down
37 changes: 26 additions & 11 deletions src/CMakeModules/Bootstrap_Windows.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required (VERSION 3.16)

include(ExternalProject)

find_package(Git)

set(CONFIG_VERSION_GIT_HASH "N/A")
Expand Down Expand Up @@ -159,27 +161,40 @@ casparcg_add_runtime_dependency("${LIBERATION_FONTS_BIN_PATH}/LiberationMono-Reg

# CEF
if (ENABLE_HTML)
set(CEF_INCLUDE_PATH "${NUGET_PACKAGES_FOLDER}/cef.sdk.3.3578.1870/CEF")
set(CEF_BIN_PATH "${NUGET_PACKAGES_FOLDER}/cef.redist.x64.3.3578.1870/CEF")
set(CEF_RESOURCE_PATH "${NUGET_PACKAGES_FOLDER}/cef.redist.x64.3.3578.1870/CEF")
link_directories("${NUGET_PACKAGES_FOLDER}/cef.sdk.3.3578.1870/CEF/x64")
# casparcg_add_external_project(cef)
ExternalProject_Add(cef
URL https://cef-builds.spotifycdn.com/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_dir("${CEF_RESOURCE_PATH}/swiftshader")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/cef.pak")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/cef_100_percent.pak")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/cef_200_percent.pak")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/cef_extensions.pak")
casparcg_add_runtime_dependency("${CEF_RESOURCE_PATH}/devtools_resources.pak")
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}/natives_blob.bin")

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)
Expand Down
69 changes: 0 additions & 69 deletions src/CMakeModules/FindCEF.cmake

This file was deleted.

16 changes: 16 additions & 0 deletions src/CMakeModules/patches/cef117.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -132,11 +132,8 @@
# Global setup.
#

-# For VS2022 and Xcode 12+ support.
-cmake_minimum_required(VERSION 3.21)
-
-# Only generate Debug and Release configuration types.
-set(CMAKE_CONFIGURATION_TYPES Debug Release)
+# VS2022 and Xcode 12+ support needs 3.21, but ubuntu22.04 ships with 3.20
+cmake_minimum_required(VERSION 3.20)

# Project name.
# TODO: Change this line to match your project name when you copy this file.
19 changes: 2 additions & 17 deletions src/accelerator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ set(SOURCES

accelerator.cpp
)
if (MSVC)
set(WIN32_SPECIFIC_SOURCES
d3d/d3d_device.cpp
d3d/d3d_device_context.cpp
d3d/d3d_texture2d.cpp
)
endif ()
set(HEADERS
ogl/image/image_kernel.h
ogl/image/image_mixer.h
Expand All @@ -36,19 +29,12 @@ set(HEADERS
accelerator.h
StdAfx.h
)
if (MSVC)
set(WIN32_SPECIFIC_HEADERS
d3d/d3d_device.h
d3d/d3d_device_context.h
d3d/d3d_texture2d.h
)
endif ()

bin2c("ogl/image/shader.vert" "ogl_image_vertex.h" "caspar::accelerator::ogl" "vertex_shader")
bin2c("ogl/image/shader.frag" "ogl_image_fragment.h" "caspar::accelerator::ogl" "fragment_shader")

add_library(accelerator ${SOURCES} ${HEADERS} ${WIN32_SPECIFIC_SOURCES} ${WIN32_SPECIFIC_HEADERS})
target_compile_features(accelerator PRIVATE cxx_std_14)
add_library(accelerator ${SOURCES} ${HEADERS})
target_compile_features(accelerator PRIVATE cxx_std_17)
target_include_directories(accelerator PRIVATE
..
${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -66,6 +52,5 @@ source_group(sources\\cpu\\image cpu/image/.*)
source_group(sources\\cpu\\util cpu/util/.*)
source_group(sources\\ogl\\image ogl/image/.*)
source_group(sources\\ogl\\util ogl/util/.*)
source_group(sources\\d3d d3d/.*)

target_link_libraries(accelerator common core)
Loading