2020-10-29 18:53:52 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16.0)
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-12-31 13:32:37 +01:00
|
|
|
project(
|
|
|
|
ScreenPlay
|
|
|
|
VERSION 0.15.0
|
|
|
|
DESCRIPTION "Modern, Cross Plattform, Live Wallpaper, Widgets and AppDrawer!"
|
|
|
|
HOMEPAGE_URL "https://screen-play.app/"
|
|
|
|
LANGUAGES CXX)
|
2020-10-29 18:19:22 +01:00
|
|
|
|
2022-07-08 12:33:26 +02:00
|
|
|
# Only used for some custom file copy
|
2020-08-10 22:57:57 +02:00
|
|
|
if(WIN32)
|
|
|
|
set(VCPKG_ARCH "x64-windows")
|
2021-06-12 15:17:38 +02:00
|
|
|
elseif(UNIX AND NOT APPLE)
|
2020-08-10 22:57:57 +02:00
|
|
|
set(VCPKG_ARCH "x64-linux")
|
|
|
|
elseif(APPLE)
|
2022-07-15 12:43:57 +02:00
|
|
|
# CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
|
2022-07-08 13:31:51 +02:00
|
|
|
# Universal builds are not available with vcpkg,
|
2022-07-15 12:43:57 +02:00
|
|
|
# but the prebuild Qt binaries are. CMake also handles
|
2022-07-08 13:31:51 +02:00
|
|
|
# https://github.com/microsoft/vcpkg/discussions/19454
|
2022-07-15 12:43:57 +02:00
|
|
|
# This means we must compile twice and then merge the binaries with lipo
|
|
|
|
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
|
|
|
|
set(VCPKG_ARCH "x64-osx")
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
|
|
|
set(VCPKG_TARGET_ARCHITECTURE x86_64)
|
|
|
|
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL arm)
|
|
|
|
set(VCPKG_ARCH "arm64-osx")
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
|
|
|
set(VCPKG_TARGET_ARCHITECTURE arm64)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "[PROJECT] CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
|
2020-08-10 22:57:57 +02:00
|
|
|
endif()
|
2020-04-30 20:03:14 +02:00
|
|
|
|
|
|
|
# This sets cmake to compile all dlls into the main directory
|
2022-04-23 19:26:55 +02:00
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
2020-06-07 13:06:55 +02:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2022-04-30 12:07:54 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
|
2021-07-16 11:14:21 +02:00
|
|
|
|
2022-05-12 14:36:18 +02:00
|
|
|
# This is needed for OSX:
|
|
|
|
# Because we bundle ScreenPlay and ScreenPlayWallpaper into .app
|
|
|
|
# they both need other QML dependencies like ScreenPlayUtil.
|
|
|
|
# The fastest way is to use a shared QML module path for development
|
|
|
|
# and add this path to the qml engines import pah.
|
2022-08-14 11:58:41 +02:00
|
|
|
# For the SCREENPLAY_DEPLOY we copy them into the matching dirs
|
2022-05-12 14:36:18 +02:00
|
|
|
# via the build.py
|
|
|
|
#
|
|
|
|
# This subdirectoy is needed for OSX and Linux to fix linker errors because
|
|
|
|
# we would have ScreenPlayApp executable and folder for the qml files in the
|
|
|
|
# same directory.
|
|
|
|
set(SCREENPLAY_QML_MODULES_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qml")
|
|
|
|
# Adds the qml import path so QtCreator can find them
|
|
|
|
list(APPEND QML_DIRS "${SCREENPLAY_QML_MODULES_PATH}")
|
|
|
|
set(QML_IMPORT_PATH "${QML_DIRS}" CACHE STRING "Qt Creator extra qml import paths")
|
|
|
|
|
2022-01-27 18:18:49 +01:00
|
|
|
set(SCREENPLAY_IFW_ROOT "")
|
2022-07-21 14:25:25 +02:00
|
|
|
set(SCREENPLAY_IFW_VERSION "4.4")
|
2021-01-24 16:55:13 +01:00
|
|
|
|
2021-07-16 11:14:21 +02:00
|
|
|
set(VCPKG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ScreenPlay-vcpkg")
|
2020-10-29 19:47:22 +01:00
|
|
|
set(VCPKG_INSTALLED_PATH "${VCPKG_PATH}/installed/${VCPKG_ARCH}")
|
2022-07-09 19:54:54 +02:00
|
|
|
set(VCPKG_BIN_PATH "${VCPKG_INSTALLED_PATH}/bin")
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-12-31 13:32:37 +01:00
|
|
|
option(SCREENPLAY_STEAM "For FOSS distribution so we do not bundle proprietary code." ON)
|
2022-08-14 11:58:41 +02:00
|
|
|
option(SCREENPLAY_DEPLOY "Marks this version as an official deploy version. This version uses different import paths and other settings." OFF)
|
2022-04-04 18:06:43 +02:00
|
|
|
option(SCREENPLAY_TESTS "Enables UI tests." ON)
|
|
|
|
option(SCREENPLAY_INSTALLER "Indicates whether an installer via the Qt Installer Framework is created." OFF)
|
2021-08-16 11:00:53 +02:00
|
|
|
|
2022-01-29 12:24:26 +01:00
|
|
|
# Gitlab CI has many ENV variables. We use this one to check if the current build happens inside the CI
|
|
|
|
if(DEFINED ENV{CI_COMMIT_MESSAGE})
|
|
|
|
set(GITLAB_CI true)
|
|
|
|
endif()
|
2022-01-04 10:12:03 +01:00
|
|
|
|
2022-04-30 12:07:54 +02:00
|
|
|
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
2020-06-21 16:07:41 +02:00
|
|
|
|
2022-04-30 12:07:54 +02:00
|
|
|
add_compile_definitions(COMPILE_INFO="Build Date: ${BUILD_DATE}. Git Hash: ${GIT_COMMIT_HASH}. ")
|
|
|
|
add_compile_definitions(SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
|
2022-08-14 11:58:41 +02:00
|
|
|
if(${SCREENPLAY_DEPLOY})
|
|
|
|
add_compile_definitions(DEPLOY_VERSION)
|
2022-07-08 12:49:53 +02:00
|
|
|
endif()
|
|
|
|
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2020-08-10 17:39:42 +02:00
|
|
|
find_package(Git REQUIRED)
|
|
|
|
if(WIN32)
|
2022-07-09 18:24:14 +02:00
|
|
|
set(DATE_COMMAND "CMD")
|
|
|
|
set(DATE_ARG "/c date /t")
|
2020-08-10 17:39:42 +02:00
|
|
|
elseif(APPLE)
|
2022-07-09 18:24:14 +02:00
|
|
|
set(DATE_COMMAND "date")
|
|
|
|
set(DATE_ARG " +%y.%m.%d")
|
2020-08-10 17:39:42 +02:00
|
|
|
elseif(UNIX)
|
2022-07-09 18:24:14 +02:00
|
|
|
set(DATE_COMMAND "date")
|
|
|
|
set(DATE_ARG "")
|
2020-08-10 17:39:42 +02:00
|
|
|
endif()
|
|
|
|
|
2020-10-29 18:53:52 +01:00
|
|
|
execute_process(
|
2022-07-09 18:24:14 +02:00
|
|
|
COMMAND ${DATE_COMMAND} ${DATE_ARG}
|
2020-10-29 18:53:52 +01:00
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE BUILD_DATE
|
2022-07-09 18:24:14 +02:00
|
|
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2020-08-10 17:39:42 +02:00
|
|
|
|
2020-10-29 18:53:52 +01:00
|
|
|
execute_process(
|
2022-07-09 18:24:14 +02:00
|
|
|
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
|
|
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
|
2020-10-29 18:53:52 +01:00
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
2020-10-29 20:06:13 +01:00
|
|
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
2022-07-09 18:24:14 +02:00
|
|
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2020-08-10 17:39:42 +02:00
|
|
|
|
2022-07-09 18:24:14 +02:00
|
|
|
add_compile_definitions(BUILD_TYPE="${CMAKE_BUILD_TYPE}")
|
|
|
|
add_compile_definitions(BUILD_DATE="${BUILD_DATE}")
|
|
|
|
add_compile_definitions(GIT_BRANCH_NAME="${GIT_BRANCH_NAME}")
|
|
|
|
add_compile_definitions(GIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
|
2022-05-06 17:23:14 +02:00
|
|
|
|
2020-10-31 19:59:46 +01:00
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
# Fixes QWebEngine linker errors on Ubuntu 20.04
|
2020-10-29 18:53:52 +01:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
|
2020-10-02 21:25:36 +02:00
|
|
|
endif()
|
2022-05-06 14:51:56 +02:00
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/FetchContentThirdParty.cmake)
|
2020-10-02 21:25:36 +02:00
|
|
|
|
2022-05-06 14:51:56 +02:00
|
|
|
add_subdirectory(CMake)
|
2020-03-10 12:16:58 +01:00
|
|
|
add_subdirectory(ScreenPlay)
|
|
|
|
add_subdirectory(ScreenPlaySDK)
|
2020-09-10 11:40:07 +02:00
|
|
|
add_subdirectory(ScreenPlayShader)
|
2020-03-10 12:16:58 +01:00
|
|
|
add_subdirectory(ScreenPlayWallpaper)
|
|
|
|
add_subdirectory(ScreenPlayWidget)
|
2021-01-28 15:19:46 +01:00
|
|
|
add_subdirectory(ScreenPlayUtil)
|
2022-02-20 17:55:26 +01:00
|
|
|
add_subdirectory(ScreenPlayWeather)
|
2022-05-06 14:51:56 +02:00
|
|
|
add_subdirectory(ThirdParty/QArchive)
|
2021-12-03 15:30:17 +01:00
|
|
|
add_subdirectory(Tools)
|
2020-10-02 21:25:36 +02:00
|
|
|
|
2022-05-06 14:51:56 +02:00
|
|
|
|
2022-04-30 12:07:54 +02:00
|
|
|
if(${SCREENPLAY_TESTS})
|
|
|
|
enable_testing()
|
|
|
|
endif()
|
|
|
|
|
2020-10-02 21:25:36 +02:00
|
|
|
|
2022-04-04 18:06:43 +02:00
|
|
|
# Only add target SteamSDKQtEnums
|
|
|
|
add_subdirectory(ScreenPlayWorkshop/SteamSDK)
|
2021-07-16 11:14:21 +02:00
|
|
|
if(${SCREENPLAY_STEAM})
|
2021-07-16 16:44:28 +02:00
|
|
|
add_subdirectory(ScreenPlayWorkshop)
|
2021-07-16 11:14:21 +02:00
|
|
|
endif()
|
2020-10-02 21:25:36 +02:00
|
|
|
|
|
|
|
if(WIN32)
|
2020-10-29 18:53:52 +01:00
|
|
|
add_subdirectory(ScreenPlaySysInfo)
|
2020-10-02 21:25:36 +02:00
|
|
|
endif()
|
2021-03-12 09:19:19 +01:00
|
|
|
|
2022-04-23 19:26:55 +02:00
|
|
|
if(${SCREENPLAY_INSTALLER})
|
2022-01-27 14:54:45 +01:00
|
|
|
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CreateIFWInstaller.cmake)
|
2021-12-03 15:30:17 +01:00
|
|
|
endif()
|
2022-01-04 10:12:03 +01:00
|
|
|
|
2022-08-14 11:58:41 +02:00
|
|
|
message(STATUS "[CPP DEFINE] DEPLOY_VERSION = ${DEPLOY_VERSION}")
|
2022-05-12 14:36:18 +02:00
|
|
|
message(STATUS "[CPP DEFINE] SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
message(STATUS "[CPP DEFINE] BUILD_DATE = ${BUILD_DATE}")
|
2022-04-30 12:07:54 +02:00
|
|
|
message(STATUS "[DEFINE] BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
|
|
|
message(STATUS "[DEFINE] GIT_COMMIT_HASH = ${GIT_COMMIT_HASH}")
|
2022-08-14 11:58:41 +02:00
|
|
|
message(STATUS "[OPTION] SCREENPLAY_DEPLOY = ${SCREENPLAY_DEPLOY}")
|
2022-04-30 12:07:54 +02:00
|
|
|
message(STATUS "[OPTION] SCREENPLAY_INSTALLER = ${SCREENPLAY_INSTALLER}")
|
|
|
|
message(STATUS "[OPTION] SCREENPLAY_STEAM = ${SCREENPLAY_STEAM}")
|
|
|
|
message(STATUS "[OPTION] SCREENPLAY_TESTS = ${SCREENPLAY_TESTS}")
|
|
|
|
message(STATUS "[PROJECT] SCREENPLAY_QML_MODULES_PATH = ${SCREENPLAY_QML_MODULES_PATH}")
|
2022-04-30 14:18:02 +02:00
|
|
|
message(STATUS "[PROJECT] SCREENPLAY_IFW_VERSION = ${SCREENPLAY_IFW_VERSION}")
|
2022-04-30 12:07:54 +02:00
|
|
|
message(STATUS "[PROJECT] CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")
|
|
|
|
message(STATUS "[PROJECT] VCPKG_PATH = ${VCPKG_PATH}")
|
|
|
|
message(STATUS "[PROJECT] VCPKG_TARGET_TRIPLET = ${VCPKG_TARGET_TRIPLET}")
|
|
|
|
message(STATUS "[PROJECT] CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
|
|
|
|
message(STATUS "[PROJECT] CMAKE_VERSION = ${CMAKE_VERSION}")
|