Skip to content

Commit

Permalink
Support drop for x86 architecture (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meltie2013 authored Aug 28, 2023
1 parent b5dec8f commit b1a3f9e
Show file tree
Hide file tree
Showing 23 changed files with 793 additions and 905 deletions.
13 changes: 0 additions & 13 deletions cmake/compiler/msvc/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ if(PLATFORM EQUAL 64)
INTERFACE
-D_WIN64)
message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter")

else()
# mark 32 bit executables large address aware so they can use > 2GB address space
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
message(STATUS "MSVC: Enabled large address awareness")

target_compile_options(fc-compile-option-interface
INTERFACE
/arch:SSE2)
message(STATUS "MSVC: Enabled SSE2 support")

set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /SAFESEH:NO")
message(STATUS "MSVC: Disabled Safe Exception Handlers for debug builds")
endif()

# Set build-directive (used in core to tell which buildtype we used)
Expand Down
8 changes: 4 additions & 4 deletions cmake/macros/CheckPlatform.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# check what platform we're on (64-bit or 32-bit), and create a simpler test than CMAKE_SIZEOF_VOID_P
# check what platform we're on 64-bit, and create a simpler test than CMAKE_SIZEOF_VOID_P
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(PLATFORM 64)
MESSAGE(STATUS "Detected 64-bit platform")
message(STATUS "Detected 64-bit platform - ok")
else()
set(PLATFORM 32)
MESSAGE(STATUS "Detected 32-bit platform")
set(PLATFORM 32)
message(FATAL_ERROR "FirelandsCore doesn't support x86, please use x64 architecture.")
endif()

if(WIN32)
Expand Down
4 changes: 1 addition & 3 deletions src/common/CompilerDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
#define FC_PLATFORM_APPLE 2
#define FC_PLATFORM_INTEL 3

// must be first (win 64 also define _WIN32)
// must be first Win64
#if defined( _WIN64 )
# define FC_PLATFORM FC_PLATFORM_WINDOWS
#elif defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 )
# define FC_PLATFORM FC_PLATFORM_WINDOWS
#elif defined( __APPLE_CC__ )
# define FC_PLATFORM FC_PLATFORM_APPLE
#elif defined( __INTEL_COMPILER )
Expand Down
1,132 changes: 508 additions & 624 deletions src/common/Debugging/WheatyExceptionReport.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/common/Logging/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class FC_COMMON_API Log

#ifdef PERFORMANCE_PROFILING
#define LOG_MESSAGE_BODY(filterType__, level__, ...) ((void)0)
#elif FC_PLATFORM != FC_PLATFORM_WINDOWS
#elif FC_PLATFORM == FC_PLATFORM_UNIX || FC_PLATFORM == FC_PLATFORM_APPLE
void check_args(char const*, ...) ATTR_PRINTF(1, 2);
void check_args(std::string const&, ...);

Expand Down
2 changes: 1 addition & 1 deletion src/common/Metric/Metric.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class FC_COMMON_API Metric
#ifdef PERFORMANCE_PROFILING
#define FC_METRIC_EVENT(category, title, description) ((void)0)
#define FC_METRIC_VALUE(category, value) ((void)0)
#elif FC_PLATFORM != FC_PLATFORM_WINDOWS
#elif FC_PLATFORM == FC_PLATFORM_UNIX
#define FC_METRIC_EVENT(category, title, description) \
do { \
if (sMetric->IsEnabled()) \
Expand Down
4 changes: 2 additions & 2 deletions src/common/Platform/ServiceWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef _WIN32
#if FC_PLATFORM == FC_PLATFORM_WINDOWS

#include "Common.h"
#include "Log.h"
Expand Down Expand Up @@ -259,4 +259,4 @@ bool WinServiceRun()
}
return true;
}
#endif
#endif // FC_PLATFORM_WINDOWS
4 changes: 2 additions & 2 deletions src/common/Platform/ServiceWin32.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef _WIN32
#if FC_PLATFORM == FC_PLATFORM_WINDOWS
#ifndef _WIN32_SERVICE_
#define _WIN32_SERVICE_

Expand All @@ -24,4 +24,4 @@ bool WinServiceUninstall();
bool WinServiceRun();

#endif // _WIN32_SERVICE_
#endif // _WIN32
#endif // FC_PLATFORM_WINDOWS
8 changes: 4 additions & 4 deletions src/common/Threading/ProcessPriority.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include "ProcessPriority.h"
#include "Log.h"

