1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-05 02:22:28 +01:00
ScreenPlay/CMakeLists.txt
2022-01-04 09:12:03 +00:00

174 lines
6.2 KiB
CMake

cmake_minimum_required(VERSION 3.16.0)
project(
ScreenPlay
VERSION 0.15.0
DESCRIPTION "Modern, Cross Plattform, Live Wallpaper, Widgets and AppDrawer!"
HOMEPAGE_URL "https://screen-play.app/"
LANGUAGES CXX)
# This sets cmake to compile all dlls into the main directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
option(SCREENPLAY_IFW_ROOT "" STRING )
option(SCREENPLAY_STEAM "For FOSS distribution so we do not bundle proprietary code." ON)
option(SCREENPLAY_TESTS "Enables UI tests." OFF)
option(SCREENPLAY_CREATE_INSTALLER "Indicates whether an installer via the Qt Installer Framework is created." OFF)
# Add our *.cmake diretory to the CMAKE_MODULE_PATH, so that our includes are found
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
file(MAKE_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
set(CMAKE_CXX_STANDARD 20)
if(WIN32)
set(VCPKG_ARCH "x64-windows")
elseif(UNIX AND NOT APPLE)
set(VCPKG_ARCH "x64-linux")
elseif(APPLE)
set(VCPKG_ARCH "x64-osx")
endif()
if(${SCREENPLAY_TESTS})
enable_testing()
endif()
set(VCPKG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ScreenPlay-vcpkg")
set(VCPKG_INSTALLED_PATH "${VCPKG_PATH}/installed/${VCPKG_ARCH}")
find_package(Git REQUIRED)
if(WIN32)
set(date_command "CMD")
set(date_arg "/c date /t")
elseif(APPLE)
set(date_command "date")
set(date_arg "")
elseif(UNIX)
set(date_command "date")
set(date_arg "")
endif()
execute_process(
COMMAND ${date_command} ${date_arg}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE BUILD_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --always
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
add_compile_definitions(COMPILE_INFO="Build Date: ${BUILD_DATE}. Git Hash: ${GIT_COMMIT_HASH}. ")
add_compile_definitions(SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
add_compile_definitions(SCREENPLAY_STEAM="${SCREENPLAY_STEAM}")
if(UNIX AND NOT APPLE)
# Fixes QWebEngine linker errors on Ubuntu 20.04
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
endif()
add_subdirectory(ScreenPlay)
add_subdirectory(ScreenPlaySDK)
add_subdirectory(ScreenPlayShader)
add_subdirectory(ScreenPlayWallpaper)
add_subdirectory(ScreenPlayWidget)
add_subdirectory(ScreenPlayUtil)
add_subdirectory(CMake)
add_subdirectory(Tools)
if(${SCREENPLAY_STEAM})
add_subdirectory(ScreenPlayWorkshop)
else()
# Only add target SteamSDKQtEnums
add_subdirectory(ScreenPlayWorkshop/SteamSDK)
endif()
if(WIN32)
add_subdirectory(ScreenPlaySysInfo)
endif()
message(STATUS "[DEFINE] SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
message(STATUS "[DEFINE] BUILD_DATE = ${BUILD_DATE}")
message(STATUS "[DEFINE] BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
message(STATUS "[DEFINE] GIT_COMMIT_HASH = ${GIT_COMMIT_HASH}")
message(STATUS "[OPTION] SCREENPLAY_CREATE_INSTALLER = ${SCREENPLAY_CREATE_INSTALLER}")
message(STATUS "[OPTION] SCREENPLAY_STEAM = ${SCREENPLAY_STEAM}")
message(STATUS "[OPTION] SCREENPLAY_TESTS = ${SCREENPLAY_TESTS}")
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}")
if(${SCREENPLAY_CREATE_INSTALLER})
message(STATUS "[INSTALLER] CPACK_GENERATOR = ${CPACK_GENERATOR}")
if(${SCREENPLAY_IFW_ROOT} STREQUAL "")
# Hardcoded Qt paths that are used by the QtMaintanance tool for now...
if(WIN32)
set(SCREENPLAY_IFW_ROOT "C:/Qt/Tools/QtInstallerFramework/4.2")
elseif(UNIX AND NOT APPLE)
set(SCREENPLAY_IFW_ROOT "$ENV{HOME}/Qt/Tools/QtInstallerFramework/4.2")
endif()
message(STATUS "[CPACK_IFW_ROOT] Not set. Using hardcoded value: ${SCREENPLAY_IFW_ROOT}")
message(STATUS "WARNING: MAKE SURE YOU HAVE THIS EXACT VERSION INSTALLED VIA THE QTMAINTANANCE TOOL!")
else()
message(STATUS "[CPACK_IFW_ROOT] = ${SCREENPLAY_IFW_ROOT}")
endif()
message(STATUS "[IFW INSTALLER ENABLED]: Configuring. This can take some time...")
set(CPACK_IFW_ROOT ${SCREENPLAY_IFW_ROOT})
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-Installer")
set(CPACK_PACKAGE_VENDOR "Elias Steurer")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}")
# Ensures that contents written to the CPack configuration files is escaped properly.
set(CPACK_VERBATIM_VARIABLES TRUE)
set(CPACK_GENERATOR "IFW")
set(CPACK_IFW_PACKAGE_START_MENU_DIRECTORY "") # empty => default is install to top-level (?)
set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/Apps/${CMAKE_PROJECT_NAME}")
set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico")
set(CPACK_IFW_PACKAGE_WINDOW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico")
set(CPACK_IFW_PACKAGE_CONTROL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Tools/Installer/installscript.qs")
set(CPACK_COMPONENTS_GROUPING IGNORE)
set(CPACK_IFW_PACKAGE_GROUP ScreenPlay)
set(CPACK_IFW_VERBOSE ON)
include(CPack)
include(CPackIFW)
# Install all files from /bin
install(
DIRECTORY "${CMAKE_BINARY_DIR}/bin/"
COMPONENT ScreenPlay
DESTINATION "/")
cpack_add_component(
ScreenPlay
DISPLAY_NAME "ScreenPlay"
DESCRIPTION "This installs ScreenPlay.")
cpack_ifw_configure_component(
ScreenPlayApp FORCED_INSTALLATION
NAME "ScreenPlay"
VERSION ${PROJECT_VERSION} # Version of component
DESCRIPTION "Welcome to the K3000 installer."
# Gets ignored and I do not know why
SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/Tools/Installer/installscript.qs"
CHECKABLE FALSE)
endif()