← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2522: 1. (hopefully) fix build with boost::serialization<1.42 broken by previous commit.

 

------------------------------------------------------------
revno: 2522
committer: Václav Šmilauer <eudoxos@xxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-10-29 12:32:13 +0200
message:
  1. (hopefully) fix build with boost::serialization<1.42 broken by previous commit.
modified:
  core/corePlugins.cpp
  lib/factory/ClassFactory.hpp
  lib/serialization/Serializable.hpp


--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'core/corePlugins.cpp'
--- core/corePlugins.cpp	2010-10-29 10:12:44 +0000
+++ core/corePlugins.cpp	2010-10-29 10:32:13 +0000
@@ -20,9 +20,17 @@
 #include<yade/core/State.hpp>
 #include<yade/core/TimeStepper.hpp>
 
+#include<boost/version.hpp>
+
 // these two are not accessible from python directly (though they should be in the future, perhaps)
-BOOST_CLASS_EXPORT_IMPLEMENT(BodyContainer);
-BOOST_CLASS_EXPORT_IMPLEMENT(InteractionContainer);
+
+#if BOOST_VERSION>=104200
+	BOOST_CLASS_EXPORT_IMPLEMENT(BodyContainer);
+	BOOST_CLASS_EXPORT_IMPLEMENT(InteractionContainer);
+#else
+	BOOST_CLASS_EXPORT(BodyContainer);
+	BOOST_CLASS_EXPORT(InteractionContainer);
+#endif
 
 YADE_PLUGIN((Body)(Bound)(Cell)(Dispatcher)(EnergyTracker)(Engine)(FileGenerator)(Functor)(GlobalEngine)(Interaction)(IGeom)(IPhys)(Material)(PartialEngine)(Shape)(State)(TimeStepper));
 

=== modified file 'lib/factory/ClassFactory.hpp'
--- lib/factory/ClassFactory.hpp	2010-10-29 10:12:44 +0000
+++ lib/factory/ClassFactory.hpp	2010-10-29 10:32:13 +0000
@@ -38,6 +38,7 @@
 	Python wrapper defines O.saveXML('file.xml') to try it out.
 	Loading is not yet implemented (should be easy)
 */
+#include<boost/version.hpp>
 
 #include<boost/archive/binary_oarchive.hpp>
 #include<boost/archive/binary_iarchive.hpp>
@@ -178,7 +179,11 @@
  * be unique and avoids use of __COUNTER__ which didn't appear in gcc until 4.3.
  */
 
-#define _YADE_PLUGIN_BOOST_REGISTER(x,y,z) BOOST_CLASS_EXPORT_IMPLEMENT(z); BOOST_SERIALIZATION_FACTORY_0(z);
+#if BOOST_VERSION>=104200
+	#define _YADE_PLUGIN_BOOST_REGISTER(x,y,z) BOOST_CLASS_EXPORT_IMPLEMENT(z); BOOST_SERIALIZATION_FACTORY_0(z);
+#else
+	#define _YADE_PLUGIN_BOOST_REGISTER(x,y,z) BOOST_CLASS_EXPORT(z); BOOST_SERIALIZATION_FACTORY_0(z);
+#endif
 
 // the __attribute__((constructor(priority))) construct not supported before gcc 4.3
 // it will only produce warning from log4cxx if not used

=== modified file 'lib/serialization/Serializable.hpp'
--- lib/serialization/Serializable.hpp	2010-10-29 10:12:44 +0000
+++ lib/serialization/Serializable.hpp	2010-10-29 10:32:13 +0000
@@ -19,6 +19,7 @@
 #	include<memory>
 	using std::shared_ptr;
 #endif
+#include<boost/version.hpp>
 #include<boost/python.hpp>
 #include<boost/type_traits.hpp>
 #include<boost/lexical_cast.hpp>
@@ -228,7 +229,13 @@
 	thisClass() BOOST_PP_IF(BOOST_PP_SEQ_SIZE(inits attrDecls),:,) BOOST_PP_SEQ_FOR_EACH_I(_ATTR_MAKE_INITIALIZER,BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(inits attrDecls)), inits BOOST_PP_SEQ_FOR_EACH(_ATTR_MAKE_INIT_TUPLE,~,attrDecls)) { ctor ; } /* ctor, with initialization of defaults */ \
 	_YADE_CLASS_BASE_DOC_ATTRS_DEPREC_PY(thisClass,baseClass,docString,BOOST_PP_SEQ_FOR_EACH(_ATTRS_EMBED_INI_TYP_IN_DOC,~,attrDecls),deprec,extras)
 
-#define REGISTER_SERIALIZABLE(name) REGISTER_FACTORABLE(name); BOOST_CLASS_EXPORT_KEY(name);
+// see https://bugs.launchpad.net/yade/+bug/666876
+// we have to change things at a few other places as well
+#if BOOST_VERSION>=104200
+	#define REGISTER_SERIALIZABLE(name) REGISTER_FACTORABLE(name); BOOST_CLASS_EXPORT_KEY(name);
+#else
+	#define REGISTER_SERIALIZABLE(name) REGISTER_FACTORABLE(name); 
+#endif
 
 // for static classes (Gl1 functors, for instance)
 #define YADE_CLASS_BASE_DOC_STATICATTRS(thisClass,baseClass,docString,attrs)\