Move names of platform-specific sources into subclasses

This commit is contained in:
Kp 2013-03-02 23:00:10 +00:00
parent 2851dac581
commit e2c8e95cfc

View file

@ -55,6 +55,7 @@ class DXXProgram:
def __init__(self): def __init__(self):
self.ogllibs = '' self.ogllibs = ''
self.osasmdef = None self.osasmdef = None
self.platform_sources = []
# Settings to apply to mingw32 builds # Settings to apply to mingw32 builds
class Win32PlatformSettings(_PlatformSettings): class Win32PlatformSettings(_PlatformSettings):
def __init__(self,user_settings): def __init__(self,user_settings):
@ -68,6 +69,7 @@ class DXXProgram:
env.RES('arch/win32/%s.rc' % program.target) env.RES('arch/win32/%s.rc' % program.target)
env.Append(CPPDEFINES = ['_WIN32']) env.Append(CPPDEFINES = ['_WIN32'])
env.Append(CPPPATH = ['arch/win32/include']) env.Append(CPPPATH = ['arch/win32/include'])
self.platform_sources = ['arch/win32/messagebox.c']
# Settings to apply to Apple builds # Settings to apply to Apple builds
# This appears to be unused. The reference to sdl_only fails to # This appears to be unused. The reference to sdl_only fails to
# execute. # execute.
@ -87,6 +89,7 @@ class DXXProgram:
self.libs = ['../physfs/build/Debug/libphysfs.dylib'] self.libs = ['../physfs/build/Debug/libphysfs.dylib']
def adjust_environment(self,program,env): def adjust_environment(self,program,env):
env.Append(CPPDEFINES = ['__unix__']) env.Append(CPPDEFINES = ['__unix__'])
self.platform_sources = ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']
# Settings to apply to Linux builds # Settings to apply to Linux builds
class LinuxPlatformSettings(_PlatformSettings): class LinuxPlatformSettings(_PlatformSettings):
def __init__(self,user_settings): def __init__(self,user_settings):
@ -153,11 +156,9 @@ class DXXProgram:
if sys.platform == 'win32': if sys.platform == 'win32':
print "%s: compiling on Windows" % self.PROGRAM_NAME print "%s: compiling on Windows" % self.PROGRAM_NAME
platform = self.Win32PlatformSettings platform = self.Win32PlatformSettings
self.common_sources += ['arch/win32/messagebox.c']
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
print "%s: compiling on Mac OS X" % self.PROGRAM_NAME print "%s: compiling on Mac OS X" % self.PROGRAM_NAME
platform = self.DarwinPlatformSettings platform = self.DarwinPlatformSettings
self.common_sources += ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']
sys.path += ['./arch/cocoa'] sys.path += ['./arch/cocoa']
VERSION = str(VERSION_MAJOR) + '.' + str(VERSION_MINOR) VERSION = str(VERSION_MAJOR) + '.' + str(VERSION_MINOR)
if (VERSION_MICRO): if (VERSION_MICRO):
@ -172,6 +173,7 @@ class DXXProgram:
self.platform_settings = platform(self.user_settings) self.platform_settings = platform(self.user_settings)
self.platform_settings.adjust_environment(self, env) self.platform_settings.adjust_environment(self, env)
self.platform_settings.libs += ['physfs', 'm'] self.platform_settings.libs += ['physfs', 'm']
self.common_sources += self.platform_settings.platform_sources
def process_user_settings(self): def process_user_settings(self):
env = self.env env = self.env