diff --git a/makefile b/makefile index dad69c9c143..a524d1d210f 100644 --- a/makefile +++ b/makefile @@ -166,6 +166,9 @@ endif ifneq ($(filter aarch64%,$(UNAME_M)),) PLATFORM := arm64 endif +ifneq ($(filter arm64%,$(UNAME_M)),) +PLATFORM := arm64 +endif ifneq ($(filter aarch64%,$(UNAME_P)),) PLATFORM := arm64 endif @@ -399,6 +402,13 @@ ifndef FORCE_DRC_C_BACKEND endif endif +# ARM / ARM64 +ifeq ($(findstring arm,$(UNAME)),arm) +ifndef FORCE_DRC_C_BACKEND + FORCE_DRC_C_BACKEND := 1 +endif +endif + # Autodetect BIGENDIAN # MacOSX ifndef BIGENDIAN @@ -1030,10 +1040,14 @@ ifneq ($(TARGETOS),asmjs) ifeq ($(ARCHITECTURE),_x64) ARCHITECTURE := _x64_clang else +ifneq ($(filter arm64%,$(UNAME_M)),) +ARCHITECTURE := _arm64_clang +else ARCHITECTURE := _x86_clang endif endif endif +endif ifneq ($(PYTHON_AVAILABLE),python) $(error Python is not available in path) @@ -1420,6 +1434,11 @@ $(PROJECTDIR)/$(MAKETYPE)-osx-clang/Makefile: makefile $(SCRIPTS) $(GENIE) .PHONY: macosx_x64_clang macosx_x64_clang: generate $(PROJECTDIR)/$(MAKETYPE)-osx-clang/Makefile + $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/$(MAKETYPE)-osx-clang config=$(CONFIG)64 precompile + $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/$(MAKETYPE)-osx-clang config=$(CONFIG)64 + +.PHONY: macosx_arm64_clang +macosx_arm64_clang: generate $(PROJECTDIR)/$(MAKETYPE)-osx-clang/Makefile $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/$(MAKETYPE)-osx-clang config=$(CONFIG)64 precompile $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/$(MAKETYPE)-osx-clang config=$(CONFIG)64 diff --git a/scripts/genie.lua b/scripts/genie.lua index d8e74506ce1..c479fe34bfd 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -681,14 +681,21 @@ else "LSB_FIRST", } if _OPTIONS["targetos"]=="macosx" then - configuration { "x64" } + configuration { "arm64" } + buildoptions { + "-arch arm64", + } + linkoptions { + "-arch arm64", + } + configuration { "x64", "not arm64" } buildoptions { "-arch x86_64", } linkoptions { "-arch x86_64", } - configuration { "x32" } + configuration { "x32", "not arm64" } buildoptions { "-arch i386", } diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 3eb2acf0e0b..e8f1c3caa31 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -1054,27 +1054,39 @@ function toolchain(_buildDir, _subDir) configuration { "pnacl", "Release" } libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" } - configuration { "osx*", "x32" } + configuration { "osx*", "x32", "not arm64" } objdir (_buildDir .. "osx_clang" .. "/obj") buildoptions { "-m32", } - configuration { "osx*", "x32", "Release" } + configuration { "osx*", "x32", "not arm64", "Release" } targetdir (_buildDir .. "osx_clang" .. "/bin/x32/Release") - configuration { "osx*", "x32", "Debug" } + configuration { "osx*", "x32", "not arm64", "Debug" } targetdir (_buildDir .. "osx_clang" .. "/bin/x32/Debug") - configuration { "osx*", "x64" } + configuration { "osx*", "x64", "not arm64" } objdir (_buildDir .. "osx_clang" .. "/obj") buildoptions { "-m64", "-DHAVE_IMMINTRIN_H=1", } - configuration { "osx*", "x64", "Release" } + configuration { "osx*", "x64", "not arm64", "Release" } targetdir (_buildDir .. "osx_clang" .. "/bin/x64/Release") - configuration { "osx*", "x64", "Debug" } + configuration { "osx*", "x64", "not arm64", "Debug" } + targetdir (_buildDir .. "osx_clang" .. "/bin/x64/Debug") + + configuration { "osx*", "arm64" } + objdir (_buildDir .. "osx_clang" .. "/obj") + buildoptions { + "-m64", "-DHAVE_IMMINTRIN_H=0", "-DSDL_DISABLE_IMMINTRIN_H=1", "-DHAVE_SSE=0" + } + + configuration { "osx*", "arm64", "Release" } + targetdir (_buildDir .. "osx_clang" .. "/bin/x64/Release") + + configuration { "osx*", "arm64", "Debug" } targetdir (_buildDir .. "osx_clang" .. "/bin/x64/Debug") configuration { "ios-arm" }