1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 12:57:45 +00:00
astra/CMakeLists.txt

133 lines
3.4 KiB
Text
Raw Normal View History

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)
set(CMAKE_AUTORCC ON)
2021-11-01 09:54:58 -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)
option(USE_OWN_LIBRARIES "Build with own libraries" OFF)
option(BUILD_FLATPAK "Build with Flatpak support in mind" OFF)
option(USE_STEAM "Build with Steam support" OFF)
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
if (USE_GAMEMODE)
find_package(PkgConfig REQUIRED)
pkg_search_module(GAMEMODE REQUIRED gamemode)
endif()
include(FetchContent)
2022-08-15 11:14:37 -04:00
if (NOT USE_OWN_LIBRARIES)
find_package(Qt5Keychain QUIET)
2022-08-15 11:14:37 -04:00
endif ()
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)
message("Using system library for Qt5 Keychain")
set(LIBRARIES Qt5Keychain::Qt5Keychain ${LIBRARIES})
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 ()
message("Using downloaded qtkeychain")
FetchContent_Declare(
qtkeychain
GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
2022-08-15 11:14:37 -04:00
GIT_TAG v0.12.0
)
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-08-15 11:14:37 -04:00
if (NOT USE_OWN_LIBRARIES)
find_package(QuaZip-Qt5 QUIET)
2022-08-15 11:14:37 -04:00
endif ()
2022-08-15 11:14:37 -04:00
if (TARGET QuaZip::QuaZip)
message("Using system library for Quazip")
set(LIBRARIES QuaZip::QuaZip ${LIBRARIES})
2022-08-15 11:14:37 -04:00
else ()
message("Using downloaded quazip")
FetchContent_Declare(
quazip
GIT_REPOSITORY https://github.com/stachenov/quazip.git
2022-08-15 11:14:37 -04:00
GIT_TAG v1.2
)
set(QUAZIP_USE_QT_ZLIB ON CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
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-08-15 11:14:37 -04:00
if (NOT USE_OWN_LIBRARIES)
find_package(fmt QUIET)
2022-08-15 11:14:37 -04:00
endif ()
2022-08-15 11:14:37 -04:00
if (TARGET fmt::fmt)
message("Using system library for fmt")
set(LIBRARIES fmt::fmt ${LIBRARIES})
2022-08-15 11:14:37 -04:00
else ()
message("Using downloaded fmt")
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt
2022-08-15 11:14:37 -04:00
GIT_TAG master
)
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 ()
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})
set(SRC ${SRC}
2022-08-15 11:14:37 -04:00
include/watchdog.h
src/watchdog.cpp
include/gameparser.h
src/gameparser.cpp)
endif ()
2022-08-15 11:14:37 -04:00
if (ENABLE_WATCHDOG)
set(LIBRARIES ${LIBRARIES}
X11
Xcomposite
Xrender)
2022-08-15 11:14:37 -04:00
endif ()
2022-06-08 12:45:12 -04:00
add_subdirectory(launcher)