summaryrefslogtreecommitdiff
path: root/ZAPDTR
diff options
context:
space:
mode:
authorDavid Chavez <david@dcvz.io>2022-06-22 20:59:21 +0200
committerGitHub <noreply@github.com>2022-06-22 14:59:21 -0400
commite42b18cf71c828cbab9b2dca4d74c3c554b2acc7 (patch)
tree7f9389fe784ba554232bb15f751dfaf5a925330b /ZAPDTR
parent77e7080a8cc2b76eddb0bca6a0beeb0685288758 (diff)
Add Support for macOS (#441)
* Fixed soh filters * add more makefile changes * almost ready * more updates * update * update * Update Makefiles to handle both platforms * Allow for overriding the CXX and CC executables * Restore original structure while supporting custom CXX flags * Remove some platform specific libs * Dynamic target name * Make X11 paths package-agnostic * Remove changes to `gfx_opengl.cpp` * Use OpenGL2 on MacOS instead of OpenGL3 * make it actually render something * render at least the first texture, still need to figure out the second one * Let’s use OpenGL 3 again * maybe this works to get the right texture? link's eyes still look off a bit * did this work? * set the platform to macos * actual numbers are right, but logic is ugly XXX/TODO, i know * add zlib to ldflags for ZAPDUtils * A bit of cleanup * Revert unneeded changes * Remove GL_CHECK * Fix issues with z64 branch * use an std::map instead of a giant array * three point filter fix (#2) * Fix mac compilation * fix audio for 64 bit * revert audio heap size, keep bigger pools * Add more Apple specific checks to our modifications * Add building instructions for macOS * Remove unecessary step from building instructions * Add missing SDL2 & GLEW to Linux LDLIBS * Update BUILDING.md Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Update soh/.gitignore to include other arch binaries Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Use right platform name for debugging window Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Fix stormlib on macos (arm64) * Simplify some of the ifdef checks * Revert an older no longer necessary fix * Remove remaining unecessary deviations * Update building instructions after StormLib changes * Feature: Use OpenGL 4.1 (#1) * Further tweak the BUILDING * Tidy up * reword -j message * Add Jenkins CI Support (#2) * Fix type issues * add target <appbundle> and <filledappbundle> add makefile targets to create an .app `filledappbundle` creates the target with the .otr included this should perhaps be moved to Application Support though * pull gcc's rpath from otool output * move make target to the end so it's not default * Add Jenkins and make exe in par with other platforms * Actually save build artefacts * Fix artefact path * Remove x11 mentions and linking (not used) * Update building instructions for generating app * use appsupport directory * Add new app icon * Update target to match macOS types * Update more audio types * fix null deref in Audio_PlayFanfare * Remove old import from z64 * address final nit with apple ifdefs Co-authored-by: KiritoDev <36680385+KiritoDv@users.noreply.github.com> Co-authored-by: Jeffrey Crowell <github@crowell.biz> Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com>
Diffstat (limited to 'ZAPDTR')
-rw-r--r--ZAPDTR/Makefile25
-rw-r--r--ZAPDTR/ZAPD/ZRom.cpp6
-rw-r--r--ZAPDTR/ZAPDUtils/Makefile3
-rw-r--r--ZAPDTR/lib/libgfxd/Makefile1
4 files changed, 20 insertions, 15 deletions
diff --git a/ZAPDTR/Makefile b/ZAPDTR/Makefile
index 9ff869f89..2e871b32f 100644
--- a/ZAPDTR/Makefile
+++ b/ZAPDTR/Makefile
@@ -7,12 +7,13 @@ DEBUG ?= 0
COPYCHECK_ARGS ?=
LLD ?= 0
WERROR ?= 0
+UNAME := $(shell uname)
# Use clang++ if available, else use g++
ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0)
- CXX := clang++
+ CXX ?= clang++
else
- CXX := g++
+ CXX ?= g++
endif
INC := -I ZAPD -I lib/elfio -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils
@@ -44,8 +45,15 @@ ifneq ($(DEPRECATION_ON),0)
endif
# CXXFLAGS += -DTEXTURE_DEBUG
-LDFLAGS := -lm -ldl -lpng \
- -L../StormLib/build -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 -lGLEW -lGL -lX11
+LDFLAGS := -lm -ldl \
+ -L../StormLib/build -L../libultraship -lbz2 -pthread -lultraship -lstorm
+
+ifeq ($(UNAME), Darwin)
+ LDFLAGS += $(shell pkg-config --libs glew libpng zlib) $(shell sdl2-config --libs) -framework OpenGL
+ INC += $(shell pkg-config --cflags libpng)
+else
+ LDFLAGS += -lpng -lGL -lGLEW -lX11 -lz -lSDL2 -lpulse
+endif
# Use LLD if available. Set LLD=0 to not use it
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
@@ -56,21 +64,12 @@ ifneq ($(LLD),0)
LDFLAGS += -fuse-ld=lld
endif
-UNAME := $(shell uname)
UNAMEM := $(shell uname -m)
ifneq ($(UNAME), Darwin)
LDFLAGS += -Wl,-export-dynamic -lstdc++fs
EXPORTERS := -Wl,--whole-archive ../OTRExporter/OTRExporter/OTRExporter.a -Wl,--no-whole-archive
else
EXPORTERS := -Wl,-force_load ../OTRExporter/OTRExporter/OTRExporter.a
- ifeq ($(UNAMEM),arm64)
- ifeq ($(shell brew list libpng > /dev/null 2>&1; echo $$?),0)
- LDFLAGS += -L $(shell brew --prefix)/lib
- INC += -I $(shell brew --prefix)/include
- else
- $(error Please install libpng via Homebrew)
- endif
- endif
endif
diff --git a/ZAPDTR/ZAPD/ZRom.cpp b/ZAPDTR/ZAPD/ZRom.cpp
index 111888e86..f13a6e2f8 100644
--- a/ZAPDTR/ZAPD/ZRom.cpp
+++ b/ZAPDTR/ZAPD/ZRom.cpp
@@ -4,7 +4,7 @@
#include "Utils/Directory.h"
#include "yaz0/yaz0.h"
-#ifndef _MSC_VER
+#ifdef __linux__
#include <byteswap.h>
#endif
#include <Globals.h>
@@ -17,6 +17,10 @@ namespace fs = std::filesystem;
#define __bswap_32 _byteswap_ulong
#define bswap_32 _byteswap_ulong
#endif
+#if defined __APPLE__
+#define __bswap32 __builtin_bswap32
+#define bswap32 __builtin_bswap32
+#endif
// ROM DMA Table Start
#define OOT_OFF_NTSC_10_RC 0x7430
diff --git a/ZAPDTR/ZAPDUtils/Makefile b/ZAPDTR/ZAPDUtils/Makefile
index aef678031..b9c4e29ad 100644
--- a/ZAPDTR/ZAPDUtils/Makefile
+++ b/ZAPDTR/ZAPDUtils/Makefile
@@ -1,7 +1,8 @@
# Only used for standalone compilation, usually inherits these from the main makefile
+CXX ?= g++
CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17
-SRC_DIRS := $(shell find -type d -not -path "*build*")
+SRC_DIRS := $(shell find . -type d -not -path "*build*")
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h))
diff --git a/ZAPDTR/lib/libgfxd/Makefile b/ZAPDTR/lib/libgfxd/Makefile
index b340ff5c0..5c3edbef4 100644
--- a/ZAPDTR/lib/libgfxd/Makefile
+++ b/ZAPDTR/lib/libgfxd/Makefile
@@ -1,3 +1,4 @@
+CC ?= gcc
CFLAGS = -Wall -O2 -g
UC_OBJ = uc_f3d.o uc_f3db.o uc_f3dex.o uc_f3dexb.o uc_f3dex2.o
OBJ = gfxd.o $(UC_OBJ)