This repository has been archived by the owner on Jan 12, 2022. It is now read-only.
forked from ahal/pow-wow
-
Notifications
You must be signed in to change notification settings - Fork 3
/
SConstruct
70 lines (56 loc) · 2.03 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import sys
import os
# 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
# We need to instantiate the env module differently on different platforms
env = None
subdirs = []
if is_mac():
print "No Mac Support"
elif is_linux():
env = Environment()
subdirs.append('linux')
# This is necessary to get gtk to compile and link properly
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
elif is_windows():
# 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
# Build our windows subdirectory
subdirs.append('windows')
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
env.SharedLibrary('native_events', objs)