Shipwright/libultraship/Makefile
David Chavez e42b18cf71
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>
2022-06-22 14:59:21 -04:00

108 lines
2.4 KiB
Makefile

# Only used for standalone compilation, usually inherits these from the main makefile
CXX ?= g++
CC ?= gcc
AR := ar
FORMAT := clang-format-11
UNAME := $(shell uname)
ASAN ?= 0
DEBUG ?= 1
OPTFLAGS ?= -O0
LTO ?= 0
WARN := -Wall -Wextra -Werror \
-Wno-unused-variable \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-parentheses \
-Wno-narrowing \
-Wno-missing-field-initializers \
-Wno-error=multichar
CWARN :=
CXXWARN := -Wno-deprecated-enum-enum-conversion
CXXFLAGS := $(WARN) $(CXXWARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CFLAGS := $(WARN) $(CWARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CPPFLAGS := -MMD
ifeq ($(UNAME), Darwin) #APPLE
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew) -framework OpenGL
endif
ifneq ($(DEBUG),0)
CXXFLAGS += -g -D_DEBUG
CFLAGS += -g -D_DEBUG
endif
ifneq ($(ASAN),0)
CXXFLAGS += -fsanitize=address
CFLAGS += -fsanitize=address
endif
ifneq ($(LTO),0)
CXXFLAGS += -flto
CFLAGS += -flto
endif
SRC_DIRS := $(shell find . -type d -not -path "*build*")
CXX_FILES := \
$(shell find libultraship/Factories -name "*.cpp") \
$(shell find libultraship/Lib/Fast3D -name "*.cpp") \
$(shell find libultraship -maxdepth 1 -name "*.cpp") \
$(shell find libultraship/Lib/ImGui -maxdepth 1 -name "*.cpp") \
libultraship/Lib/ImGui/backends/imgui_impl_opengl3.cpp \
libultraship/Lib/ImGui/backends/imgui_impl_sdl.cpp \
libultraship/Lib/StrHash64.cpp \
libultraship/Lib/tinyxml2/tinyxml2.cpp
C_FILES := \
libultraship/mixer.c \
libultraship/Lib/stb/stb_impl.c
FMT_FILES := $(shell find libultraship/ -type f \( -name "*.cpp" -o -name "*.h" \) -a -not -path "libultraship/Lib/*")
O_FILES := \
$(CXX_FILES:%.cpp=build/%.o) \
$(C_FILES:%.c=build/%.o)
D_FILES := $(O_FILES:%.o=%.d)
LIB := libultraship.a
INC_DIRS := $(addprefix -I, \
../ZAPDTR/ZAPDUtils \
libultraship/Lib/Fast3D/U64 \
libultraship/Lib/spdlog \
libultraship/Lib/spdlog/include \
libultraship/Lib/ImGui \
libultraship \
../StormLib/src \
)
# create build directories
$(shell mkdir -p $(SRC_DIRS:%=build/%))
all: $(LIB)
clean:
rm -rf build $(LIB)
format:
$(FORMAT) -i $(FMT_FILES)
.PHONY: all clean format
build/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
build/%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(OPTFLAGS) $(INC_DIRS) -c $< -o $@
$(LIB): $(O_FILES)
$(AR) rcs $@ $^
-include $(D_FILES)