X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FConfig.h.in;h=c58039cd24fe19e4ba59ea79904c922c9727c642;hb=a0e33d8a43c431e3df4c9aba45839a324b3ac0bc;hp=6cec4adba2ace6e7f9b2cf827765c14888e1baac;hpb=d300d9869563bae0ac020e7ed00a5a9905c897fb;p=cpPlugins.git diff --git a/lib/cpPlugins/Config.h.in b/lib/cpPlugins/Config.h.in index 6cec4ad..c58039c 100644 --- a/lib/cpPlugins/Config.h.in +++ b/lib/cpPlugins/Config.h.in @@ -1,121 +1,158 @@ -#ifndef __CPPLUGINS__CONFIG__H__ -#define __CPPLUGINS__CONFIG__H__ +#ifndef __cpPlugins__Config__h__ +#define __cpPlugins__Config__h__ -#include -#include -#include +#define ITK_MANUAL_INSTANTIATION +#include +#include +#include /* * ========================================================================= - * Version numbers and strings + * Identify OS * ========================================================================= */ -#define cpPlugins_MAJ_VER @prj_MAJ_VER@ -#define cpPlugins_MIN_VER @prj_MIN_VER@ -#define cpPlugins_REL_VER @prj_REL_VER@ -#define cpPlugins_VER "@prj_VER@" -#define cpPlugins_sVER "@prj_sVER@" +#define cpPlugins_OS_@CMAKE_SYSTEM_NAME@ +#ifdef cpPlugins_OS_Windows +# define cpPlugins_LIB_PREFIX "" +# define cpPlugins_ENV_SEPARATOR ";" +# define cpPlugins_PATH_SEPARATOR '\\' +# define cpPlugins_LIB_EXT ".dll" +#else // cpPlugins_OS_Windows +# define cpPlugins_LIB_PREFIX "lib" +# define cpPlugins_ENV_SEPARATOR ":" +# define cpPlugins_PATH_SEPARATOR '/' +# ifdef cpPlugins_OS_Linux +# define cpPlugins_LIB_EXT ".so" +# else // cpPlugins_OS_Linux +# define cpPlugins_LIB_EXT ".dylib" +# endif // cpPlugins_OS_Linux +#endif // cpPlugins_OS_Windows + +#ifdef cpPlugins_OS_Windows +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif // WIN32_LEAN_AND_MEAN +# define NOMINMAX +# include +# include +#endif // cpPlugins_OS_Windows /* * ========================================================================= - * Some useful constants and values + * Some global values * ========================================================================= */ -#define cpPlugins_CONFIG_FILE "plugins.cfg" - +#define cpPlugins_PATHS "cpPlugins_PATHS" +#define cpPlugins_CONFIG "cpPlugins_Libraries.config" #define cpPlugins_QT4_USED @QT4_FOUND@ #if cpPlugins_QT4_USED == 1 # define cpPlugins_QT4 +# define cpPlugins_QVTKWidget @cpPlugins_Qt4_VTKWidget@ +/* TODO + # include <@cpPlugins_Qt4_VTKWidget@.h> +*/ #else // cpPlugins_QT4_USED == 1 # undef cpPlugins_QT4 #endif // cpPlugins_QT4_USED == 1 /* * ========================================================================= - * Identify OS + * Version numbers and strings * ========================================================================= */ -#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) -# define cpPlugins_SYS_WINDOWS -# define cpPlugins_PLUGIN_PREFIX "" -# define cpPlugins_PLUGIN_EXT "dll" -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# define NOMINMAX -# include -# include -#elif defined( linux ) || defined( __linux ) -# define cpPlugins_SYS_LINUX -# define cpPlugins_PLUGIN_PREFIX "lib" -# define cpPlugins_PLUGIN_EXT "so" -#elif defined( __APPLE__ ) || defined( MACOSX ) || defined( macintosh ) || defined( Macintosh ) -# define cpPlugins_SYS_MACOS -# define cpPlugins_PLUGIN_PREFIX "lib" -# define cpPlugins_PLUGIN_EXT "dylib" -#elif defined( __FreeBSD__ ) || defined( __FreeBSD_kernel__ ) -# define cpPlugins_SYS_FREEBSD -# define cpPlugins_PLUGIN_PREFIX "lib" -# define cpPlugins_PLUGIN_EXT "so" -#else -# error "This operating system is not supported by cpPlugins" -#endif + +#define cpPlugins_MAJOR_VERSION @prj_MAJ_VER@ +#define cpPlugins_MINOR_VERSION @prj_MIN_VER@ +#define cpPlugins_RELEASE_VERSION @prj_REL_VER@ +#define cpPlugins_VERSION "@prj_VERSION@" +#define cpPlugins_SHORT_VERSION "@prj_SHORT_VERSION@" +#define cpPlugins_OpenGL_BackEnd_@VTK_RENDERING_BACKEND@ /* * ========================================================================= - * Some macros + * Language related macros * ========================================================================= */ -#define cpPlugins_Id_Macro( N, C ) \ - public: \ - virtual const char* GetClassName( ) override { return( #N ); } \ - virtual const char* GetClassCategory( ) override { return( #C ); } + +#if __cplusplus >= 201103L +# define cpPlugins_OVERRIDE override +# define cpPlugins_DELETE_FUNCTION =delete +# define cpPlugins_NULLPTR nullptr +# define cpPlugins_NOEXCEPT noexcept +# define cpPlugins_HAS_CXX11_STATIC_ASSERT +# define cpPlugins_HAS_CXX11_RVREF +#else // __cplusplus >= 201103L +# define cpPlugins_OVERRIDE +# define cpPlugins_DELETE_FUNCTION +# define cpPlugins_NULLPTR NULL +# define cpPlugins_NOEXCEPT throw() +#endif // __cplusplus >= 201103L /* * ========================================================================= - * Some functions + * Some macros * ========================================================================= */ -#include -namespace cpPlugins -{ - struct PathHelper - { - // --------------------------------------------------------------------- - inline bool operator()( char c ) const - { -#ifdef cpPlugins_SYS_WINDOWS - return( c == '\\' || c == '/' ); -#else // cpPlugins_SYS_WINDOWS - return( c == '/' ); -#endif // cpPlugins_SYS_WINDOWS - } - - // --------------------------------------------------------------------- - inline static std::string CanonicalPath( const std::string& path ) - { - std::string ret = ""; -#ifdef cpPlugins_SYS_WINDOWS - TCHAR buffer[ 4096 ] = TEXT( "" ); - TCHAR** lppPart = { NULL }; - GetFullPathName( path.c_str( ), 4096, buffer, lppPart ); - ret = std::string( buffer ); -#else // cpPlugins_SYS_WINDOWS - char* canonical_path = realpath( path.c_str( ), NULL ); - if( canonical_path != NULL ) - { - ret = canonical_path; - free( canonical_path ); - - } // fi -#endif // cpPlugins_SYS_WINDOWS - return( ret ); - } - }; - -} // ecapseman - -#endif // __CPPLUGINS__CONFIG__H__ + +#define cpPluginsNewMacro( x ) \ + static Pointer New( ) \ + { \ + Pointer smartPtr = new x( ); \ + smartPtr->UnRegister( ); \ + return( smartPtr ); \ + } \ + virtual itk::LightObject::Pointer \ + CreateAnother( ) const cpPlugins_OVERRIDE \ + { \ + itk::LightObject::Pointer smartPtr; \ + smartPtr = x::New( ).GetPointer( ); \ + return( smartPtr ); \ + } \ + Pointer Clone( ) const \ + { \ + Pointer rval = \ + dynamic_cast< x* >( this->InternalClone( ).GetPointer( ) ); \ + return( rval ); \ + } + +#define cpPlugins_Id_Macro( _class, _category ) \ + public: \ + virtual const char* GetClassName( ) const cpPlugins_OVERRIDE \ + { return( #_class ); } \ + virtual const char* GetClassCategory( ) const cpPlugins_OVERRIDE \ + { return( #_category ); } + +#define cpPluginsObject( _cls, _scls, _cat ) \ + public: \ + typedef _cls Self; \ + typedef _scls Superclass; \ + typedef itk::SmartPointer< Self > Pointer; \ + typedef itk::SmartPointer< const Self > ConstPointer; \ + public: \ + cpPluginsNewMacro( Self ); \ + itkTypeMacro( _cls, _scls ); \ + public: \ + virtual const char* GetClassName( ) const cpPlugins_OVERRIDE \ + { return( #_cls ); } \ + virtual const char* GetClassCategory( ) const cpPlugins_OVERRIDE \ + { return( #_cat ); } \ + protected: \ + _cls( ); \ + virtual ~_cls( ); \ + virtual void _GenerateData( ) cpPlugins_OVERRIDE; \ + private: \ + _cls( const Self& ); \ + Self& operator=( const Self& ) + +#define cpPlugins_Compatibility_Macro \ + virtual bool IsCompatible( \ + const DataObject* other \ + ) const cpPlugins_OVERRIDE \ + { \ + return( dynamic_cast< const Self* >( other ) != NULL ); \ + } + +#endif // __cpPlugins__Config__h__ // eof - $RCSfile$