From f0f4e55c489de6ff6da5e99efdc4328fe5770359 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 3 Jul 2023 01:45:28 +0300 Subject: [PATCH] Add PowerPC to library naming scheme --- cmake/LibraryNaming.cmake | 10 ++++++++++ public/build.h | 13 ++++++++++++- scripts/waifulib/library_naming.py | 17 ++++++++++++----- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/cmake/LibraryNaming.cmake b/cmake/LibraryNaming.cmake index 0ffae76f..724349bd 100644 --- a/cmake/LibraryNaming.cmake +++ b/cmake/LibraryNaming.cmake @@ -59,6 +59,7 @@ check_group_build_target(XASH_X86 XASH_ARCHITECTURE) check_group_build_target(XASH_AMD64 XASH_ARCHITECTURE) check_group_build_target(XASH_ARM XASH_ARCHITECTURE) check_group_build_target(XASH_MIPS XASH_ARCHITECTURE) +check_group_build_target(XASH_PPC XASH_ARCHITECTURE) check_group_build_target(XASH_JS XASH_ARCHITECTURE) check_group_build_target(XASH_E2K XASH_ARCHITECTURE) check_group_build_target(XASH_RISCV XASH_ARCHITECTURE) @@ -168,6 +169,15 @@ elseif(XASH_JS) set(BUILDARCH "javascript") elseif(XASH_E2K) set(BUILDARCH "e2k") +elseif(XASH_PPC) + set(BUILDARCH "ppc") + if(XASH_64BIT) + set(BUILDARCH "${BUILDARCH}64") + endif() + + if(XASH_LITTLE_ENDIAN) + set(BUILDARCH "${BUILDARCH}el") + endif() else() message(SEND_ERROR "Place your architecture name here! If this is a mistake, try to fix conditions above and report a bug") endif() diff --git a/public/build.h b/public/build.h index 636d97a4..2f8fffae 100644 --- a/public/build.h +++ b/public/build.h @@ -76,6 +76,7 @@ Then you can use another oneliner to query all variables: #undef XASH_NETBSD #undef XASH_OPENBSD #undef XASH_POSIX +#undef XASH_PPC #undef XASH_RISCV #undef XASH_RISCV_DOUBLEFP #undef XASH_RISCV_SINGLEFP @@ -138,7 +139,12 @@ Then you can use another oneliner to query all variables: #endif #endif -#if XASH_ANDROID || defined XASH_IOS || defined XASH_NSWITCH || defined XASH_PSVITA +// XASH_SAILFISH is special: SailfishOS by itself is a normal GNU/Linux platform +// It doesn't make sense to split it to separate platform +// but we still need XASH_MOBILE_PLATFORM for the engine. +// So this macro is defined entirely in build-system: see main wscript +// HLSDK/PrimeXT/other SDKs users note: you may ignore this macro +#if XASH_ANDROID || XASH_IOS || XASH_NSWITCH || XASH_PSVITA || XASH_SAILFISH #define XASH_MOBILE_PLATFORM 1 #endif @@ -190,6 +196,11 @@ Then you can use another oneliner to query all variables: #elif defined __e2k__ #define XASH_64BIT 1 #define XASH_E2K 1 +#elif defined __PPC__ || defined __powerpc__ + #define XASH_PPC 1 + #if defined __PPC64__ || defined __powerpc64__ + #define XASH_64BIT 1 + #endif #elif defined _M_ARM // msvc #define XASH_ARM 7 #define XASH_ARM_HARDFP 1 diff --git a/scripts/waifulib/library_naming.py b/scripts/waifulib/library_naming.py index 78acafe9..4369b3b6 100644 --- a/scripts/waifulib/library_naming.py +++ b/scripts/waifulib/library_naming.py @@ -51,6 +51,7 @@ DEFINES = [ 'XASH_NETBSD', 'XASH_OPENBSD', 'XASH_POSIX', +'XASH_PPC', 'XASH_RISCV', 'XASH_RISCV_DOUBLEFP', 'XASH_RISCV_SINGLEFP', @@ -126,7 +127,7 @@ def configure(conf): buildarch += "4" else: raise conf.fatal('Unknown ARM') - + if conf.env.XASH_ARM_HARDFP: buildarch += "hf" else: @@ -143,7 +144,7 @@ def configure(conf): buildarch += "64" else: buildarch += "32" - + if conf.env.XASH_RISCV_DOUBLEFP: buildarch += "d" elif conf.env.XASH_RISCV_SINGLEFP: @@ -152,12 +153,18 @@ def configure(conf): buildarch = "javascript" elif conf.env.XASH_E2K: buildarch = "e2k" + elif conf.env.XASH_PPC: + buildarch = "ppc" + if conf.env.XASH_64BIT: + buildarch += "64" + if conf.env.XASH_LITTLE_ENDIAN: + buildarch += "el" else: raise conf.fatal("Place your architecture name in build.h and library_naming.py!\n" "If this is a mistake, try to fix conditions above and report a bug") - + conf.env.revert() - + if buildos == 'android': # force disable for Android, as Android ports aren't distributed in normal way and doesn't follow library naming conf.env.POSTFIX = '' @@ -167,5 +174,5 @@ def configure(conf): conf.env.POSTFIX = '_%s' % buildarch else: conf.env.POSTFIX = '' - + conf.end_msg(conf.env.POSTFIX)