Skip to content

Commit

Permalink
[Linux] Fix architecture and platform handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Buom01 committed Feb 3, 2024
1 parent 96fcdf7 commit 35de4e1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,7 @@ elseif( UNIX )
endif()

# Determine arch
if( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" )
set( BUILD_ARCH "x86_64" )
else()
set( BUILD_ARCH ${CMAKE_SYSTEM_PROCESSOR} )
endif()
set( BUILD_ARCH ${CMAKE_SYSTEM_PROCESSOR} )

######################
# Define Build Files #
Expand Down
9 changes: 8 additions & 1 deletion src/engine/platform/systemLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@
#include <stdexcept>

int main(int argc, char **argv) {
const std::string dynName = "engine.AMD64.dll";
const std::string dynName;
#if defined (_WIN32)
dynName = "engine.AMD64.dll";
#elif defined (__LINUX__)
dynName = "./engine.x86_64.so";
#else
dynName = "./engine.x86_64.dylib";
#endif
const std::string engineExportName = "engineMain";

SDL_Init(0);
Expand Down
6 changes: 3 additions & 3 deletions src/engine/qcommon/q_platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
#define PATH_SEP '/'

#if defined __x86_64__
#define ARCH_STRING "AMD64"
#define ARCH_STRING "x86_64"
#elif defined __arm__
#define ARCH_STRING "arm"
#endif
Expand Down Expand Up @@ -169,9 +169,9 @@
#define PATH_SEP '/'

#if defined __amd64__
#define ARCH_STRING "AMD564"
#elif defined __x86_64__
#define ARCH_STRING "AMD64"
#elif defined __x86_64__
#define ARCH_STRING "x86_64"
#endif

#if BYTE_ORDER == BIG_ENDIAN
Expand Down
2 changes: 1 addition & 1 deletion src/engine/server/serverGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ void idServerGameSystemLocal::ShutdownGameProgs(void) {
gvm = nullptr;

if(sv_newGameShlib->string[0]) {
fileSystem->Rename(sv_newGameShlib->string, "sgameAMD64" DLL_EXT);
fileSystem->Rename(sv_newGameShlib->string, "sgame" ARCH_STRING DLL_EXT);
cvarSystem->Set("sv_newGameShlib",
"Replace game module library after map restart.");
}
Expand Down

0 comments on commit 35de4e1

Please sign in to comment.