From 5f937f6a06f45bc9f61d0ff79e6e594a74541822 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 10 Aug 2024 19:18:55 +1000 Subject: [PATCH] Fix PPC build not actually working --- .github/workflows/build_mac32.yml | 2 +- src/ExtMath.h | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_mac32.yml b/.github/workflows/build_mac32.yml index f7a9173c7..90b516b86 100644 --- a/.github/workflows/build_mac32.yml +++ b/.github/workflows/build_mac32.yml @@ -46,7 +46,7 @@ jobs: ln -s /usr/local/compiler/ppc/target/bin/powerpc64-apple-darwin9-as /home/minty/repos/osxcross-ppc-test/target/bin/powerpc64-apple-darwin9-as cd src PATH=$PATH:/usr/local/compiler/ppc/target/bin - powerpc-apple-darwin9-base-gcc *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-ppc -mmacosx-version-min=10.3.0 -m32 -framework Cocoa -framework OpenGL -framework IOKit -lobjc + powerpc-apple-darwin9-base-gcc *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-ppc -mmacosx-version-min=10.2.0 -m32 -framework Cocoa -framework OpenGL -framework IOKit -lobjc - uses: ./.github/actions/notify_failure diff --git a/src/ExtMath.h b/src/ExtMath.h index ef218fc97..2d4ecdb1b 100644 --- a/src/ExtMath.h +++ b/src/ExtMath.h @@ -16,14 +16,19 @@ CC_BEGIN_HEADER #define Math_Deg2Packed(x) ((cc_uint8)((x) * 256.0f / 360.0f)) #define Math_Packed2Deg(x) ((x) * 360.0f / 256.0f) -#if defined __GNUC__ && !defined CC_PLAT_PS1 -/* fabsf/sqrtf are single intrinsic instructions in gcc/clang */ -/* (sqrtf is only when -fno-math-errno though) */ -#define Math_AbsF(x) __builtin_fabsf(x) -#define Math_SqrtF(x) __builtin_sqrtf(x) +#if defined __GNUC__ && defined __APPLE__ && defined _ARCH_PPC + /* fabsf is single intrinsic instructions in gcc/clang */ + /* (sqrtf doesn't seem to exist in 10.3 and earlier SDKs) */ + #define Math_AbsF(x) __builtin_fabsf(x) + #define Math_SqrtF(x) __builtin_sqrt(x) +#elif defined __GNUC__ && !defined CC_PLAT_PS1 + /* fabsf/sqrtf are single intrinsic instructions in gcc/clang */ + /* (sqrtf is only when -fno-math-errno though) */ + #define Math_AbsF(x) __builtin_fabsf(x) + #define Math_SqrtF(x) __builtin_sqrtf(x) #else -float Math_AbsF(float x); -float Math_SqrtF(float x); + float Math_AbsF(float x); + float Math_SqrtF(float x); #endif float Math_Mod1(float x);