]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Config.h.in
75ae331c78387b5ea180f761fe0e68e78ca6fb00
[cpPlugins.git] / lib / cpPlugins / Config.h.in
1 #ifndef __CPPLUGINS__CONFIG__H__
2 #define __CPPLUGINS__CONFIG__H__
3
4 #include <cpPlugins/cpPlugins_Export.h>
5 #include <string>
6
7 /*
8  * =========================================================================
9  * Version numbers and strings
10  * =========================================================================
11  */
12 #define cpPlugins_MAJ_VER @prj_MAJ_VER@
13 #define cpPlugins_MIN_VER @prj_MIN_VER@
14 #define cpPlugins_REL_VER @prj_REL_VER@
15 #define cpPlugins_VER     "@prj_VER@"
16 #define cpPlugins_sVER    "@prj_sVER@"
17
18 /*
19  * =========================================================================
20  * Some useful constants and values
21  * =========================================================================
22  */
23
24 #define ITK_MANUAL_INSTANTIATION
25 #define cpPlugins_CONFIG_FILE "plugins.cfg"
26
27 #define cpPlugins_QT4_USED @QT4_FOUND@
28 #if cpPlugins_QT4_USED == 1
29 #  define cpPlugins_QT4
30 #else // cpPlugins_QT4_USED == 1
31 #  undef cpPlugins_QT4
32 #endif // cpPlugins_QT4_USED == 1
33
34 /*
35  * =========================================================================
36  * Identify OS
37  * =========================================================================
38  */
39 #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
40 #  define cpPlugins_SYS_WINDOWS
41 #  define cpPlugins_PLUGIN_PREFIX ""
42 #  define cpPlugins_PLUGIN_EXT "dll"
43 #  ifndef WIN32_LEAN_AND_MEAN
44 #    define WIN32_LEAN_AND_MEAN
45 #  endif
46 #  ifndef NOMINMAX
47 #    define NOMINMAX
48 #  endif
49 #elif defined( linux ) || defined( __linux )
50 #  define cpPlugins_SYS_LINUX
51 #  define cpPlugins_PLUGIN_PREFIX "lib"
52 #  define cpPlugins_PLUGIN_EXT "so"
53 #elif defined( __APPLE__ ) || defined( MACOSX ) || defined( macintosh ) || defined( Macintosh )
54 #  define cpPlugins_SYS_MACOS
55 #  define cpPlugins_PLUGIN_PREFIX "lib"
56 #  define cpPlugins_PLUGIN_EXT "dylib"
57 #elif defined( __FreeBSD__ ) || defined( __FreeBSD_kernel__ )
58 #  define cpPlugins_SYS_FREEBSD
59 #  define cpPlugins_PLUGIN_PREFIX "lib"
60 #  define cpPlugins_PLUGIN_EXT "so"
61 #else
62 #  error "This operating system is not supported by cpPlugins"
63 #endif
64
65 /*
66  * =========================================================================
67  * Some macros
68  * =========================================================================
69  */
70 #define cpPlugins_Id_Macro( N, C )                                      \
71   public:                                                               \
72   virtual const char* GetClassName( )     override { return( #N ); }    \
73   virtual const char* GetClassCategory( ) override { return( #C ); }
74
75 /*
76  * =========================================================================
77  * Some functions
78  * =========================================================================
79  */
80 namespace cpPlugins
81 {
82   struct PathHelper
83   {
84     // ---------------------------------------------------------------------
85     inline bool operator()( char c ) const
86       {
87 #ifdef cpPlugins_SYS_WINDOWS
88         return( c == '\\' || c == '/' );
89 #else // cpPlugins_SYS_WINDOWS
90         return( c == '/' );
91 #endif // cpPlugins_SYS_WINDOWS
92       }
93
94     // ---------------------------------------------------------------------
95     inline static std::string CanonicalPath( const std::string& path )
96       {
97 #ifdef cpPlugins_SYS_WINDOWS
98         TCHAR  buffer[ 4096 ] = TEXT( "" );
99         TCHAR** lppPart = { NULL };
100         GetFullPathName( path.c_str( ), 4096, buffer, lppPart );
101         return( std::string( buffer ) );
102 #else // cpPlugins_SYS_WINDOWS
103         return( std::string( realpath( path.c_str( ), NULL ) ) );
104 #endif // cpPlugins_SYS_WINDOWS
105       }
106   };
107
108 } // ecapseman
109
110 #endif // __CPPLUGINS__CONFIG__H__
111
112 // eof - $RCSfile$