2021-11-01 09:54:58 -04:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2022-02-23 19:00:17 -05:00
|
|
|
project(Astra)
|
2021-11-01 09:54:58 -04:00
|
|
|
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
2022-06-08 12:06:44 -04:00
|
|
|
set(CMAKE_AUTORCC ON)
|
2021-11-01 09:54:58 -04:00
|
|
|
|
2022-06-08 12:06:44 -04:00
|
|
|
find_package(Qt5 COMPONENTS Core Widgets Network Quick CONFIG REQUIRED)
|
2021-11-01 09:54:58 -04:00
|
|
|
|
2022-01-27 09:25:23 -05:00
|
|
|
option(ENABLE_WATCHDOG "Build with Tesseract support (needed for Watchdog)" OFF)
|
2022-03-01 17:21:29 -05:00
|
|
|
option(USE_OWN_LIBRARIES "Build with own libraries" OFF)
|
2022-04-17 22:31:22 -04:00
|
|
|
option(BUILD_FLATPAK "Build with Flatpak support in mind" OFF)
|
2022-09-05 15:43:15 -04:00
|
|
|
option(USE_STEAM "Build with Steam support" OFF)
|
2022-09-05 17:10:37 -04:00
|
|
|
option(USE_GAMEMODE "Build with GameMode support" ON)
|
2022-01-27 09:25:23 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (ENABLE_WATCHDOG)
|
2022-01-27 09:25:23 -05:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_search_module(TESSERACT REQUIRED tesseract)
|
|
|
|
pkg_search_module(LEPTONICA REQUIRED lept)
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2022-01-27 09:25:23 -05:00
|
|
|
|
2022-09-05 17:10:37 -04:00
|
|
|
if (USE_GAMEMODE)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_search_module(GAMEMODE REQUIRED gamemode)
|
|
|
|
endif()
|
|
|
|
|
2022-03-01 17:21:29 -05:00
|
|
|
include(FetchContent)
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (NOT USE_OWN_LIBRARIES)
|
2022-03-27 21:08:27 -04:00
|
|
|
find_package(Qt5Keychain QUIET)
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2022-03-01 17:21:29 -05:00
|
|
|
|
2022-09-05 15:43:15 -04:00
|
|
|
if(USE_STEAM)
|
|
|
|
add_library(Steamworks IMPORTED STATIC)
|
|
|
|
set_target_properties(Steamworks PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${STEAMWORKS_INCLUDE_DIR}
|
|
|
|
IMPORTED_LOCATION ${STEAMWORKS_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (TARGET Qt5Keychain::Qt5Keychain)
|
2022-03-01 16:58:47 -05:00
|
|
|
message("Using system library for Qt5 Keychain")
|
|
|
|
|
|
|
|
set(LIBRARIES Qt5Keychain::Qt5Keychain ${LIBRARIES})
|
2022-03-01 17:21:29 -05:00
|
|
|
set(KEYCHAIN_INCLUDE_DIRS ${QTKEYCHAIN_INCLUDE_DIRS}/qt5keychain) # this is to be consistent with the built-in lib?
|
2022-08-15 11:14:37 -04:00
|
|
|
else ()
|
2022-04-15 21:01:44 -04:00
|
|
|
message("Using downloaded qtkeychain")
|
2022-03-01 17:21:29 -05:00
|
|
|
|
|
|
|
FetchContent_Declare(
|
|
|
|
qtkeychain
|
|
|
|
GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
|
2022-08-15 11:14:37 -04:00
|
|
|
GIT_TAG v0.12.0
|
2022-03-01 17:21:29 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
set(BUILD_WITH_QT6 OFF CACHE BOOL "" FORCE)
|
|
|
|
set(QTKEYCHAIN_STATIC ON CACHE BOOL "" FORCE)
|
|
|
|
|
|
|
|
FetchContent_MakeAvailable(qtkeychain)
|
|
|
|
|
|
|
|
set(LIBRARIES qt5keychain ${LIBRARIES})
|
|
|
|
set(KEYCHAIN_INCLUDE_DIRS
|
|
|
|
${CMAKE_BINARY_DIR}/_deps/qtkeychain-src
|
|
|
|
${CMAKE_BINARY_DIR}/_deps/qtkeychain-build)
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2022-03-01 17:21:29 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (NOT USE_OWN_LIBRARIES)
|
2022-03-27 21:08:27 -04:00
|
|
|
find_package(QuaZip-Qt5 QUIET)
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2022-03-01 16:58:47 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (TARGET QuaZip::QuaZip)
|
2022-03-01 16:58:47 -05:00
|
|
|
message("Using system library for Quazip")
|
|
|
|
|
|
|
|
set(LIBRARIES QuaZip::QuaZip ${LIBRARIES})
|
2022-08-15 11:14:37 -04:00
|
|
|
else ()
|
2022-04-15 21:01:44 -04:00
|
|
|
message("Using downloaded quazip")
|
2022-03-01 17:21:29 -05:00
|
|
|
|
|
|
|
FetchContent_Declare(
|
|
|
|
quazip
|
|
|
|
GIT_REPOSITORY https://github.com/stachenov/quazip.git
|
2022-08-15 11:14:37 -04:00
|
|
|
GIT_TAG v1.2
|
2022-03-01 17:21:29 -05:00
|
|
|
)
|
2022-03-27 21:08:27 -04:00
|
|
|
|
|
|
|
set(QUAZIP_USE_QT_ZLIB ON CACHE BOOL "" FORCE)
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
|
|
|
2022-03-01 17:21:29 -05:00
|
|
|
FetchContent_MakeAvailable(quazip)
|
|
|
|
|
|
|
|
set(LIBRARIES QuaZip ${LIBRARIES})
|
|
|
|
set(QUAZIP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/_deps/quazip-src/quazip)
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2022-03-01 16:58:47 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (NOT USE_OWN_LIBRARIES)
|
2022-03-27 21:08:27 -04:00
|
|
|
find_package(fmt QUIET)
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2022-03-27 21:08:27 -04:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (TARGET fmt::fmt)
|
2022-03-27 21:08:27 -04:00
|
|
|
message("Using system library for fmt")
|
|
|
|
|
|
|
|
set(LIBRARIES fmt::fmt ${LIBRARIES})
|
2022-08-15 11:14:37 -04:00
|
|
|
else ()
|
2022-04-15 21:01:44 -04:00
|
|
|
message("Using downloaded fmt")
|
2022-03-27 21:08:27 -04:00
|
|
|
|
|
|
|
FetchContent_Declare(
|
|
|
|
fmt
|
|
|
|
GIT_REPOSITORY https://github.com/fmtlib/fmt
|
2022-08-15 11:14:37 -04:00
|
|
|
GIT_TAG master
|
2022-03-27 21:08:27 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
|
|
|
|
|
|
FetchContent_MakeAvailable(fmt)
|
|
|
|
|
|
|
|
set(LIBRARIES fmt::fmt ${LIBRARIES})
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2022-03-27 21:08:27 -04:00
|
|
|
|
2022-03-01 16:58:47 -05:00
|
|
|
add_subdirectory(external)
|
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (ENABLE_WATCHDOG)
|
2022-01-27 09:25:23 -05:00
|
|
|
set(LIBRARIES ${LIBRARIES} ${TESSERACT_LIBRARIES} ${LEPTONICA_LIBRARIES})
|
|
|
|
|
2021-12-06 21:15:31 -05:00
|
|
|
set(SRC ${SRC}
|
2022-08-15 11:14:37 -04:00
|
|
|
include/watchdog.h
|
|
|
|
src/watchdog.cpp
|
|
|
|
include/gameparser.h
|
|
|
|
src/gameparser.cpp)
|
|
|
|
endif ()
|
2021-12-06 21:15:31 -05:00
|
|
|
|
2022-08-15 11:14:37 -04:00
|
|
|
if (ENABLE_WATCHDOG)
|
2021-12-06 21:15:31 -05:00
|
|
|
set(LIBRARIES ${LIBRARIES}
|
|
|
|
X11
|
|
|
|
Xcomposite
|
|
|
|
Xrender)
|
2022-08-15 11:14:37 -04:00
|
|
|
endif ()
|
2021-12-06 21:15:31 -05:00
|
|
|
|
2022-06-08 12:45:12 -04:00
|
|
|
add_subdirectory(launcher)
|