Code::Blocks
SVN r11506
|
Generate command-lines needed to produce a build. More...
#include <compilercommandgenerator.h>
Public Member Functions | |
CompilerCommandGenerator () | |
virtual | ~CompilerCommandGenerator () |
virtual void | Init (cbProject *project) |
Initialize for use with the specified project . More... | |
virtual void | GenerateCommandLine (wxString ¯o, ProjectBuildTarget *target, ProjectFile *pf, const wxString &file, const wxString &object, const wxString &flat_object, const wxString &deps) |
Get the command line to compile/link the specific file. More... | |
virtual const wxArrayString & | GetCompilerSearchDirs (ProjectBuildTarget *target) |
Get the full include dirs used in the actual command line. More... | |
virtual const wxArrayString & | GetLinkerSearchDirs (ProjectBuildTarget *target) |
Get the full linker dirs used in the actual command line. More... | |
Protected Member Functions | |
virtual void | DoBuildScripts (cbProject *project, CompileTargetBase *target, const wxString &funcName) |
Apply pre-build scripts for base . More... | |
virtual wxString | GetOrderedOptions (const ProjectBuildTarget *target, OptionsRelationType rel, const wxString &project_options, const wxString &target_options) |
Arrange order of options. More... | |
virtual wxArrayString | GetOrderedOptions (const ProjectBuildTarget *target, OptionsRelationType rel, const wxArrayString &project_options, const wxArrayString &target_options) |
Arrange order of options. More... | |
virtual wxArrayString | GetOrderedIncludeDirs (Compiler *compiler, ProjectBuildTarget *target) |
virtual wxArrayString | GetOrderedLibrariesDirs (Compiler *compiler, ProjectBuildTarget *target) |
virtual wxArrayString | GetOrderedResourceIncludeDirs (Compiler *compiler, ProjectBuildTarget *target) |
virtual wxString | SetupOutputFilenames (Compiler *compiler, ProjectBuildTarget *target) |
Setup output filename for build target. More... | |
virtual wxString | SetupIncludeDirs (Compiler *compiler, ProjectBuildTarget *target) |
Setup compiler include dirs for build target. More... | |
virtual wxString | SetupLibrariesDirs (Compiler *compiler, ProjectBuildTarget *target) |
Setup linker include dirs for build target. More... | |
virtual wxString | SetupResourceIncludeDirs (Compiler *compiler, ProjectBuildTarget *target) |
Setup resource compiler include dirs for build target. More... | |
virtual wxString | SetupCompilerOptions (Compiler *compiler, ProjectBuildTarget *target) |
Setup compiler flags for build target. More... | |
virtual wxString | SetupLinkerOptions (Compiler *compiler, ProjectBuildTarget *target) |
Setup linker flags for build target. More... | |
virtual wxString | SetupLinkLibraries (Compiler *compiler, ProjectBuildTarget *target) |
Setup link libraries for build target. More... | |
virtual wxString | SetupResourceCompilerOptions (Compiler *compiler, ProjectBuildTarget *target) |
Setup resource compiler flags for build target. More... | |
virtual wxString | FixupLinkLibraries (Compiler *compiler, const wxString &lib) |
Fix library name based on advanced compiler settings. More... | |
virtual void | FixPathSeparators (Compiler *compiler, wxString &inAndOut) |
Static Protected Member Functions | |
static wxString | MakeOptString (const wxArrayString &arr, const wxString &opt, wxChar separator=_T(' ')) |
static wxString | PathSearch (const wxArrayString &arr, const wxString &filename) |
Protected Attributes | |
OptionsMap | m_Output |
output filenames, per-target More... | |
OptionsMap | m_StaticOutput |
static output filenames, per-target More... | |
OptionsMap | m_DefOutput |
def output filenames, per-target More... | |
OptionsMap | m_Inc |
compiler 'include' dirs, per-target More... | |
OptionsMap | m_Lib |
linker 'include' dirs, per-target More... | |
OptionsMap | m_RC |
resource compiler 'include' dirs, per-target More... | |
OptionsMap | m_CFlags |
compiler flags, per-target More... | |
OptionsMap | m_RCFlags |
resource compiler flags, per-target More... | |
OptionsMap | m_LDFlags |
linker flags, per-target More... | |
OptionsMap | m_LDAdd |
link libraries, per-target More... | |
wxString | m_PrjIncPath |
directive to add the project's top-level path in compiler search dirs (ready for the command line) More... | |
SearchDirsMap | m_CompilerSearchDirs |
array of final compiler search dirs, per-target More... | |
SearchDirsMap | m_LinkerSearchDirs |
array of final linker search dirs, per-target More... | |
Private Member Functions | |
wxString | GetProcessedIncludeDir (Compiler *compiler, ProjectBuildTarget *target, const wxArrayString &inc_dirs, const wxString &inc_switch) |
Processes include dirs by default. More... | |
void | SearchDirsFromBackticks (Compiler *compiler, ProjectBuildTarget *target, const wxString &btOutput) |
Private Attributes | |
wxArrayString | m_NotLoadedScripts |
wxArrayString | m_ScriptsWithErrors |
Generate command-lines needed to produce a build.
This pre-generates everything when Init() is called.
This is used by compilers to generate the needed command lines for a build.
Definition at line 30 of file compilercommandgenerator.h.
CompilerCommandGenerator::CompilerCommandGenerator | ( | ) |
Definition at line 39 of file compilercommandgenerator.cpp.
|
virtual |
Definition at line 44 of file compilercommandgenerator.cpp.
|
protectedvirtual |
Apply pre-build scripts for base
.
Definition at line 514 of file compilercommandgenerator.cpp.
References _T, wxArrayString::Add(), cbU2C(), ScriptingManager::DisplayErrors(), Manager::Get(), CompileTargetBase::GetBasePath(), CompileOptionsBase::GetBuildScripts(), wxArrayString::GetCount(), Manager::GetMacrosManager(), Manager::GetScriptingManager(), wxArrayString::Index(), wxFileName::IsAbsolute(), ScriptingManager::LoadBuffer(), m_NotLoadedScripts, m_ScriptsWithErrors, MacrosManager::ReplaceMacros(), and wxNOT_FOUND.
Referenced by Init().
|
protectedvirtual |
Definition at line 555 of file compilercommandgenerator.cpp.
References _T, CompilerSwitches::forceFwdSlashes, wxString::GetChar(), Compiler::GetSwitches(), wxString::Length(), and wxString::SetChar().
Referenced by FixupLinkLibraries(), GenerateCommandLine(), GetOrderedIncludeDirs(), GetOrderedLibrariesDirs(), GetOrderedResourceIncludeDirs(), GetProcessedIncludeDir(), and SetupOutputFilenames().
|
protectedvirtual |
Fix library name based on advanced compiler settings.
Definition at line 984 of file compilercommandgenerator.cpp.
References _T, wxString::Find(), FixPathSeparators(), Compiler::GetSwitches(), wxString::IsEmpty(), wxString::Length(), CompilerSwitches::libExtension, CompilerSwitches::libPrefix, CompilerSwitches::linkerNeedsLibExtension, CompilerSwitches::linkerNeedsLibPrefix, CompilerSwitches::linkLibs, QuoteStringIfNeeded(), wxString::Remove(), wxString::RemoveLast(), wxString::Right(), wxString::StartsWith(), and wxEmptyString.
Referenced by SetupLinkLibraries().
|
virtual |
Get the command line to compile/link the specific file.
Definition at line 207 of file compilercommandgenerator.cpp.
References _T, wxFileName::Assign(), CompilerPrograms::C, wxString::Clear(), ProjectFile::compilerVar, wxString::Contains(), CompilerPrograms::CPP, LogManager::DebugLog(), wxString::EndsWith(), FileFilters::EXECUTABLE_EXT, F(), wxString::Find(), FixPathSeparators(), Manager::Get(), GetArrayFromString(), CompilerFactory::GetCompiler(), CompileTargetBase::GetCompilerID(), Compiler::GetCOnlyFlags(), wxArrayString::GetCount(), Compiler::GetCPPOnlyFlags(), CompilerFactory::GetDefaultCompiler(), wxFileName::GetExt(), wxFileName::GetFullPath(), Manager::GetLogManager(), Manager::GetMacrosManager(), wxFileName::GetName(), wxFileName::GetPath(), Compiler::GetPrograms(), GetStringFromArray(), Compiler::GetSwitches(), CompilerSwitches::includeDirs, CompilerSwitches::includeDirSeparator, wxArrayString::Index(), wxArrayString::IsEmpty(), wxString::IsEmpty(), CompilerPrograms::LD, CompilerPrograms::LIB, wxString::Lower(), m_CFlags, m_DefOutput, m_Inc, m_LDAdd, m_LDFlags, m_Lib, m_Output, m_PrjIncPath, m_RC, m_RCFlags, m_StaticOutput, wxString::Matches(), CompilerSwitches::objectSeparator, QuoteStringIfNeeded(), wxArrayString::RemoveAt(), wxString::RemoveLast(), wxString::Replace(), MacrosManager::ReplaceMacros(), wxFileName::SetExt(), CompileOptionsBase::SupportsCurrentPlatform(), ttDynamicLib, ttStaticLib, UnquoteStringIfNeeded(), CompilerPrograms::WINDRES, wxString::wx_str(), wxNOT_FOUND, and wxT.
Referenced by DirectCommands::GetCompileFileCommand(), DirectCommands::GetCompileSingleFileCommand(), DirectCommands::GetPostBuildCommands(), DirectCommands::GetPreBuildCommands(), and DirectCommands::GetTargetLinkCommands().
|
virtual |
Get the full include dirs used in the actual command line.
These are the actual include dirs that will be used for building and might be different than target->GetIncludeDirs(). This is because it's the sum of target include dirs + project include dirs + build-script include dirs.
Definition at line 1098 of file compilercommandgenerator.cpp.
References wxArrayString::Clear(), and m_CompilerSearchDirs.
Referenced by DirectCommands::DepsSearchStart().
|
virtual |
Get the full linker dirs used in the actual command line.
These are the actual linker dirs that will be used for building and might be different than target->GetLibDirs(). This is because it's the sum of target linker dirs + project linker dirs + build-script linker dirs.
Definition at line 1110 of file compilercommandgenerator.cpp.
References wxArrayString::Clear(), and m_LinkerSearchDirs.
Referenced by cbGetDynamicLinkerPathForTarget(), and DebuggerGDB::DoDebug().
|
protectedvirtual |
Definition at line 718 of file compilercommandgenerator.cpp.
References _T, wxArrayString::Add(), LogManager::DebugLogError(), wxFileName::DirExists(), FixPathSeparators(), Manager::Get(), CompileTargetBase::GetBasePath(), Manager::GetConfigManager(), wxArrayString::GetCount(), CompileOptionsBase::GetIncludeDirs(), Manager::GetLogManager(), Manager::GetMacrosManager(), GetOrderedOptions(), ProjectBuildTarget::GetParentProject(), wxFileName::GetShortPath(), Compiler::GetSwitches(), wxString::IsEmpty(), m_CompilerSearchDirs, ortIncludeDirs, ConfigManager::ReadBool(), MacrosManager::ReplaceMacros(), wxString::Trim(), UnquoteStringIfNeeded(), CompilerSwitches::Use83Paths, and wxEmptyString.
Referenced by SetupIncludeDirs().
|
protectedvirtual |
Definition at line 767 of file compilercommandgenerator.cpp.
References _T, wxArrayString::Add(), LogManager::DebugLogError(), wxFileName::DirExists(), FixPathSeparators(), Manager::Get(), CompileTargetBase::GetBasePath(), wxArrayString::GetCount(), wxFileName::GetFullPath(), CompileOptionsBase::GetLibDirs(), Manager::GetLogManager(), Manager::GetMacrosManager(), GetOrderedOptions(), ProjectBuildTarget::GetParentProject(), wxFileName::GetShortPath(), Compiler::GetSwitches(), wxString::IsEmpty(), wxFileName::IsRelative(), m_LinkerSearchDirs, wxFileName::MakeAbsolute(), ortLibDirs, MacrosManager::ReplaceMacros(), wxString::Trim(), UnquoteStringIfNeeded(), CompilerSwitches::Use83Paths, and wxEmptyString.
Referenced by SetupLibrariesDirs(), and SetupLinkLibraries().
|
protectedvirtual |
Arrange order of options.
Depending on the order defined for the build target, it concatenates project_options
with target_options
and returns the result.
Definition at line 1126 of file compilercommandgenerator.cpp.
References CompileTargetBase::GetOptionRelation(), orAppendToParentOptions, orPrependToParentOptions, orUseParentOptionsOnly, and orUseTargetOptionsOnly.
Referenced by GetOrderedIncludeDirs(), GetOrderedLibrariesDirs(), GetOrderedResourceIncludeDirs(), SetupCompilerOptions(), CompilerOWGenerator::SetupLibrariesDirs(), CompilerOWGenerator::SetupLinkerOptions(), SetupLinkerOptions(), CompilerOWGenerator::SetupLinkLibraries(), SetupLinkLibraries(), and SetupResourceCompilerOptions().
|
protectedvirtual |
Arrange order of options.
Depending on the order defined for the build target, it concatenates project_options
with target_options
and returns the result.
Definition at line 1154 of file compilercommandgenerator.cpp.
References wxArrayString::Add(), wxArrayString::GetCount(), CompileTargetBase::GetOptionRelation(), orAppendToParentOptions, orPrependToParentOptions, orUseParentOptionsOnly, and orUseTargetOptionsOnly.
|
protectedvirtual |
Definition at line 820 of file compilercommandgenerator.cpp.
References _T, wxArrayString::Add(), LogManager::DebugLogError(), wxFileName::DirExists(), FixPathSeparators(), Manager::Get(), wxArrayString::GetCount(), Manager::GetLogManager(), Manager::GetMacrosManager(), GetOrderedOptions(), ProjectBuildTarget::GetParentProject(), CompileOptionsBase::GetResourceIncludeDirs(), wxFileName::GetShortPath(), Compiler::GetSwitches(), wxString::IsEmpty(), ortResDirs, MacrosManager::ReplaceMacros(), wxString::Trim(), UnquoteStringIfNeeded(), CompilerSwitches::Use83Paths, and wxEmptyString.
Referenced by SetupResourceIncludeDirs().
|
private |
Processes include dirs by default.
Definition at line 1187 of file compilercommandgenerator.cpp.
References _T, wxFileName::DirExists(), FixPathSeparators(), Manager::Get(), wxArrayString::GetCount(), Manager::GetMacrosManager(), wxFileName::GetShortPath(), Compiler::GetSwitches(), QuoteStringIfNeeded(), MacrosManager::ReplaceMacros(), UnquoteStringIfNeeded(), CompilerSwitches::Use83Paths, and wxEmptyString.
|
virtual |
Initialize for use with the specified project
.
Definition at line 49 of file compilercommandgenerator.cpp.
References _(), _T, cbEVT_COMPILER_SET_BUILD_OPTIONS, cbMessageBox(), cbThrow, wxArrayString::Clear(), DoBuildScripts(), Manager::Get(), CompileTargetBase::GetBasePath(), cbProject::GetBuildTarget(), cbProject::GetBuildTargetsCount(), cbProject::GetCommonTopLevelPath(), CompilerFactory::GetCompiler(), CompileTargetBase::GetCompilerID(), wxArrayString::GetCount(), CompilerFactory::GetDefaultCompiler(), Manager::GetLogManager(), cbProject::GetModified(), CompileTargetBase::GetTargetType(), CompileTargetBase::GetTitle(), Manager::IsBatchBuild(), wxArrayString::IsEmpty(), wxString::IsEmpty(), wxString::Last(), LogManager::LogToStdOut(), m_CFlags, m_CompilerSearchDirs, m_DefOutput, m_Inc, m_LDAdd, m_LDFlags, m_Lib, m_LinkerSearchDirs, m_NotLoadedScripts, m_Output, m_PrjIncPath, m_RC, m_RCFlags, m_ScriptsWithErrors, m_StaticOutput, Manager::ProcessEvent(), QuoteStringIfNeeded(), wxString::RemoveLast(), CodeBlocksEvent::SetBuildTargetName(), cbProject::SetModified(), SetupCompilerOptions(), SetupIncludeDirs(), SetupLibrariesDirs(), SetupLinkerOptions(), SetupLinkLibraries(), SetupOutputFilenames(), SetupResourceCompilerOptions(), SetupResourceIncludeDirs(), CompileOptionsBase::SupportsCurrentPlatform(), ttCommandsOnly, wxEmptyString, wxICON_ERROR, and wxSetWorkingDirectory().
Referenced by CompilerMINGW::GetCommandGenerator(), CompilerOW::GetCommandGenerator(), and Compiler::GetCommandGenerator().
|
staticprotected |
Definition at line 850 of file compilercommandgenerator.cpp.
References _T, wxString::EndsWith(), wxArrayString::GetCount(), and QuoteStringIfNeeded().
Referenced by SetupIncludeDirs(), SetupLibrariesDirs(), and SetupResourceIncludeDirs().
|
staticprotected |
Definition at line 883 of file compilercommandgenerator.cpp.
References _T, Manager::Get(), wxArrayString::GetCount(), Manager::GetLogManager(), LogManager::Log(), and wxFileExists().
Referenced by SetupLinkLibraries().
|
private |
Definition at line 1212 of file compilercommandgenerator.cpp.
References _T, wxString::find(), Compiler::GetSwitches(), CompilerSwitches::includeDirs, wxString::IsEmpty(), wxString::Length(), CompilerSwitches::libDirs, m_CompilerSearchDirs, m_LinkerSearchDirs, wxString::Mid(), and wxString::npos.
Referenced by SetupCompilerOptions(), SetupLinkerOptions(), and SetupResourceCompilerOptions().
|
protectedvirtual |
Setup compiler flags for build target.
Definition at line 926 of file compilercommandgenerator.cpp.
References _T, ExpandBackticks(), Manager::Get(), CompileOptionsBase::GetCompilerOptions(), Manager::GetMacrosManager(), GetOrderedOptions(), ProjectBuildTarget::GetParentProject(), GetStringFromArray(), ortCompilerOptions, MacrosManager::ReplaceMacros(), and SearchDirsFromBackticks().
Referenced by Init().
|
protectedvirtual |
Setup compiler include dirs for build target.
Reimplemented in CompilerMINGWGenerator.
Definition at line 900 of file compilercommandgenerator.cpp.
References GetOrderedIncludeDirs(), Compiler::GetSwitches(), CompilerSwitches::includeDirs, CompilerSwitches::includeDirSeparator, and MakeOptString().
Referenced by Init(), and CompilerMINGWGenerator::SetupIncludeDirs().
|
protectedvirtual |
Setup linker include dirs for build target.
Reimplemented in CompilerOWGenerator.
Definition at line 908 of file compilercommandgenerator.cpp.
References GetOrderedLibrariesDirs(), Compiler::GetSwitches(), CompilerSwitches::libDirs, CompilerSwitches::libDirSeparator, CompilerSwitches::linkerNeedsPathResolved, and MakeOptString().
Referenced by Init().
|
protectedvirtual |
Setup linker flags for build target.
Reimplemented in CompilerOWGenerator.
Definition at line 955 of file compilercommandgenerator.cpp.
References _T, ExpandBackticks(), Manager::Get(), CompileOptionsBase::GetLinkerOptions(), Manager::GetMacrosManager(), GetOrderedOptions(), ProjectBuildTarget::GetParentProject(), GetStringFromArray(), ortLinkerOptions, MacrosManager::ReplaceMacros(), and SearchDirsFromBackticks().
Referenced by Init().
|
protectedvirtual |
Setup link libraries for build target.
Reimplemented in CompilerOWGenerator.
Definition at line 1032 of file compilercommandgenerator.cpp.
References wxArrayString::Add(), FixupLinkLibraries(), wxArrayString::GetCount(), CompileOptionsBase::GetLinkLibs(), GetOrderedLibrariesDirs(), GetOrderedOptions(), ProjectBuildTarget::GetParentProject(), Compiler::GetSwitches(), CompilerSwitches::linkerNeedsPathResolved, CompilerSwitches::objectSeparator, ortLinkerOptions, PathSearch(), and QuoteStringIfNeeded().
Referenced by Init().
|
protectedvirtual |
Setup output filename for build target.
Definition at line 574 of file compilercommandgenerator.cpp.
References _T, LogManager::DebugLog(), F(), FixPathSeparators(), Manager::Get(), CompileTargetBase::GetDynamicLibDefFilename(), CompileTargetBase::GetDynamicLibImportFilename(), wxFileName::GetExt(), wxFileName::GetFullName(), wxFileName::GetFullPath(), Manager::GetLogManager(), Manager::GetMacrosManager(), wxFileName::GetName(), CompileTargetBase::GetOutputFilename(), Compiler::GetSwitches(), CompileTargetBase::GetTargetFilenameGenerationPolicy(), CompileTargetBase::GetTargetType(), wxString::IsSameAs(), CompilerSwitches::libExtension, CompilerSwitches::libPrefix, m_Output, m_StaticOutput, QuoteStringIfNeeded(), MacrosManager::ReplaceMacros(), wxFileName::SetExt(), wxFileName::SetFullName(), wxFileName::SetName(), wxString::StartsWith(), tgfpPlatformDefault, ttCommandsOnly, ttConsoleOnly, ttDynamicLib, ttExecutable, ttNative, ttStaticLib, UnixFilename(), UnquoteStringIfNeeded(), wxString::wx_str(), and wxEmptyString.
Referenced by Init().
|
protectedvirtual |
Setup resource compiler flags for build target.
Definition at line 1070 of file compilercommandgenerator.cpp.
References _T, ExpandBackticks(), Manager::Get(), Manager::GetMacrosManager(), GetOrderedOptions(), GetStringFromArray(), ortCompilerOptions, MacrosManager::ReplaceMacros(), and SearchDirsFromBackticks().
Referenced by Init().
|
protectedvirtual |
Setup resource compiler include dirs for build target.
Definition at line 918 of file compilercommandgenerator.cpp.
References GetOrderedResourceIncludeDirs(), Compiler::GetSwitches(), CompilerSwitches::includeDirs, CompilerSwitches::includeDirSeparator, and MakeOptString().
Referenced by Init().
|
protected |
compiler flags, per-target
Definition at line 93 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
array of final compiler search dirs, per-target
Definition at line 100 of file compilercommandgenerator.h.
Referenced by GetCompilerSearchDirs(), GetOrderedIncludeDirs(), Init(), and SearchDirsFromBackticks().
|
protected |
def output filenames, per-target
Definition at line 89 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
compiler 'include' dirs, per-target
Definition at line 90 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
link libraries, per-target
Definition at line 96 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
linker flags, per-target
Definition at line 95 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
linker 'include' dirs, per-target
Definition at line 91 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
array of final linker search dirs, per-target
Definition at line 101 of file compilercommandgenerator.h.
Referenced by GetLinkerSearchDirs(), GetOrderedLibrariesDirs(), Init(), and SearchDirsFromBackticks().
|
private |
Definition at line 106 of file compilercommandgenerator.h.
Referenced by DoBuildScripts(), and Init().
|
protected |
output filenames, per-target
Definition at line 87 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), Init(), and SetupOutputFilenames().
|
protected |
directive to add the project's top-level path in compiler search dirs (ready for the command line)
Definition at line 98 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
resource compiler 'include' dirs, per-target
Definition at line 92 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
protected |
resource compiler flags, per-target
Definition at line 94 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), and Init().
|
private |
Definition at line 107 of file compilercommandgenerator.h.
Referenced by DoBuildScripts(), and Init().
|
protected |
static output filenames, per-target
Definition at line 88 of file compilercommandgenerator.h.
Referenced by GenerateCommandLine(), Init(), and SetupOutputFilenames().