X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FConfig.h.in;h=71e0b03d3b6e7acc9cbf401e8458301eebdd14ba;hb=HEAD;hp=53b6242ddc47b050132446b31c0a44f8d07ec479;hpb=201c5026430f9bcc33f9db6a39f5d03db096c860;p=cpPlugins.git diff --git a/lib/cpPlugins/Config.h.in b/lib/cpPlugins/Config.h.in index 53b6242..71e0b03 100644 --- a/lib/cpPlugins/Config.h.in +++ b/lib/cpPlugins/Config.h.in @@ -1,103 +1,85 @@ -#ifndef __CPPLUGINS__CONFIG__H__ -#define __CPPLUGINS__CONFIG__H__ +// ========================================================================= +// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) +// ========================================================================= +#ifndef __cpPlugins__Config__h__ +#define __cpPlugins__Config__h__ -#include +#include +#include #include +#include +#include +#include -/* - * ========================================================================= - * Identify OS - * ========================================================================= - */ +// ========================================================================= +// Identify OS +// ========================================================================= -#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) -# define cpPlugins_SYS_WINDOWS -# define cpPlugins_LIB_PREFIX "" -# define cpPlugins_LIB_EXT "dll" -# define cpPlugins_SEPARATOR ";" -# define cpPlugins_PATH_SEPARATOR '/' +#define cpPlugins_OS_@CMAKE_SYSTEM_NAME@ +#define cpPlugins_LIB_EXT "@CMAKE_SHARED_LIBRARY_SUFFIX@" +#define cpPlugins_LIB_PREFIX "@CMAKE_SHARED_LIBRARY_PREFIX@" +#define cpPlugins_ENV "cpPlugins_PATH" +#define cpPlugins_EXT ".plg" + +#ifdef cpPlugins_OS_Windows +# define cpPlugins_ENV_SEP ";" # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN -# endif +# endif // WIN32_LEAN_AND_MEAN # define NOMINMAX # include # include -#elif defined( linux ) || defined( __linux ) -# define cpPlugins_SYS_LINUX -# define cpPlugins_LIB_PREFIX "lib" -# define cpPlugins_LIB_EXT "so" -# define cpPlugins_SEPARATOR ":" -# define cpPlugins_PATH_SEPARATOR '/' -#elif defined( __APPLE__ ) || defined( MACOSX ) || defined( macintosh ) || defined( Macintosh ) -# define cpPlugins_SYS_MACOS -# define cpPlugins_LIB_PREFIX "lib" -# define cpPlugins_LIB_EXT "dylib" -# define cpPlugins_SEPARATOR ":" -# define cpPlugins_PATH_SEPARATOR '/' -#elif defined( __FreeBSD__ ) || defined( __FreeBSD_kernel__ ) -# define cpPlugins_SYS_FREEBSD -# define cpPlugins_LIB_PREFIX "lib" -# define cpPlugins_LIB_EXT "so" -# define cpPlugins_SEPARATOR ":" -# define cpPlugins_PATH_SEPARATOR '/' -#else -# error "This operating system is not supported by cpPlugins" -#endif - -/* - * ========================================================================= - * Some global values - * ========================================================================= - */ - -#define cpPluginsObject -#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 -#else // cpPlugins_QT4_USED == 1 -# undef cpPlugins_QT4 -#endif // cpPlugins_QT4_USED == 1 +#else // cpPlugins_OS_Windows +# define cpPlugins_ENV_SEP ":" +#endif // cpPlugins_OS_Windows -/* - * ========================================================================= - * Version numbers and strings - * ========================================================================= - */ +// ========================================================================= +// Some generic macros +// ========================================================================= -#define cpPlugins_MAJ_VERSION @prj_MAJ_VER@ -#define cpPlugins_MIN_VERSION @prj_MIN_VER@ -#define cpPlugins_REL_VERSION @prj_REL_VER@ -#define cpPlugins_VERSION "@prj_VER@" -#define cpPlugins_SHORT_VERSION "@prj_sVER@" +#define _cpPluginsErrorMacro_2( CPPLUGINS_OBJECT, CPPLUGINS_MESSAGE ) \ + { \ + std::stringstream _cpPlugins_error_message_; \ + _cpPlugins_error_message_ \ + << "Error in \"" << __FILE__ \ + << "\", line \"" << __LINE__ << "\": "; \ + if( CPPLUGINS_OBJECT != NULL ) \ + { \ + const cpPlugins::ProcessObject* _cpPlugins_Object = \ + reinterpret_cast< const cpPlugins::ProcessObject* >( \ + CPPLUGINS_OBJECT \ + ); \ + _cpPlugins_error_message_ \ + << "\"" \ + << _cpPlugins_Object->GetName( ) << "\"@\"" \ + << _cpPlugins_Object->GetClassName( ) << "\": "; \ + } \ + _cpPlugins_error_message_ CPPLUGINS_MESSAGE; \ + throw std::runtime_error( _cpPlugins_error_message_.str( ) ); \ + } -/* - * ========================================================================= - * ITK related macros - * ========================================================================= - */ +#define _cpPluginsErrorMacro_1( CPPLUGINS_MESSAGE ) \ + { \ + std::stringstream _cpPlugins_error_message_; \ + _cpPlugins_error_message_ \ + << "Error in \"" << __FILE__ \ + << "\", line \"" << __LINE__ << "\": "; \ + _cpPlugins_error_message_ CPPLUGINS_MESSAGE; \ + throw std::runtime_error( _cpPlugins_error_message_.str( ) ); \ + } -#include -#define ITK_MANUAL_INSTANTIATION -#ifndef ITK_DELETE_FUNCTION -# define ITK_DELETE_FUNCTION -#endif // ITK_DELETE_FUNCTION -#ifndef ITK_OVERRIDE -# define ITK_OVERRIDE -#endif // ITK_OVERRIDE +#define _cpPluginsErrorMacro_0( ) \ + _cpPluginsErrorMacro_1( << "Unknown error." ) -/* - * ========================================================================= - * VTK related macros - * ========================================================================= - */ +#define _cpPluginsErrorMacro_( x, A, B, FUNC, ... ) FUNC -#include -#ifndef VTK_OVERRIDE -# define VTK_OVERRIDE -#endif // VTK_OVERRIDE +#define cpPluginsErrorMacro( ... ) \ + _cpPluginsErrorMacro_(, ##__VA_ARGS__, \ + _cpPluginsErrorMacro_2(__VA_ARGS__), \ + _cpPluginsErrorMacro_1(__VA_ARGS__), \ + _cpPluginsErrorMacro_0(__VA_ARGS__) \ + ) -#endif // __CPPLUGINS__CONFIG__H__ +#endif // __cpPlugins__Config__h__ // eof - $RCSfile$