/usr/include/codeblocks/compiletargetbase.h is in codeblocks-dev 16.01+dfsg-2+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | /*
* This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
* http://www.gnu.org/licenses/lgpl-3.0.html
*/
#ifndef COMPILETARGETBASE_H
#define COMPILETARGETBASE_H
#include "compileoptionsbase.h"
/** Enum that defines the option's relation types */
enum OptionsRelationType
{
ortCompilerOptions = 0, /**< Compiler option */
ortLinkerOptions, /**< Linker option */
ortIncludeDirs, /**< Compiler include dir option */
ortLibDirs, /**< Linker include dir option */
ortResDirs, /**< Resource compiler include dir option */
ortLast
};
/** Option's relation */
enum OptionsRelation
{
orUseParentOptionsOnly = 0, /**< The option uses parent options only */
orUseTargetOptionsOnly, /**< The option uses target options only */
orPrependToParentOptions, /**< The option uses parent options appended to target options */
orAppendToParentOptions /**< The option uses target options appended to parent options */
};
/** Enum to define the type of output the target produces */
enum TargetType
{
ttExecutable = 0, /**< Target produces an executable */
ttConsoleOnly = 1, /**< Target produces a console executable (without GUI) (distinction between ttExecutable and ttConsoleOnly happens only under Win32) */
ttStaticLib = 2, /**< Target produces a static library */
ttDynamicLib = 3, /**< Target produces a dynamic library */
ttCommandsOnly = 4, /**< Target only runs commands in pre-build and/or post-build steps */
ttNative = 5 /**< Target produces a native binary */
};
enum MakeCommand
{
mcClean = 0,
mcDistClean,
mcBuild,
mcCompileFile,
mcAskRebuildNeeded,
mcSilentBuild,
/// *Don't* use this. It's only used internally for enumerations...
mcLast
};
/** A target's filename can either be auto-generated based on the running platform,
* or completely specified by the user. For more info, see
* CompileTargetBase::SetTargetFilenameGenerationPolicy.
*/
enum TargetFilenameGenerationPolicy
{
tgfpPlatformDefault = 0, ///< Generate filename based on running platform defaults.
tgfpNone ///< No automatic generation; let the user specify the full filename.
};
/**
* @brief Base class for build target classes
* Each Code::Blocks project
* consists of at least one target. Each target has different settings,
* e.g.:
* \li Build options,
* \li Output type,
* \li Execution parameters, etc.
* \n\n
* This class holds the settings of one build target.
*/
class DLLIMPORT CompileTargetBase : public CompileOptionsBase
{
public:
CompileTargetBase();
virtual ~CompileTargetBase();
/** A target's filename can either be auto-generated based on the running platform,
* or completely specified by the user. Calling this function sets the
* filename generation method.
* @par The filename is divided in 4 parts. Let's see how "Debug/libSomeLib.a"
* is divided:
* @li the directory part: @c Debug,
* @li the filename's prefix: @c lib,
* @li the base name: @c SomeLib and
* @li the extension: @c a
* @par
* Calling this function defines if the prefix and extension are auto-generated
* or are left as the user specified. So, if the prefix is set to auto-generated
* (i.e. @c tgfpPlatformDefault), it would be set depending on the running
* platform and compiler, e.g.:
* @li Windows & GCC: @c lib
* @li Windows & MSVC: @c \<empty\>
* @li Linux & <*>: @c lib
* @par
* The default generation policy is @c tgfpPlatformDefault for both the prefix
* and the extension.
* @note The ProjectLoader detects old projects when loaded and, for those, it
* sets the default generation policy to @c tgfpNone (i.e. no auto-generation)
* for both the prefix and the extension. This is done so the user doesn't
* notice any unexpected behaviour...
*/
virtual void SetTargetFilenameGenerationPolicy(TargetFilenameGenerationPolicy prefix,
TargetFilenameGenerationPolicy extension);
virtual void GetTargetFilenameGenerationPolicy(TargetFilenameGenerationPolicy& prefixOut,
TargetFilenameGenerationPolicy& extensionOut) const;
virtual const wxString& GetFilename() const;
virtual const wxString& GetTitle() const; ///< Read the target's title
virtual void SetTitle(const wxString& title); ///< Set the target's title
virtual void SetOutputFilename(const wxString& filename); ///< Set the target's output filename
virtual void SetImportLibraryFilename(const wxString& filename); ///< Set the target's import library filename
virtual void SetDefinitionFileFilename(const wxString& filename); ///< Set the target's definition file filename
virtual void SetWorkingDir(const wxString& dirname); ///< Set the target's working dir on execution (valid only for executable targets)
virtual void SetObjectOutput(const wxString& dirname); ///< Set the target's objects output dir
virtual void SetDepsOutput(const wxString& dirname); ///< Set the target's dependencies output dir
virtual OptionsRelation GetOptionRelation(OptionsRelationType type) const; ///< Read the target's options relation for \c type
virtual void SetOptionRelation(OptionsRelationType type, OptionsRelation rel); ///< Set the target's options relation for \c type to \c rel
virtual wxString GetWorkingDir(); ///< Read the target's working dir for execution (valid only for executable targets)
virtual wxString GetObjectOutput() const; ///< Read the target's objects output dir
virtual wxString GetDepsOutput() const; ///< Read the target's dependencies output dir
virtual wxString GetOutputFilename(); ///< Read the target's output filename
virtual wxString SuggestOutputFilename(); ///< Suggest a filename based on the target's type
virtual wxString GetExecutableFilename() const; ///< Read the target's executable filename (produced if target type is ttExecutable)
virtual wxString GetDynamicLibFilename(); ///< Read the target's dynamic library filename (produced if target type is ttDynamicLib)
virtual wxString GetDynamicLibImportFilename(); ///< Read the target's dynamic library import filename (produced if target type is ttDynamicLib)
virtual wxString GetDynamicLibDefFilename(); ///< Read the target's dynamic library definition file filename (produced if target type is ttDynamicLib)
virtual wxString GetStaticLibFilename(); ///< Read the target's static library filename (produced if target type is ttStaticLib)
virtual wxString GetNativeFilename(); ///< Read the target's native filename (produced if target type is ttNative)
virtual wxString GetBasePath() const; ///< Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will return "/usr/local/bin"
virtual void SetTargetType(TargetType pt); ///< Set the target's type to \c pt
virtual TargetType GetTargetType() const; ///< Read the target's type
virtual const wxString& GetExecutionParameters() const; ///< Read the target's execution parameters
virtual void SetExecutionParameters(const wxString& params); ///< Set the target's execution parameters to \c params
virtual const wxString& GetHostApplication() const; ///< Read the target's host application
virtual void SetHostApplication(const wxString& app); ///< Set the target's host application to \c app
virtual bool GetRunHostApplicationInTerminal() const; ///< Get the flag if the host app should be run in terminal
virtual void SetRunHostApplicationInTerminal(bool in_terminal); ///! Set the flag if the host app should be run in terminal
virtual void SetCompilerID(const wxString& id); ///< Set the target's compiler
virtual const wxString& GetCompilerID() const { return m_CompilerId; } ///< Read the target's compiler
virtual wxString GetMakeCommandFor(MakeCommand cmd) const { return m_MakeCommands[cmd]; } ///< Get the "make" command used for @c cmd
virtual void SetMakeCommandFor(MakeCommand cmd, const wxString& make); ///< Set the "make" command used for @c cmd
virtual bool MakeCommandsModified() const { return m_MakeCommandsModified; } ///< True if any of the "make" commands is modified.
protected:
friend class cbProject;
wxString m_Filename;
wxString m_Title;
mutable wxString m_OutputFilename;
wxString m_ImportLibraryFilename;
wxString m_DefinitionFileFilename;
wxString m_WorkingDir;
wxString m_ObjectOutput;
wxString m_DepsOutput;
wxString m_ExecutionParameters;
wxString m_HostApplication;
OptionsRelation m_OptionsRelation[ortLast];
TargetType m_TargetType;
wxString m_CompilerId;
wxString m_MakeCommands[mcLast];
bool m_MakeCommandsModified;
bool m_RunHostApplicationInTerminal;
TargetFilenameGenerationPolicy m_PrefixGenerationPolicy;
TargetFilenameGenerationPolicy m_ExtensionGenerationPolicy;
private:
void GenerateTargetFilename(wxString& filename) const;
};
#endif // COMPILETARGETBASE_H
|