CMakeLists.txt 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. cmake_minimum_required(VERSION 3.12)
  2. project(linux-wallpaperengine)
  3. # prevent installing to /usr by default so we don't bork anything
  4. if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  5. set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}" CACHE PATH "..." FORCE)
  6. endif()
  7. set_property(GLOBAL PROPERTY OS_FOLDERS ON)
  8. set(CMAKE_CXX_STANDARD 20)
  9. set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
  10. set(OpenGL_GL_PREFERENCE "LEGACY")
  11. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  12. if(NOT DEMOMODE)
  13. set(DEMOMODE 0)
  14. endif()
  15. if(NOT ERRORONLY)
  16. set(ERRORONLY 0)
  17. endif()
  18. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
  19. option(LWE_LTO "Link time optimization for the engine and its bundled libraries (long link, needs a lot of memory)" OFF)
  20. option(LWE_LINK_TRIM "Put functions and data in their own sections and let the linker drop what is unused" OFF)
  21. if(LWE_LTO)
  22. include(CheckIPOSupported)
  23. check_ipo_supported(RESULT lwe_ipo_ok OUTPUT lwe_ipo_log LANGUAGES C CXX)
  24. if(NOT lwe_ipo_ok)
  25. message(FATAL_ERROR "LWE_LTO is not supported by this toolchain: ${lwe_ipo_log}")
  26. endif()
  27. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
  28. endif()
  29. if(LWE_LINK_TRIM)
  30. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
  31. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
  32. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
  33. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
  34. endif()
  35. set(LWE_SANITIZE "" CACHE STRING "Build with sanitizers: address, address;undefined or thread (tools/runtime_analysis.py)")
  36. if(LWE_SANITIZE)
  37. string(REPLACE ";" "," lwe_sanitize_list "${LWE_SANITIZE}")
  38. set(lwe_sanitize_flags "-fsanitize=${lwe_sanitize_list} -fno-omit-frame-pointer -g1")
  39. if(lwe_sanitize_list MATCHES "undefined|thread")
  40. set(lwe_sanitize_flags "${lwe_sanitize_flags} -fno-sanitize=vptr")
  41. endif()
  42. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${lwe_sanitize_flags}")
  43. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${lwe_sanitize_flags} -Wno-error=maybe-uninitialized -Wno-error=tsan")
  44. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${lwe_sanitize_list}")
  45. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=${lwe_sanitize_list}")
  46. endif()
  47. option(LWE_TRACY "Build with Tracy profiler zones on the render loop (off by default, connect tracy-profiler or tracy-capture)" OFF)
  48. option(LWE_TRACY_ON_DEMAND "Tracy only records once a profiler is connected (off: startup and loading are recorded too, which tools/tracy_profile.sh needs for the loader zones)" ON)
  49. set(LWE_TRACY_DIR "" CACHE PATH "A Tracy 0.14.1 source tree to use instead of downloading it")
  50. if(LWE_TRACY)
  51. if(NOT LWE_TRACY_DIR)
  52. include(FetchContent)
  53. FetchContent_Declare(tracy
  54. URL https://github.com/wolfpld/tracy/archive/refs/tags/v0.14.1.tar.gz
  55. URL_HASH SHA256=bf4af567e9c7524d07f3caa745fad02fb33bd5694f11910750382d1efbb251c1)
  56. FetchContent_Populate(tracy)
  57. set(LWE_TRACY_DIR ${tracy_SOURCE_DIR})
  58. endif()
  59. # TracyClient.cpp alone is the whole client, the library it ends up in is a shared one so it needs PIC
  60. add_library(tracy-client STATIC ${LWE_TRACY_DIR}/public/TracyClient.cpp)
  61. target_include_directories(tracy-client SYSTEM PUBLIC ${LWE_TRACY_DIR}/public)
  62. target_compile_definitions(tracy-client PUBLIC LWE_TRACY TRACY_ENABLE)
  63. if(LWE_TRACY_ON_DEMAND)
  64. target_compile_definitions(tracy-client PUBLIC TRACY_ON_DEMAND)
  65. endif()
  66. set_target_properties(tracy-client PROPERTIES POSITION_INDEPENDENT_CODE ON)
  67. target_link_libraries(tracy-client PUBLIC ${CMAKE_DL_LIBS} pthread)
  68. endif()
  69. find_package(X11)
  70. find_package(OpenGL REQUIRED)
  71. find_package(GLEW REQUIRED)
  72. find_package(DBus REQUIRED)
  73. find_package(GLUT REQUIRED)
  74. find_package(ZLIB REQUIRED)
  75. find_package(SDL2 REQUIRED)
  76. find_package(MPV REQUIRED)
  77. find_package(LZ4 REQUIRED)
  78. find_package(FFMPEG REQUIRED)
  79. find_package(PulseAudio REQUIRED)
  80. find_package(Freetype REQUIRED)
  81. find_package(PkgConfig REQUIRED)
  82. pkg_check_modules(HARFBUZZ REQUIRED IMPORTED_TARGET harfbuzz)
  83. # scene scripts run on V8 from the system's Node.js library, like WE's scenescript64.dll
  84. find_package(V8 10.2 REQUIRED)
  85. set(ENABLE_OPT OFF)
  86. set(SPIRV_CROSS_FORCE_PIC ON)
  87. set(CMAKE_POSITION_INDEPENDENT_CODE ON)
  88. set(KISSFFT_TEST OFF)
  89. set(KISSFFT_TOOLS OFF)
  90. set(CEF_VERSION "156.0.14+g4fa4ab5+chromium-156.0.8078.48")
  91. # SHA256 of the archives for that version, a CEF_SHA256_<platform> per distribution that is pinned (bump with CEF_VERSION)
  92. set(CEF_SHA256_linux64_minimal "4191ac920a91a052eba04afb6ed830d47aed46a3e246c434a2f062c23588dc8a")
  93. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  94. set(default_cef_dist "standard")
  95. else()
  96. set(default_cef_dist "minimal")
  97. endif()
  98. set(CEF_DISTRIBUTION_TYPE "${default_cef_dist}" CACHE STRING "CEF distribution variant")
  99. set_property(CACHE CEF_DISTRIBUTION_TYPE PROPERTY STRINGS "minimal" "standard")
  100. if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
  101. if("${PROJECT_ARCH}" STREQUAL "arm64")
  102. set(CEF_PLATFORM "macosarm64")
  103. set(CEF_ARCH_DETECTION "${PROJECT_ARCH}")
  104. elseif("${PROJECT_ARCH}" STREQUAL "x86_64")
  105. set(CEF_PLATFORM "macosx64")
  106. set(CEF_ARCH_DETECTION "${PROJECT_ARCH}")
  107. elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
  108. set(PROJECT_ARCH "arm64")
  109. set(CEF_PLATFORM "macosarm64")
  110. set(CEF_ARCH_DETECTION "${CMAKE_HOST_SYSTEM_PROCESSOR}")
  111. else()
  112. set(PROJECT_ARCH "x86_64")
  113. set(CEF_PLATFORM "macosx64")
  114. set(CEF_ARCH_DETECTION "Default for Darwin")
  115. endif()
  116. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
  117. if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm")
  118. set(CEF_PLATFORM "linuxarm")
  119. set(CEF_ARCH_DETECTION "${CMAKE_SYSTEM_PROCESSOR}")
  120. elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
  121. set(PROJECT_ARCH "arm64")
  122. set(CEF_PLATFORM "linuxarm64")
  123. set(CEF_ARCH_DETECTION "${CMAKE_SYSTEM_PROCESSOR}")
  124. elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
  125. set(PROJECT_ARCH "arm64")
  126. set(CEF_PLATFORM "linuxarm64")
  127. set(CEF_ARCH_DETECTION "${CMAKE_SYSTEM_PROCESSOR}")
  128. elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
  129. set(CEF_PLATFORM "linux64")
  130. set(CEF_ARCH_DETECTION "Based on void size ${CMAKE_SIZEOF_VOID_P} (${CMAKE_SYSTEM_PROCESSOR})")
  131. else()
  132. message(FATAL_ERROR "Linux x86 32-bit builds are discontinued.")
  133. endif()
  134. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
  135. if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM64")
  136. set(CEF_PLATFORM "windowsarm64")
  137. set(CEF_ARCH_DETECTION "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}")
  138. elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
  139. set(CEF_PLATFORM "windows64")
  140. set(CEF_ARCH_DETECTION "Based on void size ${CMAKE_SIZEOF_VOID_P}")
  141. else()
  142. set(CEF_PLATFORM "windows32")
  143. set(CEF_ARCH_DETECTION "Default for Windows")
  144. endif()
  145. endif()
  146. if(CEF_DISTRIBUTION_TYPE AND NOT CEF_DISTRIBUTION_TYPE STREQUAL "standard")
  147. set(CEF_PLATFORM "${CEF_PLATFORM}_${CEF_DISTRIBUTION_TYPE}")
  148. endif()
  149. message(STATUS "Using CEF for ${CMAKE_SYSTEM_NAME} - ${CEF_PLATFORM} (${CEF_ARCH_DETECTION})")
  150. include(DownloadCEF)
  151. DownloadCEF("${CEF_PLATFORM}" "${CEF_VERSION}" "${CMAKE_CURRENT_BINARY_DIR}/cef")
  152. list(APPEND CMAKE_MODULE_PATH "${CEF_ROOT}/cmake")
  153. find_package(CEF REQUIRED)
  154. list(REMOVE_ITEM CEF_CXX_COMPILER_FLAGS -fno-exceptions)
  155. list(REMOVE_ITEM CEF_CXX_COMPILER_FLAGS -fno-rtti)
  156. list(REMOVE_ITEM CEF_CXX_COMPILER_FLAGS -std=c++17)
  157. # function-local statics (the shaders' regexes, memos, singletons) are first used from worker threads
  158. list(REMOVE_ITEM CEF_CXX_COMPILER_FLAGS -fno-threadsafe-statics)
  159. list(REMOVE_ITEM CEF_COMPILER_FLAGS -fvisibility=hidden)
  160. list(REMOVE_ITEM CEF_COMPILER_FLAGS -fvisibility-inlines-hidden)
  161. # CEF's release flags set _FORTIFY_SOURCE=2 with a -U in front; CMake drops that repeated -U when our own target options
  162. # carry one, which leaves two -D with different values and -Werror turns the redefinition into an error
  163. list(REMOVE_ITEM CEF_COMPILER_FLAGS_RELEASE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2)
  164. list(APPEND CEF_CXX_COMPILER_FLAGS -std=c++20)
  165. list(APPEND CEF_EXE_LINKER_FLAGS -rdynamic)
  166. # remove the vulkan library from the files to copy so it doesn't fail after removing it
  167. list(REMOVE_ITEM CEF_BINARY_FILES libvulkan.so.1)
  168. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output)
  169. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
  170. set(TARGET_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output)
  171. # build dirs as RPATH during development, \$ORIGIN once installed (escaped for CMake); must come before any add_executable()
  172. set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  173. set(CMAKE_INSTALL_RPATH "\$ORIGIN;\$ORIGIN/lib;\$ORIGIN/lib64")
  174. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
  175. add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
  176. add_subdirectory(src/External/glslang-WallpaperEngine glslang)
  177. # SPIRV-Cross and kissfft want CMake < 3.13, the options set above only stick with CMP0077 NEW
  178. set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
  179. # EXCLUDE_FROM_ALL keeps their install rules (headers, cmake and pkg-config files, SPIRV-Cross' libraries and CLI) out of
  180. # the prefix, the targets we link still get built
  181. add_subdirectory(src/External/SPIRV-Cross-WallpaperEngine spirv-cross EXCLUDE_FROM_ALL)
  182. add_subdirectory(src/External/kissfft kissfft EXCLUDE_FROM_ALL)
  183. unset(CMAKE_POLICY_DEFAULT_CMP0077)
  184. # only msdfgen's core is needed, its own CMake project pulls in vcpkg/skia/tinyxml
  185. file(GLOB MSDFGEN_CORE_SOURCES src/External/msdfgen/core/*.cpp)
  186. add_library(msdfgen-core STATIC ${MSDFGEN_CORE_SOURCES})
  187. target_include_directories(msdfgen-core PUBLIC src/External/msdfgen)
  188. # an empty export macro makes base.h skip the msdfgen-config.h its CMake project would generate
  189. target_compile_definitions(msdfgen-core PUBLIC "MSDFGEN_PUBLIC=")
  190. add_subdirectory(src/External/argparse argparse)
  191. if(BUILD_TESTING)
  192. add_subdirectory(src/External/Catch2)
  193. endif()
  194. pkg_check_modules(WAYLAND_SUPPORT wayland-cursor wayland-protocols egl wayland-egl)
  195. option(DISABLE_KDE_FEATURES "Build without the KDE Plasma integration (plasma-shell surfaces, KWin fullscreen detection and cursor tracking)" OFF)
  196. if(WAYLAND_SUPPORT_FOUND)
  197. find_program(WaylandScanner NAMES wayland-scanner)
  198. message(STATUS "Found WaylandScanner at ${WaylandScanner}")
  199. execute_process(
  200. COMMAND pkg-config --variable=pkgdatadir wayland-protocols
  201. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  202. OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR
  203. OUTPUT_STRIP_TRAILING_WHITESPACE)
  204. message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
  205. set(WAYLAND_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/wayland)
  206. file(MAKE_DIRECTORY ${WAYLAND_OUTPUT_DIR})
  207. message(STATUS "Building protocols...")
  208. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.h
  209. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-foreign-toplevel-management-unstable-v1.xml ${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.h)
  210. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.c
  211. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-foreign-toplevel-management-unstable-v1.xml ${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.c)
  212. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/wlr-layer-shell-unstable-v1-protocol.h
  213. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-layer-shell-unstable-v1.xml ${WAYLAND_OUTPUT_DIR}/wlr-layer-shell-unstable-v1-protocol.h)
  214. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/wlr-layer-shell-unstable-v1-protocol.c
  215. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/wlr-layer-shell-unstable-v1.xml ${WAYLAND_OUTPUT_DIR}/wlr-layer-shell-unstable-v1-protocol.c)
  216. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/color-management-v1-protocol.h
  217. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/color-management-v1.xml ${WAYLAND_OUTPUT_DIR}/color-management-v1-protocol.h)
  218. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/color-management-v1-protocol.c
  219. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/color-management-v1.xml ${WAYLAND_OUTPUT_DIR}/color-management-v1-protocol.c)
  220. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/fractional-scale-v1-protocol.h
  221. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/fractional-scale-v1.xml ${WAYLAND_OUTPUT_DIR}/fractional-scale-v1-protocol.h)
  222. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/fractional-scale-v1-protocol.c
  223. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/fractional-scale-v1.xml ${WAYLAND_OUTPUT_DIR}/fractional-scale-v1-protocol.c)
  224. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.h
  225. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/ext-idle-notify-v1.xml ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.h)
  226. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.c
  227. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/ext-idle-notify-v1.xml ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.c)
  228. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.h
  229. COMMAND ${WaylandScanner} client-header ${WAYLAND_PROTOCOLS_DIR}/stable/viewporter/viewporter.xml ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.h)
  230. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.c
  231. COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/stable/viewporter/viewporter.xml ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.c)
  232. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.h
  233. COMMAND ${WaylandScanner} client-header ${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml ${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.h)
  234. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.c
  235. COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml ${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.c)
  236. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.h
  237. COMMAND ${WaylandScanner} client-header ${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-output/xdg-output-unstable-v1.xml ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.h)
  238. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.c
  239. COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-output/xdg-output-unstable-v1.xml ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.c)
  240. # COSMIC's window state: cosmic-comp has no wlr foreign toplevel, it speaks ext-foreign-toplevel-list plus its own
  241. # toplevel info extension (which refers to the workspace interfaces)
  242. set(COSMIC_PROTOCOL_SOURCES)
  243. foreach(proto cosmic-toplevel-info-unstable-v1 cosmic-workspace-unstable-v1 ext-foreign-toplevel-list-v1 ext-workspace-v1
  244. ext-image-capture-source-v1 ext-image-copy-capture-v1)
  245. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.h
  246. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/${proto}.xml ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.h)
  247. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.c
  248. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/${proto}.xml ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.c)
  249. list(APPEND COSMIC_PROTOCOL_SOURCES ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.c ${WAYLAND_OUTPUT_DIR}/${proto}-protocol.h)
  250. endforeach()
  251. include_directories(${WAYLAND_SUPPORT_INCLUDE_DIRS})
  252. include_directories(${WAYLAND_OUTPUT_DIR})
  253. set(WAYLAND_LIBRARIES
  254. pthread
  255. wayland-cursor
  256. wayland-client
  257. wayland-egl
  258. ${OPENGL_egl_LIBRARY})
  259. set(WAYLAND_SOURCES
  260. src/WallpaperEngine/Render/Drivers/HeadlessOpenGLDriver.h
  261. src/WallpaperEngine/Render/Drivers/HeadlessOpenGLDriver.cpp
  262. src/WallpaperEngine/Render/Drivers/WaylandOpenGLDriver.h
  263. src/WallpaperEngine/Render/Drivers/WaylandOpenGLDriver.cpp
  264. src/WallpaperEngine/Desktop/HostWayland.h
  265. src/WallpaperEngine/Desktop/HostWayland.cpp
  266. src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.cpp
  267. src/WallpaperEngine/Render/Drivers/Detectors/WaylandFullScreenDetector.h
  268. src/WallpaperEngine/Render/Drivers/Detectors/GnomeFullScreenDetector.cpp
  269. src/WallpaperEngine/Render/Drivers/Detectors/GnomeFullScreenDetector.h
  270. src/WallpaperEngine/Render/Drivers/Output/WaylandOutput.cpp
  271. src/WallpaperEngine/Render/Drivers/Output/WaylandOutput.h
  272. src/WallpaperEngine/Render/Drivers/Output/WaylandOutputViewport.cpp
  273. src/WallpaperEngine/Render/Drivers/Output/WaylandOutputViewport.h
  274. src/WallpaperEngine/Input/Drivers/WaylandMouseInput.cpp
  275. src/WallpaperEngine/Input/Drivers/WaylandMouseInput.h
  276. ${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.c
  277. ${WAYLAND_OUTPUT_DIR}/xdg-shell-protocol.h
  278. ${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.c
  279. ${WAYLAND_OUTPUT_DIR}/wlr-foreign-toplevel-management-unstable-v1-protocol.h
  280. ${WAYLAND_OUTPUT_DIR}/wlr-layer-shell-unstable-v1-protocol.c
  281. ${WAYLAND_OUTPUT_DIR}/wlr-layer-shell-unstable-v1-protocol.h
  282. ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.c
  283. ${WAYLAND_OUTPUT_DIR}/xdg-output-unstable-v1-protocol.h
  284. ${WAYLAND_OUTPUT_DIR}/color-management-v1-protocol.c
  285. ${WAYLAND_OUTPUT_DIR}/color-management-v1-protocol.h
  286. ${WAYLAND_OUTPUT_DIR}/fractional-scale-v1-protocol.c
  287. ${WAYLAND_OUTPUT_DIR}/fractional-scale-v1-protocol.h
  288. ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.c
  289. ${WAYLAND_OUTPUT_DIR}/viewporter-protocol.h
  290. ${COSMIC_PROTOCOL_SOURCES}
  291. ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.c
  292. ${WAYLAND_OUTPUT_DIR}/ext-idle-notify-v1-protocol.h)
  293. if(NOT DISABLE_KDE_FEATURES)
  294. pkg_check_modules(DBUS dbus-1)
  295. if(NOT DBUS_FOUND)
  296. message(FATAL_ERROR "The KDE integration needs the dbus-1 development files (libdbus-1-dev, dbus-devel or dbus depending on the distro). Install them or configure with -DDISABLE_KDE_FEATURES=ON")
  297. endif()
  298. set(KDE_FEATURES_ENABLED TRUE)
  299. message(STATUS "KDE integration enabled")
  300. include_directories(${DBUS_INCLUDE_DIRS})
  301. list(APPEND WAYLAND_LIBRARIES ${DBUS_LIBRARIES})
  302. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/plasma-shell-protocol.h
  303. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/plasma-shell.xml ${WAYLAND_OUTPUT_DIR}/plasma-shell-protocol.h)
  304. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/plasma-shell-protocol.c
  305. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/plasma-shell.xml ${WAYLAND_OUTPUT_DIR}/plasma-shell-protocol.c)
  306. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/kwin-dpms-protocol.h
  307. COMMAND ${WaylandScanner} client-header ${CMAKE_CURRENT_SOURCE_DIR}/protocols/kwin-dpms.xml ${WAYLAND_OUTPUT_DIR}/kwin-dpms-protocol.h)
  308. add_custom_command(OUTPUT ${WAYLAND_OUTPUT_DIR}/kwin-dpms-protocol.c
  309. COMMAND ${WaylandScanner} private-code ${CMAKE_CURRENT_SOURCE_DIR}/protocols/kwin-dpms.xml ${WAYLAND_OUTPUT_DIR}/kwin-dpms-protocol.c)
  310. list(APPEND WAYLAND_SOURCES
  311. ${WAYLAND_OUTPUT_DIR}/kwin-dpms-protocol.c
  312. ${WAYLAND_OUTPUT_DIR}/kwin-dpms-protocol.h
  313. src/WallpaperEngine/Render/Drivers/Detectors/KDEWaylandFullScreenDetector.cpp
  314. src/WallpaperEngine/Render/Drivers/Detectors/KDEWaylandFullScreenDetector.h
  315. src/WallpaperEngine/Input/Drivers/KDECursorInput.cpp
  316. src/WallpaperEngine/Input/Drivers/KDECursorInput.h
  317. src/WallpaperEngine/Desktop/KDESession.cpp
  318. src/WallpaperEngine/Desktop/KDESession.h
  319. ${WAYLAND_OUTPUT_DIR}/plasma-shell-protocol.c
  320. ${WAYLAND_OUTPUT_DIR}/plasma-shell-protocol.h)
  321. endif()
  322. endif()
  323. if(X11_FOUND)
  324. if(NOT X11_Xrandr_FOUND)
  325. message(WARNING "X11 support disabled. Xrandr package is missing")
  326. set(X11_SUPPORT_FOUND FALSE)
  327. elseif(NOT X11_xf86vmode_FOUND)
  328. message(WARNING "X11 support disabled. Xxf86vm package is missing")
  329. set(X11_SUPPORT_FOUND FALSE)
  330. else()
  331. message("X11 support enabled")
  332. set(X11_SUPPORT_FOUND TRUE)
  333. endif()
  334. endif()
  335. if(X11_SUPPORT_FOUND)
  336. include_directories(${X11_INCLUDE_DIR} ${XRANDR_INCLUDE_DIR})
  337. set(X11_LIBRARIES
  338. ${X11_LIBRARIES}
  339. ${X11_Xrandr_LIB}
  340. ${X11_Xext_LIB})
  341. if(X11_Xcomposite_FOUND AND X11_Xdamage_FOUND)
  342. set(X11_ICONS_SOURCES
  343. src/WallpaperEngine/Render/Drivers/Output/X11DesktopIcons.cpp
  344. src/WallpaperEngine/Render/Drivers/Output/X11DesktopIcons.h)
  345. set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xcomposite_LIB} ${X11_Xdamage_LIB})
  346. add_compile_definitions(HAVE_X11_DESKTOP_ICONS)
  347. else()
  348. message(WARNING "Xcomposite or Xdamage is missing, desktop icons stay under the wallpaper on XFCE")
  349. endif()
  350. set(X11_SOURCES
  351. ${X11_ICONS_SOURCES}
  352. src/WallpaperEngine/Render/Drivers/Output/X11Output.cpp
  353. src/WallpaperEngine/Render/Drivers/Output/X11Output.h
  354. src/WallpaperEngine/Render/Drivers/Detectors/X11FullScreenDetector.cpp
  355. src/WallpaperEngine/Render/Drivers/Detectors/X11FullScreenDetector.h)
  356. SET(X11_INCLUDES
  357. ${X11_INCLUDE_DIR}
  358. ${XRANDR_INCLUDE_DIR})
  359. set(CMAKE_REQUIRED_LIBRARIES ${X11_LIBRARIES})
  360. endif()
  361. if(DEMOMODE)
  362. set(DEMOMODE_SOURCES
  363. src/recording.cpp
  364. src/recording.h)
  365. message(WARNING "Enabling demo mode will automatically record 5 seconds and stop the software. This is used internally to produce the video seen on the website as a sort of status report")
  366. endif()
  367. if(NOT WAYLAND_SUPPORT_FOUND AND NOT X11_SUPPORT_FOUND)
  368. message(WARNING "No window server detected at build time. You will only be able to preview backgrounds")
  369. endif()
  370. add_library(ceflib SHARED IMPORTED)
  371. set_target_properties(ceflib
  372. PROPERTIES IMPORTED_LOCATION ${TARGET_OUTPUT_DIRECTORY}/libcef.so)
  373. ADD_LOGICAL_TARGET(libcef_lib "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
  374. PRINT_CEF_CONFIG()
  375. set(WPENGINE_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
  376. set(WPENGINE_BUILTINS_JS "${CMAKE_CURRENT_SOURCE_DIR}/src/WallpaperEngine/Scripting/resources/builtins.js")
  377. file(READ "${WPENGINE_BUILTINS_JS}" WPENGINE_SCRIPT_BUILTINS)
  378. configure_file(
  379. "${CMAKE_CURRENT_SOURCE_DIR}/src/WallpaperEngine/Scripting/resources/Builtins.generated.h.in"
  380. "${WPENGINE_GENERATED_DIR}/WallpaperEngine/Scripting/Builtins.generated.h"
  381. @ONLY)
  382. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${WPENGINE_BUILTINS_JS}")
  383. set(WPENGINE_DEFAULT_HRTF "${CMAKE_CURRENT_SOURCE_DIR}/src/WallpaperEngine/Audio/resources/default_hrtf.mhr")
  384. file(READ "${WPENGINE_DEFAULT_HRTF}" WPENGINE_DEFAULT_HRTF_HEX HEX)
  385. string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," WPENGINE_DEFAULT_HRTF_BYTES "${WPENGINE_DEFAULT_HRTF_HEX}")
  386. configure_file(
  387. "${CMAKE_CURRENT_SOURCE_DIR}/src/WallpaperEngine/Audio/resources/DefaultHrtf.generated.h.in"
  388. "${WPENGINE_GENERATED_DIR}/WallpaperEngine/Audio/DefaultHrtf.generated.h"
  389. @ONLY)
  390. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${WPENGINE_DEFAULT_HRTF}")
  391. include_directories(
  392. ${WPENGINE_GENERATED_DIR}
  393. src
  394. src/External/glslang-WallpaperEngine
  395. src/External/SPIRV-Cross-WallpaperEngine
  396. src/External/MimeTypes
  397. src/External/nanosvg
  398. src/External/json/include
  399. src/External/stb
  400. src/External/kissfft
  401. ${MPV_INCLUDE_DIR}
  402. ${GLEW_INCLUDE_DIR}
  403. ${LZ4_INCLUDE_DIR}
  404. ${SDL2_INCLUDE_DIRS}
  405. ${FFMPEG_INCLUDE_DIR}
  406. ${PULSEAUDIO_INCLUDE_DIR}
  407. ${CEF_INCLUDE_PATH}
  408. ${CMAKE_SOURCE_DIR}
  409. ${X11_INCLUDES}
  410. ${DBUS_INCLUDE_DIRS})
  411. set(COMMON_SOURCES
  412. src/External/MimeTypes/MimeTypes.cpp
  413. src/External/MimeTypes/MimeTypes.h
  414. src/Steam/FileSystem/FileSystem.cpp
  415. src/Steam/FileSystem/FileSystem.h
  416. src/WallpaperEngine/Logging/Log.cpp
  417. src/WallpaperEngine/Logging/Log.h
  418. src/WallpaperEngine/Debugging/CallStack.cpp
  419. src/WallpaperEngine/Debugging/CallStack.h
  420. src/WallpaperEngine/Application/ApplicationContext.cpp
  421. src/WallpaperEngine/Application/ApplicationContext.h
  422. src/WallpaperEngine/Application/WallpaperApplication.cpp
  423. src/WallpaperEngine/Application/WallpaperApplication.h
  424. src/WallpaperEngine/Application/PlaylistSchedule.cpp
  425. src/WallpaperEngine/Application/PlaylistSchedule.h
  426. src/WallpaperEngine/Assets/AssetLoadException.cpp
  427. src/WallpaperEngine/Assets/AssetLoadException.h
  428. src/WallpaperEngine/Assets/AssetLocator.cpp
  429. src/WallpaperEngine/Assets/AssetLocator.h
  430. src/WallpaperEngine/FileSystem/Container.h
  431. src/WallpaperEngine/FileSystem/StateDirectory.h
  432. src/WallpaperEngine/FileSystem/Container.cpp
  433. src/WallpaperEngine/FileSystem/Adapters/Types.h
  434. src/WallpaperEngine/FileSystem/Adapters/Directory.cpp
  435. src/WallpaperEngine/FileSystem/Adapters/Directory.h
  436. src/WallpaperEngine/FileSystem/Adapters/Package.cpp
  437. src/WallpaperEngine/FileSystem/Adapters/Package.h
  438. src/WallpaperEngine/FileSystem/Adapters/Virtual.cpp
  439. src/WallpaperEngine/FileSystem/Adapters/Virtual.h
  440. src/WallpaperEngine/FileSystem/Adapters/MediaCover.h
  441. src/WallpaperEngine/FileSystem/Adapters/MediaCover.cpp
  442. src/WallpaperEngine/Audio/Drivers/Recorders/PulseAudioPlaybackRecorder.cpp
  443. src/WallpaperEngine/Audio/Drivers/Recorders/PulseAudioPlaybackRecorder.h
  444. src/WallpaperEngine/Audio/Drivers/Recorders/PlaybackRecorder.cpp
  445. src/WallpaperEngine/Desktop/IconTheme.cpp
  446. src/WallpaperEngine/Desktop/IconTheme.h
  447. src/WallpaperEngine/Desktop/UserShortcut.cpp
  448. src/WallpaperEngine/Desktop/UserShortcut.h
  449. src/WallpaperEngine/Audio/SpectrumAnalyzer.cpp
  450. src/WallpaperEngine/Audio/SpectrumAnalyzer.h
  451. src/WallpaperEngine/Audio/SpectrumProcessor.cpp
  452. src/WallpaperEngine/Audio/SpectrumProcessor.h
  453. src/WallpaperEngine/Audio/Drivers/Recorders/PlaybackRecorder.h
  454. src/WallpaperEngine/Audio/Drivers/Detectors/PulseAudioPlayingDetector.cpp
  455. src/WallpaperEngine/Audio/Drivers/PulseProcessVolume.h
  456. src/WallpaperEngine/Audio/Drivers/PulseProcessVolume.cpp
  457. src/WallpaperEngine/Audio/Drivers/Detectors/PulseAudioPlayingDetector.h
  458. src/WallpaperEngine/Audio/Drivers/Detectors/AudioPlayingDetector.cpp
  459. src/WallpaperEngine/Audio/Drivers/Detectors/AudioPlayingDetector.h
  460. src/WallpaperEngine/Audio/Drivers/Detectors/HeadphonesDetector.cpp
  461. src/WallpaperEngine/Audio/Drivers/Detectors/HeadphonesDetector.h
  462. src/WallpaperEngine/Audio/Drivers/AudioDriver.cpp
  463. src/WallpaperEngine/Audio/Drivers/AudioDriver.h
  464. src/WallpaperEngine/Audio/Drivers/SDLAudioDriver.cpp
  465. src/WallpaperEngine/Audio/Drivers/SDLAudioDriver.h
  466. src/WallpaperEngine/Audio/AudioContext.cpp
  467. src/WallpaperEngine/Audio/AudioInput.h
  468. src/WallpaperEngine/Audio/AudioContext.h
  469. src/WallpaperEngine/Audio/AudioStream.cpp
  470. src/WallpaperEngine/Audio/AudioStream.h
  471. src/WallpaperEngine/Audio/Hrtf.cpp
  472. src/WallpaperEngine/Audio/Hrtf.h
  473. src/WallpaperEngine/Input/InputContext.cpp
  474. src/WallpaperEngine/Input/InputContext.h
  475. src/WallpaperEngine/Input/MouseInput.h
  476. src/WallpaperEngine/Input/ForwardedButton.h
  477. src/WallpaperEngine/Input/ForwardedButton.cpp
  478. src/WallpaperEngine/Input/Drivers/GLFWMouseInput.cpp
  479. src/WallpaperEngine/Input/Drivers/GLFWMouseInput.h
  480. src/WallpaperEngine/Media/CoverDownloader.h
  481. src/WallpaperEngine/Media/CoverDownloader.cpp
  482. src/WallpaperEngine/Media/CoverImage.h
  483. src/WallpaperEngine/Media/CoverImage.cpp
  484. src/WallpaperEngine/Media/MediaSource.h
  485. src/WallpaperEngine/Media/MediaSource.cpp
  486. src/WallpaperEngine/Media/DBusMediaSource.h
  487. src/WallpaperEngine/Media/DBusMediaSource.cpp
  488. src/WallpaperEngine/Desktop/GnomeShell.h
  489. src/WallpaperEngine/Desktop/GnomeShell.cpp
  490. src/WallpaperEngine/Desktop/PantheonShell.h
  491. src/WallpaperEngine/Desktop/PantheonShell.cpp
  492. src/WallpaperEngine/Desktop/WindowState.h
  493. src/WallpaperEngine/Desktop/WindowState.cpp
  494. src/WallpaperEngine/Desktop/KWinScript.h
  495. src/WallpaperEngine/Desktop/KWinScript.cpp
  496. src/WallpaperEngine/Desktop/SessionBus.h
  497. src/WallpaperEngine/Desktop/SessionBus.cpp
  498. src/WallpaperEngine/Desktop/SessionMonitor.h
  499. src/WallpaperEngine/Desktop/SessionMonitor.cpp
  500. src/WallpaperEngine/Desktop/PowerMonitor.h
  501. src/WallpaperEngine/Desktop/PowerMonitor.cpp
  502. src/WallpaperEngine/Desktop/HyprlandIPC.h
  503. src/WallpaperEngine/Desktop/HyprlandIPC.cpp
  504. src/WallpaperEngine/Media/ThumbnailPalette.h
  505. src/WallpaperEngine/Media/ThumbnailPalette.cpp
  506. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariable.h
  507. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariable.cpp
  508. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableFloat.h
  509. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableFloat.cpp
  510. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableInteger.h
  511. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableInteger.cpp
  512. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector2.h
  513. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector2.cpp
  514. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector3.h
  515. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector3.cpp
  516. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector4.h
  517. src/WallpaperEngine/Render/Shaders/Variables/ShaderVariableVector4.cpp
  518. src/WallpaperEngine/Render/Shaders/Shader.h
  519. src/WallpaperEngine/Render/Shaders/Shader.cpp
  520. src/WallpaperEngine/Render/Shaders/ShaderUnit.cpp
  521. src/WallpaperEngine/Render/Shaders/ShaderUnit.h
  522. src/WallpaperEngine/Render/Shaders/GLSLContext.cpp
  523. src/WallpaperEngine/Render/Shaders/GLSLContext.h
  524. src/WallpaperEngine/Render/Shaders/ShaderCache.cpp
  525. src/WallpaperEngine/Render/Shaders/ShaderCache.h
  526. src/WallpaperEngine/Render/Helpers/ContextAware.cpp
  527. src/WallpaperEngine/Render/Helpers/ContextAware.h
  528. src/WallpaperEngine/Render/Drivers/VideoFactories.cpp
  529. src/WallpaperEngine/Render/Drivers/VideoFactories.h
  530. src/WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.cpp
  531. src/WallpaperEngine/Render/Drivers/Detectors/FullScreenDetector.h
  532. src/WallpaperEngine/Render/Drivers/Output/Output.cpp
  533. src/WallpaperEngine/Render/Drivers/Output/Output.h
  534. src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.cpp
  535. src/WallpaperEngine/Render/Drivers/Output/GLFWWindowOutput.h
  536. src/WallpaperEngine/Render/Drivers/Output/X11BackgroundWindow.cpp
  537. src/WallpaperEngine/Render/Drivers/Output/X11BackgroundWindow.h
  538. src/WallpaperEngine/Render/Drivers/Output/GLFWOutputViewport.cpp
  539. src/WallpaperEngine/Render/Drivers/Output/GLFWOutputViewport.h
  540. src/WallpaperEngine/Render/Drivers/Output/OutputViewport.cpp
  541. src/WallpaperEngine/Render/Drivers/Output/OutputViewport.h
  542. src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.h
  543. src/WallpaperEngine/Render/Drivers/GLFWOpenGLDriver.cpp
  544. src/WallpaperEngine/Render/Drivers/VideoDriver.h
  545. src/WallpaperEngine/Render/Drivers/VideoDriver.cpp
  546. src/WallpaperEngine/Render/RenderContext.h
  547. src/WallpaperEngine/Render/RenderContext.cpp
  548. src/WallpaperEngine/Render/SplitLayout.h
  549. src/WallpaperEngine/Render/SplitLayout.cpp
  550. src/WallpaperEngine/Render/TextureCache.h
  551. src/WallpaperEngine/Render/TextureCache.cpp
  552. src/WallpaperEngine/Render/ImageDecoder.h
  553. src/WallpaperEngine/Render/ImageDecoder.cpp
  554. src/WallpaperEngine/Render/GifAnimation.h
  555. src/WallpaperEngine/Render/GifAnimation.cpp
  556. src/WallpaperEngine/Render/FBOProvider.cpp
  557. src/WallpaperEngine/Render/FBOProvider.h
  558. src/WallpaperEngine/Render/Helpers/ContextAware.cpp
  559. src/WallpaperEngine/Render/Helpers/ContextAware.h
  560. src/WallpaperEngine/Render/CWallpaper.h
  561. src/WallpaperEngine/Render/CWallpaper.cpp
  562. src/WallpaperEngine/Render/WallpaperState.h
  563. src/WallpaperEngine/Render/WallpaperState.cpp
  564. src/WallpaperEngine/Render/Wallpapers/CScene.h
  565. src/WallpaperEngine/Render/Wallpapers/CScene.cpp
  566. src/WallpaperEngine/Render/Wallpapers/CVideo.h
  567. src/WallpaperEngine/Render/Wallpapers/CVideo.cpp
  568. src/WallpaperEngine/Render/Wallpapers/CWeb.h
  569. src/WallpaperEngine/Render/Wallpapers/CWeb.cpp
  570. src/WallpaperEngine/Render/Wallpapers/CSplat.h
  571. src/WallpaperEngine/Render/Wallpapers/CSplat.cpp
  572. src/WallpaperEngine/Splat/SogLoader.h
  573. src/WallpaperEngine/Splat/SogLoader.cpp
  574. src/WallpaperEngine/Led/LedHub.h
  575. src/WallpaperEngine/Led/LedHub.cpp
  576. src/WallpaperEngine/Led/LedLayout.h
  577. src/WallpaperEngine/Led/LedLayout.cpp
  578. src/WallpaperEngine/Led/LedOutput.h
  579. src/WallpaperEngine/Led/LedOutput.cpp
  580. src/WallpaperEngine/Led/OpenRgbProtocol.h
  581. src/WallpaperEngine/Led/OpenRgbProtocol.cpp
  582. src/WallpaperEngine/Render/LedFrameGrabber.h
  583. src/WallpaperEngine/Render/LedFrameGrabber.cpp
  584. src/WallpaperEngine/Render/DepthRange.h
  585. src/WallpaperEngine/Render/DepthRange.cpp
  586. src/WallpaperEngine/Render/Camera.h
  587. src/WallpaperEngine/Render/Camera.cpp
  588. src/WallpaperEngine/Render/CObject.h
  589. src/WallpaperEngine/Render/CObject.cpp
  590. src/WallpaperEngine/Render/CTexture.cpp
  591. src/WallpaperEngine/Render/CTexture.h
  592. src/WallpaperEngine/Render/AlbumTexture.h
  593. src/WallpaperEngine/Render/AlbumTexture.cpp
  594. src/WallpaperEngine/Render/MissingTexture.h
  595. src/WallpaperEngine/Render/MissingTexture.cpp
  596. src/WallpaperEngine/Render/TextureProvider.h
  597. src/WallpaperEngine/Render/Objects/CRenderable.cpp
  598. src/WallpaperEngine/Render/Objects/CRenderable.h
  599. src/WallpaperEngine/Render/Objects/CImage.h
  600. src/WallpaperEngine/Render/Objects/CImage.cpp
  601. src/WallpaperEngine/Render/Objects/PuppetClipping.h
  602. src/WallpaperEngine/Render/Objects/PuppetClipping.cpp
  603. src/WallpaperEngine/Render/Objects/PuppetMeshFile.h
  604. src/WallpaperEngine/Render/Objects/PuppetMeshFile.cpp
  605. src/WallpaperEngine/Render/Objects/PuppetIK.h
  606. src/WallpaperEngine/Render/Objects/PuppetIK.cpp
  607. src/WallpaperEngine/Render/Objects/PuppetPhysics.h
  608. src/WallpaperEngine/Render/Objects/PuppetPhysics.cpp
  609. src/WallpaperEngine/Render/Objects/PuppetRootMotion.h
  610. src/WallpaperEngine/Render/Objects/PuppetRootMotion.cpp
  611. src/WallpaperEngine/Render/Objects/PuppetRig.h
  612. src/WallpaperEngine/Render/Objects/PuppetRig.cpp
  613. src/WallpaperEngine/Render/Objects/CSound.h
  614. src/WallpaperEngine/Render/Objects/CSound.cpp
  615. src/WallpaperEngine/Render/Objects/CParticle.h
  616. src/WallpaperEngine/Render/Objects/CParticle.cpp
  617. src/WallpaperEngine/Render/Objects/CText.h
  618. src/WallpaperEngine/Render/Objects/CText.cpp
  619. src/WallpaperEngine/Render/Objects/TextLayout.h
  620. src/WallpaperEngine/Render/Objects/TextLayout.cpp
  621. src/WallpaperEngine/Render/Fonts/SystemFonts.h
  622. src/WallpaperEngine/Render/Fonts/SystemFonts.cpp
  623. src/WallpaperEngine/Render/Objects/CLight.h
  624. src/WallpaperEngine/Render/Objects/CLight.cpp
  625. src/WallpaperEngine/Render/Objects/CCamera.h
  626. src/WallpaperEngine/Render/Objects/CCamera.cpp
  627. src/WallpaperEngine/Render/Volumetrics.h
  628. src/WallpaperEngine/Render/Volumetrics.cpp
  629. src/WallpaperEngine/Render/FrameMaterial.h
  630. src/WallpaperEngine/Render/FrameMaterial.cpp
  631. src/WallpaperEngine/Render/ShadowMapping.h
  632. src/WallpaperEngine/Render/ShadowMapping.cpp
  633. src/WallpaperEngine/Render/ModelData.h
  634. src/WallpaperEngine/Render/ModelData.cpp
  635. src/WallpaperEngine/Render/Objects/CMesh.h
  636. src/WallpaperEngine/Render/Objects/CMesh.cpp
  637. src/WallpaperEngine/Render/CFBO.h
  638. src/WallpaperEngine/Render/CFBO.cpp
  639. src/WallpaperEngine/Render/Objects/Effects/CPass.h
  640. src/WallpaperEngine/Render/Objects/Effects/CPass.cpp
  641. src/WallpaperEngine/WebBrowser/CEF/SharedMemoryRenderHandler.cpp
  642. src/WallpaperEngine/WebBrowser/CEF/SharedMemoryRenderHandler.h
  643. src/WallpaperEngine/WebBrowser/CEF/BrowserClient.cpp
  644. src/WallpaperEngine/WebBrowser/CEF/PageBridge.cpp
  645. src/WallpaperEngine/WebBrowser/CEF/PageBridge.h
  646. src/WallpaperEngine/WebBrowser/CEF/BrowserClient.h
  647. src/WallpaperEngine/WebBrowser/CEF/BrowserApp.cpp
  648. src/WallpaperEngine/WebBrowser/CEF/BrowserApp.h
  649. src/WallpaperEngine/WebBrowser/CEF/SubprocessApp.cpp
  650. src/WallpaperEngine/WebBrowser/CEF/SubprocessApp.h
  651. src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandlerFactory.cpp
  652. src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandlerFactory.h
  653. src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandler.cpp
  654. src/WallpaperEngine/WebBrowser/CEF/WPSchemeHandler.h
  655. src/WallpaperEngine/WebBrowser/WebBrowserContext.cpp
  656. src/WallpaperEngine/WebBrowser/WebBrowserContext.h
  657. src/WallpaperEngine/WebBrowser/IPC/WebHostSharedMemory.cpp
  658. src/WallpaperEngine/WebBrowser/IPC/WebHostSharedMemory.h
  659. src/WallpaperEngine/WebBrowser/IPC/DmabufChannel.cpp
  660. src/WallpaperEngine/WebBrowser/IPC/DmabufChannel.h
  661. src/WallpaperEngine/Render/Wallpapers/WebDmabufImport.cpp
  662. src/WallpaperEngine/Render/Wallpapers/WebDmabufImport.h
  663. src/WallpaperEngine/Data/Assets/Types.h
  664. src/WallpaperEngine/Data/Assets/Texture.h
  665. src/WallpaperEngine/Data/Assets/Package.h
  666. src/WallpaperEngine/Data/Model/Types.h
  667. src/WallpaperEngine/Data/Model/Project.h
  668. src/WallpaperEngine/Data/Model/ImageAdjustments.h
  669. src/WallpaperEngine/Data/Model/Wallpaper.h
  670. src/WallpaperEngine/Data/Model/Object.h
  671. src/WallpaperEngine/Data/Model/Material.h
  672. src/WallpaperEngine/Data/Model/Effect.h
  673. src/WallpaperEngine/Data/Model/Model.h
  674. src/WallpaperEngine/Data/Model/UserSetting.h
  675. src/WallpaperEngine/Data/Model/DynamicValue.h
  676. src/WallpaperEngine/Data/Model/DynamicValue.cpp
  677. src/WallpaperEngine/Data/Model/Effect.cpp
  678. src/WallpaperEngine/Data/Model/PropertyAnimation.h
  679. src/WallpaperEngine/Data/Model/Property.h
  680. src/WallpaperEngine/Data/Utils/TypeCaster.h
  681. src/WallpaperEngine/Data/Utils/BinaryReader.cpp
  682. src/WallpaperEngine/Data/Utils/BinaryReader.h
  683. src/WallpaperEngine/Data/Utils/MemoryStream.h
  684. src/WallpaperEngine/Data/Utils/SFINAE.h
  685. src/WallpaperEngine/Data/Parsers/DynamicValueParser.h
  686. src/WallpaperEngine/Data/Parsers/DynamicValueParser.cpp
  687. src/WallpaperEngine/Data/Parsers/EffectParser.cpp
  688. src/WallpaperEngine/Data/Parsers/EffectParser.h
  689. src/WallpaperEngine/Data/Parsers/Localization.cpp
  690. src/WallpaperEngine/Data/Parsers/Localization.h
  691. src/WallpaperEngine/Data/Parsers/ProjectParser.cpp
  692. src/WallpaperEngine/Data/Parsers/ProjectParser.h
  693. src/WallpaperEngine/Data/Parsers/WallpaperParser.cpp
  694. src/WallpaperEngine/Data/Parsers/WallpaperParser.h
  695. src/WallpaperEngine/Data/Parsers/UserSettingParser.cpp
  696. src/WallpaperEngine/Data/Parsers/UserSettingParser.h
  697. src/WallpaperEngine/Data/Parsers/ObjectParser.cpp
  698. src/WallpaperEngine/Data/Parsers/ObjectParser.h
  699. src/WallpaperEngine/Data/Parsers/MaterialParser.cpp
  700. src/WallpaperEngine/Data/Parsers/MaterialParser.h
  701. src/WallpaperEngine/Data/Parsers/ModelParser.cpp
  702. src/WallpaperEngine/Data/Parsers/ModelParser.h
  703. src/WallpaperEngine/Data/Parsers/ShaderConstantParser.cpp
  704. src/WallpaperEngine/Data/Parsers/ShaderConstantParser.h
  705. src/WallpaperEngine/Data/Parsers/PackageParser.cpp
  706. src/WallpaperEngine/Data/Parsers/PackageParser.h
  707. src/WallpaperEngine/Data/Parsers/PropertyParser.cpp
  708. src/WallpaperEngine/Data/Parsers/PropertyParser.h
  709. src/WallpaperEngine/Data/Parsers/TextureParser.cpp
  710. src/WallpaperEngine/Data/Parsers/TextureParser.h
  711. src/WallpaperEngine/Data/Builders/ColorBuilder.h
  712. src/WallpaperEngine/Data/Builders/ColorBuilder.cpp
  713. src/WallpaperEngine/Data/Builders/UserSettingBuilder.h
  714. src/WallpaperEngine/Data/Builders/VectorBuilder.cpp
  715. src/WallpaperEngine/Data/Builders/VectorBuilder.h
  716. src/WallpaperEngine/Data/Dumpers/StringPrinter.cpp
  717. src/WallpaperEngine/Data/Dumpers/StringPrinter.h
  718. src/WallpaperEngine/Data/JSON.cpp
  719. src/WallpaperEngine/VideoPlayback/MPV/GLPlayer.cpp
  720. src/WallpaperEngine/VideoPlayback/MPV/GLPlayer.h
  721. src/WallpaperEngine/VideoPlayback/MPV/MemoryStreamProtocol.cpp
  722. src/WallpaperEngine/VideoPlayback/MPV/MemoryStreamProtocol.h
  723. src/WallpaperEngine/Scripting/Adapters/VectorAdapter.h
  724. src/WallpaperEngine/Scripting/Adapters/VectorAdapter.cpp
  725. src/WallpaperEngine/Scripting/Adapters/ScriptableObjectAdapter.h
  726. src/WallpaperEngine/Scripting/Adapters/ScriptableObjectAdapter.cpp
  727. src/WallpaperEngine/Scripting/JS.h
  728. src/WallpaperEngine/Scripting/JS.cpp
  729. src/WallpaperEngine/Scripting/ConsoleObject.h
  730. src/WallpaperEngine/Scripting/ConsoleObject.cpp
  731. src/WallpaperEngine/Scripting/LocalStorage.h
  732. src/WallpaperEngine/Scripting/LocalStorage.cpp
  733. src/WallpaperEngine/Scripting/LocalStorageObject.h
  734. src/WallpaperEngine/Scripting/LocalStorageObject.cpp
  735. src/WallpaperEngine/Scripting/EngineObject.h
  736. src/WallpaperEngine/Scripting/EngineObject.cpp
  737. src/WallpaperEngine/Scripting/InputObject.h
  738. src/WallpaperEngine/Scripting/InputObject.cpp
  739. src/WallpaperEngine/Scripting/SceneObject.h
  740. src/WallpaperEngine/Scripting/SceneObject.cpp
  741. src/WallpaperEngine/Scripting/ScriptEngine.h
  742. src/WallpaperEngine/Scripting/ScriptPropertiesObject.h
  743. src/WallpaperEngine/Scripting/ScriptPropertiesObject.cpp
  744. src/WallpaperEngine/Scripting/ScriptEngine.cpp
  745. src/WallpaperEngine/Scripting/LimitedAllocator.h
  746. src/WallpaperEngine/Scripting/LimitedAllocator.cpp
  747. src/WallpaperEngine/Scripting/ScriptWatchdog.cpp
  748. src/WallpaperEngine/Scripting/ScriptableObject.h
  749. src/WallpaperEngine/Scripting/ScriptableObject.cpp
  750. src/WallpaperEngine/Scripting/AnimationSystem.h
  751. src/WallpaperEngine/Scripting/AnimationSystem.cpp
  752. src/WallpaperEngine/Maths.h
  753. src/WallpaperEngine/Maths.cpp)
  754. if(BUILD_TESTING)
  755. add_executable(
  756. tests
  757. ${COMMON_SOURCES}
  758. src/WallpaperEngine/Testing/Cases/DmabufChannel.cpp
  759. src/WallpaperEngine/Testing/Cases/DynamicValueListeners.cpp
  760. src/WallpaperEngine/Testing/Cases/Example.cpp
  761. src/WallpaperEngine/Testing/Cases/Leds.cpp
  762. src/WallpaperEngine/Testing/Cases/FramePacer.cpp
  763. src/WallpaperEngine/Testing/Cases/AudioStream.cpp
  764. src/WallpaperEngine/Testing/Cases/Hrtf.cpp
  765. src/WallpaperEngine/Testing/Render/TestingOpenGLDriver.cpp
  766. src/WallpaperEngine/Testing/Render/TestingOpenGLDriver.h
  767. src/WallpaperEngine/Testing/Input/TestingMouseInput.cpp
  768. src/WallpaperEngine/Testing/Input/TestingMouseInput.h
  769. src/WallpaperEngine/Testing/Harnesses/RenderHarness.cpp
  770. src/WallpaperEngine/Testing/Harnesses/RenderHarness.h
  771. src/WallpaperEngine/Testing/Cases/MouseCoordinates.cpp
  772. src/WallpaperEngine/Testing/Cases/SystemFonts.cpp
  773. src/WallpaperEngine/Testing/Cases/PropertyParser.cpp
  774. src/WallpaperEngine/Testing/Cases/SpectrumListeners.cpp
  775. src/WallpaperEngine/Testing/Cases/SpectrumPipeline.cpp
  776. src/WallpaperEngine/Testing/Cases/ParticleNoise.cpp
  777. src/WallpaperEngine/Testing/Cases/UserShortcut.cpp
  778. src/WallpaperEngine/Testing/Cases/Localization.cpp
  779. src/WallpaperEngine/Testing/Cases/ScalingModes.cpp
  780. src/WallpaperEngine/Testing/Cases/CornerColor.cpp
  781. src/WallpaperEngine/Testing/Cases/GnomeSession.cpp
  782. src/WallpaperEngine/Testing/Cases/JsonVectorParsing.cpp
  783. src/WallpaperEngine/Testing/Cases/ModuleNamespaceTiming.cpp
  784. src/WallpaperEngine/Testing/Cases/AudioSensitivity.cpp
  785. src/WallpaperEngine/Testing/Cases/ThumbnailPalette.cpp
  786. src/WallpaperEngine/Testing/Cases/Transition.cpp
  787. src/WallpaperEngine/Testing/Cases/TextInputProperty.cpp
  788. src/WallpaperEngine/Testing/Cases/TextLayoutRules.cpp
  789. src/WallpaperEngine/Testing/Cases/MediaCover.cpp
  790. src/WallpaperEngine/Testing/Cases/ForwardedButton.cpp
  791. src/WallpaperEngine/Testing/Cases/LocalStorage.cpp
  792. src/WallpaperEngine/Testing/Cases/HyprlandIPC.cpp
  793. src/WallpaperEngine/Testing/Cases/WebHostFiles.cpp
  794. src/WallpaperEngine/Testing/Cases/PowerSupply.cpp
  795. src/WallpaperEngine/Testing/Cases/EncodedImages.cpp
  796. src/WallpaperEngine/Testing/Cases/AuthoringJson.cpp
  797. src/WallpaperEngine/Testing/Cases/ReaderLimits.cpp
  798. src/WallpaperEngine/Testing/Cases/SteamLibraries.cpp
  799. src/WallpaperEngine/Testing/Cases/ErrorRepeatFilter.cpp
  800. src/WallpaperEngine/Testing/Cases/WebTestHooks.cpp
  801. src/WallpaperEngine/Testing/Cases/DirectoryAdapter.cpp
  802. src/WallpaperEngine/Testing/Cases/ControlFileOwner.cpp
  803. src/WallpaperEngine/Testing/Cases/HandleTable.cpp
  804. src/WallpaperEngine/Testing/Cases/PuppetMeshFile.cpp
  805. src/WallpaperEngine/Testing/Cases/ScriptLocalStorage.cpp
  806. src/WallpaperEngine/Testing/Cases/KWinScriptFiles.cpp
  807. src/WallpaperEngine/Testing/Cases/NumericGuards.cpp
  808. src/WallpaperEngine/Testing/Cases/ThreadGuard.cpp
  809. src/WallpaperEngine/Testing/Cases/ScriptCallbackGuard.cpp
  810. src/WallpaperEngine/Testing/Cases/WeJsonTypes.cpp
  811. src/WallpaperEngine/Testing/Cases/ScriptLimits.cpp
  812. src/WallpaperEngine/Testing/Cases/ShaderCompat.cpp
  813. src/WallpaperEngine/Testing/Cases/ShaderCache.cpp
  814. src/WallpaperEngine/Testing/Cases/ShaderUniforms.cpp
  815. src/WallpaperEngine/Testing/Cases/ScriptWatchdog.cpp
  816. src/WallpaperEngine/Testing/Cases/WebFrameSlots.cpp
  817. src/WallpaperEngine/Testing/Cases/AlbumArtworkUpload.cpp
  818. src/WallpaperEngine/Testing/Cases/SplitLayout.cpp
  819. src/WallpaperEngine/Testing/Cases/PlaylistSchedule.cpp
  820. src/WallpaperEngine/Testing/Cases/AutomuteDetector.cpp
  821. src/WallpaperEngine/Testing/Cases/IconTheme.cpp
  822. src/WallpaperEngine/Testing/Cases/ApplicationArguments.cpp
  823. src/WallpaperEngine/Testing/Cases/PuppetIK.cpp
  824. src/WallpaperEngine/Testing/Cases/ProjectScenes.cpp)
  825. endif()
  826. # the one file that derives from a V8 class: libnode is built without RTTI and exports no typeinfo of V8's classes
  827. set_source_files_properties(src/WallpaperEngine/Scripting/LimitedAllocator.cpp PROPERTIES COMPILE_OPTIONS -fno-rtti)
  828. add_library(
  829. linux-wallpaperengine-lib SHARED
  830. ${COMMON_SOURCES}
  831. ${WAYLAND_SOURCES}
  832. ${X11_SOURCES}
  833. ${DEMOMODE_SOURCES})
  834. target_link_libraries (linux-wallpaperengine-lib PUBLIC
  835. $<$<BOOL:${LWE_TRACY}>:tracy-client>
  836. ${OPENGL_LIBRARIES}
  837. GLEW::GLEW
  838. ${GLUT_LIBRARIES}
  839. ${ZLIB_LIBRARIES}
  840. ${LZ4_LIBRARY}
  841. ${SDL2_LIBRARIES}
  842. ${FFMPEG_LIBRARIES}
  843. ${MPV_LIBRARY}
  844. ${PULSEAUDIO_LIBRARY}
  845. Freetype::Freetype
  846. PkgConfig::HARFBUZZ
  847. msdfgen-core
  848. ${WAYLAND_LIBRARIES}
  849. ${X11_LIBRARIES}
  850. ${DBUS_LIBRARIES}
  851. kissfft
  852. glslang
  853. spirv-cross-core
  854. spirv-cross-glsl
  855. glfw
  856. libcef_lib
  857. libcef_dll_wrapper
  858. argparse
  859. V8::V8)
  860. if (BUILD_TESTING)
  861. target_link_libraries (tests PRIVATE
  862. Catch2::Catch2WithMain
  863. ${OPENGL_LIBRARIES}
  864. GLEW::GLEW
  865. ${GLUT_LIBRARIES}
  866. ${ZLIB_LIBRARIES}
  867. ${LZ4_LIBRARY}
  868. ${SDL2_LIBRARIES}
  869. ${FFMPEG_LIBRARIES}
  870. ${MPV_LIBRARY}
  871. ${PULSEAUDIO_LIBRARY}
  872. Freetype::Freetype
  873. PkgConfig::HARFBUZZ
  874. msdfgen-core
  875. ${WAYLAND_LIBRARIES}
  876. ${X11_LIBRARIES}
  877. ${DBUS_LIBRARIES}
  878. kissfft
  879. glslang
  880. spirv-cross-core
  881. spirv-cross-glsl
  882. glfw
  883. libcef_lib
  884. libcef_dll_wrapper
  885. argparse
  886. V8::V8)
  887. endif()
  888. # the shader caches under ~/.cache hold what these sources and compilers made, so their content is the key (a build date
  889. # stays the same in reproducible builds)
  890. set(SHADER_CACHE_SOURCES
  891. ${CMAKE_CURRENT_SOURCE_DIR}/src/WallpaperEngine/Render/Shaders/ShaderUnit.cpp
  892. ${CMAKE_CURRENT_SOURCE_DIR}/src/WallpaperEngine/Render/Shaders/GLSLContext.cpp)
  893. set(SHADER_CACHE_ID "")
  894. foreach(SHADER_CACHE_SOURCE ${SHADER_CACHE_SOURCES})
  895. file(SHA256 ${SHADER_CACHE_SOURCE} SHADER_CACHE_HASH)
  896. string(APPEND SHADER_CACHE_ID ${SHADER_CACHE_HASH})
  897. set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SHADER_CACHE_SOURCE})
  898. endforeach()
  899. foreach(SHADER_CACHE_DEP glslang-WallpaperEngine SPIRV-Cross-WallpaperEngine)
  900. execute_process(
  901. COMMAND git -C ${CMAKE_CURRENT_SOURCE_DIR}/src/External/${SHADER_CACHE_DEP} rev-parse HEAD
  902. OUTPUT_VARIABLE SHADER_CACHE_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
  903. string(APPEND SHADER_CACHE_ID ${SHADER_CACHE_REVISION})
  904. endforeach()
  905. string(SHA256 SHADER_CACHE_ID "${SHADER_CACHE_ID}")
  906. target_compile_definitions(linux-wallpaperengine-lib PRIVATE "LWE_SHADER_CACHE_ID=\"${SHADER_CACHE_ID}\"")
  907. target_compile_definitions(linux-wallpaperengine-lib PUBLIC ERRORONLY=${ERRORONLY})
  908. target_compile_definitions(linux-wallpaperengine-lib PUBLIC DEMOMODE=${DEMOMODE})
  909. if (BUILD_TESTING)
  910. target_compile_definitions(tests PRIVATE ERRORONLY=0)
  911. target_compile_definitions(tests PRIVATE "LWE_SHADER_CACHE_ID=\"${SHADER_CACHE_ID}\"")
  912. target_compile_definitions(tests PRIVATE DEMOMODE=0)
  913. endif()
  914. if(X11_SUPPORT_FOUND)
  915. target_compile_definitions(linux-wallpaperengine-lib PUBLIC ENABLE_X11)
  916. check_function_exists(XSetIOErrorExitHandler HAVE_XSETIOERROREXITHANDLER)
  917. if(HAVE_XSETIOERROREXITHANDLER)
  918. target_compile_definitions(linux-wallpaperengine-lib PUBLIC HAVE_XSETIOERROREXITHANDLER=1)
  919. endif()
  920. endif()
  921. if(WAYLAND_SUPPORT_FOUND)
  922. target_compile_definitions(linux-wallpaperengine-lib PUBLIC ENABLE_WAYLAND)
  923. endif()
  924. if(KDE_FEATURES_ENABLED)
  925. target_compile_definitions(linux-wallpaperengine-lib PUBLIC ENABLE_KDE_FEATURES)
  926. endif()
  927. if(WAYLAND_SUPPORT_FOUND AND NOT X11_SUPPORT_FOUND)
  928. target_compile_definitions(linux-wallpaperengine-lib PUBLIC GLEW_EGL)
  929. endif()
  930. target_include_directories(linux-wallpaperengine-lib PUBLIC
  931. src
  932. src/External/glslang-WallpaperEngine
  933. src/External/SPIRV-Cross-WallpaperEngine
  934. src/External/MimeTypes
  935. src/External/nanosvg
  936. src/External/json/include
  937. src/External/stb
  938. src/External/kissfft
  939. ${MPV_INCLUDE_DIR}
  940. ${GLEW_INCLUDE_DIR}
  941. ${LZ4_INCLUDE_DIR}
  942. ${SDL2_INCLUDE_DIRS}
  943. ${FFMPEG_INCLUDE_DIR}
  944. ${PULSEAUDIO_INCLUDE_DIR}
  945. ${CEF_INCLUDE_PATH}
  946. ${CMAKE_SOURCE_DIR}
  947. ${X11_INCLUDES}
  948. ${WAYLAND_OUTPUT_DIR})
  949. COPY_FILES(linux-wallpaperengine-lib "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
  950. COPY_FILES(linux-wallpaperengine-lib "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
  951. # remove the vulkan lib as chromium includes a broken libvulkan.so.1 with it
  952. file(REMOVE "${CEF_BINARY_DIR}/libvulkan.so.1")
  953. set_target_properties(linux-wallpaperengine-lib PROPERTIES
  954. LIBRARY_OUTPUT_DIRECTORY ${TARGET_OUTPUT_DIRECTORY})
  955. # hardening for our own code only (the CEF wrapper builds with -Werror and its own flags)
  956. # packagers set their own level (Fedora, Arch: 3) through CXXFLAGS, glibc before 2.33 treats 3 as 2
  957. if(NOT CMAKE_CXX_FLAGS MATCHES "_FORTIFY_SOURCE")
  958. target_compile_options(linux-wallpaperengine-lib PRIVATE
  959. $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release,RelWithDebInfo>>:-U_FORTIFY_SOURCE>
  960. $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release,RelWithDebInfo>>:-D_FORTIFY_SOURCE=3>)
  961. endif()
  962. target_link_options(linux-wallpaperengine-lib PRIVATE -Wl,-z,relro,-z,now)
  963. # Debugging/ThreadSafety.h carries the lock annotations, only clang checks them
  964. target_compile_options(linux-wallpaperengine-lib PRIVATE $<$<CXX_COMPILER_ID:Clang>:-Wthread-safety>)
  965. add_dependencies(linux-wallpaperengine-lib libcef_dll_wrapper glslang spirv-cross-core spirv-cross-glsl)
  966. # CEF's SET_EXECUTABLE_TARGET_PROPERTIES without C++ flags on C files
  967. REPLACED_SET_EXECUTABLE_TARGET_PROPERTIES(linux-wallpaperengine-lib)
  968. # after CEF's options, the compilers keep the last of -fstack-protector and -fstack-protector-strong
  969. target_compile_options(linux-wallpaperengine-lib PRIVATE
  970. $<$<COMPILE_LANGUAGE:CXX>:-fstack-protector-strong>)
  971. add_executable(linux-wallpaperengine
  972. src/main.cpp)
  973. target_link_libraries (linux-wallpaperengine PUBLIC linux-wallpaperengine-lib)
  974. # libcef has to load before libc (Chromium finds close() via RTLD_NEXT), --as-needed distros dropped the dependency
  975. target_link_options (linux-wallpaperengine PRIVATE -Wl,--no-as-needed -pie -Wl,-z,relro,-z,now)
  976. add_executable(linux-wallpaperengine-web-helper
  977. src/web_helper.cpp
  978. src/WallpaperEngine/WebBrowser/CEF/SubprocessApp.cpp)
  979. target_include_directories(linux-wallpaperengine-web-helper PRIVATE
  980. src
  981. ${CEF_INCLUDE_PATH}
  982. ${CMAKE_SOURCE_DIR})
  983. target_link_libraries(linux-wallpaperengine-web-helper PRIVATE
  984. libcef_lib
  985. libcef_dll_wrapper)
  986. add_dependencies(linux-wallpaperengine-web-helper libcef_dll_wrapper)
  987. REPLACED_SET_EXECUTABLE_TARGET_PROPERTIES(linux-wallpaperengine-web-helper)
  988. # unloads the engine's KWin scripts once the engine is gone, however it went; libdbus only (the engine is over 100 MB
  989. # resident), next to the engine like the web helper
  990. if(KDE_FEATURES_ENABLED)
  991. add_executable(linux-wallpaperengine-kwin-janitor src/kwin_janitor.cpp)
  992. target_include_directories(linux-wallpaperengine-kwin-janitor PRIVATE ${DBUS_INCLUDE_DIRS})
  993. target_link_libraries(linux-wallpaperengine-kwin-janitor PRIVATE ${DBUS_LIBRARIES})
  994. set_target_properties(linux-wallpaperengine-kwin-janitor PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TARGET_OUTPUT_DIRECTORY})
  995. add_dependencies(linux-wallpaperengine linux-wallpaperengine-kwin-janitor)
  996. endif()
  997. # GNOME 45-48 helper spawned by the Shell extension, static so it also runs on the host for Flatpak
  998. include(CheckCSourceCompiles)
  999. set(CMAKE_REQUIRED_LINK_OPTIONS -static)
  1000. check_c_source_compiles("int main(void) { return 0; }" LWE_CAN_LINK_STATIC)
  1001. unset(CMAKE_REQUIRED_LINK_OPTIONS)
  1002. add_executable(linux-wallpaperengine-gnome-helper src/gnome_wayland_helper.c)
  1003. if(LWE_CAN_LINK_STATIC)
  1004. target_link_options(linux-wallpaperengine-gnome-helper PRIVATE -static)
  1005. endif()
  1006. set_target_properties(linux-wallpaperengine-gnome-helper PROPERTIES RUNTIME_OUTPUT_DIRECTORY
  1007. ${TARGET_OUTPUT_DIRECTORY}/gnome-shell-extension/linux-wallpaperengine@wallpaperenginelover.github.io)
  1008. add_custom_target(gnome-shell-extension ALL
  1009. COMMAND ${CMAKE_COMMAND} -E copy_directory
  1010. ${CMAKE_CURRENT_SOURCE_DIR}/gnome-shell-extension ${TARGET_OUTPUT_DIRECTORY}/gnome-shell-extension)
  1011. add_dependencies(gnome-shell-extension linux-wallpaperengine-gnome-helper)
  1012. add_dependencies(linux-wallpaperengine gnome-shell-extension)
  1013. # install(TARGETS) so CMake replaces the build-time RPATH
  1014. install(TARGETS linux-wallpaperengine linux-wallpaperengine-web-helper
  1015. RUNTIME DESTINATION .
  1016. )
  1017. if(KDE_FEATURES_ENABLED)
  1018. install(TARGETS linux-wallpaperengine-kwin-janitor RUNTIME DESTINATION .)
  1019. endif()
  1020. install(TARGETS linux-wallpaperengine-lib
  1021. LIBRARY DESTINATION .
  1022. )
  1023. include(GNUInstallDirs)
  1024. install(TARGETS kissfft LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
  1025. install(DIRECTORY resources/icons/hicolor DESTINATION share/icons)
  1026. install(FILES resources/linux-wallpaperengine.desktop DESTINATION share/applications)
  1027. install(DIRECTORY ${TARGET_OUTPUT_DIRECTORY}/ DESTINATION . USE_SOURCE_PERMISSIONS
  1028. PATTERN "linux-wallpaperengine" EXCLUDE
  1029. PATTERN "linux-wallpaperengine-web-helper" EXCLUDE
  1030. PATTERN "linux-wallpaperengine-kwin-janitor" EXCLUDE
  1031. PATTERN "liblinux-wallpaperengine-lib.so" EXCLUDE
  1032. PATTERN "glslang" EXCLUDE
  1033. PATTERN "glslangValidator" EXCLUDE
  1034. PATTERN "spirv-cross" EXCLUDE
  1035. PATTERN "spirv-remap" EXCLUDE
  1036. PATTERN "tests" EXCLUDE
  1037. PATTERN "lwe-resample-bin" EXCLUDE
  1038. PATTERN "lwe-sound-bin" EXCLUDE
  1039. )
  1040. # Chromium's sandbox helper only works setuid root. Only root can set that up (as another user the bit would run it as
  1041. # that user, and the engine ignores a chrome-sandbox that root doesn't own). Under fakeroot (packages) id -u says 0 too
  1042. install(CODE [[
  1043. execute_process(COMMAND id -u OUTPUT_VARIABLE lwe_uid OUTPUT_STRIP_TRAILING_WHITESPACE)
  1044. set(lwe_sandbox "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/chrome-sandbox")
  1045. if(EXISTS "${lwe_sandbox}")
  1046. if(lwe_uid STREQUAL "0")
  1047. execute_process(COMMAND chown 0:0 "${lwe_sandbox}" RESULT_VARIABLE lwe_chown)
  1048. execute_process(COMMAND chmod 4755 "${lwe_sandbox}" RESULT_VARIABLE lwe_chmod)
  1049. if(lwe_chown OR lwe_chmod)
  1050. message(WARNING "Could not make ${lwe_sandbox} setuid root, web wallpapers need user namespaces")
  1051. else()
  1052. message(STATUS "Set chrome-sandbox setuid root: ${lwe_sandbox}")
  1053. endif()
  1054. else()
  1055. message(STATUS "chrome-sandbox is not setuid (not installing as root), web wallpapers need user namespaces: "
  1056. "chown root:root chrome-sandbox; chmod 4755 chrome-sandbox")
  1057. endif()
  1058. endif()
  1059. ]])