pow-wow/SConstruct

71 строка
2.0 KiB
Python
Исходник Обычный вид История

2011-04-14 02:54:21 +04:00
import sys
2011-04-14 10:12:52 +04:00
import os
2011-04-14 02:54:21 +04:00
# TODO: I'm quite certain the Configuration settings can handle this, but
# I can't seem to make it work, so punting for now...
def is_mac():
if sys.platform == 'darwin':
return True
return False
def is_linux():
if sys.platform == 'linux2':
return True
return False
def is_windows():
if (sys.platform == 'win32' or
sys.platform == 'cygwin'):
return True
return False
2011-04-14 10:12:52 +04:00
# We need to instantiate the env module differently on different platforms
env = None
2011-04-14 11:28:31 +04:00
subdirs = []
2011-04-14 02:54:21 +04:00
if is_mac():
print "No Mac Support"
elif is_linux():
2011-04-14 10:12:52 +04:00
env = Environment()
2011-04-14 02:54:21 +04:00
subdirs.append('linux')
2011-04-14 10:12:52 +04:00
2011-04-14 02:54:21 +04:00
# This is necessary to get gtk to compile and link properly
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
elif is_windows():
2011-04-14 10:12:52 +04:00
# Ensure you launched us the right way
if (not 'INCLUDE' in os.environ or not 'WindowsSdkDir' in os.environ):
# Then you didn't launch us with a visual studio shell
print "Error: You must run this from a visual studio enabled command prompt."
print "Please also ensure you have a valid installation of the Windows SDK for your platform"
sys.exit(1)
env = Environment(ENV = {'PATH': os.environ['PATH'],
'INCLUDE': os.environ['INCLUDE']
})
# We need to build out the path to the sdk lib directory so that we can be sure
# it is included. Otherwise, you get a error: "missing kernel32.lib".
sdkpath = os.path.join(os.environ['WindowsSdkDir'], 'lib')
env['LIBPATH'] = os.environ['LIBPATH'] + ';' + sdkpath
2011-04-14 11:28:31 +04:00
# Build our windows subdirectory
subdirs.append('windows')
2011-04-14 02:54:21 +04:00
else:
print "Your OS is not recognized"
# Export the environment to our dependent SConscripts
Export('env')
# Make our subdirectories
objs = []
for subdir in subdirs:
o = SConscript('%s/SConscript' % subdir)
objs.append(o)
# Append our files in the top level directory:
objs.append('native_events.c')
# Make the library
2011-04-14 11:28:31 +04:00
env.SharedLibrary('native_events', objs)
2011-04-14 02:54:21 +04:00