2020-10-29 18:53:52 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16.0)
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-01-03 16:54:51 +01:00
|
|
|
project(ScreenPlay LANGUAGES CXX)
|
2020-10-29 18:19:22 +01:00
|
|
|
|
2020-04-30 20:03:14 +02:00
|
|
|
# This sets cmake to compile all dlls into the main directory
|
2020-06-07 13:06:55 +02:00
|
|
|
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)
|
2021-07-16 11:14:21 +02:00
|
|
|
|
2021-08-16 11:00:53 +02:00
|
|
|
option(SCREENPLAY_STEAM ON "For FOSS distribution so we do not bundle proprietary code.")
|
|
|
|
option(TESTS_ENABLED OFF)
|
|
|
|
|
2021-08-21 12:11:31 +02:00
|
|
|
# Add our *.cmake diretory to the CMAKE_MODULE_PATH, so that our includes are found
|
2021-08-24 17:49:38 +02:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
|
2021-08-21 12:11:31 +02:00
|
|
|
|
2021-07-16 11:14:21 +02:00
|
|
|
file(MAKE_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2020-06-21 16:07:41 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
|
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)
|
|
|
|
set(VCPKG_ARCH "x64-osx")
|
|
|
|
endif()
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-08-14 13:39:36 +02:00
|
|
|
if(${TESTS_ENABLED})
|
|
|
|
enable_testing()
|
2021-01-24 16:55:13 +01:00
|
|
|
endif()
|
|
|
|
|
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}")
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2020-08-10 17:39:42 +02:00
|
|
|
find_package(Git REQUIRED)
|
|
|
|
if(WIN32)
|
2020-10-29 18:53:52 +01:00
|
|
|
set(date_command "CMD")
|
2020-08-10 17:39:42 +02:00
|
|
|
set(date_arg "/c date /t")
|
|
|
|
elseif(APPLE)
|
|
|
|
set(date_command "date")
|
2021-08-16 11:00:53 +02:00
|
|
|
set(date_arg "")
|
2020-08-10 17:39:42 +02:00
|
|
|
elseif(UNIX)
|
|
|
|
set(date_command "date")
|
|
|
|
set(date_arg "")
|
|
|
|
endif()
|
|
|
|
|
2020-10-29 18:53:52 +01:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${date_command} ${date_arg}
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE BUILD_DATE
|
2021-08-16 11:00:53 +02:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2020-08-10 17:39:42 +02:00
|
|
|
|
2020-10-29 18:53:52 +01:00
|
|
|
execute_process(
|
|
|
|
COMMAND "${GIT_EXECUTABLE}" describe --always
|
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
2020-10-29 20:06:13 +01:00
|
|
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
2021-08-16 11:00:53 +02:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2020-08-10 17:39:42 +02:00
|
|
|
|
|
|
|
add_compile_definitions(COMPILE_INFO="${BUILD_DATE} + ${GIT_COMMIT_HASH}")
|
2021-09-04 14:41:49 +02:00
|
|
|
add_compile_definitions(SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
|
2021-09-19 14:34:04 +02:00
|
|
|
add_compile_definitions(SCREENPLAY_STEAM="${SCREENPLAY_STEAM}")
|
2020-08-10 17:39:42 +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()
|
|
|
|
|
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)
|
2021-08-21 12:11:31 +02:00
|
|
|
add_subdirectory(CMake)
|
2020-10-02 21:25:36 +02:00
|
|
|
|
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
|
|
|
|
2021-09-04 14:41:49 +02:00
|
|
|
message(STATUS "[DEFINE] SOURCE_DIR = ${SOURCE_DIR}")
|
2021-08-16 11:00:53 +02:00
|
|
|
message(STATUS "[DEFINE] BUILD_DATE = ${BUILD_DATE}")
|
|
|
|
message(STATUS "[DEFINE] GIT_COMMIT_HASH = ${GIT_COMMIT_HASH}")
|
2021-09-26 16:52:14 +02:00
|
|
|
message(STATUS "[OPTION] SCREENPLAY_STEAM = ${SCREENPLAY_STEAM}")
|
|
|
|
message(STATUS "[OPTION] TESTS_ENABLED = ${TESTS_ENABLED}")
|
2021-08-16 11:00:53 +02:00
|
|
|
message(STATUS "[PROJECT] CMAKE_TOOLCHAIN_FILE = ${CMAKE_TOOLCHAIN_FILE}")
|
|
|
|
message(STATUS "[PROJECT] VCPKG_PATH = ${VCPKG_PATH}")
|
|
|
|
message(STATUS "[PROJECT] VCPKG_ARCH = ${VCPKG_ARCH}")
|
|
|
|
message(STATUS "[PROJECT] CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
|
|
|
|
message(STATUS "[PROJECT] VCPKG_TARGET_TRIPLET = ${VCPKG_TARGET_TRIPLET}")
|