-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.py
More file actions
64 lines (53 loc) · 2.67 KB
/
project.py
File metadata and controls
64 lines (53 loc) · 2.67 KB
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
import os, platform, re
from sipbuild import Project, UserException
class fbx_moduleProject(Project):
includePath = ""
FBXSDK_ROOT = ""
def get_include_path(self):
# Use any user supplied include directory.
if self.includePath == "":
if not 'FBXSDK_ROOT' in os.environ:
raise UserException("Environment variable FBXSDK_ROOT not specified")
self.FBXSDK_ROOT = os.environ['FBXSDK_ROOT']
self.includePath = os.path.join(self.FBXSDK_ROOT,'include')
self.includePath = self.includePath.replace('"', '')
return self.includePath
def get_metadata_overrides(self):
# Get the fib metadata object.
try:
# Open fbxsdk_version.h to parser version
with open(os.path.join(self.get_include_path(),'fbxsdk','fbxsdk_version.h')) as fh:
fstring = fh.readlines()
matched = re.findall("#define FBXSDK_VERSION_([A-Z]+)[ ]+([0-9]+)", str(fstring))
if(len(matched)<3):
raise UserException("Unable to parse the fbx version")
except:
raise UserException("Unable to parse the fbx version")
global FBXSDK_VERSION_STRING
FBXSDK_VERSION_STRING = matched[0][1]+'.'+matched[1][1]+'.'+matched[2][1]
print ("Fbx version: %s" % FBXSDK_VERSION_STRING)
dict = {}
dict['version'] = FBXSDK_VERSION_STRING
return dict
def update(self, tool):
""" Update the project configuration. """
# Get the fib bindings object.
fbx_bindings = self.bindings['fbx_module']
fbx_bindings.include_dirs += [self.get_include_path()]
# Use any user supplied library directory.
if platform.system() == 'Windows' or platform.system() == 'Microsoft':
if not 'FBXSDK_COMPILER' in os.environ:
raise UserException("Environment variable FBXSDK_COMPILER not specified")
compiler = os.environ['FBXSDK_COMPILER']
fbx_bindings.libraries += ["libfbxsdk-md", "zlib-md", "libxml2-md", "Advapi32", "Wininet"]
path = os.path.join(self.FBXSDK_ROOT, 'lib', compiler, 'x64', 'release')
else:
fbx_bindings.libraries += ["z", "xml2"]
if platform.system()=="Darwin":
fbx_bindings.libraries += ["fbxsdk", "iconv"]
path = os.path.join(self.FBXSDK_ROOT, 'lib', 'clang', 'x64', 'release')
else:
path = os.path.join(self.FBXSDK_ROOT, 'lib', 'gcc', 'x64', 'release')
fbx_bindings.libraries += [":libfbxsdk.a"]
path = path.replace('"', '')
fbx_bindings.library_dirs += [path]