diff options
author | David Cole <david.cole@kitware.com> | 2012-06-19 18:42:41 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-06-19 18:42:41 (GMT) |
commit | 565744bd3db6f730a31e0325a1c7336224237d12 (patch) | |
tree | bf231f1aafe422fa60fd4fcba4a9e180a718d221 /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | 8d198a71fc157343de56b0addcd987681639c127 (diff) | |
parent | eb410e8dd8f4d1401d11713f398d38e0f250b136 (diff) | |
download | CMake-565744bd3db6f730a31e0325a1c7336224237d12.zip CMake-565744bd3db6f730a31e0325a1c7336224237d12.tar.gz CMake-565744bd3db6f730a31e0325a1c7336224237d12.tar.bz2 |
Merge topic 'ninja-cldeps'
eb410e8 Ninja: disable cldeps for bcc32, it's too old, and ninja would also not build
5ead31d Ninja: try work around for bcc32 bug
1333b57 Ninja: build server fixes
9081e3a remove warning about unused parameter
f430bea Ninja: maybe this fixes the bcc32 build
f2c1288 Ninja: msvc6 for-scoping
44b9bbc Ninja: build with old msvc versions
57156a5 Ninja: build server fixes
f1abdce Ninja: some bytes of the rc files couldn't be piped correctly
2de963d Ninja: don't remove space between command and parameters
50b6f33 Ninja: build cmcldeps with mingw
c05653e Ninja: try to make GetProcessId visible
ab245ff Ninja: but cl supports /nologo ...
bf58e9a Ninja: no /nologo option in old rc.exe
2fb07fc Ninja: Eclipse and KDevelop fixes for ninja
518c065 Ninja: don't pollute build dir with preprocessed rc files
...
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 72 |
1 files changed, 34 insertions, 38 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b38619a..01e8e73 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -55,21 +55,6 @@ cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() { } -void -cmNinjaNormalTargetGenerator -::EnsureDirectoryExists(const std::string& dir) -{ - cmSystemTools::MakeDirectory(dir.c_str()); -} - -void -cmNinjaNormalTargetGenerator -::EnsureParentDirectoryExists(const std::string& path) -{ - EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str())); -} - - void cmNinjaNormalTargetGenerator::Generate() { if (!this->TargetLinkLanguage) { @@ -96,13 +81,11 @@ void cmNinjaNormalTargetGenerator::Generate() #endif this->WriteLinkStatement(); } - - this->GetBuildFileStream() << "\n"; - this->GetRulesFileStream() << "\n"; } void cmNinjaNormalTargetGenerator::WriteLanguagesRules() { +#ifdef NINJA_GEN_VERBOSE_FILES cmGlobalNinjaGenerator::WriteDivider(this->GetRulesFileStream()); this->GetRulesFileStream() << "# Rules for each languages for " @@ -110,6 +93,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() << " target " << this->GetTargetName() << "\n\n"; +#endif std::set<cmStdString> languages; this->GetTarget()->GetLanguages(languages); @@ -180,16 +164,8 @@ cmNinjaNormalTargetGenerator responseFlag += rspfile; vars.Objects = responseFlag.c_str(); } - std::string objdir = - this->GetLocalGenerator()->GetHomeRelativeOutputPath(); - objdir += objdir.empty() ? "" : "/"; - objdir += cmake::GetCMakeFilesDirectoryPostSlash(); - objdir += this->GetTargetName(); - objdir += ".dir"; - objdir = this->GetLocalGenerator()->Convert(objdir.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL); - vars.ObjectDir = objdir.c_str(); + + vars.ObjectDir = "$OBJECT_DIR"; vars.Target = "$out"; vars.SONameFlag = "$SONAME_FLAG"; vars.TargetSOName = "$SONAME"; @@ -402,13 +378,18 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Compute architecture specific link flags. Yes, these go into a different // variable for executables, probably due to a mistake made when duplicating // code between the Makefile executable and library generators. - this->GetLocalGenerator() - ->AddArchitectureFlags(targetType == cmTarget::EXECUTABLE + std::string flags = (targetType == cmTarget::EXECUTABLE ? vars["FLAGS"] - : vars["ARCH_FLAGS"], + : vars["ARCH_FLAGS"]); + this->GetLocalGenerator()->AddArchitectureFlags(flags, this->GetTarget(), this->TargetLinkLanguage, this->GetConfigName()); + if (targetType == cmTarget::EXECUTABLE) { + vars["FLAGS"] = flags; + } else { + vars["ARCH_FLAGS"] = flags; + } if (this->GetTarget()->HasSOName(this->GetConfigName())) { vars["SONAME_FLAG"] = this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage); @@ -434,10 +415,24 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() EnsureParentDirectoryExists(path); } - path = this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetTargetPDB().c_str(), cmLocalGenerator::SHELL); - vars["TARGET_PDB"] = path; - EnsureParentDirectoryExists(path); + // TODO move to GetTargetPDB + cmMakefile* mf = this->GetMakefile(); + if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || + mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) + { + path = this->GetTargetPDB(); + vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( + ConvertToNinjaPath(path.c_str()).c_str(), + cmLocalGenerator::SHELL); + EnsureParentDirectoryExists(path); + } + + if (mf->IsOn("CMAKE_COMPILER_IS_MINGW")) + { + path = GetTarget()->GetSupportDirectory(); + vars["OBJECT_DIR"] = ConvertToNinjaPath(path.c_str()); + EnsureDirectoryExists(path); + } std::vector<cmCustomCommand> *cmdLists[3] = { &this->GetTarget()->GetPreBuildCommands(), @@ -483,12 +478,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() symlinkVars["POST_BUILD"] = postBuildCmdLine; } - int cmdLineLimit = -1; + int cmdLineLimit; #ifdef _WIN32 - cmdLineLimit = 8100; + cmdLineLimit = 8000; #else - // TODO + cmdLineLimit = -1; // TODO #endif + // Write the build statement for this target. cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(), comment.str(), |