linux-wallpaperengine/CMakeModules/DownloadCEF.cmake
Alexis Maiquez 7bffcded09
feat: make custom version of glslang to improve shader compatibility + random improvements (#291)
* feat: added glslang and spirv-core for handling shaders, should provide better results than current systems

* fix: brought back proper include placement, should fix some shaders not working

* chore: dial down required version to 330

* fix: crash when taking screenshot

* fix: use glReadnPixels for X11 copying to be more memory safe

* chore: reverted part of last commit

* chore: delay initialization of browser until it's used once

* chore: do not initialize web browser unless explicitly needed

* chore: cleanup filesystem functions to use containers directly

* chore: memory cleanup fixes

* chore: fix glReadPixels for older opengl versions

* chore: remove shader patches as they shouldn't be needed anymore

* chore: initialise variables

* chore: update deps, actions and readme

* chore: make use of custon glslang and SPIRV-Cross

* Revert "chore: update deps, actions and readme"

This reverts commit c3fbc9340b.

* chore: update actions to include submodules

* chore: do not depend on SPIRV-Tools

* fix: added log10 macro

* feat: update to latest glslang (swizzle and vec2/vec3/vec4 implicit casting to float)

* revert: delayed initialization of cef was causing issues, reverted

* chore: re-organized web wallpaper support to use custom scheme and better handle multiprocessing

* chore: make use of external repos for all deps instead of copying things manually and more cleanup work

* chore: wrong include file used in CGLSLContext.cpp

* chore: fix wayland generation folder not being present

* feat: somewhat support TEXB0004

* chore: improve function call matching and fallback to more lax method if no function is found

* chore: changed shader compilation slightly so they're passed onto glsl just once

* feat: swap android's fft implementation (which wasn't right) with kissfft's and fix update frequency issues

* chore: added missing dependency

* chore: added missing dep to PKGBUILD

* feat: add testing tools to run over all backgrounds and getting output data

* chore: jail CDirectory to the basepath and prevent accessing data outside of the main directory

* chore: process script now scales the previews so the html file is not too big

* chore: add showcase gallery to the README.md

* chore: update README

* chore: some readability improvements on code

* chore: fix segfault after code cleanup

* chore: make use of std::filesystem::canonical instead of basepath and slight typing changes on texture objects

* chore: fix path detection being wrong, make use of std::filesystem::path on CContainers

* chore: cleanup of the core part of the project

* chore: bring back std::move and make some methods const where it makes sense

* feat: added a pretty printer for easier debug and comparison between different versions of linux-wallpaperengine

* chore: refactored shader compilation code once more to be easier to follow and fixed the longstanding bug of #include not being added in the right place

* chore: more debug info for the pretty printer

* fix: some textures applied were not the right ones

* chore: properly set combos based on textures

* feat: take into account project properties for shader values
feat: proper parsing of combo values in shaders
fix: shader units weren't linked as they should
chore: more support for detecting shader things automatically

* fix: blending mode for passes using the wrong value
fix: shader uniforms from project properties should now be taken into account

* chore: use ubuntu 22 and ubuntu 24 as builders, ubuntu 20 is retired

* chore: use ubuntu 22 and ubuntu 24 as builders, ubuntu 20 is retired

* chore: hopefully fix github actions build

* refactor: simplified working with properties, constants and shader variables

* chore: remove a couple of todos that aren't needed anymore

* chore: simplify the texture detection a little bit, still work left to do

* fix: regression on texture setup not working properly

* fix: filenames with dots were not being handled properly

* chore: remove some uselesss messages

* chore: fixed std::string json values not casting anything to it as it was assumed

* fix: null user value for constants means it cannot be modified by the user

* chore: remove exception when a shader constant uses a non-existant property

* fix: angles can be an user setting too, also added detection for animation frames to show a warning

* fix: ensure variable information is not commented out by a line comment

* fix: shader includes weren't being processed properly

* chore: update to latest glslang and SPIRV-Cross to support non-integer array indices

* chore: make use of auto where it made sense

* feat: make use of in/out promotion on glslang-WallpaperEngine
feat: use glslang-WallpaperEngine linkin process as an extra validation

* chore: improve scripts for running the app

* chore: hide background structure dump behind a command-line switch

* chore: rewritten bloom effect as a json object inside C++ so it's easier to follow

