From 1f528805ba5a3c584737a5926f775e81bd759d0c Mon Sep 17 00:00:00 2001 From: Archie Date: Tue, 9 Jul 2024 12:38:51 +0100 Subject: [PATCH] feat: Changed D++ to statically link on Linux --- .gitignore | 3 +++ CMakeLists.txt | 17 ++++++++--------- README.md | 2 +- src/main.cpp | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index c53b37f..ba7a76e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ # Build directories build cmake-build-debug +cmake-build-release out # Xcode stuff @@ -17,3 +18,5 @@ out # Extras config.cfg + +libdpp.a diff --git a/CMakeLists.txt b/CMakeLists.txt index 27ed191..ad320b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required (VERSION 3.20) -project ("FDR" VERSION 0.1 DESCRIPTION "Factorio-Discord-Relay in C++") +project ("FDR" VERSION 1.0 DESCRIPTION "Factorio-Discord-Relay in C++") file(GLOB source_files CONFIGURE_DEPENDS "src/*.cpp" "include/*.h") @@ -17,15 +17,11 @@ if(WIN32) ws2_32 ) else() - find_package(DPP REQUIRED) + set_target_properties(${PROJECT_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) + set_target_properties(${PROJECT_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) - target_link_libraries(${PROJECT_NAME} - ${DPP_LIBRARIES} - ) - - target_include_directories(${PROJECT_NAME} PRIVATE - ${DPP_INCLUDE_DIR} - ) + set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") + target_link_libraries(${PROJECT_NAME} libdpp.a) endif() set_target_properties(${PROJECT_NAME} PROPERTIES @@ -33,3 +29,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON ) +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/include +) diff --git a/README.md b/README.md index 78e9a6c..3261494 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ RCON is extremely insecure as it sends all the data as plain text over the netwo ## Requirements -- [D++](https://github.com/brainboxdotcc/DPP/) (10.0.29 or higher). +- D++ 10.0.30 (If you're on Linux, this is automatically packaged with FDR, meaning you do not need D++ installed). - A Factorio Server. - A Discord Bot with the `Message Content` and the `Server Members` intent on. - A channel for messages. diff --git a/src/main.cpp b/src/main.cpp index 5d1d3bf..b1af404 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,6 @@ -#include "../include/main.h" +#include "main.h" -#include "../include/rcon.h" +#include "rcon.h" #include #include