diff --git a/build/SConscript.configure b/build/SConscript.configure index c896f3df..e3664ff1 100644 --- a/build/SConscript.configure +++ b/build/SConscript.configure @@ -232,10 +232,17 @@ Export('dist') def osxlibinst_build_function(self, target, source, pkgname = None, use_own = None): inst = self.Install(target, source) prefix, name = os.path.split(source) - self.AddPostAction(inst, 'install_name_tool -id @executable_path/../Frameworks/' + name + ' $TARGET') + self.AddPostAction(inst, 'install_name_tool -id @loader_path/../Frameworks/' + name + ' $TARGET') + return inst + +def osxlibinst_as_build_function(self, target, source, pkgname = None, use_own = None): + inst = self.InstallAs(target, source) + prefix, name = os.path.split(source) + self.AddPostAction(inst, 'install_name_tool -id @loader_path/../Frameworks/' + name + ' $TARGET') return inst env.__class__.OSXLibInst = osxlibinst_build_function +env.__class__.OSXLibInstAs = osxlibinst_as_build_function if hasCollada: env.Append(CPPDEFINES = [['MTS_HAS_COLLADA', 1]] ) diff --git a/build/SConscript.install b/build/SConscript.install index 3300ea9d..fe074257 100644 --- a/build/SConscript.install +++ b/build/SConscript.install @@ -15,6 +15,15 @@ def install(target, paths, prefix = None): else: installTargets += env.Install(target, prefix + '/' + path) +def installAs(target, path, prefix = None): + global installTargets + if prefix == None: + prefix = env['BUILDDIR'] + if os.path.splitext(path)[1] == '.dylib': + installTargets += env.OSXLibInstAs(target, prefix + '/' + path) + else: + installTargets += env.InstallAs(target, prefix + '/' + path) + if not 'DISTDIR' in env: print 'The \"DISTDIR\" variable is missing. Please update your configuration file!' Exit(1) @@ -61,7 +70,7 @@ if sys.platform == 'win32': install(distDir, ['libcore/libmitsuba-core.dll', 'libhw/libmitsuba-hw.dll', 'librender/libmitsuba-render.dll', 'libbidir/libmitsuba-bidir.dll']) if hasPython: - install(distDir, ['mtspy/mtspy.dll']) + installAs(os.path.join(distDir, 'mtspy.pyd'), 'mtspy/mtspy.dylib') install(distDir, ['Iex.dll', 'Half.dll','IlmThread.dll', 'Imath.dll','IlmImf.dll','zlib1.dll', 'libpng13.dll', 'jpeg62.dll', 'pthreadVCE2.dll', 'xerces-c_3_0.dll', 'glew32mx.dll'], prefix=dllprefix) @@ -83,7 +92,16 @@ if sys.platform == 'win32': 'QtNetwork4.dll', 'QtOpenGL4.dll', 'QtXmlPatterns4.dll'], prefix = env['QT4_BINPATH']) elif sys.platform == 'darwin': for i in plugins: - installTargets += env.Install(os.path.join(distDir, 'plugins'), i) + plugin = env.Install(os.path.join(distDir, 'plugins'), i) + plugin = env.AddPostAction(plugin, + 'install_name_tool -change @loader_path/../Frameworks/libmitsuba-core.dylib @loader_path/../Contents/Frameworks/libmitsuba-core.dylib ${TARGET}; ' + + 'install_name_tool -change @loader_path/../Frameworks/libmitsuba-render.dylib @loader_path/../Contents/Frameworks/libmitsuba-render.dylib ${TARGET}; ' + + 'install_name_tool -change @loader_path/../Frameworks/libmitsuba-hw.dylib @loader_path/../Contents/Frameworks/libmitsuba-hw.dylib ${TARGET}; ' + + 'install_name_tool -change @loader_path/../Frameworks/libmitsuba-bidir.dylib @loader_path/../Contents/Frameworks/libmitsuba-bidir.dylib ${TARGET}; ' + + 'install_name_tool -change @loader_path/../Frameworks/libboost_system.dylib @loader_path/../Contents/Frameworks/libboost_system.dylib ${TARGET}; ' + + 'install_name_tool -change @loader_path/../Frameworks/libboost_filesystem.dylib @loader_path/../Contents/Frameworks/libboost_filesystem.dylib ${TARGET}' + ); + installTargets += plugin install(os.path.join(distDir, 'Contents/MacOS'), ['mitsuba/mitsuba', 'mitsuba/mtssrv', 'mitsuba/mtsutil']) if hasCollada: install(os.path.join(distDir, 'Contents/MacOS'), ['converter/mtsimport']) @@ -97,13 +115,14 @@ elif sys.platform == 'darwin': install(frameworkDir, ['libcore/libmitsuba-core.dylib', 'libhw/libmitsuba-hw.dylib', 'librender/libmitsuba-render.dylib', 'libbidir/libmitsuba-bidir.dylib']) if hasPython: - install(frameworkDir, ['mtspy/mtspy.dylib']) + installAs(os.path.join(frameworkDir, 'mtspy.so'), 'mtspy/mtspy.dylib') install(frameworkDir, [ 'GLEW.framework/Resources/libs/libGLEW.dylib', 'OpenEXR.framework/Resources/lib/libHalf.6.dylib', 'OpenEXR.framework/Resources/lib/libIex.6.dylib', 'OpenEXR.framework/Resources/lib/libImath.6.dylib', 'OpenEXR.framework/Resources/lib/libIlmThread.6.dylib', 'OpenEXR.framework/Resources/lib/libIlmImf.6.dylib', 'Xerces-C.framework/Resources/lib/libxerces-c-3.0.dylib', 'libpng.framework/Resources/lib/libpng.dylib', - 'libjpeg.framework/Resources/lib/libjpeg.dylib', 'libboost.framework/Resources/lib/libboost_system.dylib', + 'libjpeg.framework/Resources/lib/libjpeg.dylib', 'libboost.framework/Resources/lib/libboost_python.dylib', + 'libboost.framework/Resources/lib/libboost_system.dylib', 'libboost.framework/Resources/lib/libboost_filesystem.dylib'], '#dependencies/darwin') if hasCollada: install(frameworkDir, [ @@ -116,13 +135,13 @@ elif sys.platform == 'darwin': xmlpatterns = env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtXmlPatterns.framework/Versions/4/QtXmlPatterns') network = env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork') gui = env.OSXLibInst(frameworkDir, '/Library/Frameworks/QtGui.framework/Versions/4/QtGui') - installTargets += env.AddPostAction(xml, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore $TARGET') - installTargets += env.AddPostAction(xmlpatterns, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore $TARGET') - installTargets += env.AddPostAction(xmlpatterns, 'install_name_tool -change QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork $TARGET') - installTargets += env.AddPostAction(network, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore $TARGET') - installTargets += env.AddPostAction(gui, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore $TARGET') - installTargets += env.AddPostAction(opengl, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore $TARGET') - installTargets += env.AddPostAction(opengl, 'install_name_tool -change QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui $TARGET') + installTargets += env.AddPostAction(xml, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../Frameworks/QtCore $TARGET') + installTargets += env.AddPostAction(xmlpatterns, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../Frameworks/QtCore $TARGET') + installTargets += env.AddPostAction(xmlpatterns, 'install_name_tool -change QtNetwork.framework/Versions/4/QtNetwork @loader_path/../Frameworks/QtNetwork $TARGET') + installTargets += env.AddPostAction(network, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../Frameworks/QtCore $TARGET') + installTargets += env.AddPostAction(gui, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../Frameworks/QtCore $TARGET') + installTargets += env.AddPostAction(opengl, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../Frameworks/QtCore $TARGET') + installTargets += env.AddPostAction(opengl, 'install_name_tool -change QtGui.framework/Versions/4/QtGui @loader_path/../Frameworks/QtGui $TARGET') installTargets += env.Install(os.path.join(distDir, 'Contents/Resources'), '/Library/Frameworks//QtGui.framework/Versions/4/Resources/qt_menu.nib') installTargets += env.Install(os.path.join(distDir, 'Contents/Resources/PreviewSettings.nib'), '#data/darwin/PreviewSettings.nib/designable.nib') installTargets += env.Install(os.path.join(distDir, 'Contents/Resources/PreviewSettings.nib'), '#data/darwin/PreviewSettings.nib/keyedobjects.nib') diff --git a/build/config-darwin-universal.py b/build/config-darwin-universal.py index 192958c6..d1949fbc 100644 --- a/build/config-darwin-universal.py +++ b/build/config-darwin-universal.py @@ -26,7 +26,7 @@ BOOSTINCLUDE = ['#dependencies'] BOOSTLIB = ['boost_filesystem', 'boost_system'] BOOSTLIBDIR = ['#dependencies/darwin/libboost.framework/Resources/lib'] PYTHONINCLUDE = ['/System/Library/Frameworks/Python.framework/Versions/2.5/Headers'] -PYTHONLIBS = ['boost_python', 'boost_system', 'Python'] +PYTHONLIB = ['boost_python', 'boost_system', 'Python'] COLLADAINCLUDE = ['#dependencies/windows/include/colladadom', '#dependencies/windows/include/colladadom/1.4'] COLLADALIB = ['libCollada14Dom'] COLLADALIBDIR = ['#dependencies/darwin/Collada14Dom.framework/Resources/lib'] diff --git a/build/config-darwin-x86.py b/build/config-darwin-x86.py index dcbb4dde..6544dfa6 100644 --- a/build/config-darwin-x86.py +++ b/build/config-darwin-x86.py @@ -26,7 +26,7 @@ BOOSTINCLUDE = ['#dependencies'] BOOSTLIB = ['boost_filesystem', 'boost_system'] BOOSTLIBDIR = ['#dependencies/darwin/libboost.framework/Resources/lib'] PYTHONINCLUDE = ['/System/Library/Frameworks/Python.framework/Versions/2.5/Headers'] -PYTHONLIBS = ['boost_python', 'boost_system', 'Python'] +PYTHONLIB = ['boost_python', 'boost_system', 'Python'] COLLADAINCLUDE = ['#dependencies/windows/include/colladadom', '#dependencies/windows/include/colladadom/1.4'] COLLADALIB = ['libCollada14Dom'] COLLADALIBDIR = ['#dependencies/darwin/Collada14Dom.framework/Resources/lib'] diff --git a/build/config-darwin-x86_64.py b/build/config-darwin-x86_64.py index 3c83896b..53ddbabf 100644 --- a/build/config-darwin-x86_64.py +++ b/build/config-darwin-x86_64.py @@ -26,7 +26,7 @@ BOOSTINCLUDE = ['#dependencies'] BOOSTLIB = ['boost_filesystem', 'boost_system'] BOOSTLIBDIR = ['#dependencies/darwin/libboost.framework/Resources/lib'] PYTHONINCLUDE = ['/System/Library/Frameworks/Python.framework/Versions/2.5/Headers'] -PYTHONLIBS = ['boost_python', 'boost_system', 'Python'] +PYTHONLIB = ['boost_python', 'boost_system', 'Python'] COLLADAINCLUDE = ['#dependencies/windows/include/colladadom', '#dependencies/windows/include/colladadom/1.4'] COLLADALIB = ['libCollada14Dom'] COLLADALIBDIR = ['#dependencies/darwin/Collada14Dom.framework/Resources/lib'] diff --git a/src/libbidir/SConscript b/src/libbidir/SConscript index 1e374621..916daed2 100644 --- a/src/libbidir/SConscript +++ b/src/libbidir/SConscript @@ -6,7 +6,7 @@ bidirEnv.Append(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_BIDIR']] ) libbidir = bidirEnv.SharedLibrary('mitsuba-bidir', ['rsampler.cpp']) if sys.platform == "darwin": - bidirEnv.AddPostAction(libbidir, 'install_name_tool -id @executable_path/../Frameworks/libmitsuba-bidir.dylib $TARGET') + bidirEnv.AddPostAction(libbidir, 'install_name_tool -id @loader_path/../Frameworks/libmitsuba-bidir.dylib $TARGET') env.Append(LIBS=['mitsuba-bidir']) env.Append(LIBPATH=[os.path.join(env['BUILDDIR'], 'libbidir')]) diff --git a/src/libcore/SConscript b/src/libcore/SConscript index e88b988d..07bcc858 100644 --- a/src/libcore/SConscript +++ b/src/libcore/SConscript @@ -50,7 +50,7 @@ elif sys.platform == 'win32': libcore = coreEnv.SharedLibrary('mitsuba-core', libcore_objects) if sys.platform == "darwin": - coreEnv.AddPostAction(libcore, 'install_name_tool -id @executable_path/../Frameworks/libmitsuba-core.dylib $TARGET') + coreEnv.AddPostAction(libcore, 'install_name_tool -id @loader_path/../Frameworks/libmitsuba-core.dylib $TARGET') env.Append(LIBS=['mitsuba-core']) env.Append(LIBPATH=[os.path.join(env['BUILDDIR'], 'libcore')]) diff --git a/src/libhw/SConscript b/src/libhw/SConscript index 0f3debf9..58a28b18 100644 --- a/src/libhw/SConscript +++ b/src/libhw/SConscript @@ -38,7 +38,7 @@ if sys.platform == 'darwin': libhw = glEnv.SharedLibrary('mitsuba-hw', libhw_objects) if sys.platform == "darwin": - glEnv.AddPostAction(libhw, 'install_name_tool -id @executable_path/../Frameworks/libmitsuba-hw.dylib $TARGET') + glEnv.AddPostAction(libhw, 'install_name_tool -id @loader_path/../Frameworks/libmitsuba-hw.dylib $TARGET') env.Append(LIBS=['mitsuba-hw']) env.Append(LIBPATH=[os.path.join(env['BUILDDIR'], 'libhw')]) diff --git a/src/librender/SConscript b/src/librender/SConscript index 418534e4..1509c8e8 100644 --- a/src/librender/SConscript +++ b/src/librender/SConscript @@ -23,7 +23,7 @@ librender = renderEnv.SharedLibrary('mitsuba-render', [ ]) if sys.platform == "darwin": - renderEnv.AddPostAction(librender, 'install_name_tool -id @executable_path/../Frameworks/libmitsuba-render.dylib $TARGET') + renderEnv.AddPostAction(librender, 'install_name_tool -id @loader_path/../Frameworks/libmitsuba-render.dylib $TARGET') env.Append(LIBS=['mitsuba-render']) env.Append(LIBPATH=[os.path.join(env['BUILDDIR'], 'librender')]) diff --git a/src/mtsgui/SConscript b/src/mtsgui/SConscript index a791a0ab..86581b6d 100644 --- a/src/mtsgui/SConscript +++ b/src/mtsgui/SConscript @@ -59,10 +59,10 @@ if hasQt: qtSources = [x for x in qtSources if (not isinstance(x, str) or 'cocoa' not in x)] mtsgui = qtEnv.Program('mtsgui', qtSources) if sys.platform == 'darwin': - qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui $TARGET') - qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore $TARGET') - qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtOpenGL.framework/Versions/4/QtOpenGL @executable_path/../Frameworks/QtOpenGL $TARGET') - qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml $TARGET') - qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork $TARGET') - qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtXmlPatterns.framework/Versions/4/QtXmlPatterns @executable_path/../Frameworks/QtXmlPatterns $TARGET') + qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtGui.framework/Versions/4/QtGui @loader_path/../Frameworks/QtGui $TARGET') + qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtCore.framework/Versions/4/QtCore @loader_path/../Frameworks/QtCore $TARGET') + qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtOpenGL.framework/Versions/4/QtOpenGL @loader_path/../Frameworks/QtOpenGL $TARGET') + qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtXml.framework/Versions/4/QtXml @loader_path/../Frameworks/QtXml $TARGET') + qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtNetwork.framework/Versions/4/QtNetwork @loader_path/../Frameworks/QtNetwork $TARGET') + qtEnv.AddPostAction(mtsgui, 'install_name_tool -change QtXmlPatterns.framework/Versions/4/QtXmlPatterns @loader_path/../Frameworks/QtXmlPatterns $TARGET') diff --git a/src/mtspy/SConscript b/src/mtspy/SConscript index c0912439..ab4c9ab3 100644 --- a/src/mtspy/SConscript +++ b/src/mtspy/SConscript @@ -11,7 +11,8 @@ if pythonEnv.has_key('PYTHONLIB'): pythonEnv.Prepend(LIBS=pythonEnv['PYTHONLIB']) if hasPython: - mtspy = pythonEnv.SharedLibrary('mtspy', ['base.cpp']); + mtspy_plugin = pythonEnv.SharedLibrary('mtspy', ['base.cpp']); + #mtspy_app = pythonEnv.SharedLibrary('mtspy', ['base.cpp']); if sys.platform == "darwin": - pythonEnv.AddPostAction(mtspy, 'install_name_tool -id @executable_path/../Frameworks/mtspy.dylib $TARGET') + pythonEnv.AddPostAction(mtspy_plugin, 'install_name_tool -id @loader_path/mtspy.dylib $TARGET')