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

Rearrange source directories

This commit is contained in:
Joshua Goins 2022-06-08 12:45:12 -04:00
parent 365706e43a
commit 51e1bd7ac4
50 changed files with 150 additions and 86 deletions

View file

@ -16,40 +16,6 @@ if(ENABLE_WATCHDOG)
pkg_search_module(LEPTONICA REQUIRED lept)
endif()
set(SRC
src/main.cpp
src/launchercore.cpp
include/launchercore.h
include/squarelauncher.h
src/sapphirelauncher.cpp
src/squareboot.cpp
src/squarelauncher.cpp
src/settingswindow.cpp
src/blowfish.cpp
src/assetupdater.cpp
include/assetupdater.h
src/launcherwindow.cpp
include/launcherwindow.h
src/gamescopesettingswindow.cpp
include/gamescopesettingswindow.h
include/headline.h
src/headline.cpp
include/config.h
include/gameinstaller.h
src/gameinstaller.cpp
src/encryptedarg.cpp
src/aboutwindow.cpp
include/aboutwindow.h
src/bannerwidget.cpp
include/bannerwidget.h
include/desktopinterface.h
include/cmdinterface.h
src/cmdinterface.cpp
src/desktopinterface.cpp
include/tabletinterface.h
src/tabletinterface.cpp
qml/qml.qrc)
include(FetchContent)
if(NOT USE_OWN_LIBRARIES)
@ -133,9 +99,6 @@ endif()
add_subdirectory(external)
set(LIBRARIES
Qt5::Core Qt5::Widgets Qt5::Network Qt5::Quick ${LIBRARIES})
if(ENABLE_WATCHDOG)
set(LIBRARIES ${LIBRARIES} ${TESSERACT_LIBRARIES} ${LEPTONICA_LIBRARIES})
@ -153,50 +116,4 @@ if(ENABLE_WATCHDOG)
Xrender)
endif()
add_executable(astra ${SRC})
target_link_libraries(astra PUBLIC ${LIBRARIES} libxiv)
target_compile_features(astra PUBLIC cxx_std_17)
set_target_properties(astra PROPERTIES CXX_EXTENSIONS OFF)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE LICENSE_TXT)
STRING(REPLACE "\n" " \\n" LICENSE_TXT ${LICENSE_TXT})
STRING(REPLACE "\"" "\"\"" LICENSE_TXT ${LICENSE_TXT})
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/license.h.in
${CMAKE_BINARY_DIR}/license.h)
target_include_directories(astra
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE
${KEYCHAIN_INCLUDE_DIRS}
${QUAZIP_INCLUDE_DIRS}
${CMAKE_BINARY_DIR})
if(ENABLE_WATCHDOG)
target_include_directories(astra PRIVATE ${TESSERACT_INCLUDE_DIRS} ${LEPTONICA_INCLUDE_DIRS})
target_compile_definitions(astra PRIVATE ENABLE_WATCHDOG)
endif()
if(BUILD_FLATPAK)
target_compile_definitions(astra PRIVATE FLATPAK)
endif()
install(TARGETS astra
DESTINATION "${INSTALL_BIN_PATH}")
if(WIN32)
get_target_property(QMAKE_EXE Qt5::qmake IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QMAKE_EXE}" DIRECTORY)
find_program(WINDEPLOYQT_ENV_SETUP qtenv2.bat HINTS "${QT_BIN_DIR}")
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
# Run windeployqt immediately after build
add_custom_command(TARGET astra
POST_BUILD
COMMAND "${WINDEPLOYQT_ENV_SETUP}" && "${WINDEPLOYQT_EXECUTABLE}" \"$<TARGET_FILE:astra>\"
)
endif()
add_subdirectory(launcher)

44
launcher/CMakeLists.txt Normal file
View file

