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