mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-04-08 08:46:19 +00:00
added json header and fixed static linking
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(BeamMP-Launcher)
|
||||
|
||||
|
||||
if (WIN32)
|
||||
#message(STATUS "MSVC -> forcing use of statically-linked runtime.")
|
||||
#STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
#STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
|
||||
message(STATUS "MSVC -> forcing use of statically-linked runtime.")
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
#-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
|
||||
@@ -15,19 +15,24 @@ if (WIN32)
|
||||
link_directories(${VcpkgRoot}/lib)
|
||||
endif(WIN32)
|
||||
|
||||
set(wxUSE_STL ON)
|
||||
set(wxBUILD_SHARED OFF)
|
||||
add_subdirectory(wxWidgets)
|
||||
set(wxBUILD_MSVC_MULTIPROC ON)
|
||||
set(wxBUILD_USE_STATIC_RUNTIME ON)
|
||||
add_subdirectory(include/wxWidgets)
|
||||
add_subdirectory(include/rapidjson)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
src/main.cpp
|
||||
src/main.cpp include/easylogging++.h
|
||||
src/Launcher.cpp include/Launcher.h
|
||||
src/Logger.cpp include/Logger.h
|
||||
src/Gui.cpp
|
||||
src/gifs.cpp src/gifs.h)
|
||||
src/gui/Gui.cpp include/Json.h
|
||||
src/gui/gifs.cpp src/gui/gifs.h
|
||||
)
|
||||
|
||||
|
||||
if (WIN32)
|
||||
@@ -41,4 +46,4 @@ else(WIN32) #MINGW
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -s --static")
|
||||
target_link_libraries(${PROJECT_NAME} discord-rpc ssl crypto ws2_32 ssp crypt32 z)
|
||||
endif(WIN32)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE "include")
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE "include")
|
||||
10
include/Json.h
Normal file
10
include/Json.h
Normal file
@@ -0,0 +1,10 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 1/16/22
|
||||
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
|
||||
///
|
||||
|
||||
#pragma once
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/writer.h>
|
||||
namespace Json = rapidjson;
|
||||
@@ -9,12 +9,12 @@
|
||||
class Launcher {
|
||||
public:
|
||||
Launcher(int argc, char* argv[]);
|
||||
const std::string& getFullVersion(){return FullVersion;}
|
||||
const std::string& getWorkingDir(){return DirPath;}
|
||||
const std::string& getVersion(){return Version;}
|
||||
const std::string& getFullVersion(){return FullVersion;}
|
||||
void launchGame();
|
||||
private:
|
||||
void WindowsInit();
|
||||
|
||||
private:
|
||||
std::string DirPath;
|
||||
std::string Version{"3.0"};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
///
|
||||
|
||||
#pragma once
|
||||
#define ELPP_NO_DEFAULT_LOG_FILE
|
||||
#include "easylogging++.h"
|
||||
|
||||
class Log {
|
||||
|
||||
@@ -3,22 +3,25 @@
|
||||
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
|
||||
///
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include "Launcher.h"
|
||||
#include <Logger.h>
|
||||
#include "Logger.h"
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
Launcher::Launcher(int argc, char **argv) : DirPath(argv[0]) {
|
||||
Launcher::Launcher(int argc, char* argv[]) : DirPath(argv[0]) {
|
||||
DirPath = DirPath.substr(0, DirPath.find_last_of("\\/") + 1);
|
||||
Log::Init();
|
||||
WindowsInit();
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
void Launcher::launchGame() {
|
||||
ShellExecuteA(nullptr, nullptr, "steam://rungameid/284160", nullptr, nullptr, SW_SHOWNORMAL);
|
||||
ShowWindow(GetConsoleWindow(), HIDE_WINDOW);
|
||||
LOG(INFO) << "Sus";
|
||||
}
|
||||
|
||||
void Launcher::WindowsInit() {
|
||||
system("cls");
|
||||
SetConsoleTitleA(("BeamMP Launcher v" + FullVersion).c_str());
|
||||
}
|
||||
#else //WIN32
|
||||
void Launcher::WindowsInit() {}
|
||||
#endif //WIN32
|
||||
}
|
||||
@@ -3,9 +3,8 @@
|
||||
/// Copyright (c) 2021-present Anonymous275 read the LICENSE file for more info.
|
||||
///
|
||||
|
||||
#include <iostream>
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#include <set>
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
@@ -85,7 +84,7 @@ void MyFrame::OnHello(wxCommandEvent& event) {
|
||||
}
|
||||
|
||||
|
||||
int Entry (int argc, char *argv[]) {
|
||||
int GUIEntry (int argc, char *argv[]) {
|
||||
new MyApp();
|
||||
return wxEntry(argc, argv);
|
||||
}
|
||||
@@ -4,10 +4,9 @@
|
||||
///
|
||||
|
||||
#include "Launcher.h"
|
||||
|
||||
int Entry (int argc, char *argv[]);
|
||||
|
||||
#include "Logger.h"
|
||||
int main(int argc, char* argv[]) {
|
||||
Launcher launcher(argc, argv);
|
||||
return Entry(argc, argv);
|
||||
launcher.launchGame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user