#ifdef _WIN32 // Windows
#if FC_PLATFORM == FC_PLATFORM_WINDOWS // Windows
#include <Windows.h>
#elif defined(__linux__)
#elif FC_PLATFORM == FC_PLATFORM_UNIX
#include <sched.h>
#include <sys/resource.h>
#define PROCESS_HIGH_PRIORITY -15 // [-20, 19], default is 0
Expand All @@ -29,7 +29,7 @@
void SetProcessPriority(std::string const& logChannel, uint32 affinity, bool highPriority)
{
///- Handle affinity for multiple processors and process priority
#ifdef _WIN32 // Windows
#if FC_PLATFORM == FC_PLATFORM_WINDOWS // Windows

HANDLE hProcess = GetCurrentProcess();
if (affinity > 0)
Expand Down Expand Up @@ -59,7 +59,7 @@ void SetProcessPriority(std::string const& logChannel, uint32 affinity, bool hig
LOG_ERROR(logChannel, "Can't set process priority class.");
}

#elif defined(__linux__) // Linux
#elif FC_PLATFORM == FC_PLATFORM_UNIX // Linux

if (affinity > 0)
{
Expand Down
6 changes: 3 additions & 3 deletions src/common/Utilities/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void stripLineInvisibleChars(std::string& str)
str.clear();
}

#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
#if FC_PLATFORM == FC_PLATFORM_WINDOWS
struct tm* localtime_r(time_t const* time, struct tm* result)
{
localtime_s(result, time);
Expand All @@ -119,7 +119,7 @@ tm TimeBreakdown(time_t time)

time_t LocalTimeToUTCTime(time_t time)
{
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
#if FC_PLATFORM == FC_PLATFORM_WINDOWS
return time + _timezone;
#else
return time + timezone;
Expand Down Expand Up @@ -287,7 +287,7 @@ uint32 CreatePIDFile(std::string const& filename)

uint32 GetPID()
{
#ifdef _WIN32
#if FC_PLATFORM == FC_PLATFORM_WINDOWS
DWORD pid = GetCurrentProcessId();
#else
pid_t pid = getpid();
Expand Down
7 changes: 5 additions & 2 deletions src/server/authserver/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@
#include "ProcessPriority.h"
#include "RealmList.h"
#include "Util.h"

#include <openssl/crypto.h>
#include <openssl/opensslv.h>

#include <boost/asio/signal_set.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/program_options.hpp>

#include <csignal>
#include <iostream>
#include <openssl/crypto.h>
#include <openssl/opensslv.h>

using boost::asio::ip::tcp;
using namespace boost::program_options;
Expand Down
2 changes: 1 addition & 1 deletion src/server/database/Database/MySQLConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ uint32 MySQLConnection::Open()

mysql_options(mysqlInit, MYSQL_SET_CHARSET_NAME, "utf8");
//mysql_options(mysqlInit, MYSQL_OPT_READ_TIMEOUT, (char const*)&timeout);
#ifdef _WIN32
#if FC_PLATFORM == FC_PLATFORM_WINDOWS
if (m_connectionInfo.host == ".") // named pipe use option (Windows)
{
unsigned int opt = MYSQL_PROTOCOL_PIPE;
Expand Down
2 changes: 1 addition & 1 deletion src/server/database/Database/MySQLWorkaround.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef _WIN32 // hack for broken mysql.h not including the correct winsock header for SOCKET definition, fixed in 5.7
#if FC_PLATFORM == FC_PLATFORM_WINDOWS // hack for broken mysql.h not including the correct winsock header for SOCKET definition, fixed in 5.7
#include <winsock2.h>
#endif
#include <mysql.h>
2 changes: 1 addition & 1 deletion src/server/database/Updater/DBUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void DBUpdater<T>::ApplyFile(
args.emplace_back("-p" + password);

// Check if we want to connect through ip or socket (Unix only)
#ifdef _WIN32
#if FC_PLATFORM == FC_PLATFORM_WINDOWS

if (host == ".")
args.emplace_back("--protocol=PIPE");
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Scripting/ScriptReloadMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ class HotSwapScriptReloadMgr final

auto current_path = fs::current_path();

#if FC_PLATFORM != FC_PLATFORM_WINDOWS
#if FC_PLATFORM == FC_PLATFORM_UNIX
// The worldserver location is ${CMAKE_INSTALL_PREFIX}/bin
// on all other platforms then windows
current_path = current_path.parent_path();
Expand Down
2 changes: 1 addition & 1 deletion src/server/shared/Networking/AsyncAcceptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class AsyncAcceptor
return false;
}

#if FC_PLATFORM != FC_PLATFORM_WINDOWS
#if FC_PLATFORM == FC_PLATFORM_UNIX
_acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true), errorCode);
if (errorCode)
{
Expand Down
Loading

0 comments on commit b1a3f9e

Please sign in to comment.