40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
Import('env', 'sys', 'os', 'hasPython')
|
|
|
|
for ver in hasPython:
|
|
sver = ver.replace('.', '')
|
|
|
|
pythonEnv = env.Clone()
|
|
if pythonEnv.has_key('PYTHON'+sver+'INCLUDE'):
|
|
pythonEnv.Prepend(CPPPATH=pythonEnv['PYTHON'+sver+'INCLUDE'])
|
|
if pythonEnv.has_key('PYTHON'+sver+'LIBDIR'):
|
|
pythonEnv.Prepend(LIBPATH=pythonEnv['PYTHON'+sver+'LIBDIR'])
|
|
if pythonEnv.has_key('PYTHON'+sver+'LIB'):
|
|
pythonEnv.Prepend(LIBS=pythonEnv['PYTHON'+sver+'LIB'])
|
|
|
|
pythonEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_PYTHON']])
|
|
pythonEnv['SHLIBPREFIX']=''
|
|
pythonEnv.RelaxCompilerSettings()
|
|
|
|
if pythonEnv.has_key('XERCESINCLUDE'):
|
|
pythonEnv.Prepend(CPPPATH=pythonEnv['XERCESINCLUDE'])
|
|
if pythonEnv.has_key('XERCESLIBDIR'):
|
|
pythonEnv.Prepend(LIBPATH=pythonEnv['XERCESLIBDIR'])
|
|
if pythonEnv.has_key('XERCESLIB'):
|
|
pythonEnv.Prepend(LIBS=pythonEnv['XERCESLIB'])
|
|
|
|
if sys.platform != 'win32':
|
|
# Python has serious aliasing issues. Disable -fstrict-aliasing only for this library
|
|
pythonEnv.Append(CXXFLAGS = ['-fno-strict-aliasing']);
|
|
pythonEnv.RemoveFlags(['-fstrict-aliasing', '-ftree-vectorize']);
|
|
else:
|
|
# Create an OBJ file with many addressable sections (or compilation may fail on Windows)
|
|
pythonEnv.Append(CPPFLAGS = ['/bigobj'])
|
|
|
|
if sys.platform == 'darwin':
|
|
pythonEnv.Append(LINKFLAGS=['-Xlinker', '-rpath', '-Xlinker', '@loader_path/../../Contents/Frameworks', '-undefined', 'dynamic_lookup'])
|
|
|
|
if hasPython:
|
|
libcore_obj = pythonEnv.SharedObject('core_'+ver, 'core.cpp')
|
|
librender_obj = pythonEnv.SharedObject('render_'+ver, 'render.cpp')
|
|
libpython = pythonEnv.SharedLibrary('mitsuba_python'+ver, [libcore_obj, librender_obj]);
|