mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
macOS build support
This commit is contained in:
@@ -212,6 +212,14 @@ def define_platform(conf):
|
||||
'_ALLOW_MSC_VER_MISMATCH',
|
||||
'NO_X360_XDK'
|
||||
])
|
||||
elif conf.env.DEST_OS == 'darwin':
|
||||
conf.env.append_unique('DEFINES', [
|
||||
'OSX=1', '_OSX=1',
|
||||
'POSIX=1', '_POSIX=1', 'PLATFORM_POSIX=1',
|
||||
'GNUC',
|
||||
'NO_HOOK_MALLOC',
|
||||
'_DLL_EXT=.dylib'
|
||||
])
|
||||
|
||||
if conf.options.DEBUG_ENGINE:
|
||||
conf.env.append_unique('DEFINES', [
|
||||
@@ -302,8 +310,7 @@ def configure(conf):
|
||||
conf.env.BIT32_MANDATORY = not conf.options.ALLOW64
|
||||
if conf.env.BIT32_MANDATORY:
|
||||
Logs.info('WARNING: will build engine for 32-bit target')
|
||||
|
||||
conf.load('force_32bit')
|
||||
conf.load('force_32bit')
|
||||
|
||||
if conf.options.DISABLE_WARNS:
|
||||
compiler_optional_flags = ['-w']
|
||||
@@ -353,7 +360,7 @@ def configure(conf):
|
||||
]
|
||||
|
||||
flags += ['-funwind-tables', '-fvisibility=default']
|
||||
elif conf.env.COMPILER_CC != 'msvc':
|
||||
elif conf.env.COMPILER_CC not in ['msvc', 'clang']:
|
||||
flags += ['-march=native']
|
||||
|
||||
if conf.env.DEST_CPU in ['x86', 'x86_64']:
|
||||
@@ -444,7 +451,10 @@ def configure(conf):
|
||||
else:
|
||||
conf.check_pkg('freetype2', 'FT2', FT2_CHECK)
|
||||
conf.check_pkg('fontconfig', 'FC', FC_CHECK)
|
||||
conf.check_cfg(package='openal', uselib_store='OPENAL', args=['--cflags', '--libs'])
|
||||
if conf.env.DEST_OS == "darwin":
|
||||
conf.env.FRAMEWORK_OPENAL = "OpenAL"
|
||||
else:
|
||||
conf.check_cfg(package='openal', uselib_store='OPENAL', args=['--cflags', '--libs'])
|
||||
conf.check_cfg(package='libjpeg', uselib_store='JPEG', args=['--cflags', '--libs'])
|
||||
conf.check_cfg(package='libpng', uselib_store='PNG', args=['--cflags', '--libs'])
|
||||
conf.check_cfg(package='libcurl', uselib_store='CURL', args=['--cflags', '--libs'])
|
||||
@@ -466,6 +476,21 @@ def configure(conf):
|
||||
conf.check(lib='android_support', uselib_store='ANDROID_SUPPORT')
|
||||
conf.check(lib='opus', uselib_store='OPUS')
|
||||
|
||||
if conf.env.DEST_OS == "darwin":
|
||||
conf.check(lib='iconv', uselib_store='ICONV')
|
||||
conf.env.FRAMEWORK_APPKIT = "AppKit"
|
||||
conf.env.FRAMEWORK_IOKIT = "IOKit"
|
||||
conf.env.FRAMEWORK_FOUNDATION = "Foundation"
|
||||
conf.env.FRAMEWORK_COREFOUNDATION = "CoreFoundation"
|
||||
conf.env.FRAMEWORK_COREGRAPHICS = "CoreGraphics"
|
||||
conf.env.FRAMEWORK_OPENGL = "OpenGL"
|
||||
conf.env.FRAMEWORK_CARBON = "Carbon"
|
||||
conf.env.FRAMEWORK_APPLICATIONSERVICES = "ApplicationServices"
|
||||
conf.env.FRAMEWORK_CORESERVICES = "CoreServices"
|
||||
conf.env.FRAMEWORK_COREAUDIO = "CoreAudio"
|
||||
conf.env.FRAMEWORK_AUDIOTOOLBOX = "AudioToolbox"
|
||||
conf.env.FRAMEWORK_SYSTEMCONFIGURATION = "SystemConfiguration"
|
||||
|
||||
if conf.env.DEST_OS != 'win32':
|
||||
conf.check_cc(lib='dl', mandatory=False)
|
||||
conf.check_cc(lib='bz2', mandatory=False)
|
||||
@@ -535,6 +560,13 @@ def configure(conf):
|
||||
else:
|
||||
conf.add_subproject(projects['game'])
|
||||
|
||||
from waflib import TaskGen
|
||||
@TaskGen.extension('.mm')
|
||||
def m_hook(self, node):
|
||||
"""Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
|
||||
return self.create_compiled_task('cxx', node)
|
||||
|
||||
|
||||
def build(bld):
|
||||
os.environ["CCACHE_DIR"] = os.path.abspath('.ccache/'+bld.env.COMPILER_CC+'/'+bld.env.DEST_OS+'/'+bld.env.DEST_CPU)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user