mirror of https://github.com/bsnes-emu/bsnes.git
Support for building universal macOS binaries.
This commit is contained in:
parent
c26ffeea2a
commit
1f75ba8912
|
@ -60,5 +60,8 @@ include $(ui)/GNUmakefile
|
|||
-include obj/*.d
|
||||
|
||||
clean:
|
||||
ifeq ($(platform),macos)
|
||||
rm -rf out/$(name).app
|
||||
endif
|
||||
$(call delete,obj/*)
|
||||
$(call delete,out/*)
|
||||
|
|
|
@ -21,7 +21,13 @@ obj/ui-resource.o: $(ui)/resource/resource.cpp
|
|||
|
||||
all: $(hiro.objects) $(ruby.objects) $(objects)
|
||||
$(info Linking out/$(name) ...)
|
||||
ifeq ($(universal),true)
|
||||
+@$(compiler) -o obj/$(name).arm64 $(hiro.objects) $(ruby.objects) $(objects) $(hiro.options) $(ruby.options) $(options) $(flags.arm64)
|
||||
+@$(compiler) -o obj/$(name).amd64 $(hiro.objects) $(ruby.objects) $(objects) $(hiro.options) $(ruby.options) $(options) $(flags.amd64)
|
||||
lipo -create -output out/$(name) obj/$(name).arm64 obj/$(name).amd64
|
||||
else
|
||||
+@$(compiler) -o out/$(name) $(hiro.objects) $(ruby.objects) $(objects) $(hiro.options) $(ruby.options) $(options)
|
||||
endif
|
||||
ifeq ($(platform),macos)
|
||||
rm -rf out/$(name).app
|
||||
mkdir -p out/$(name).app/Contents/MacOS/
|
||||
|
|
|
@ -66,11 +66,22 @@ hiro.objects := \
|
|||
$(object.path)/hiro-$(hiro).o \
|
||||
$(if $(filter windows,$(hiro)),$(object.path)/hiro-resource.o)
|
||||
|
||||
ifeq ($(universal),true)
|
||||
compile.hiro = \
|
||||
$(strip \
|
||||
$(compiler) $(hiro.flags) $(flags.arm64) $(flags) $(flags.deps) -c $< -o $@.arm64 && \
|
||||
$(compiler) $(hiro.flags) $(flags.amd64) $(flags) $(flags.deps) -c $< -o $@.amd64 && \
|
||||
lipo -create -output $@ $@.arm64 $@.amd64 \
|
||||
)
|
||||
else
|
||||
compile.hiro = $(strip $(compiler) $(hiro.flags) $(flags) $(flags.deps) -c $< -o $@)
|
||||
endif
|
||||
|
||||
$(object.path)/hiro-$(hiro).o: $(hiro.path)/hiro.cpp
|
||||
$(if $(filter qt%,$(hiro)),$(info Compiling $(hiro.path)/qt/qt.moc ...))
|
||||
$(if $(filter qt%,$(hiro)),@$(moc) -i -o $(hiro.path)/qt/qt.moc $(hiro.path)/qt/qt.hpp)
|
||||
$(info Compiling $< ...)
|
||||
@$(compiler) $(hiro.flags) $(flags) $(flags.deps) -c $< -o $@
|
||||
@$(call compile.hiro)
|
||||
|
||||
$(object.path)/hiro-resource.o: $(hiro.resource)
|
||||
$(info Compiling $< ...)
|
||||
|
|
|
@ -124,6 +124,8 @@ endif
|
|||
ifeq ($(platform),macos)
|
||||
flags += -stdlib=libc++
|
||||
options += -lc++ -lobjc
|
||||
flags.arm64 += -target x86_64-apple-macos10.12
|
||||
flags.amd64 += -target arm64-apple-macos11
|
||||
endif
|
||||
|
||||
# linux settings
|
||||
|
@ -166,14 +168,28 @@ nall.verbose:
|
|||
@$(call compile)
|
||||
|
||||
# function compile([arguments])
|
||||
compile = \
|
||||
$(strip \
|
||||
$(if $(filter %.c,$<), \
|
||||
$(compiler.c) $(flags.deps) $(flags) $1 -c $< -o $@ \
|
||||
,$(if $(filter %.cpp,$<), \
|
||||
$(compiler.cpp) $(flags.deps) $(flags) $1 -c $< -o $@ \
|
||||
)) \
|
||||
)
|
||||
ifeq ($(universal),true)
|
||||
compile = \
|
||||
$(strip \
|
||||
$(if $(filter %.c,$<), \
|
||||
$(compiler.c) $(flags.arm64) $(flags.deps) $(flags) $1 -c $< -o $@.arm64 && \
|
||||
$(compiler.c) $(flags.amd64) $(flags.deps) $(flags) $1 -c $< -o $@.amd64 && \
|
||||
,$(if $(filter %.cpp,$<), \
|
||||
$(compiler.cpp) $(flags.arm64) $(flags.deps) $(flags) $1 -c $< -o $@.arm64 && \
|
||||
$(compiler.cpp) $(flags.amd64) $(flags.deps) $(flags) $1 -c $< -o $@.amd64 && \
|
||||
)) \
|
||||
lipo -create -output $@ $@.arm64 $@.amd64 \
|
||||
)
|
||||
else
|
||||
compile = \
|
||||
$(strip \
|
||||
$(if $(filter %.c,$<), \
|
||||
$(compiler.c) $(flags.deps) $(flags) $1 -c $< -o $@ \
|
||||
,$(if $(filter %.cpp,$<), \
|
||||
$(compiler.cpp) $(flags.deps) $(flags) $1 -c $< -o $@ \
|
||||
)) \
|
||||
)
|
||||
endif
|
||||
|
||||
# function rwildcard(directory, pattern)
|
||||
rwildcard = \
|
||||
|
|
|
@ -71,9 +71,20 @@ endif
|
|||
|
||||
ruby.objects := $(object.path)/ruby.o
|
||||
|
||||
ifeq ($(universal),true)
|
||||
compile.ruby = \
|
||||
$(strip \
|
||||
$(compiler) $(ruby.flags) $(flags.arm64) $(flags) $(flags.deps) -c $< -o $@.arm64 && \
|
||||
$(compiler) $(ruby.flags) $(flags.amd64) $(flags) $(flags.deps) -c $< -o $@.amd64 && \
|
||||
lipo -create -output $@ $@.arm64 $@.amd64 \
|
||||
)
|
||||
else
|
||||
compile.ruby = $(strip $(compiler) $(ruby.flags) $(flags) $(flags.deps) -c $< -o $@)
|
||||
endif
|
||||
|
||||
$(object.path)/ruby.o: $(ruby.path)/ruby.cpp $(call rwildcard,$(ruby.path))
|
||||
$(info Compiling $< ...)
|
||||
@$(compiler) $(ruby.flags) $(flags) $(flags.deps) -c $< -o $@
|
||||
@$(call compile.ruby)
|
||||
|
||||
ruby.verbose:
|
||||
$(info ruby Drivers:)
|
||||
|
|
Loading…
Reference in New Issue