yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #01530
[svn] r1877 - in trunk: . lib py scripts/test
Author: eudoxos
Date: 2009-07-18 13:07:40 +0200 (Sat, 18 Jul 2009)
New Revision: 1877
Modified:
trunk/SConstruct
trunk/lib/SConscript
trunk/py/SConscript
trunk/scripts/test/gts-horse.py
Log:
1. Fix linking logic for _packPredicates (fixes https://bugs.launchpad.net/yade/+bug/401029)
2. Make gts-horse coarse original horse automatically
Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct 2009-07-18 08:35:07 UTC (rev 1876)
+++ trunk/SConstruct 2009-07-18 11:07:40 UTC (rev 1877)
@@ -541,7 +541,8 @@
for root,dirs,files in os.walk(env.subst('$PREFIX/lib/yade${SUFFIX}')):
for f in files:
ff=os.path.join(root,f)
- if ff not in toInstall and not ff.endswith('.pyo'):
+ # do not delete python-optimized files and symbolic links (lib_gts__python-module.so, for instance)
+ if ff not in toInstall and not ff.endswith('.pyo') and not os.path.islink(ff):
print "Deleting extra plugin", ff
os.remove(ff)
Modified: trunk/lib/SConscript
===================================================================
--- trunk/lib/SConscript 2009-07-18 08:35:07 UTC (rev 1876)
+++ trunk/lib/SConscript 2009-07-18 11:07:40 UTC (rev 1877)
@@ -78,6 +78,13 @@
env.File('py/pygts-0.3.1/__init__.py'),
env.File('py/pygts-0.3.1/pygts.py')
])
+ #
+ # the _packPredicates module needs to link to us, but linker by defaults looks for lib*.so files
+ # Therefore we will create symlink with that name (in lib/ rather than py/gts, so that it is in the RPATH
+ # without further modifications). If the file were copied (installed 2 times), static data would be
+ # created twice and it would break python type identification (among other things).
+ #
+ env.Command('$PREFIX/lib/yade$SUFFIX/lib/lib_gts__python-module.so','$PREFIX/lib/yade$SUFFIX/py/gts/_gts.so','ln -s -f ../py/gts/_gts.so $TARGET')
env.Install('$PREFIX/lib/yade$SUFFIX/lib',[
Modified: trunk/py/SConscript
===================================================================
--- trunk/py/SConscript 2009-07-18 08:35:07 UTC (rev 1876)
+++ trunk/py/SConscript 2009-07-18 11:07:40 UTC (rev 1877)
@@ -8,13 +8,8 @@
env.SharedLibrary('log',['log.cpp'],SHLIBPREFIX=''),
env.SharedLibrary('_utils',['_utils.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['Shop','ConcretePM']),
env.SharedLibrary('_packPredicates',['_packPredicates.cpp'],SHLIBPREFIX='',
- # if we compile with GTS, link to the python module, as inGtsSurface uses some of its symbols.
- # because the module doesn't have the lib- suffix, we put it directly to SHLINKFLAGS
- # using the -l: syntax (see man ld); we further have to add a special LIBDIR (for link-time lookup)
- # and RPATH (for run-time lookup)
- SHLINKFLAGS=env['SHLINKFLAGS']+(['-l:_gts.so'] if 'GTS' in env['features'] else []),
- LIBPATH=env['LIBPATH']+(['$PREFIX/lib/yade$SUFFIX/py/gts'] if 'GTS' in env['features'] else []),
- RPATH=env['RPATH']+(['$runtimePREFIX/lib/yade$SUFFIX/py/gts'] if 'GTS' in env['features'] else []),
+ # link to the symlink to the python module (created in lib/SConstruct; see explanation there)
+ LIBS=env['LIBS']+(['_gts__python-module'] if 'GTS' in env['features'] else []),
),
env.SharedLibrary('_packSpheres',['_packSpheres.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['Shop']),
env.SharedLibrary('_packObb',['_packObb.cpp'],SHLIBPREFIX=''),
@@ -27,7 +22,6 @@
env.SharedLibrary('wrapper',['yadeWrapper/yadeWrapper.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['XMLFormatManager','yade-factory','yade-serialization','Shop','BoundingVolumeMetaEngine','GeometricalModelMetaEngine','InteractingGeometryMetaEngine','InteractionGeometryMetaEngine','InteractionPhysicsMetaEngine','PhysicalParametersMetaEngine','ConstitutiveLawDispatcher','InteractionDispatchers','STLImporter','ParallelEngine','Clump'],),
env.SharedLibrary('_customConverters',['yadeWrapper/customConverters.cpp'],SHLIBPREFIX='',LIBS=env['LIBS']+['boost_python_indexing_suite_v2'])
])
- if 'GTS' in env['features']: env.Depends('_packPredicates.so','$PREFIX/lib/yade$SUFFIX/py/gts/_gts.so')
# 3rd party modules:
# ==================
Modified: trunk/scripts/test/gts-horse.py
===================================================================
--- trunk/scripts/test/gts-horse.py 2009-07-18 08:35:07 UTC (rev 1876)
+++ trunk/scripts/test/gts-horse.py 2009-07-18 11:07:40 UTC (rev 1877)
@@ -5,19 +5,23 @@
to facets representing the surface."""
from yade import pack
-import gts
+import gts, os.path
-try:
- #surf=gts.read(open('horse.gts')); surf.coarsen(1000); surf.write(open('horse.coarse.gts','w'))
- surf=gts.read(open('horse.coarse.gts'))
-except IOError:
- print """horse.gts not found, you need to download input data:
+# coarsen the original horse if we have it
+# do nothing if we have the coarsened horse already
+if not os.path.exists('horse.coarse.gts'):
+ if os.path.exists('horse.gts'):
+ surf=gts.read(open('horse.gts')); surf.coarsen(1000); surf.write(open('horse.coarse.gts','w'))
+ else:
+ print """horse.gts not found, you need to download input data:
- wget http://gts.sourceforge.net/samples/horse.gts.gz
- gunzip horse.gts.gz
- """
- quit()
-print dir(surf)
+ wget http://gts.sourceforge.net/samples/horse.gts.gz
+ gunzip horse.gts.gz
+ """
+ quit()
+
+surf=gts.read(open('horse.coarse.gts'))
+
if surf.is_closed():
pred=pack.inGtsSurface(surf)
aabb=pred.aabb()