From 2e353fd473d83bff56b9108aa7339c48b63271f4 Mon Sep 17 00:00:00 2001 From: Miralqir Date: Fri, 9 Aug 2024 04:17:28 +0300 Subject: [PATCH 1/4] Remove pre-C++17 Filesystem library support --- deps/watchdog/Watchdog.h | 6 ------ src/api/main.cpp | 6 ------ src/common/Config/ConfigMgr.cpp | 7 +------ src/common/Logging/Logger.cpp | 5 ----- src/dbm/DbManager.cpp | 6 ------ src/dbm/main.cpp | 6 ------ 6 files changed, 1 insertion(+), 35 deletions(-) diff --git a/deps/watchdog/Watchdog.h b/deps/watchdog/Watchdog.h index 08cc0678..7d5e9803 100644 --- a/deps/watchdog/Watchdog.h +++ b/deps/watchdog/Watchdog.h @@ -32,14 +32,8 @@ #include - // fucking filesystem -#if _MSC_VER >= 1925 #include namespace ci { namespace fs = std::filesystem; } -#else -#include -namespace ci { namespace fs = std::experimental::filesystem; } -#endif //! Exception for when Watchdog can't locate a file or parse the wildcard class WatchedFileSystemExc : public std::exception { diff --git a/src/api/main.cpp b/src/api/main.cpp index c21f0ddd..c1697b23 100644 --- a/src/api/main.cpp +++ b/src/api/main.cpp @@ -31,14 +31,8 @@ #include -// fucking filesystem -#if _MSC_VER >= 1925 #include namespace fs = std::filesystem; -#else -#include -namespace fs = std::experimental::filesystem; -#endif Sapphire::Common::Util::CrashHandler crashHandler; diff --git a/src/common/Config/ConfigMgr.cpp b/src/common/Config/ConfigMgr.cpp index 5d95e17f..52808aac 100644 --- a/src/common/Config/ConfigMgr.cpp +++ b/src/common/Config/ConfigMgr.cpp @@ -2,13 +2,8 @@ #include #include -#if _MSC_VER >= 1925 #include namespace fs = std::filesystem; -#else -#include -namespace fs = std::experimental::filesystem; -#endif using namespace Sapphire; using namespace Sapphire::Common; @@ -94,4 +89,4 @@ bool ConfigMgr::copyDefaultConfig( const std::string& configName ) fs::copy_file( configPath.string() + m_configDefaultSuffix, configPath ); return true; -} \ No newline at end of file +} diff --git a/src/common/Logging/Logger.cpp b/src/common/Logging/Logger.cpp index 82867199..9fc6b37b 100644 --- a/src/common/Logging/Logger.cpp +++ b/src/common/Logging/Logger.cpp @@ -8,13 +8,8 @@ #include // #include -#if _MSC_VER >= 1925 #include namespace fs = std::filesystem; -#else -#include -namespace fs = std::experimental::filesystem; -#endif void Sapphire::Logger::init( const std::string& logPath ) diff --git a/src/dbm/DbManager.cpp b/src/dbm/DbManager.cpp index 0f706212..31ef313c 100644 --- a/src/dbm/DbManager.cpp +++ b/src/dbm/DbManager.cpp @@ -11,14 +11,8 @@ using namespace Sapphire; using namespace Sapphire::Common; -// fucking filesystem -#if _MSC_VER >= 1925 #include namespace fs = std::filesystem; -#else -#include -namespace fs = std::experimental::filesystem; -#endif DbManager::DbManager( const std::string& host, const std::string& database, const std::string& user, const std::string& pw, uint16_t port ) : diff --git a/src/dbm/main.cpp b/src/dbm/main.cpp index 7eaff903..dd28ef9f 100644 --- a/src/dbm/main.cpp +++ b/src/dbm/main.cpp @@ -9,14 +9,8 @@ Sapphire::Common::Util::CrashHandler crashHandler; -// fucking filesystem -#if _MSC_VER >= 1925 #include namespace filesys = std::filesystem; -#else -#include -namespace filesys = std::experimental::filesystem; -#endif #include #include From 086dfb7133120c4870ab6a04966faa933b815dbe Mon Sep 17 00:00:00 2001 From: Miralqir Date: Fri, 9 Aug 2024 04:44:13 +0300 Subject: [PATCH 2/4] Fix CMake Policy CMP0153 warning --- cmake/FindMySQL.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index e629b8ae..ed1104aa 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -28,18 +28,18 @@ if( UNIX ) if( MYSQL_CONFIG ) message(STATUS "Using mysql-config: ${MYSQL_CONFIG}") # set INCLUDE_DIR - exec_program(${MYSQL_CONFIG} - ARGS --include + execute_process(COMMAND ${MYSQL_CONFIG} --include OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE ) string(REGEX REPLACE "-I([^ ]*)( .*)?" "\\1" MY_TMP "${MY_TMP}") set(MYSQL_ADD_INCLUDE_PATH ${MY_TMP} CACHE FILEPATH INTERNAL) #message("[DEBUG] MYSQL ADD_INCLUDE_PATH : ${MYSQL_ADD_INCLUDE_PATH}") # set LIBRARY_DIR - exec_program(${MYSQL_CONFIG} - ARGS --libs_r + execute_process(COMMAND ${MYSQL_CONFIG} --libs_r OUTPUT_VARIABLE MY_TMP + OUTPUT_STRIP_TRAILING_WHITESPACE ) set(MYSQL_ADD_LIBRARIES "") string(REGEX MATCHALL "-l[^ ]*" MYSQL_LIB_LIST "${MY_TMP}") From 967d8b1422c8edb651cdb464b4ef602c25a5d4f6 Mon Sep 17 00:00:00 2001 From: Miralqir Date: Fri, 9 Aug 2024 05:06:18 +0300 Subject: [PATCH 3/4] Make FindMySQL.cmake work on Gentoo --- cmake/FindMySQL.cmake | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index ed1104aa..abec4027 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -18,7 +18,24 @@ if( UNIX ) "preferred path to MySQL (mysql_config)" ) - find_program(MYSQL_CONFIG mysql_config + # use mariadb_config on Gentoo + find_program(LSB_RELEASE_EXEC lsb_release) + execute_process(COMMAND ${LSB_RELEASE_EXEC} -is + OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if( ${LSB_RELEASE_ID_SHORT} STREQUAL "Gentoo" ) + set(MY_TMP "mariadb_config") + else() + set(MY_TMP "mysql_config") + endif() + + set(MYSQL_CONFIG_EXECUTABLE_NAME ${MY_TMP} CACHE STRING + "mysql_config executable name" + ) + + find_program(MYSQL_CONFIG ${MYSQL_CONFIG_EXECUTABLE_NAME} ${MYSQL_CONFIG_PREFER_PATH} /usr/local/mysql/bin/ /usr/local/bin/ From 66dca3e04dc5f4f1c7fb38c24d1c8c5d2d5ac8fe Mon Sep 17 00:00:00 2001 From: Miralqir Date: Fri, 9 Aug 2024 14:31:08 +0300 Subject: [PATCH 4/4] Remove distribution specific code in FindMySQL.cmake --- cmake/FindMySQL.cmake | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake index abec4027..d15f7abd 100644 --- a/cmake/FindMySQL.cmake +++ b/cmake/FindMySQL.cmake @@ -18,30 +18,24 @@ if( UNIX ) "preferred path to MySQL (mysql_config)" ) - # use mariadb_config on Gentoo - find_program(LSB_RELEASE_EXEC lsb_release) - execute_process(COMMAND ${LSB_RELEASE_EXEC} -is - OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - if( ${LSB_RELEASE_ID_SHORT} STREQUAL "Gentoo" ) - set(MY_TMP "mariadb_config") - else() - set(MY_TMP "mysql_config") - endif() - - set(MYSQL_CONFIG_EXECUTABLE_NAME ${MY_TMP} CACHE STRING - "mysql_config executable name" - ) - - find_program(MYSQL_CONFIG ${MYSQL_CONFIG_EXECUTABLE_NAME} + # try mariadb first + find_program(MYSQL_CONFIG mariadb_config ${MYSQL_CONFIG_PREFER_PATH} /usr/local/mysql/bin/ /usr/local/bin/ /usr/bin/ ) + if( NOT MYSQL_CONFIG ) + # fallback to mysql + find_program(MYSQL_CONFIG mysql_config + ${MYSQL_CONFIG_PREFER_PATH} + /usr/local/mysql/bin/ + /usr/local/bin/ + /usr/bin/ + ) + endif() + if( MYSQL_CONFIG ) message(STATUS "Using mysql-config: ${MYSQL_CONFIG}") # set INCLUDE_DIR