1 #ifndef __CPPLUGINS__CONFIG__H__
2 #define __CPPLUGINS__CONFIG__H__
4 #include <cpPlugins/cpPlugins_Export.h>
5 #include <cpPlugins_Config.h>
9 * =========================================================================
10 * Version numbers and strings
11 * =========================================================================
13 #define cpPlugins_MAJ_VER @prj_MAJ_VER@
14 #define cpPlugins_MIN_VER @prj_MIN_VER@
15 #define cpPlugins_REL_VER @prj_REL_VER@
16 #define cpPlugins_VER "@prj_VER@"
17 #define cpPlugins_sVER "@prj_sVER@"
20 * =========================================================================
21 * Some useful constants and values
22 * =========================================================================
25 #define cpPlugins_CONFIG_FILE "plugins.cfg"
27 #define cpPlugins_QT4_USED @QT4_FOUND@
28 #if cpPlugins_QT4_USED == 1
29 # define cpPlugins_QT4
30 #else // cpPlugins_QT4_USED == 1
32 #endif // cpPlugins_QT4_USED == 1
35 * =========================================================================
37 * =========================================================================
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
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"
62 # error "This operating system is not supported by cpPlugins"
66 * =========================================================================
68 * =========================================================================
70 #define cpPlugins_Id_Macro( N, C ) \
72 virtual const char* GetClassName( ) override { return( #N ); } \
73 virtual const char* GetClassCategory( ) override { return( #C ); }
76 * =========================================================================
78 * =========================================================================
85 // ---------------------------------------------------------------------
86 inline bool operator()( char c ) const
88 #ifdef cpPlugins_SYS_WINDOWS
89 return( c == '\\' || c == '/' );
90 #else // cpPlugins_SYS_WINDOWS
92 #endif // cpPlugins_SYS_WINDOWS
95 // ---------------------------------------------------------------------
96 inline static std::string CanonicalPath( const std::string& path )
99 #ifdef cpPlugins_SYS_WINDOWS
100 TCHAR buffer[ 4096 ] = TEXT( "" );
101 TCHAR** lppPart = { NULL };
102 GetFullPathName( path.c_str( ), 4096, buffer, lppPart );
103 ret = std::string( buffer );
104 #else // cpPlugins_SYS_WINDOWS
105 char* canonical_path = realpath( path.c_str( ), NULL );
106 if( canonical_path != NULL )
108 ret = canonical_path;
109 free( canonical_path );
112 #endif // cpPlugins_SYS_WINDOWS
119 #endif // __CPPLUGINS__CONFIG__H__