-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Basic support for web wallpapers (#153) #196
Changes from all commits
abfb667
2034879
0b72eeb
39d3444
4db6803
1e9196a
a2dcc0c
7a1ca4b
90dd149
9a7b68b
718ce7d
20a75c1
dd7da61
520cee7
b76a810
d2f9fd7
f13ba66
e8ca067
6076d3d
18abd3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ cmake-build-debug* | |
.idea | ||
build/ | ||
.vscode/ | ||
third_party/ | ||
|
||
*-protocol.o | ||
*-protocol.c | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(linux-wallpaperengine) | ||
|
||
set_property(GLOBAL PROPERTY OS_FOLDERS ON) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") | ||
set(OpenGL_GL_PREFERENCE "LEGACY") | ||
|
@@ -30,6 +31,63 @@ find_package(FFMPEG REQUIRED) | |
find_package(FreeImage REQUIRED) | ||
find_package(PulseAudio REQUIRED) | ||
|
||
# Download CEF of specified version for current platform | ||
# Specify the CEF distribution version. | ||
set(CEF_VERSION "120.1.10+g3ce3184+chromium-120.0.6099.129") | ||
# Determine the platform. | ||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") | ||
if("${PROJECT_ARCH}" STREQUAL "arm64") | ||
set(CEF_PLATFORM "macosarm64") | ||
elseif("${PROJECT_ARCH}" STREQUAL "x86_64") | ||
set(CEF_PLATFORM "macosx64") | ||
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") | ||
set(PROJECT_ARCH "arm64") | ||
set(CEF_PLATFORM "macosarm64") | ||
else() | ||
set(PROJECT_ARCH "x86_64") | ||
set(CEF_PLATFORM "macosx64") | ||
endif() | ||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") | ||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm") | ||
set(CEF_PLATFORM "linuxarm") | ||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64") | ||
set(CEF_PLATFORM "linuxarm64") | ||
elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) | ||
set(CEF_PLATFORM "linux64") | ||
else() | ||
message(FATAL_ERROR "Linux x86 32-bit builds are discontinued.") | ||
endif() | ||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") | ||
if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM64") | ||
set(CEF_PLATFORM "windowsarm64") | ||
elseif(CMAKE_SIZEOF_VOID_P MATCHES 8) | ||
set(CEF_PLATFORM "windows64") | ||
else() | ||
set(CEF_PLATFORM "windows32") | ||
endif() | ||
endif() | ||
include(DownloadCEF) | ||
DownloadCEF("${CEF_PLATFORM}" "${CEF_VERSION}" "${CMAKE_SOURCE_DIR}/third_party/cef") | ||
|
||
find_package(CEF REQUIRED) | ||
|
||
set( | ||
CMAKE_RUNTIME_OUTPUT_DIRECTORY | ||
${CMAKE_HOME_DIRECTORY}/build | ||
) | ||
|
||
set( | ||
CMAKE_LIBRARY_OUTPUT_DIRECTORY | ||
${CMAKE_HOME_DIRECTORY}/lib | ||
) | ||
|
||
set( | ||
TARGET_OUTPUT_DIRECTORY | ||
${CMAKE_HOME_DIRECTORY}/build | ||
) | ||
|
||
add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper) | ||
|
||
include_directories( | ||
${MPV_INCLUDE_DIR} | ||
${X11_INCLUDE_DIR} | ||
|
@@ -41,9 +99,19 @@ include_directories( | |
${FREEIMAGE_INCLUDE_DIR} | ||
${PULSEAUDIO_INCLUDE_DIR} | ||
src | ||
${CEF_INCLUDE_PATH} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is not needed, because of 403 line |
||
${CMAKE_SOURCE_DIR} | ||
include) | ||
|
||
|
||
add_library(ceflib SHARED IMPORTED) | ||
set_target_properties(ceflib | ||
PROPERTIES IMPORTED_LOCATION ${TARGET_OUTPUT_DIRECTORY}/libcef.so) | ||
|
||
ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") | ||
# SET_CEF_TARGET_OUT_DIR() | ||
include_directories(${_CEF_ROOT}) | ||
|
||
# try to enable wayland builds when possible | ||
pkg_check_modules(WAYLAND_SUPPORT wayland-cursor wayland-protocols egl wayland-egl) | ||
|
||
|
@@ -206,6 +274,8 @@ add_executable( | |
src/WallpaperEngine/Render/CScene.cpp | ||
src/WallpaperEngine/Render/CVideo.h | ||
src/WallpaperEngine/Render/CVideo.cpp | ||
src/WallpaperEngine/Render/CWeb.h | ||
src/WallpaperEngine/Render/CWeb.cpp | ||
src/WallpaperEngine/Render/CCamera.h | ||
src/WallpaperEngine/Render/CCamera.cpp | ||
src/WallpaperEngine/Render/CObject.h | ||
|
@@ -245,6 +315,8 @@ add_executable( | |
src/WallpaperEngine/Core/CScene.h | ||
src/WallpaperEngine/Core/CVideo.cpp | ||
src/WallpaperEngine/Core/CVideo.h | ||
src/WallpaperEngine/Core/CWeb.cpp | ||
src/WallpaperEngine/Core/CWeb.h | ||
src/WallpaperEngine/Core/CObject.cpp | ||
src/WallpaperEngine/Core/CObject.h | ||
|
||
|
@@ -324,7 +396,16 @@ add_executable( | |
${WAYLAND_SOURCES} | ||
) | ||
|
||
target_link_libraries(linux-wallpaperengine | ||
COPY_FILES(linux-wallpaperengine "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${TARGET_OUTPUT_DIRECTORY}") | ||
COPY_FILES(linux-wallpaperengine "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${TARGET_OUTPUT_DIRECTORY}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copy files needed for CEF |
||
|
||
SET_EXECUTABLE_TARGET_PROPERTIES(linux-wallpaperengine) | ||
add_dependencies(linux-wallpaperengine libcef_dll_wrapper) | ||
|
||
# Need to remove libvulkan, otherwise will get error on linking: | ||
# /usr/bin/ld: /usr/lib/libmpv.so: undefined reference to `vkCreateXlibSurfaceKHR' | ||
file(REMOVE "${CEF_BINARY_DIR_DEBUG}/libvulkan.so.1" "${CEF_BINARY_DIR_RELEASE}/libvulkan.so.1") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If libvulkan.so.1 remains, than program will not link, with error: |
||
target_link_libraries (linux-wallpaperengine PUBLIC | ||
${X11_LIBRARIES} | ||
${Xrandr_LIBRARIES} | ||
${X11_Xxf86vm_LIB} | ||
|
@@ -338,10 +419,12 @@ target_link_libraries(linux-wallpaperengine | |
${FREEIMAGE_LIBRARIES} | ||
${MPV_LIBRARY} | ||
${PULSEAUDIO_LIBRARY} | ||
glfw) | ||
glfw | ||
libcef_lib libcef_dll_wrapper) | ||
|
||
|
||
if (WAYLAND_SUPPORT_FOUND) | ||
target_link_libraries(linux-wallpaperengine | ||
target_link_libraries(linux-wallpaperengine PUBLIC | ||
pthread | ||
wayland-cursor | ||
wayland-client | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 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() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# 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. | ||
|
||
# | ||
# This file is the CEF CMake configuration entry point and should be loaded | ||
# using `find_package(CEF REQUIRED)`. See the top-level CMakeLists.txt file | ||
# included with the CEF binary distribution for usage information. | ||
# | ||
|
||
# Find the CEF binary distribution root directory. | ||
set(_CEF_ROOT "") | ||
if(CEF_ROOT AND IS_DIRECTORY "${CEF_ROOT}") | ||
set(_CEF_ROOT "${CEF_ROOT}") | ||
set(_CEF_ROOT_EXPLICIT 1) | ||
else() | ||
set(_ENV_CEF_ROOT "") | ||
if(DEFINED ENV{CEF_ROOT}) | ||
file(TO_CMAKE_PATH "$ENV{CEF_ROOT}" _ENV_CEF_ROOT) | ||
endif() | ||
if(_ENV_CEF_ROOT AND IS_DIRECTORY "${_ENV_CEF_ROOT}") | ||
set(_CEF_ROOT "${_ENV_CEF_ROOT}") | ||
set(_CEF_ROOT_EXPLICIT 1) | ||
endif() | ||
unset(_ENV_CEF_ROOT) | ||
endif() | ||
|
||
if(NOT DEFINED _CEF_ROOT_EXPLICIT) | ||
message(FATAL_ERROR "Must specify a CEF_ROOT value via CMake or environment variable.") | ||
endif() | ||
|
||
if(NOT IS_DIRECTORY "${_CEF_ROOT}/cmake") | ||
message(FATAL_ERROR "No CMake bootstrap found for CEF binary distribution at: ${CEF_ROOT}.") | ||
endif() | ||
|
||
# Execute additional cmake files from the CEF binary distribution. | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CEF_ROOT}/cmake") | ||
include("cef_variables") | ||
include("cef_macros") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Download CEF to third_party/cef directory