Skip to content

Commit

Permalink
Introduce arm64 universal macOS library build support
Browse files Browse the repository at this point in the history
  • Loading branch information
RyeMutt committed Nov 22, 2024
1 parent 8124e7f commit 44d7eb7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
build:
strategy:
matrix:
os: [windows-2022, macos-12, ubuntu-22.04]
os: [windows-2022, macos-15, ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: secondlife/action-autobuild@v4
- uses: secondlife/action-autobuild@v5
release:
needs: build
runs-on: [ubuntu-latest]
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ifneq ($(shell uname -p | grep -i powerpc),)
nativeArch := ppc
endif

# arch: x86 (or i386), x64 (or x86_64), ppc, ppc64
# arch: x86 (or i386), x64 (or x86_64), ppc, ppc64, arm64
arch ?= i386

# project: 'dom', 'domTest', or 'all'
Expand Down Expand Up @@ -103,7 +103,7 @@ $(error Invalid setting os=$(os))
endif

archs := $(sort $(subst i386,x86,$(arch)))
ifneq ($(filter-out x86 ppc x86_64,$(archs)),)
ifneq ($(filter-out x86 ppc x86_64 arm64,$(archs)),)
$(error Invalid setting arch=$(arch))
endif

Expand Down
10 changes: 4 additions & 6 deletions build-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ case "$AUTOBUILD_PLATFORM" in
then
"build/$versub/domTest.exe" -all
else
# 64 bit exe ends up in different location to 32 bit hard coded
# 64 bit exe ends up in different location to 32 bit hard coded
# path to data directory - source code suggests it looks in a dir
# called domTestData first so we make one
mkdir -p "$projdir/x64/Release/domTestData"
Expand All @@ -111,7 +111,7 @@ case "$AUTOBUILD_PLATFORM" in
libname="libcollada${collada_shortver}dom${dom_shortver}-s.lib"
if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then cp -a "build/$versub/$libname" "$stage"/lib/release/
else cp -a "$projdir/x64/Release/$libname" "$stage"/lib/release/
else cp -a "$projdir/x64/Release/$libname" "$stage"/lib/release/
fi
;;

Expand All @@ -126,23 +126,21 @@ case "$AUTOBUILD_PLATFORM" in
# repo root run_tests suffix
export MACOSX_DEPLOYMENT_TARGET="$LL_BUILD_DARWIN_DEPLOY_TARGET"

opts="${TARGET_OPTS:--arch $AUTOBUILD_CONFIGURE_ARCH $LL_BUILD_RELEASE}"
opts="${TARGET_OPTS:--arch arm64 -arch x86_64 $LL_BUILD_RELEASE}"

nproc=$(sysctl -n hw.physicalcpu)

libdir="$top/stage"
mkdir -p "$libdir"/lib/release

make clean arch="$AUTOBUILD_CONFIGURE_ARCH" # Hide 'arch' env var

# Without the -Wno-etc flag, incredible spam is produced
make \
conf=release \
-j$nproc \
CFLAGS="$opts" \
CXXFLAGS="$opts -Wno-unused-local-typedef" \
LDFLAGS="-Wl,-headerpad_max_install_names" \
arch="$AUTOBUILD_CONFIGURE_ARCH" \
arch="x86_64 arm64" \
printCommands=yes \
printMessages=yes

Expand Down
4 changes: 3 additions & 1 deletion make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ ifeq ($(conf),debug)
ccFlags += -g -D_DEBUG
debugSuffix := -d
else
ccFlags += -O2 -DNDEBUG
ccFlags += -O3 -DNDEBUG
debugSuffix :=
endif

ifeq ($(arch),x86_64)
archsupport := -x64
else ifeq ($(arch),arm64)
archsupport := -a64
else
archsupport :=
endif
Expand Down
2 changes: 1 addition & 1 deletion make/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ifneq ($(obj),)
# any values we use in rule commands. This is the reason for all the target-specific variables.
$(obj): cc := $(cc)
$(obj): ccFlags := $(ccFlags)
$(obj): ccFlagsNoArch := $(filter-out -arch ppc ppc64 i386 x86_64,$(ccFlags))
$(obj): ccFlagsNoArch := $(filter-out -arch ppc ppc64 i386 x86_64 arm64,$(ccFlags))
$(obj): includeOpts := $(includeOpts)

# Call createObjRule with a source file path
Expand Down
2 changes: 1 addition & 1 deletion make/rulesC.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ifneq ($(obj),)
#$(obj): cc := $(cc)
$(obj): cc := $(CC)
$(obj): ccFlags := $(ccFlags)
$(obj): ccFlagsNoArch := $(filter-out -arch ppc ppc64 i386 x86_64,$(ccFlags))
$(obj): ccFlagsNoArch := $(filter-out -arch ppc ppc64 i386 x86_64 arm64,$(ccFlags))
$(obj): includeOpts := $(includeOpts)

# Call createObjRule with a source file path
Expand Down

0 comments on commit 44d7eb7

Please sign in to comment.