2023-01-19 10:33:49 +01:00
|
|
|
# SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
|
2020-10-29 18:53:52 +01:00
|
|
|
project(ScreenPlayWallpaper LANGUAGES CXX)
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-01-28 15:19:46 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2020-03-10 12:16:58 +01:00
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
2021-07-11 08:27:13 +02:00
|
|
|
|
2021-09-10 11:09:38 +02:00
|
|
|
find_package(
|
|
|
|
Qt6
|
2023-11-01 12:28:35 +01:00
|
|
|
COMPONENTS Core
|
|
|
|
Quick
|
|
|
|
Gui
|
|
|
|
Widgets
|
|
|
|
WebSockets
|
|
|
|
Svg
|
|
|
|
Multimedia
|
|
|
|
WebEngineCore
|
|
|
|
WebEngineQuick
|
|
|
|
WebChannel
|
|
|
|
Positioning)
|
2020-04-30 20:03:14 +02:00
|
|
|
|
|
|
|
if(WIN32)
|
2023-10-13 07:10:02 +02:00
|
|
|
set(SOURCES src/windowsdesktopproperties.cpp src/winwindow.cpp)
|
|
|
|
set(HEADER src/windowsdesktopproperties.h src/winwindow.h)
|
2020-04-30 20:03:14 +02:00
|
|
|
elseif(APPLE)
|
2022-04-04 18:09:45 +02:00
|
|
|
set(SOURCES src/macintegration.cpp src/macwindow.cpp)
|
2022-03-12 14:36:03 +01:00
|
|
|
set(HEADER
|
|
|
|
src/macbridge.h
|
|
|
|
src/MacBridge.mm
|
|
|
|
src/macintegration.h
|
|
|
|
src/macwindow.h)
|
2020-04-30 20:03:14 +02:00
|
|
|
elseif(UNIX)
|
2023-10-29 11:26:42 +01:00
|
|
|
set(SOURCES src/linuxx11window.cpp src/linuxwaylandwindow.cpp)
|
|
|
|
set(HEADER src/linuxx11window.h src/linuxwaylandwindow.h)
|
2020-04-30 20:03:14 +02:00
|
|
|
endif()
|
|
|
|
|
2021-10-15 15:06:05 +02:00
|
|
|
set(SOURCES ${SOURCES} main.cpp src/basewindow.cpp)
|
|
|
|
set(HEADER ${HEADER} src/basewindow.h)
|
2020-06-19 18:06:09 +02:00
|
|
|
|
2022-03-12 14:36:03 +01:00
|
|
|
set(QML
|
2022-11-02 11:33:40 +01:00
|
|
|
# cmake-format: sort
|
2022-03-12 14:36:03 +01:00
|
|
|
qml/GifWallpaper.qml
|
|
|
|
qml/MultimediaView.qml
|
|
|
|
qml/MultimediaWebView.qml
|
|
|
|
qml/Test.qml
|
|
|
|
qml/Wallpaper.qml
|
|
|
|
qml/WebsiteWallpaper.qml)
|
2021-10-15 15:06:05 +02:00
|
|
|
|
2022-11-02 11:33:40 +01:00
|
|
|
set(RESOURCES dot.png qtquickcontrols2.conf index.html)
|
2020-06-19 18:06:09 +02:00
|
|
|
|
2023-10-13 07:10:02 +02:00
|
|
|
set(LIB_SOURCES)
|
|
|
|
set(LIB_HEADER)
|
2023-09-01 13:48:48 +02:00
|
|
|
|
2023-10-13 07:10:02 +02:00
|
|
|
if(WIN32)
|
2023-10-28 19:45:11 +02:00
|
|
|
set(LIB_SOURCES src/windowsintegration.cpp)
|
|
|
|
set(LIB_HEADER src/windowsintegration.h)
|
2023-11-01 12:28:35 +01:00
|
|
|
add_library(ScreenPlayWallpaperLib STATIC ${LIB_SOURCES} ${LIB_HEADER})
|
|
|
|
target_include_directories(ScreenPlayWallpaperLib PUBLIC src)
|
2023-09-01 13:48:48 +02:00
|
|
|
# Used for query windows monitor data
|
|
|
|
target_link_libraries(ScreenPlayWallpaperLib PUBLIC shcore.lib)
|
|
|
|
endif()
|
|
|
|
|
2023-11-01 12:28:35 +01:00
|
|
|
add_executable(
|
|
|
|
${PROJECT_NAME}
|
|
|
|
${SOURCES}
|
|
|
|
${HEADER}
|
|
|
|
src/windowsintegration.h
|
|
|
|
src/windowsintegration.cpp)
|
2021-10-15 15:06:05 +02:00
|
|
|
|
|
|
|
qt_add_qml_module(
|
|
|
|
${PROJECT_NAME}
|
|
|
|
URI
|
2022-04-30 13:22:17 +02:00
|
|
|
${PROJECT_NAME}
|
2021-10-15 15:06:05 +02:00
|
|
|
VERSION
|
|
|
|
1.0
|
2022-02-20 17:55:26 +01:00
|
|
|
OUTPUT_DIRECTORY
|
2022-04-30 12:07:54 +02:00
|
|
|
${SCREENPLAY_QML_MODULES_PATH}/${PROJECT_NAME}
|
2022-11-02 11:33:40 +01:00
|
|
|
RESOURCE_PREFIX
|
|
|
|
/qml
|
2021-10-15 15:06:05 +02:00
|
|
|
QML_FILES
|
2022-04-30 13:22:17 +02:00
|
|
|
${QML}
|
|
|
|
RESOURCES
|
|
|
|
${RESOURCES})
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-09-10 11:09:38 +02:00
|
|
|
target_link_libraries(
|
|
|
|
${PROJECT_NAME}
|
2023-11-01 12:28:35 +01:00
|
|
|
PRIVATE ScreenPlaySDK
|
|
|
|
ScreenPlayUtil
|
|
|
|
ScreenPlayWeatherplugin
|
|
|
|
Qt6::Quick
|
|
|
|
Qt6::Gui
|
|
|
|
Qt6::Widgets
|
|
|
|
Qt6::Core
|
|
|
|
Qt6::WebSockets
|
|
|
|
Qt6::Svg
|
|
|
|
Qt6::Multimedia
|
|
|
|
Qt6::WebEngineCore
|
|
|
|
Qt6::WebEngineQuick)
|
2023-09-01 13:48:48 +02:00
|
|
|
|
2022-04-04 18:06:43 +02:00
|
|
|
if(WIN32)
|
2023-11-01 12:28:35 +01:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE ScreenPlaySysInfoplugin ScreenPlayWallpaperLib)
|
2023-01-30 16:46:39 +01:00
|
|
|
elseif(UNIX AND NOT APPLE)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE X11)
|
2022-04-04 18:06:43 +02:00
|
|
|
endif()
|
2021-07-16 16:44:28 +02:00
|
|
|
|
2021-12-31 13:32:37 +01:00
|
|
|
if(UNIX AND NOT APPLE)
|
2023-11-01 12:28:35 +01:00
|
|
|
find_package(
|
|
|
|
ECM
|
|
|
|
CONFIG
|
|
|
|
REQUIRED
|
|
|
|
NO_MODULE)
|
2023-10-29 11:26:42 +01:00
|
|
|
set(LayerShellQt "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/layer-shell-qt/")
|
|
|
|
find_package(LayerShellQt REQUIRED)
|
2023-11-01 12:28:35 +01:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE LayerShellQtInterface)
|
2021-12-03 14:23:45 +01:00
|
|
|
endif()
|
|
|
|
|
2021-01-16 17:31:07 +01:00
|
|
|
if(APPLE)
|
2021-06-20 18:50:54 +02:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE "-framework Cocoa")
|
2023-09-01 13:48:48 +02:00
|
|
|
|
2023-02-09 16:35:08 +01:00
|
|
|
if(NOT OSX_BUNDLE)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${PROJECT_NAME}
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/index.html
|
2023-11-01 12:28:35 +01:00
|
|
|
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/)
|
2023-06-11 10:07:39 +02:00
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/")
|
2023-02-09 16:35:08 +01:00
|
|
|
endif()
|
2021-01-16 17:31:07 +01:00
|
|
|
endif()
|
2020-06-19 18:06:09 +02:00
|
|
|
|
2021-07-16 16:44:28 +02:00
|
|
|
if(WIN32)
|
|
|
|
# Disable console window on Windows
|
|
|
|
# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows
|
|
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
|
2021-11-01 18:25:46 +01:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index.html ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/index.html COPYONLY)
|
2021-07-16 16:44:28 +02:00
|
|
|
endif()
|
2023-02-18 14:30:06 +01:00
|
|
|
|
|
|
|
# ##### USE CMAKE VARIABLES IN CODE #####
|
2023-02-25 14:16:45 +01:00
|
|
|
include(GenerateCMakeVariableHeader)
|
2023-06-11 10:07:39 +02:00
|
|
|
generate_cmake_variable_header(${PROJECT_NAME})
|