1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00
ScreenPlay/CMakeLists.txt

93 lines
2.6 KiB
CMake
Raw Normal View History

2020-10-29 18:53:52 +01:00
cmake_minimum_required(VERSION 3.16.0)
2021-01-03 16:54:51 +01:00
project(ScreenPlay 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)
2021-07-16 11:14:21 +02:00
set(SCREENPLAY_STEAM ON)
file(MAKE_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
set(CMAKE_CXX_STANDARD 20)
2020-08-10 22:57:57 +02:00
if(WIN32)
set(VCPKG_ARCH "x64-windows")
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()
# Assume built-in pthreads on MacOS https://stackoverflow.com/questions/54587052/cmake-on-mac-could-not-find-threads-missing-threads-found
2020-10-31 19:59:46 +01:00
if(APPLE)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
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-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")
set(date_arg " +%y.%m.%d")
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
ERROR_QUIET 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}"
OUTPUT_VARIABLE GIT_COMMIT_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
2020-08-10 17:39:42 +02:00
add_compile_definitions(COMPILE_INFO="${BUILD_DATE} + ${GIT_COMMIT_HASH}")
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")
endif()
add_subdirectory(ScreenPlay)
add_subdirectory(ScreenPlaySDK)
2020-09-10 11:40:07 +02:00
add_subdirectory(ScreenPlayShader)
add_subdirectory(ScreenPlayWallpaper)
add_subdirectory(ScreenPlayWidget)
add_subdirectory(ScreenPlayUtil)
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()
if(WIN32)
2020-10-29 18:53:52 +01:00
add_subdirectory(ScreenPlaySysInfo)
endif()
2021-03-12 09:19:19 +01:00
2021-03-13 16:17:56 +01:00
#if(APPLE)
#add_custom_target(CopyDependencies DEPENDS ScreenPlay)
#add_custom_command(TARGET CopyDependencies POST_BUILD
# COMMAND "ScreenPlayWallpaper" -E copy_directory
# "$<TARGET_FILE:ScreenPlayWallpaper>"
# "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/$<TARGET_FILE_NAME:ScreenPlayWallpaper>/"
# COMMENT "Copying into ScreenPlay.app bundle")
#endif()
2021-03-12 09:19:19 +01:00