1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Include basic framework for Steam API support

This commit is contained in:
Joshua Goins 2022-09-05 15:43:15 -04:00
parent 33f68c5586
commit dc024aceb7
6 changed files with 41 additions and 3 deletions

View file

@ -9,6 +9,7 @@ find_package(Qt5 COMPONENTS Core Widgets Network Quick CONFIG REQUIRED)
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)
if (ENABLE_WATCHDOG)
find_package(PkgConfig REQUIRED)
@ -22,6 +23,13 @@ if (NOT USE_OWN_LIBRARIES)
find_package(Qt5Keychain QUIET)
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()
if (TARGET Qt5Keychain::Qt5Keychain)
message("Using system library for Qt5 Keychain")

View file

@ -8,7 +8,8 @@ set(HEADERS
include/sapphirelauncher.h
include/squareboot.h
include/squarelauncher.h
include/patcher.h)
include/patcher.h
include/steamapi.h)
set(SRC
src/dxvkinstaller.cpp
@ -19,7 +20,8 @@ set(SRC
src/sapphirelauncher.cpp
src/squareboot.cpp
src/squarelauncher.cpp
src/patcher.cpp)
src/patcher.cpp
src/steamapi.cpp)
if (ENABLE_WATCHDOG)
set(HEADERS ${HEADERS}
@ -28,9 +30,14 @@ if (ENABLE_WATCHDOG)
set(SRC ${SRC}
src/gameparser.cpp
src/watchdog.cpp)
src/watchdog.cpp include/steamapi.h src/steamapi.cpp)
endif ()
if(USE_STEAM)
set(LIBRARIES ${LIBRARIES}
Steamworks)
endif()
add_library(astra_core STATIC ${HEADERS} ${SRC})
target_include_directories(astra_core PUBLIC
${KEYCHAIN_INCLUDE_DIRS}
@ -53,3 +60,7 @@ if (ENABLE_WATCHDOG)
target_compile_definitions(astra_core PUBLIC ENABLE_WATCHDOG)
endif ()
if(USE_STEAM)
target_compile_definitions(astra_core PUBLIC USE_STEAM)
endif()

View file

@ -10,6 +10,7 @@
#include <QtQml>
#include "squareboot.h"
#include "steamapi.h"
class SapphireLauncher;
class SquareLauncher;
@ -223,4 +224,6 @@ private:
QString getDefaultWinePrefixPath();
QVector<ProfileSettings*> profileSettings;
SteamAPI* steamApi = nullptr;
};

View file

@ -0,0 +1,6 @@
#pragma once
class SteamAPI {
public:
SteamAPI();
};

View file

@ -526,6 +526,7 @@ LauncherCore::LauncherCore()
squareLauncher = new SquareLauncher(*this);
squareBoot = new SquareBoot(*this, *squareLauncher);
assetUpdater = new AssetUpdater(*this);
steamApi = new SteamAPI();
#ifdef ENABLE_WATCHDOG
watchdog = new Watchdog(*this);

View file

@ -0,0 +1,9 @@
#include "steamapi.h"
#include <steam/steam_api.h>
SteamAPI::SteamAPI() {
#ifdef USE_STEAM
SteamAPI_Init();
#endif
}