Skip to content

Commit

Permalink
Merge pull request #967 from Miralqir/master
Browse files Browse the repository at this point in the history
Fix building on Gentoo
  • Loading branch information
hkAlice authored Aug 9, 2024
2 parents 2a0e423 + 66dca3e commit c1fdf38
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 40 deletions.
21 changes: 16 additions & 5 deletions cmake/FindMySQL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,39 @@ if( UNIX )
"preferred path to MySQL (mysql_config)"
)

find_program(MYSQL_CONFIG mysql_config
# 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
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}")
Expand Down
6 changes: 0 additions & 6 deletions deps/watchdog/Watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,8 @@

#include <functional>

// fucking filesystem
#if _MSC_VER >= 1925
#include <filesystem>
namespace ci { namespace fs = std::filesystem; }
#else
#include <experimental/filesystem>
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 {
Expand Down
6 changes: 0 additions & 6 deletions src/api/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,8 @@
#include <Util/CrashHandler.h>


// fucking filesystem
#if _MSC_VER >= 1925
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif


Sapphire::Common::Util::CrashHandler crashHandler;
Expand Down
7 changes: 1 addition & 6 deletions src/common/Config/ConfigMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
#include <iostream>
#include <fstream>

#if _MSC_VER >= 1925
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif

using namespace Sapphire;
using namespace Sapphire::Common;
Expand Down Expand Up @@ -94,4 +89,4 @@ bool ConfigMgr::copyDefaultConfig( const std::string& configName )
fs::copy_file( configPath.string() + m_configDefaultSuffix, configPath );

return true;
}
}
5 changes: 0 additions & 5 deletions src/common/Logging/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@
#include <spdlog/sinks/daily_file_sink.h>

// #include <iostream>
#if _MSC_VER >= 1925
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif


void Sapphire::Logger::init( const std::string& logPath )
Expand Down
6 changes: 0 additions & 6 deletions src/dbm/DbManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@
using namespace Sapphire;
using namespace Sapphire::Common;

// fucking filesystem
#if _MSC_VER >= 1925
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
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 ) :
Expand Down
6 changes: 0 additions & 6 deletions src/dbm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@

Sapphire::Common::Util::CrashHandler crashHandler;

// fucking filesystem
#if _MSC_VER >= 1925
#include <filesystem>
namespace filesys = std::filesystem;
#else
#include <experimental/filesystem>
namespace filesys = std::experimental::filesystem;
#endif

#include <fstream>
#include <streambuf>
Expand Down

0 comments on commit c1fdf38

Please sign in to comment.