OSX build system improvements: switched from @executable_path to @loader_path

metadata
Wenzel Jakob 2011-08-14 19:30:06 -04:00
parent 9c7a39bf0b
commit 26fc39bac0
11 changed files with 54 additions and 27 deletions

View File

@ -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]] )

View File

@ -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')

View File

@ -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']

View File

@ -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']

View File

@ -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']

View File

@ -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')])

View File

@ -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')])

View File

@ -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')])

View File

@ -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')])

View File

@ -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')

View File

@ -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')