Skip to content

Commit

Permalink
macos build attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbradsmith committed Apr 13, 2024
1 parent f88580c commit 17fa55b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 8 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:

build-msvc:
name: Windows MSVC
if: false
runs-on: windows-2019
steps:
- name: Checkout Files
Expand Down Expand Up @@ -75,6 +76,7 @@ jobs:

build-msys2:
name: Windows MSYS2
if: false
runs-on: windows-latest
steps:
- name: Checkout Files
Expand Down Expand Up @@ -143,6 +145,7 @@ jobs:

build-ubuntu:
name: Ubuntu
if: false
runs-on: ubuntu-latest
steps:
- name: Checkout Files
Expand Down Expand Up @@ -183,3 +186,44 @@ jobs:
with:
name: nsfplay3-ubuntu--${{ env.BUILD_TAG }}
path: artifact/

build-macos:
name: MacOS
runs-on: mac-latest
steps:
- name: Checkout Files
uses: actions/checkout@v4
- name: Setup MacOS
run: brew install make cmake imagemagick
- name: Build wxWidgets
run: |
export CC=clang
export WXCONF_EXTRA="-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"
make wxlib
- name: Make
run: |
export CC=clang
export CXXFLAGS_EXTRA="-target arm64-apple-macos11 -Wno-c++11-extension:
export LDFLAGS_EXTRA="-target arm64-apple-macos11"
export OUTDIR=output/makeArm INTDIR=intermediate/makeArm
make cmd nsfplay
export CXXFLAGS_EXTRA="-target x86_64-apple-macos10.13 -Wno-c++11-extension:
export LDFLAGS_EXTRA="-target x86_64-apple-macos10.13"
export OUTDIR=output/make64 INTDIR=intermediate/make64
make cmd nsfplay
- name: Prepare Artifacts
run: |
mkdir artifact
cp nsfplay.txt artifact
lipo -create -output artifact/nsfplayBoth output/makeArm/nsfplay output/make64/nsfplay
lipo -create -output artifact/nsfplacBoth output/makeArm/nsfplac output/make64/nsfplac
cp output/makeArm/nsfplay artifact/nsfplayArm
cp output/makeArm/nsfplac artifact/nsfplacArm
cp output/make64/nsfplay artifact/nsfplay64
cp output/make64/nsfplac artifact/nsfplac64
echo "BUILD_TAG=$(git log -1 --format="%ad--%h" --date=format-local:"%Y-%m-%d-%H%M%S")" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: nsfplay3-macos--${{ env.BUILD_TAG }}
path: artifact/
37 changes: 29 additions & 8 deletions makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ endif
# platform settings

ifeq ($(OS),Windows_NT)
# Windows (MSYS2, gcc)
CXXFLAGS_EXTRA ?= -municode
LDFLAGS_EXTRA ?= -static -static-libgcc -static-libstdc++
LDFLAGS_EXTRA ?= -static -static-libgcc -static-libstdc++ -Wl,--fatal-warnings
LDFLAGS_CMD ?= -mconsole
LDFLAGS_GUI ?=
LDFLAGS_NSFPLAY ?= -mwindows
Expand Down Expand Up @@ -67,19 +68,34 @@ ifeq ($(OS),Windows_NT)
-lversion -lshlwapi -luxtheme -lwinspool
endif
else
CXXFLAGS_EXTRA ?=
ifeq ($(shell uname),Darwin)
# MacOS (clang)
CXXFLAGS_EXTRA ?= -Wno-c++11-extension
LDFLAGS_EXTRA ?=
LDFLAGS_CMD ?=
LDFLAGS_GUI ?=
LDFLAGS_NSFPLAY ?=
LDFLAGS_DLL ?= -shared
LIB_SUFFIX ?= .a
EXE_SUFFIC ?=
DLL_SUFFIX ?= .so
WXL_LIBDIR ?= .
WXL_CONFIG ?= $(WXL_DIR)/$(WXL_CMAKEDIR)/wx-config
else
# Linux / Other (gcc)
CXXFLAGS_EXTRA ?=
LDFLAGS_EXTRA ?= -Wl,--fatal-warnings
LDFLAGS_CMD ?=
LDFLAGS_GUI ?=
LDFLAGS_NSFPLAY ?=
LDFLAGS_DLL ?= -shared
LIB_SUFFIX ?= .a
EXE_SUFFIX ?=
DLL_SUFFIX ?= .so
WXL_LIBDIR ?= .
# wx-config
WXL_CONFIG ?= $(WXL_DIR)/$(WXL_CMAKEDIR)/wx-config
endif
endif

ifneq ("$(WXL_CONFIG)","")
ifneq ("$(wildcard $(WXL_CONFIG))","")
Expand All @@ -94,12 +110,17 @@ endif
# common build flags

CXXFLAGS ?= $(OPTIMIZE) -Wall -Werror -g
LDFLAGS ?= -Wl,--fatal-warnings -g
LDFLAGS ?= -g
INC_COMMON ?= -I../include

# utility to move GCC debug information outside of binaries
# on MacOS we only have a limited version of strip

STRIP_DEBUG = \
objcopy --only-keep-debug $@ [email protected] ; \
strip --strip-debug --strip-unneeded $@ ; \
objcopy [email protected] $@
ifneq ($(shell uname),Darwin)
STRIP_DEBUG ?= \
objcopy --only-keep-debug $@ [email protected] ; \
strip --strip-debug --strip-unneeded $@ ; \
objcopy [email protected] $@
else
STRIP_DEBUG ?= strip $@
endif

0 comments on commit 17fa55b

Please sign in to comment.