@ -0,0 +1,44 @@
add_subdirectory(core)
add_subdirectory(cli)
add_subdirectory(desktop)
add_subdirectory(tablet)
add_executable(astra main.cpp)
target_link_libraries(astra PUBLIC
${LIBRARIES}
libxiv
astra_core
astra_desktop
astra_cli
astra_tablet)
target_compile_features(astra PUBLIC cxx_std_17)
set_target_properties(astra PROPERTIES CXX_EXTENSIONS OFF)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE LICENSE_TXT)
STRING(REPLACE "\n" " \\n" LICENSE_TXT ${LICENSE_TXT})
STRING(REPLACE "\"" "\"\"" LICENSE_TXT ${LICENSE_TXT})
configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/license.h.in
${CMAKE_BINARY_DIR}/license.h)
if(BUILD_FLATPAK)
target_compile_definitions(astra PRIVATE FLATPAK)
endif()
install(TARGETS astra
DESTINATION "${INSTALL_BIN_PATH}")
if(WIN32)
get_target_property(QMAKE_EXE Qt5::qmake IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QMAKE_EXE}" DIRECTORY)
find_program(WINDEPLOYQT_ENV_SETUP qtenv2.bat HINTS "${QT_BIN_DIR}")
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
# Run windeployqt immediately after build
add_custom_command(TARGET astra
POST_BUILD
COMMAND "${WINDEPLOYQT_ENV_SETUP}" && "${WINDEPLOYQT_EXECUTABLE}" \"$<TARGET_FILE:astra>\"
)
endif()

View file

@ -0,0 +1,12 @@
set(HEADERS
include/cmdinterface.h)
set(SRC
src/cmdinterface.cpp)
add_library(astra_cli STATIC ${HEADERS} ${SRC})
target_include_directories(astra_cli PUBLIC include)
target_link_libraries(astra_cli PUBLIC
astra_core
Qt5::Core
Qt5::Network)

View file

@ -0,0 +1,53 @@
set(HEADERS
include/blowfish.h
include/config.h
include/dxvkinstaller.h
include/encryptedarg.h
include/gameinstaller.h
include/headline.h
include/launchercore.h
include/sapphirelauncher.h
include/squareboot.h
include/squarelauncher.h)
set(SRC
src/blowfish.cpp
src/dxvkinstaller.cpp
src/encryptedarg.cpp
src/gameinstaller.cpp
src/headline.cpp
src/launchercore.cpp
src/sapphirelauncher.cpp
src/squareboot.cpp
src/squarelauncher.cpp)
if(ENABLE_WATCHDOG)
set(HEADERS ${HEADERS}
include/gameparser.h
include/watchdog.h)
set(SRC ${SRC}
src/gameparser.cpp
src/watchdog.cpp)
endif()
add_library(astra_core STATIC ${HEADERS} ${SRC})
target_include_directories(astra_core PUBLIC
${KEYCHAIN_INCLUDE_DIRS}
${QUAZIP_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}
include)
target_link_libraries(astra_core PUBLIC
libxiv
${LIBRARIES}
Qt5::Core
Qt5::Network
Qt5::Widgets # widgets is required by watchdog, to be fixed/removed later
PRIVATE
astra_desktop) # desktop is currently required by the core, to be fixed/removed later
if(ENABLE_WATCHDOG)
target_include_directories(astra_core PUBLIC ${TESSERACT_INCLUDE_DIRS} ${LEPTONICA_INCLUDE_DIRS})
target_compile_definitions(astra_core PUBLIC ENABLE_WATCHDOG)
endif()

View file

@ -0,0 +1,25 @@
set(HEADERS
include/aboutwindow.h
include/assetupdater.h
include/bannerwidget.h
include/desktopinterface.h
include/gamescopesettingswindow.h
include/launcherwindow.h
include/settingswindow.h)
set(SRC
src/aboutwindow.cpp
src/assetupdater.cpp
src/bannerwidget.cpp
src/desktopinterface.cpp
src/gamescopesettingswindow.cpp
src/launcherwindow.cpp
src/settingswindow.cpp)
add_library(astra_desktop STATIC ${HEADERS} ${SRC})
target_include_directories(astra_desktop PUBLIC include)
target_link_libraries(astra_desktop PUBLIC
astra_core
Qt5::Core
Qt5::Widgets
Qt5::Network)

View file

@ -12,7 +12,7 @@
#include "config.h"
#include "desktopinterface.h"
#include "cmdinterface.h"
#include "tabletinterface.h"
#include "../launcher/tablet/include/tabletinterface.h"
int main(int argc, char* argv[]) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

View file

@ -0,0 +1,13 @@
set(HEADERS
include/tabletinterface.h)
set(SRC
src/tabletinterface.cpp)
add_library(astra_tablet STATIC ${HEADERS} ${SRC} qml/qml.qrc)
target_include_directories(astra_tablet PUBLIC include)
target_link_libraries(astra_tablet PUBLIC
astra_core
Qt5::Core
Qt5::Network
Qt5::Quick)

View file

@ -1,4 +1,4 @@
#include "tabletinterface.h"
#include "../launcher/tablet/include/tabletinterface.h"
TabletInterface::TabletInterface(LauncherCore &core) {
applicationEngine = new QQmlApplicationEngine();