* chore: removed deprecated parameters and switched to argparse instead of getopt
fix: clamping mode wasn't applied by background properly, only globally

* chore: removed help prompt from the output unless actually required

* fix: web subprocesses weren't launching due to parameter's parsing, temporal fix

* feat: added material command copy support

* feat: do not initialize some subsystems if they're disabled or not used by backgrounds

* chore: ignore type in combos as only seems to be used in the editor

* chore: update to latest glslang-WallpaperEngine changes

* chore: delete uniforms if they already exist before setting

* chore: more cleanup and fixes

* chore: more cleanup and fixes

* chore: more cleanup and fixes

* chore: update file functions to make use of shared_ptr/unique_ptr instead of copying things around

* chore: more changes to unique_ptr and shared_ptr

* chore: more changes to unique_ptr and shared_ptr

* chore: more changes to unique_ptr and shared_ptr
feat: improved render initialization process to make it easier and simpler to add new drivers (no more #ifdef in CWallpaperApplication.cpp)

* chore: change all is/as castings to use typeid so no string comparison takes place

* chore: more cleanup, default initialization of values wherever possible

* chore: moved more things to std::unique_ptr and std::shared_ptr

* chore: moved more things to std::unique_ptr and std::shared_ptr

* fix: browser context usage crashed the app

* chore: the setting controls fullscreen detection creation the same way audio works

* fix: ensure that at least one frame is rendered before detecting fullscreen windows

* chore: slight changes to output and documentation to properly reflect current build configuration

* chore: fix mipmap texture creation

* chore: fix pass uniforms not taking into account fragment shader's uniforms
chore: keep processed code in the shader sent to opengl so it appears on RenderDoc

* chore: formating issues by codefactor

* chore: do not use new to allocate the pretty printer

* fix: strchr wasn't properly done for window geometry

* chore: add recording mode for status page generation

* chore: update .gitignore

* chore: update script to make use of video generation instead of the old python scripts

* chore: also copy project.json so it can be used on the site too

* fix: regression on invisible images not being rendered

* feat: add option to disable camera parallax

* chore: add the reversing tools I have locally

* chore: mention some of the common issues in the README.md

* chore: take submodules into account for archlinux

* chore: missed cd "$pkgname" in arch's prepare step
2025-05-10 19:34:59 +02:00

129 lines
6.8 KiB
CMake

# Copyright (c) 2016 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
# Download the CEF binary distribution for |platform| and |version| to
# |download_dir|. The |CEF_ROOT| variable will be set in global scope pointing
# to the extracted location.
# Visit https://cef-builds.spotifycdn.com/index.html for the list of
# supported platforms and versions.
function(DownloadCEF platform version download_dir)
# Specify the binary distribution type and download directory.
set(CEF_DISTRIBUTION "cef_binary_${version}_${platform}")
set(CEF_DOWNLOAD_DIR "${download_dir}")
# The location where we expect the extracted binary distribution.
set(CEF_ROOT "${CEF_DOWNLOAD_DIR}/${CEF_DISTRIBUTION}" CACHE INTERNAL "CEF_ROOT")
# Download and/or extract the binary distribution if necessary.
if(NOT IS_DIRECTORY "${CEF_ROOT}")
set(CEF_DOWNLOAD_FILENAME "${CEF_DISTRIBUTION}.tar.bz2")
set(CEF_DOWNLOAD_PATH "${CEF_DOWNLOAD_DIR}/${CEF_DOWNLOAD_FILENAME}")
if(NOT EXISTS "${CEF_DOWNLOAD_PATH}")
set(CEF_DOWNLOAD_URL "https://cef-builds.spotifycdn.com/${CEF_DOWNLOAD_FILENAME}")
string(REPLACE "+" "%2B" CEF_DOWNLOAD_URL_ESCAPED ${CEF_DOWNLOAD_URL})
# Download the SHA1 hash for the binary distribution.
message(STATUS "Downloading ${CEF_DOWNLOAD_PATH}.sha1 from ${CEF_DOWNLOAD_URL_ESCAPED}...")
file(DOWNLOAD "${CEF_DOWNLOAD_URL_ESCAPED}.sha1" "${CEF_DOWNLOAD_PATH}.sha1")
file(READ "${CEF_DOWNLOAD_PATH}.sha1" CEF_SHA1)
# Download the binary distribution and verify the hash.
message(STATUS "Downloading ${CEF_DOWNLOAD_PATH}...")
file(
DOWNLOAD "${CEF_DOWNLOAD_URL_ESCAPED}" "${CEF_DOWNLOAD_PATH}"
EXPECTED_HASH SHA1=${CEF_SHA1}
SHOW_PROGRESS
)
endif()
# Extract the binary distribution.
message(STATUS "Extracting ${CEF_DOWNLOAD_PATH}...")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf "${CEF_DOWNLOAD_DIR}/${CEF_DOWNLOAD_FILENAME}"
WORKING_DIRECTORY ${CEF_DOWNLOAD_DIR}
)
endif()
endfunction()
# Set common target properties. Use SET_LIBRARY_TARGET_PROPERTIES() or
# SET_EXECUTABLE_TARGET_PROPERTIES() instead of calling this macro directly.
macro(REPLACED_SET_COMMON_TARGET_PROPERTIES target)
# Compile flags. (MODIFIED FOR C/C++ SEPARATION)
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C>:${CEF_COMPILER_FLAGS}>)
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${CEF_CXX_COMPILER_FLAGS}>)
target_compile_options(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>)
target_compile_options(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
# Compile definitions.
target_compile_definitions(${target} PRIVATE ${CEF_COMPILER_DEFINES})
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
# Include directories.
target_include_directories(${target} PRIVATE ${CEF_INCLUDE_PATH})
# Linker flags.
if(CEF_LINKER_FLAGS)
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
endif()
if(CEF_LINKER_FLAGS_DEBUG)
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_DEBUG}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
endif()
if(CEF_LINKER_FLAGS_RELEASE)
string(REPLACE ";" " " _flags_str "${CEF_LINKER_FLAGS_RELEASE}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
endif()
if(OS_MAC)
# Set Xcode target properties.
set_target_properties(${target} PROPERTIES
XCODE_ATTRIBUTE_ALWAYS_SEARCH_USER_PATHS NO
XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11
XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME NO # -fno-objc-link-runtime
XCODE_ATTRIBUTE_CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS YES # -Wobjc-missing-property-synthesis
XCODE_ATTRIBUTE_COPY_PHASE_STRIP NO
XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] YES # -Wl,-dead_strip
XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99
XCODE_ATTRIBUTE_GCC_CW_ASM_SYNTAX NO # No -fasm-blocks
XCODE_ATTRIBUTE_GCC_DYNAMIC_NO_PIC NO
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS NO # -fno-exceptions
XCODE_ATTRIBUTE_GCC_ENABLE_CPP_RTTI NO # -fno-rtti
XCODE_ATTRIBUTE_GCC_ENABLE_PASCAL_STRINGS NO # No -mpascal-strings
XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN YES # -fvisibility-inlines-hidden
XCODE_ATTRIBUTE_GCC_OBJC_CALL_CXX_CDTORS YES # -fobjc-call-cxx-cdtors
XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN YES # -fvisibility=hidden
XCODE_ATTRIBUTE_GCC_THREADSAFE_STATICS NO # -fno-threadsafe-statics
XCODE_ATTRIBUTE_GCC_TREAT_WARNINGS_AS_ERRORS YES # -Werror
XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0"
XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_NEWLINE YES # -Wnewline-eof
XCODE_ATTRIBUTE_USE_HEADERMAP NO
OSX_ARCHITECTURES_DEBUG "${CMAKE_OSX_ARCHITECTURES}"
OSX_ARCHITECTURES_RELEASE "${CMAKE_OSX_ARCHITECTURES}"
)
endif()
endmacro()
# Set executable-specific properties.
macro(REPLACED_SET_EXECUTABLE_TARGET_PROPERTIES target)
REPLACED_SET_COMMON_TARGET_PROPERTIES(${target})
# Executable linker flags.
if(CEF_EXE_LINKER_FLAGS)
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS ${_flags_str})
endif()
if(CEF_EXE_LINKER_FLAGS_DEBUG)
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_DEBUG}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_DEBUG ${_flags_str})
endif()
if(CEF_EXE_LINKER_FLAGS_RELEASE)
string(REPLACE ";" " " _flags_str "${CEF_EXE_LINKER_FLAGS_RELEASE}")
set_property(TARGET ${target} PROPERTY LINK_FLAGS_RELEASE ${_flags_str})
endif()
endmacro()