CVS resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmCPluginAPI.h
blob41c102d9dec5a28b3042c0d9f2d29eb50ea54535
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPluginAPI.h,v $
5 Language: C++
6 Date: $Date: 2006/12/07 14:44:45 $
7 Version: $Revision: 1.25 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 /* This header file defines the API that loadable commands can use. In many
18 of these commands C++ instances of cmMakefile of cmSourceFile are passed
19 in as arguments or returned. In these cases they are passed as a void *
20 argument. In the function prototypes mf is used to represent a makefile
21 and sf is used to represent a source file. The functions are grouped
22 loosely into four groups 1) Utility 2) cmMakefile 3) cmSourceFile 4)
23 cmSystemTools. Within each grouping functions are listed alphabetically */
24 /*=========================================================================*/
25 #ifndef cmCPluginAPI_h
26 #define cmCPluginAPI_h
28 #define CMAKE_VERSION_MAJOR 2
29 #define CMAKE_VERSION_MINOR 5
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 #ifdef __WATCOMC__
36 #define CCONV __cdecl
37 #else
38 #define CCONV
39 #endif
40 /*=========================================================================
41 this is the structure of function entry points that a plugin may call. This
42 structure must be kept in sync with the static decaled at the bottom of
43 cmCPLuginAPI.cxx
44 =========================================================================*/
45 typedef struct
47 /*=========================================================================
48 Here we define the set of functions that a plugin may call. The first goup
49 of functions are utility functions that are specific to the plugin API
50 =========================================================================*/
51 /* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
52 information is passed from the InitialPass to FInalPass for commands
53 that need a FinalPass and need information from the InitialPass */
54 void *(CCONV *GetClientData) (void *info);
55 /* return the summed size in characters of all the arguments */
56 int (CCONV *GetTotalArgumentSize) (int argc, char **argv);
57 /* free all the memory associated with an argc, argv pair */
58 void (CCONV *FreeArguments) (int argc, char **argv);
59 /* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
60 information is passed from the InitialPass to FInalPass for commands
61 that need a FinalPass and need information from the InitialPass */
62 void (CCONV *SetClientData) (void *info, void *cd);
63 /* when an error occurs, call this function to set the error string */
64 void (CCONV *SetError) (void *info, const char *err);
66 /*=========================================================================
67 The following functions all directly map to methods in the cmMakefile
68 class. See cmMakefile.h for descriptions of what each method does. All of
69 these methods take the void * makefile pointer as their first argument.
70 =========================================================================*/
71 void (CCONV *AddCacheDefinition) (void *mf, const char* name,
72 const char* value,
73 const char* doc, int cachetype);
74 void (CCONV *AddCustomCommand) (void *mf, const char* source,
75 const char* command,
76 int numArgs, const char **args,
77 int numDepends, const char **depends,
78 int numOutputs, const char **outputs,
79 const char *target);
80 void (CCONV *AddDefineFlag) (void *mf, const char* definition);
81 void (CCONV *AddDefinition) (void *mf, const char* name,
82 const char* value);
83 void (CCONV *AddExecutable) (void *mf, const char *exename,
84 int numSrcs, const char **srcs, int win32);
85 void (CCONV *AddLibrary) (void *mf, const char *libname,
86 int shared, int numSrcs, const char **srcs);
87 void (CCONV *AddLinkDirectoryForTarget) (void *mf, const char *tgt,
88 const char* d);
89 void (CCONV *AddLinkLibraryForTarget) (void *mf, const char *tgt,
90 const char *libname, int libtype);
91 void (CCONV *AddUtilityCommand) (void *mf, const char* utilityName,
92 const char *command, const char *arguments,
93 int all, int numDepends, const char **depends,
94 int numOutputs, const char **outputs);
95 int (CCONV *CommandExists) (void *mf, const char* name);
96 int (CCONV *ExecuteCommand) (void *mf, const char *name,
97 int numArgs, const char **args);
98 void (CCONV *ExpandSourceListArguments) (void *mf,int argc,
99 const char **argv,
100 int *resArgc, char ***resArgv,
101 unsigned int startArgumentIndex);
102 char *(CCONV *ExpandVariablesInString) (void *mf, const char *source,
103 int escapeQuotes, int atOnly);
104 unsigned int (CCONV *GetCacheMajorVersion) (void *mf);
105 unsigned int (CCONV *GetCacheMinorVersion) (void *mf);
106 const char* (CCONV *GetCurrentDirectory) (void *mf);
107 const char* (CCONV *GetCurrentOutputDirectory) (void *mf);
108 const char* (CCONV *GetDefinition) (void *mf, const char *def);
109 const char* (CCONV *GetHomeDirectory) (void *mf);
110 const char* (CCONV *GetHomeOutputDirectory) (void *mf);
111 unsigned int (CCONV *GetMajorVersion) (void *mf);
112 unsigned int (CCONV *GetMinorVersion) (void *mf);
113 const char* (CCONV *GetProjectName) (void *mf);
114 const char* (CCONV *GetStartDirectory) (void *mf);
115 const char* (CCONV *GetStartOutputDirectory) (void *mf);
116 int (CCONV *IsOn) (void *mf, const char* name);
119 /*=========================================================================
120 The following functions are designed to operate or manipulate
121 cmSourceFiles. Please see cmSourceFile.h for additional information on many
122 of these methods. Some of these methods are in cmMakefile.h.
123 =========================================================================*/
124 void *(CCONV *AddSource) (void *mf, void *sf);
125 void *(CCONV *CreateSourceFile) ();
126 void (CCONV *DestroySourceFile) (void *sf);
127 void *(CCONV *GetSource) (void *mf, const char* sourceName);
128 void (CCONV *SourceFileAddDepend) (void *sf, const char *depend);
129 const char *(CCONV *SourceFileGetProperty) (void *sf, const char *prop);
130 int (CCONV *SourceFileGetPropertyAsBool) (void *sf, const char *prop);
131 const char *(CCONV *SourceFileGetSourceName) (void *sf);
132 const char *(CCONV *SourceFileGetFullPath) (void *sf);
133 void (CCONV *SourceFileSetName) (void *sf, const char* name,
134 const char* dir,
135 int numSourceExtensions,
136 const char **sourceExtensions,
137 int numHeaderExtensions,
138 const char **headerExtensions);
139 void (CCONV *SourceFileSetName2) (void *sf, const char* name,
140 const char* dir,
141 const char *ext, int headerFileOnly);
142 void (CCONV *SourceFileSetProperty) (void *sf, const char *prop,
143 const char *value);
146 /*=========================================================================
147 The following methods are from cmSystemTools.h see that file for specific
148 documentation on each method.
149 =========================================================================*/
150 char *(CCONV *Capitalized)(const char *);
151 void (CCONV *CopyFileIfDifferent)(const char *f1, const char *f2);
152 char *(CCONV *GetFilenameWithoutExtension)(const char *);
153 char *(CCONV *GetFilenamePath)(const char *);
154 void (CCONV *RemoveFile)(const char *f1);
155 void (CCONV *Free)(void *);
157 /*=========================================================================
158 The following are new functions added after 1.6
159 =========================================================================*/
160 void (CCONV *AddCustomCommandToOutput) (void *mf, const char* output,
161 const char* command,
162 int numArgs, const char **args,
163 const char* main_dependency,
164 int numDepends, const char **depends);
165 void (CCONV *AddCustomCommandToTarget) (void *mf, const char* target,
166 const char* command,
167 int numArgs, const char **args,
168 int commandType);
170 /* display status information */
171 void (CCONV *DisplaySatus) (void *info, const char *message);
173 /* new functions added after 2.4 */
174 void *(CCONV *CreateNewSourceFile) (void *mf);
175 void (CCONV *DefineSourceFileProperty) (void *mf, const char *name,
176 const char *briefDocs,
177 const char *longDocs,
178 int chained);
180 /* this is the end of the C function stub API structure */
181 } cmCAPI;
184 /*=========================================================================
185 CM_PLUGIN_EXPORT should be used by plugins
186 =========================================================================*/
187 #ifdef _WIN32
188 #define CM_PLUGIN_EXPORT __declspec( dllexport )
189 #else
190 #define CM_PLUGIN_EXPORT
191 #endif
193 /*=========================================================================
194 define the different types of cache entries, see cmCacheManager.h for more
195 information
196 =========================================================================*/
197 #define CM_CACHE_BOOL 0
198 #define CM_CACHE_PATH 1
199 #define CM_CACHE_FILEPATH 2
200 #define CM_CACHE_STRING 3
201 #define CM_CACHE_INTERNAL 4
202 #define CM_CACHE_STATIC 5
204 /*=========================================================================
205 define the different types of compiles a library may be
206 =========================================================================*/
207 #define CM_LIBRARY_GENERAL 0
208 #define CM_LIBRARY_DEBUG 1
209 #define CM_LIBRARY_OPTIMIZED 2
211 /*=========================================================================
212 define the different types of custom commands for a target
213 =========================================================================*/
214 #define CM_PRE_BUILD 0
215 #define CM_PRE_LINK 1
216 #define CM_POST_BUILD 2
218 /*=========================================================================
219 Finally we define the key data structures and function prototypes
220 =========================================================================*/
221 typedef const char* (CCONV *CM_DOC_FUNCTION)();
222 typedef int (CCONV *CM_INITIAL_PASS_FUNCTION)(void *info, void *mf,
223 int argc, char *[]);
224 typedef void (CCONV *CM_FINAL_PASS_FUNCTION)(void *info, void *mf);
225 typedef void (CCONV *CM_DESTRUCTOR_FUNCTION)(void *info);
227 typedef struct {
228 unsigned long reserved1; /* Reserved for future use. DO NOT USE. */
229 unsigned long reserved2; /* Reserved for future use. DO NOT USE. */
230 cmCAPI *CAPI;
231 int m_Inherited; /* this ivar is no longer used in CMake 2.2 or later */
232 CM_INITIAL_PASS_FUNCTION InitialPass;
233 CM_FINAL_PASS_FUNCTION FinalPass;
234 CM_DESTRUCTOR_FUNCTION Destructor;
235 CM_DOC_FUNCTION GetTerseDocumentation;
236 CM_DOC_FUNCTION GetFullDocumentation;
237 const char *Name;
238 char *Error;
239 void *ClientData;
240 } cmLoadedCommandInfo;
242 typedef void (CCONV *CM_INIT_FUNCTION)(cmLoadedCommandInfo *);
244 #ifdef __cplusplus
246 #endif
248 #endif