Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MStruct/libmstruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ BOOST_PYTHON_MODULE(libMStruct)
.def(init<>())
.def("SetPowderPatternObs", &_SetPowderPatternObs)
.def("SetWeightToUnit", &MStruct::PowderPattern::SetWeightToUnit)
.def("SetSigmaToSqrtIobs", &MStruct::PowderPattern::SetSigmaToSqrtIobs)
.def("SetWeightToInvSigmaSq", &MStruct::PowderPattern::SetWeightToInvSigmaSq)
.def("Prepare", &MStruct::PowderPattern::Prepare)
.def("SetObsToZero", &_PowderPattern_SetObsToZero)
.def("SavePowderPattern", &_SavePowderPattern)
Expand Down
36 changes: 24 additions & 12 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ if env['PLATFORM'] == 'darwin':
env.Append(SHLINKFLAGS=['-install_name', '$TARGET.abspath'])
env.AppendUnique(SHLINKFLAGS='-headerpad_max_install_names')
env.AppendUnique(SHLINKFLAGS=['-undefined', 'dynamic_lookup'])
env.AppendUnique(LINKFLAGS=['-Wl,-rpath,@loader_path/../lib'])
fast_linkflags[:] = []

# Compiler specific options
Expand Down Expand Up @@ -180,6 +181,14 @@ libms = Alias('libmstruct', [libmstruct,] + env['libmstruct_includes'])
#if env['PLATFORM'] != 'win32':
# Depends(libmstruct, lib)

# Make sure we have @rpath/libObjCryst.dylib instead of an absolute path on Darwin
if env['PLATFORM'] == 'darwin':
for f in libmstruct:
if f.get_suffix()=='.dylib':
target_name = os.path.normpath( os.path.join('build', env['build']+'-'+env['HOST_ARCH'], f.rstr()) )
env.AddPostAction(libmstruct,
'install_name_tool -change `otool -L ' + target_name + ' | grep libObjCryst.dylib | tail -n1 | tr -d "\\t" | cut -f1 -d " "` @rpath/libObjCryst.dylib ' + target_name)

# This builds mstruct binary executable
binmstruct = env.Program("mstruct_am", binmstructobjs, LIBS=binMStructlibs, LIBPATH=MStructlibpaths)
binms = Alias('mstruct', [binmstruct,] + env['binmstruct_includes'])
Expand All @@ -188,17 +197,20 @@ binms = Alias('mstruct', [binmstruct,] + env['binmstruct_includes'])
binxmlmstruct = env.Program("mstruct_xml", binxmlmstructobjs, LIBS=binMStructlibs, LIBPATH=MStructlibpaths)
binms_xml = Alias('mstruct_xml', [binxmlmstruct,] + env['binmstruct_includes'])

# Make sure we have @rpath/libObjCryst.dylib and @rpath/libMStruct.dylib in binaries
if env['PLATFORM'] == 'darwin':
for build_obj, name in zip([binmstruct, binxmlmstruct],['mstruct_am','mstruct_xml']):
target_name = os.path.normpath( os.path.join('build', env['build']+'-'+env['HOST_ARCH'], name) )
for libname in ['libObjCryst.dylib']:
env.AddPostAction(build_obj,
'install_name_tool -change `otool -L ' + target_name + ' | grep ' + libname + ' | tail -n1 | tr -d "\\t" | cut -f1 -d " "` @rpath/' + libname + ' ' + target_name)

# Installation targets.

prefix = env['prefix']

# install-lib
libinstall = env.Install(env['libdir'], libobjcryst)
if env['PLATFORM'] == 'darwin':
# DARWIN_INSTALL_NAME can be pre-set in sconscript.local
env.SetDefault(DARWIN_INSTALL_NAME='$TARGET.abspath')
env.AddPostAction(libinstall,
'install_name_tool -id $DARWIN_INSTALL_NAME $TARGET')
if env['PLATFORM'] == 'posix' and WhereIs('ldconfig'):
opts = ''
if os.getuid() != 0: opts = '-n'
Expand All @@ -208,11 +220,6 @@ if env['PLATFORM'] != 'win32':
libinstall = env.Install(env['libdir'], libmstruct+libobjcryst)
else:
libinstall = env.Install(env['libdir'], [f for f in libmstruct if f.get_suffix()=='.lib'])
if env['PLATFORM'] == 'darwin':
# DARWIN_INSTALL_NAME can be pre-set in sconscript.local
env.SetDefault(DARWIN_INSTALL_NAME='$TARGET.abspath')
env.AddPostAction(libinstall,
'install_name_tool -id $DARWIN_INSTALL_NAME $TARGET')
if env['PLATFORM'] == 'posix' and WhereIs('ldconfig'):
opts = ''
if os.getuid() != 0: opts = '-n'
Expand Down Expand Up @@ -248,9 +255,14 @@ Alias('install-lib', libinstall + dllinstall)

# install-bin
if env['PLATFORM'] == 'win32':
bininstall = env.InstallAs(prefix+'/bin/mstruct.exe', binmstruct) + env.InstallAs(prefix+'/bin/mstruct_xml.exe', binxmlmstruct)
bininstall = env.InstallAs(prefix+'/bin/mstruct.exe', binmstruct) + env.InstallAs(prefix+'/bin/mstruct_xml.exe', binxmlmstruct)
else:
bininstall = env.InstallAs(prefix+'/bin/mstruct', binmstruct) + env.InstallAs(prefix+'/bin/mstruct_xml', binxmlmstruct)
bininstall = env.InstallAs(prefix+'/bin/mstruct', binmstruct) + env.InstallAs(prefix+'/bin/mstruct_xml', binxmlmstruct)
if env['PLATFORM'] == 'darwin':
# DARWIN_INSTALL_NAME can be pre-set in sconscript.local
env.SetDefault(DARWIN_INSTALL_NAME='$TARGET.abspath')
env.AddPostAction(bininstall,
'install_name_tool -id $DARWIN_INSTALL_NAME $TARGET')
Alias('install-bin', bininstall)

# install-python
Expand Down
2 changes: 1 addition & 1 deletion libmstruct/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ env = DefaultEnvironment().Clone()
# Variables definitions below work only with 0.98.1 or later.
env.EnsureSConsVersion(0, 98, 1)

env['version_str'] = "0.15.9"
env['version_str'] = "0.15.10"

#Adds option for selecting desired python version
AddOption('--python-version', dest='python_version', type='string', help="Python version to build libmstruct against."\
Expand Down