godot/platform/osx/detect.py
Rémi Verschelde 87abfad7e2 OSX: Remove support for 32-bit and fat binaries
Mac OS X is 64-bit only since 10.7 (Lion), which has reached End-Of-Life in October 2014.
Therefore it no longer makes sense to support exporting 32-bit binaries for Mac OS X,
and we can now default to 64-bit instead of bigger "fat" binaries.

(cherry picked from commits f04958cd5d,
42c5af5e48, 3e6f2b7d98,
and 1602e0cdb9)
2020-08-14 14:58:49 +02:00

100 lines
3.3 KiB
Python

import os
import sys
def is_active():
return True
def get_name():
return "OSX"
def can_build():
if (sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ)):
return True
return False
def get_opts():
return [
('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
]
def get_flags():
return [
]
def configure(env):
env.Append(CPPPATH=['#platform/osx'])
# Mac OS X no longer runs on 32-bit since 10.7 which is unsupported since 2014
# As such, we only support 64-bit
env["bits"] = "64"
if (env["target"] == "release"):
env.Append(CCFLAGS=['-O2', '-ffast-math', '-fomit-frame-pointer', '-ftree-vectorize', '-msse2'])
elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
elif (env["target"] == "debug"):
env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
if ("OSXCROSS_ROOT" not in os.environ):
# regular native build
env.Append(CCFLAGS=['-arch', 'x86_64'])
env.Append(LINKFLAGS=['-arch', 'x86_64'])
else:
# osxcross build
root = os.environ.get("OSXCROSS_ROOT", 0)
basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
ccache_path = os.environ.get("CCACHE")
if ccache_path == None:
env['CC'] = basecmd + "cc"
env['CXX'] = basecmd + "c++"
else:
# there aren't any ccache wrappers available for OS X cross-compile,
# to enable caching we need to prepend the path to the ccache binary
env['CC'] = ccache_path + " " + basecmd + "cc"
env['CXX'] = ccache_path + " " + basecmd + "c++"
env['AR'] = basecmd + "ar"
env['RANLIB'] = basecmd + "ranlib"
env['AS'] = basecmd + "as"
env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED'])
env.Append(CPPFLAGS=["-mmacosx-version-min=10.9"])
env.Append(LIBS=['pthread'])
#env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
#env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-framework', 'CoreAudio', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
env.Append(LINKFLAGS=["-mmacosx-version-min=10.9"])
if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"] = "clang"
env["LD"] = "clang++"
import methods
env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.gen.h', src_suffix='.glsl')})
#env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.gen.h',src_suffix = '.hlsl') } )
env["x86_libtheora_opt_gcc"] = True