From 1572623445b5c5bcb795c26cfa5de2c8bf3babe0 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 14 Dec 2022 03:28:47 -0800 Subject: [PATCH 1/4] Enabled macOS ARM64 build --- codeJK2/game/bg_pmove.cpp | 2 ++ shared/qcommon/q_platform.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/codeJK2/game/bg_pmove.cpp b/codeJK2/game/bg_pmove.cpp index 0fb672ea5b..75e054b3ec 100644 --- a/codeJK2/game/bg_pmove.cpp +++ b/codeJK2/game/bg_pmove.cpp @@ -6500,7 +6500,9 @@ qboolean PM_SaberLocked( void ) #endif // _DEBUG gi.G2API_GetBoneAnimIndex( &gent->ghoul2[gent->playerModel], gent->lowerLumbarBone, (cg.time?cg.time:level.time), ¤tFrame, &junk, &junk, &junk, &junk2, NULL ); +#ifdef _DEBUG assert(ret); // this would be pretty bad, the below code seems to assume the call succeeds. -gil +#endif // _DEBUG strength = G_SaberLockStrength( gent ); if ( pm->ps->torsoAnim == BOTH_CCWCIRCLELOCK || diff --git a/shared/qcommon/q_platform.h b/shared/qcommon/q_platform.h index 1c450d7d80..3d423c26dc 100644 --- a/shared/qcommon/q_platform.h +++ b/shared/qcommon/q_platform.h @@ -108,6 +108,9 @@ along with this program; if not, see . #define idx64 #define ARCH_STRING "x86_64" #define Q3_LITTLE_ENDIAN + #elif defined(__aarch64__) + #define ARCH_STRING "arm64" + #define Q3_BIG_ENDIAN #endif #define DLL_EXT ".dylib" From 23b8398860687aac7e72f4ee06694f3bbe2f421c Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Wed, 14 Dec 2022 15:56:05 -0800 Subject: [PATCH 2/4] Use little endian for ARM64 See https://www.freebsd.org/cgi/man.cgi?query=arch&sektion=&manpath=freebsd-release-ports --- shared/qcommon/q_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/qcommon/q_platform.h b/shared/qcommon/q_platform.h index 3d423c26dc..6303af70c9 100644 --- a/shared/qcommon/q_platform.h +++ b/shared/qcommon/q_platform.h @@ -110,7 +110,7 @@ along with this program; if not, see . #define Q3_LITTLE_ENDIAN #elif defined(__aarch64__) #define ARCH_STRING "arm64" - #define Q3_BIG_ENDIAN + #define Q3_LITTLE_ENDIAN #endif #define DLL_EXT ".dylib" From 3e42ccb61c548b648baf7d96e122c0fbbf1d9f0c Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Sat, 17 Dec 2022 17:41:36 -0800 Subject: [PATCH 3/4] Set Arch to arm64 on Apple Silicon --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bde16bb813..8c591b954c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,8 +112,14 @@ if(WIN32) endif() else() set(X86 OFF) - if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") - set(Architecture "arm") + if(DEFINED CMAKE_GENERATOR_PLATFORM) + set(Architecture "${CMAKE_GENERATOR_PLATFORM}") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + if(APPLE) + set(Architecture "arm64") + else() + set(Architecture "arm") + endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") set(X86 ON) if(APPLE) From 8951eede5a689eab6c8fcae5a92e1efa4fef5d55 Mon Sep 17 00:00:00 2001 From: "Julio C. Rocha" Date: Fri, 23 Dec 2022 02:47:45 -0800 Subject: [PATCH 4/4] Ensure CMAKE_GENERATOR_PLATFORM is not empty string --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c591b954c..28c6313e1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,7 @@ if(WIN32) endif() else() set(X86 OFF) - if(DEFINED CMAKE_GENERATOR_PLATFORM) + if(DEFINED CMAKE_GENERATOR_PLATFORM AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "") set(Architecture "${CMAKE_GENERATOR_PLATFORM}") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") if(APPLE)