CMakeLists.txt 55 KB

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