CMake/Source/cmCPluginAPI.h

244 lines
12 KiB
C
Raw Normal View History

/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
2002-08-21 15:54:06 +00:00
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
2002-08-21 15:54:06 +00:00
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
2002-08-21 15:54:06 +00:00
/* This header file defines the API that loadable commands can use. In many
2006-03-10 18:06:26 +00:00
of these commands C++ instances of cmMakefile of cmSourceFile are passed
in as arguments or returned. In these cases they are passed as a void *
argument. In the function prototypes mf is used to represent a makefile
and sf is used to represent a source file. The functions are grouped
loosely into four groups 1) Utility 2) cmMakefile 3) cmSourceFile 4)
cmSystemTools. Within each grouping functions are listed alphabetically */
2002-08-21 15:54:06 +00:00
/*=========================================================================*/
2002-08-26 14:52:04 +00:00
#ifndef cmCPluginAPI_h
#define cmCPluginAPI_h
#define CMAKE_VERSION_MAJOR 2
2006-04-18 18:48:46 +00:00
#define CMAKE_VERSION_MINOR 5
2002-08-26 14:52:04 +00:00
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __WATCOMC__
#define CCONV __cdecl
#else
#define CCONV
#endif
2002-08-26 14:52:04 +00:00
/*=========================================================================
this is the structure of function entry points that a plugin may call. This
structure must be kept in sync with the static decaled at the bottom of
cmCPLuginAPI.cxx
=========================================================================*/
2006-03-10 18:06:26 +00:00
typedef struct
2002-08-26 14:52:04 +00:00
{
/*=========================================================================
Here we define the set of functions that a plugin may call. The first goup
of functions are utility functions that are specific to the plugin API
=========================================================================*/
/* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
information is passed from the InitialPass to FInalPass for commands
that need a FinalPass and need information from the InitialPass */
void *(CCONV *GetClientData) (void *info);
2002-08-26 14:52:04 +00:00
/* return the summed size in characters of all the arguments */
int (CCONV *GetTotalArgumentSize) (int argc, char **argv);
2002-08-26 14:52:04 +00:00
/* free all the memory associated with an argc, argv pair */
void (CCONV *FreeArguments) (int argc, char **argv);
2002-08-26 14:52:04 +00:00
/* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
information is passed from the InitialPass to FInalPass for commands
that need a FinalPass and need information from the InitialPass */
void (CCONV *SetClientData) (void *info, void *cd);
2002-10-08 19:55:04 +00:00
/* when an error occurs, call this function to set the error string */
void (CCONV *SetError) (void *info, const char *err);
2006-03-10 18:06:26 +00:00
2002-08-26 14:52:04 +00:00
/*=========================================================================
The following functions all directly map to methods in the cmMakefile
class. See cmMakefile.h for descriptions of what each method does. All of
these methods take the void * makefile pointer as their first argument.
=========================================================================*/
2006-03-10 18:06:26 +00:00
void (CCONV *AddCacheDefinition) (void *mf, const char* name,
const char* value,
2002-08-26 14:52:04 +00:00
const char* doc, int cachetype);
void (CCONV *AddCustomCommand) (void *mf, const char* source,
2002-08-26 14:52:04 +00:00
const char* command,
int numArgs, const char **args,
int numDepends, const char **depends,
int numOutputs, const char **outputs,
const char *target);
void (CCONV *AddDefineFlag) (void *mf, const char* definition);
2006-03-10 18:06:26 +00:00
void (CCONV *AddDefinition) (void *mf, const char* name,
const char* value);
void (CCONV *AddExecutable) (void *mf, const char *exename,
2002-08-26 14:52:04 +00:00
int numSrcs, const char **srcs, int win32);
2006-03-10 18:06:26 +00:00
void (CCONV *AddLibrary) (void *mf, const char *libname,
2002-08-26 14:52:04 +00:00
int shared, int numSrcs, const char **srcs);
2006-03-10 18:06:26 +00:00
void (CCONV *AddLinkDirectoryForTarget) (void *mf, const char *tgt,
2002-08-26 14:52:04 +00:00
const char* d);
2006-03-10 18:06:26 +00:00
void (CCONV *AddLinkLibraryForTarget) (void *mf, const char *tgt,
2002-08-26 14:52:04 +00:00
const char *libname, int libtype);
void (CCONV *AddUtilityCommand) (void *mf, const char* utilityName,
2002-08-26 14:52:04 +00:00
const char *command, const char *arguments,
int all, int numDepends, const char **depends,
int numOutputs, const char **outputs);
int (CCONV *CommandExists) (void *mf, const char* name);
2006-03-10 18:06:26 +00:00
int (CCONV *ExecuteCommand) (void *mf, const char *name,
int numArgs, const char **args);
2006-03-10 18:06:26 +00:00
void (CCONV *ExpandSourceListArguments) (void *mf,int argc,
const char **argv,
2002-08-26 14:52:04 +00:00
int *resArgc, char ***resArgv,
unsigned int startArgumentIndex);
2006-03-10 18:06:26 +00:00
char *(CCONV *ExpandVariablesInString) (void *mf, const char *source,
2002-08-26 14:52:04 +00:00
int escapeQuotes, int atOnly);
unsigned int (CCONV *GetCacheMajorVersion) (void *mf);
unsigned int (CCONV *GetCacheMinorVersion) (void *mf);
const char* (CCONV *GetCurrentDirectory) (void *mf);
const char* (CCONV *GetCurrentOutputDirectory) (void *mf);
const char* (CCONV *GetDefinition) (void *mf, const char *def);
const char* (CCONV *GetHomeDirectory) (void *mf);
const char* (CCONV *GetHomeOutputDirectory) (void *mf);
unsigned int (CCONV *GetMajorVersion) (void *mf);
unsigned int (CCONV *GetMinorVersion) (void *mf);
const char* (CCONV *GetProjectName) (void *mf);
const char* (CCONV *GetStartDirectory) (void *mf);
const char* (CCONV *GetStartOutputDirectory) (void *mf);
int (CCONV *IsOn) (void *mf, const char* name);
2006-03-10 18:06:26 +00:00
2002-08-26 14:52:04 +00:00
/*=========================================================================
The following functions are designed to operate or manipulate
cmSourceFiles. Please see cmSourceFile.h for additional information on many
of these methods. Some of these methods are in cmMakefile.h.
=========================================================================*/
2006-03-10 18:06:26 +00:00
void *(CCONV *AddSource) (void *mf, void *sf);
void *(CCONV *CreateSourceFile) ();
void (CCONV *DestroySourceFile) (void *sf);
void *(CCONV *GetSource) (void *mf, const char* sourceName);
void (CCONV *SourceFileAddDepend) (void *sf, const char *depend);
const char *(CCONV *SourceFileGetProperty) (void *sf, const char *prop);
int (CCONV *SourceFileGetPropertyAsBool) (void *sf, const char *prop);
const char *(CCONV *SourceFileGetSourceName) (void *sf);
const char *(CCONV *SourceFileGetFullPath) (void *sf);
2006-03-10 18:06:26 +00:00
void (CCONV *SourceFileSetName) (void *sf, const char* name,
const char* dir,
2002-08-26 14:52:04 +00:00
int numSourceExtensions,
const char **sourceExtensions,
int numHeaderExtensions,
const char **headerExtensions);
2006-03-10 18:06:26 +00:00
void (CCONV *SourceFileSetName2) (void *sf, const char* name,
const char* dir,
2002-08-26 14:52:04 +00:00
const char *ext, int headerFileOnly);
void (CCONV *SourceFileSetProperty) (void *sf, const char *prop,
2002-08-26 14:52:04 +00:00
const char *value);
2006-03-10 18:06:26 +00:00
2002-08-26 14:52:04 +00:00
/*=========================================================================
The following methods are from cmSystemTools.h see that file for specific
2002-12-11 19:16:55 +00:00
documentation on each method.
2002-08-26 14:52:04 +00:00
=========================================================================*/
char *(CCONV *Capitalized)(const char *);
void (CCONV *CopyFileIfDifferent)(const char *f1, const char *f2);
char *(CCONV *GetFilenameWithoutExtension)(const char *);
char *(CCONV *GetFilenamePath)(const char *);
void (CCONV *RemoveFile)(const char *f1);
void (CCONV *Free)(void *);
2006-03-10 18:06:26 +00:00
2003-06-03 14:30:23 +00:00
/*=========================================================================
The following are new functions added after 1.6
=========================================================================*/
void (CCONV *AddCustomCommandToOutput) (void *mf, const char* output,
2003-06-03 14:30:23 +00:00
const char* command,
int numArgs, const char **args,
const char* main_dependency,
int numDepends, const char **depends);
void (CCONV *AddCustomCommandToTarget) (void *mf, const char* target,
2003-06-03 14:30:23 +00:00
const char* command,
int numArgs, const char **args,
int commandType);
2006-03-10 18:06:26 +00:00
2003-07-23 18:31:30 +00:00
/* display status information */
void (CCONV *DisplaySatus) (void *info, const char *message);
2003-07-23 18:31:30 +00:00
/* new functions added after 2.4 */
void *(CCONV *CreateNewSourceFile) (void *mf);
void (CCONV *DefineSourceFileProperty) (void *mf, const char *name,
const char *briefDocs,
const char *longDocs,
int chained);
2006-03-10 18:06:26 +00:00
/* this is the end of the C function stub API structure */
2002-08-26 14:52:04 +00:00
} cmCAPI;
2002-08-21 15:54:06 +00:00
2006-03-10 18:06:26 +00:00
2002-08-26 14:52:04 +00:00
/*=========================================================================
CM_PLUGIN_EXPORT should be used by plugins
=========================================================================*/
2002-08-21 15:54:06 +00:00
#ifdef _WIN32
#define CM_PLUGIN_EXPORT __declspec( dllexport )
#else
2006-03-10 18:06:26 +00:00
#define CM_PLUGIN_EXPORT
2002-08-21 15:54:06 +00:00
#endif
2002-08-26 14:52:04 +00:00
/*=========================================================================
define the different types of cache entries, see cmCacheManager.h for more
information
=========================================================================*/
#define CM_CACHE_BOOL 0
2002-08-21 15:54:06 +00:00
#define CM_CACHE_PATH 1
#define CM_CACHE_FILEPATH 2
#define CM_CACHE_STRING 3
#define CM_CACHE_INTERNAL 4
#define CM_CACHE_STATIC 5
2002-08-26 14:52:04 +00:00
/*=========================================================================
define the different types of compiles a library may be
=========================================================================*/
2002-08-21 15:54:06 +00:00
#define CM_LIBRARY_GENERAL 0
#define CM_LIBRARY_DEBUG 1
#define CM_LIBRARY_OPTIMIZED 2
2003-06-03 14:30:23 +00:00
/*=========================================================================
define the different types of custom commands for a target
=========================================================================*/
#define CM_PRE_BUILD 0
#define CM_PRE_LINK 1
#define CM_POST_BUILD 2
2006-03-10 18:06:26 +00:00
2002-08-26 14:52:04 +00:00
/*=========================================================================
Finally we define the key data structures and function prototypes
=========================================================================*/
typedef const char* (CCONV *CM_DOC_FUNCTION)();
2006-03-10 18:06:26 +00:00
typedef int (CCONV *CM_INITIAL_PASS_FUNCTION)(void *info, void *mf,
2002-08-21 15:54:06 +00:00
int argc, char *[]);
typedef void (CCONV *CM_FINAL_PASS_FUNCTION)(void *info, void *mf);
typedef void (CCONV *CM_DESTRUCTOR_FUNCTION)(void *info);
2006-03-10 18:06:26 +00:00
2002-08-21 15:54:06 +00:00
typedef struct {
unsigned long reserved1; /* Reserved for future use. DO NOT USE. */
unsigned long reserved2; /* Reserved for future use. DO NOT USE. */
2002-08-26 14:52:04 +00:00
cmCAPI *CAPI;
int m_Inherited; /* this ivar is no longer used in CMake 2.2 or later */
2002-08-21 15:54:06 +00:00
CM_INITIAL_PASS_FUNCTION InitialPass;
CM_FINAL_PASS_FUNCTION FinalPass;
2002-09-17 14:38:00 +00:00
CM_DESTRUCTOR_FUNCTION Destructor;
2002-08-21 15:54:06 +00:00
CM_DOC_FUNCTION GetTerseDocumentation;
2006-03-10 18:06:26 +00:00
CM_DOC_FUNCTION GetFullDocumentation;
2002-09-23 18:57:24 +00:00
const char *Name;
2002-10-08 19:55:04 +00:00
char *Error;
2002-08-21 15:54:06 +00:00
void *ClientData;
} cmLoadedCommandInfo;
typedef void (CCONV *CM_INIT_FUNCTION)(cmLoadedCommandInfo *);
2006-03-10 18:06:26 +00:00
2002-08-21 15:54:06 +00:00
#ifdef __cplusplus
}
#endif
2002-08-26 14:52:04 +00:00
#endif