This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 94d5a919570b7dbb82fa2f45b88f1b57b5d42c8e (commit) via 77b7f1be4074843abf5156c9ff6aed5b91456afb (commit) via 12685e14e96497785f67c451c8288ecfb23261bc (commit) via 04c3d7759905a8f811be35005e06bfa43b69dc13 (commit) from bd132bd4e82c17a3bb34982be2deadcf8815cbfd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94d5a919570b7dbb82fa2f45b88f1b57b5d42c8e commit 94d5a919570b7dbb82fa2f45b88f1b57b5d42c8e Merge: bd132bd 77b7f1b Author: Peter Kuemmel <syntheti...@gmx.net> AuthorDate: Sun Apr 13 08:46:14 2014 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Sun Apr 13 08:46:14 2014 -0400 Merge topic 'ninja-link-with-compile-flags' into next 77b7f1be Ninja: set correct LANGUAGE_COMPILE_FLAGS when linking 12685e14 Ninja: cmake formatting, make code more readable 04c3d775 MinGW: link like on Unix and use compile flags when linking http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=77b7f1be4074843abf5156c9ff6aed5b91456afb commit 77b7f1be4074843abf5156c9ff6aed5b91456afb Author: Peter Kümmel <syntheti...@gmx.net> AuthorDate: Sun Apr 13 14:29:20 2014 +0200 Commit: Peter Kümmel <syntheti...@gmx.net> CommitDate: Sun Apr 13 14:42:34 2014 +0200 Ninja: set correct LANGUAGE_COMPILE_FLAGS when linking diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 92919ee..4874a5c 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -232,13 +232,11 @@ cmNinjaNormalTargetGenerator vars.LinkFlags = "$LINK_FLAGS"; std::string langFlags; - if (targetType != cmTarget::EXECUTABLE) { - this->GetLocalGenerator()->AddLanguageFlags(langFlags, - this->TargetLinkLanguage, - this->GetConfigName()); - langFlags += " $ARCH_FLAGS"; + if (targetType != cmTarget::EXECUTABLE) + { + langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS"; vars.LanguageCompileFlags = langFlags.c_str(); - } + } // Rule for linking library/executable. std::vector<std::string> linkCmds = this->ComputeLinkCmd(); @@ -476,21 +474,22 @@ 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. - std::string flags = (targetType == cmTarget::EXECUTABLE - ? vars["FLAGS"] - : vars["ARCH_FLAGS"]); - localGen.AddArchitectureFlags(flags, - &genTarget, - this->TargetLinkLanguage, - cfgName); if (targetType == cmTarget::EXECUTABLE) { - vars["FLAGS"] = flags; + std::string t = vars["FLAGS"]; + localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName); + vars["FLAGS"] = t; } else { - vars["ARCH_FLAGS"] = flags; + std::string t = vars["ARCH_FLAGS"]; + localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName); + vars["ARCH_FLAGS"] = t; + t.clear(); + localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName); + vars["LANGUAGE_COMPILE_FLAGS"] = t; } + if (target.HasSOName(cfgName)) { vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage); http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12685e14e96497785f67c451c8288ecfb23261bc commit 12685e14e96497785f67c451c8288ecfb23261bc Author: Peter Kümmel <syntheti...@gmx.net> AuthorDate: Sun Apr 13 14:06:41 2014 +0200 Commit: Peter Kümmel <syntheti...@gmx.net> CommitDate: Sun Apr 13 14:42:23 2014 +0200 Ninja: cmake formatting, make code more readable diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index c865617..92919ee 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -363,25 +363,39 @@ cmNinjaNormalTargetGenerator return std::vector<std::string>(); } -void cmNinjaNormalTargetGenerator::WriteLinkStatement() + +static int calculateCommandLineLengthLimit(int linkRuleLength) { - cmTarget::TargetType targetType = this->GetTarget()->GetType(); +#ifdef _WIN32 + return 8000 - linkRuleLength; +#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__) + // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac + return ((int)sysconf(_SC_ARG_MAX)) - linkRuleLength - 1000; +#else + (void)linkRuleLength; + return -1; +#endif +} + +void cmNinjaNormalTargetGenerator::WriteLinkStatement() +{ + cmTarget& target = *this->GetTarget(); + const std::string cfgName = this->GetConfigName(); std::string targetOutput = ConvertToNinjaPath( - this->GetTarget()->GetFullPath(this->GetConfigName()).c_str()); + target.GetFullPath(cfgName).c_str()); std::string targetOutputReal = ConvertToNinjaPath( - this->GetTarget()->GetFullPath(this->GetConfigName(), - /*implib=*/false, - /*realpath=*/true).c_str()); + target.GetFullPath(cfgName, + /*implib=*/false, + /*realpath=*/true).c_str()); std::string targetOutputImplib = ConvertToNinjaPath( - this->GetTarget()->GetFullPath(this->GetConfigName(), - /*implib=*/true).c_str()); + target.GetFullPath(cfgName, + /*implib=*/true).c_str()); - if (this->GetTarget()->IsAppBundleOnApple()) + if (target.IsAppBundleOnApple()) { // Create the app bundle - std::string outpath = - this->GetTarget()->GetDirectory(this->GetConfigName()); + std::string outpath = target.GetDirectory(cfgName); this->OSXBundleGenerator->CreateAppBundle(this->TargetNameOut, outpath); // Calculate the output path @@ -394,23 +408,22 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() targetOutputReal += this->TargetNameReal; targetOutputReal = this->ConvertToNinjaPath(targetOutputReal.c_str()); } - else if (this->GetTarget()->IsFrameworkOnApple()) + else if (target.IsFrameworkOnApple()) { // Create the library framework. - std::string outpath = - this->GetTarget()->GetDirectory(this->GetConfigName()); - this->OSXBundleGenerator->CreateFramework(this->TargetNameOut, outpath); + this->OSXBundleGenerator->CreateFramework(this->TargetNameOut, + target.GetDirectory(cfgName)); } - else if(this->GetTarget()->IsCFBundleOnApple()) + else if(target.IsCFBundleOnApple()) { // Create the core foundation bundle. - std::string outpath = - this->GetTarget()->GetDirectory(this->GetConfigName()); - this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut, outpath); + this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut, + target.GetDirectory(cfgName)); } // Write comments. cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream()); + const cmTarget::TargetType targetType = target.GetType(); this->GetBuildFileStream() << "# Link build statements for " << cmTarget::GetTargetTypeName(targetType) @@ -423,8 +436,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Compute the comment. cmOStringStream comment; - comment << "Link the " << this->GetVisibleTypeName() << " " - << targetOutputReal; + comment << + "Link the " << this->GetVisibleTypeName() << " " << targetOutputReal; // Compute outputs. cmNinjaDeps outputs; @@ -438,21 +451,21 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string frameworkPath; std::string linkPath; - cmGeneratorTarget* gtarget = this->GetGeneratorTarget(); + cmGeneratorTarget& genTarget = *this->GetGeneratorTarget(); std::string createRule = "CMAKE_"; - createRule += this->TargetLinkLanguage; - createRule += gtarget->GetCreateRuleVariable(); + createRule += this->TargetLinkLanguage + genTarget.GetCreateRuleVariable(); bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE"); - this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], - vars["FLAGS"], - vars["LINK_FLAGS"], - frameworkPath, - linkPath, - gtarget, - useWatcomQuote); + cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator(); + localGen.GetTargetFlags(vars["LINK_LIBRARIES"], + vars["FLAGS"], + vars["LINK_FLAGS"], + frameworkPath, + linkPath, + &genTarget, + useWatcomQuote); - this->addPoolNinjaVariable("JOB_POOL_LINK", this->GetTarget(), vars); + this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars); this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]); vars["LINK_FLAGS"] = cmGlobalNinjaGenerator @@ -466,39 +479,43 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string flags = (targetType == cmTarget::EXECUTABLE ? vars["FLAGS"] : vars["ARCH_FLAGS"]); - this->GetLocalGenerator()->AddArchitectureFlags(flags, - gtarget, - this->TargetLinkLanguage, - this->GetConfigName()); - if (targetType == cmTarget::EXECUTABLE) { + localGen.AddArchitectureFlags(flags, + &genTarget, + this->TargetLinkLanguage, + cfgName); + if (targetType == cmTarget::EXECUTABLE) + { vars["FLAGS"] = flags; - } else { + } + else + { vars["ARCH_FLAGS"] = flags; - } - if (this->GetTarget()->HasSOName(this->GetConfigName())) { - vars["SONAME_FLAG"] = - mf->GetSONameFlag(this->TargetLinkLanguage); + } + if (target.HasSOName(cfgName)) + { + vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage); vars["SONAME"] = this->TargetNameSO; - if (targetType == cmTarget::SHARED_LIBRARY) { - std::string install_name_dir = this->GetTarget() - ->GetInstallNameDirForBuildTree(this->GetConfigName()); - - if (!install_name_dir.empty()) { - vars["INSTALLNAME_DIR"] = - this->GetLocalGenerator()->Convert(install_name_dir, - cmLocalGenerator::NONE, - cmLocalGenerator::SHELL, false); + if (targetType == cmTarget::SHARED_LIBRARY) + { + std::string install_dir = target.GetInstallNameDirForBuildTree(cfgName); + if (!install_dir.empty()) + { + vars["INSTALLNAME_DIR"] = localGen.Convert(install_dir, + cmLocalGenerator::NONE, + cmLocalGenerator::SHELL, + false); + } } } - } - if (!this->TargetNameImport.empty()) { - const std::string impLibPath = this->GetLocalGenerator() - ->ConvertToOutputFormat(targetOutputImplib, - cmLocalGenerator::SHELL); + if (!this->TargetNameImport.empty()) + { + const std::string impLibPath = localGen.ConvertToOutputFormat( + targetOutputImplib, + cmLocalGenerator::SHELL); vars["TARGET_IMPLIB"] = impLibPath; EnsureParentDirectoryExists(impLibPath); - } + } if (!this->SetMsvcTargetPdbVariable(vars)) { @@ -507,11 +524,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string prefix; std::string base; std::string suffix; - this->GetTarget()->GetFullNameComponents(prefix, base, suffix); + target.GetFullNameComponents(prefix, base, suffix); std::string dbg_suffix = ".dbg"; // TODO: Where to document? if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) + { dbg_suffix = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX"); + } vars["TARGET_PDB"] = base + suffix + dbg_suffix; } @@ -526,9 +545,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } const std::vector<cmCustomCommand> *cmdLists[3] = { - &this->GetTarget()->GetPreBuildCommands(), - &this->GetTarget()->GetPreLinkCommands(), - &this->GetTarget()->GetPostBuildCommands() + &target.GetPreBuildCommands(), + &target.GetPreLinkCommands(), + &target.GetPostBuildCommands() }; std::vector<std::string> preLinkCmdLines, postBuildCmdLines; @@ -538,100 +557,97 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() &postBuildCmdLines }; - for (unsigned i = 0; i != 3; ++i) { + for (unsigned i = 0; i != 3; ++i) + { for (std::vector<cmCustomCommand>::const_iterator ci = cmdLists[i]->begin(); - ci != cmdLists[i]->end(); ++ci) { - cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), mf); - this->GetLocalGenerator()->AppendCustomCommandLines(ccg, - *cmdLineLists[i]); + ci != cmdLists[i]->end(); ++ci) + { + cmCustomCommandGenerator ccg(*ci, cfgName, mf); + localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]); + } } - } // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for // the link commands. - if (!preLinkCmdLines.empty()) { - const std::string homeOutDir = this->GetLocalGenerator() - ->ConvertToOutputFormat(mf->GetHomeOutputDirectory(), - cmLocalGenerator::SHELL); + if (!preLinkCmdLines.empty()) + { + const std::string homeOutDir = localGen.ConvertToOutputFormat( + mf->GetHomeOutputDirectory(), + cmLocalGenerator::SHELL); preLinkCmdLines.push_back("cd " + homeOutDir); - } + } - vars["PRE_LINK"] = - this->GetLocalGenerator()->BuildCommandLine(preLinkCmdLines); - std::string postBuildCmdLine = - this->GetLocalGenerator()->BuildCommandLine(postBuildCmdLines); + vars["PRE_LINK"] = localGen.BuildCommandLine(preLinkCmdLines); + std::string postBuildCmdLine = localGen.BuildCommandLine(postBuildCmdLines); cmNinjaVars symlinkVars; - if (targetOutput == targetOutputReal) { + if (targetOutput == targetOutputReal) + { vars["POST_BUILD"] = postBuildCmdLine; - } else { + } + else + { vars["POST_BUILD"] = ":"; symlinkVars["POST_BUILD"] = postBuildCmdLine; - } + } - int linkRuleLength = this->GetGlobalGenerator()-> - GetRuleCmdLength(this->LanguageLinkerRule()); + cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator(); int commandLineLengthLimit = 1; const char* forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE"; if (!mf->IsDefinitionSet(forceRspFile) && - cmSystemTools::GetEnv(forceRspFile) == 0) { -#ifdef _WIN32 - commandLineLengthLimit = 8000 - linkRuleLength; -#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__) - // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac - commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000; -#else - (void)linkRuleLength; - commandLineLengthLimit = -1; -#endif - } - - //Get the global generator as we are going to be call WriteBuild numerous - //times in the following section - cmGlobalNinjaGenerator* globalGenerator = this->GetGlobalGenerator(); - + cmSystemTools::GetEnv(forceRspFile) == 0) + { + commandLineLengthLimit = calculateCommandLineLengthLimit( + globalGen.GetRuleCmdLength(this->LanguageLinkerRule())); + } - const std::string rspfile = std::string - (cmake::GetCMakeFilesDirectoryPostSlash()) + - this->GetTarget()->GetName() + ".rsp"; + const std::string rspfile = + std::string(cmake::GetCMakeFilesDirectoryPostSlash()) + + target.GetName() + ".rsp"; // Write the build statement for this target. - globalGenerator->WriteBuild(this->GetBuildFileStream(), - comment.str(), - this->LanguageLinkerRule(), - outputs, - explicitDeps, - implicitDeps, - emptyDeps, - vars, - rspfile, - commandLineLengthLimit); - - if (targetOutput != targetOutputReal && - !this->GetTarget()->IsFrameworkOnApple()) { - if (targetType == cmTarget::EXECUTABLE) { - globalGenerator->WriteBuild(this->GetBuildFileStream(), - "Create executable symlink " + targetOutput, - "CMAKE_SYMLINK_EXECUTABLE", - cmNinjaDeps(1, targetOutput), - cmNinjaDeps(1, targetOutputReal), - emptyDeps, - emptyDeps, - symlinkVars); - } else { + globalGen.WriteBuild(this->GetBuildFileStream(), + comment.str(), + this->LanguageLinkerRule(), + outputs, + explicitDeps, + implicitDeps, + emptyDeps, + vars, + rspfile, + commandLineLengthLimit); + + if (targetOutput != targetOutputReal && !target.IsFrameworkOnApple()) + { + if (targetType == cmTarget::EXECUTABLE) + { + globalGen.WriteBuild(this->GetBuildFileStream(), + "Create executable symlink " + targetOutput, + "CMAKE_SYMLINK_EXECUTABLE", + cmNinjaDeps(1, targetOutput), + cmNinjaDeps(1, targetOutputReal), + emptyDeps, + emptyDeps, + symlinkVars); + } + else + { cmNinjaDeps symlinks; const std::string soName = this->GetTargetFilePath(this->TargetNameSO); // If one link has to be created. - if (targetOutputReal == soName || targetOutput == soName) { + if (targetOutputReal == soName || targetOutput == soName) + { symlinkVars["SONAME"] = soName; - } else { + } + else + { symlinkVars["SONAME"] = ""; symlinks.push_back(soName); - } + } symlinks.push_back(targetOutput); - globalGenerator->WriteBuild(this->GetBuildFileStream(), + globalGen.WriteBuild(this->GetBuildFileStream(), "Create library symlink " + targetOutput, "CMAKE_SYMLINK_LIBRARY", symlinks, @@ -639,23 +655,22 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() emptyDeps, emptyDeps, symlinkVars); + } } - } - if (!this->TargetNameImport.empty()) { + if (!this->TargetNameImport.empty()) + { // Since using multiple outputs would mess up the $out variable, use an // alias for the import library. - globalGenerator->WritePhonyBuild(this->GetBuildFileStream(), - "Alias for import library.", - cmNinjaDeps(1, targetOutputImplib), - cmNinjaDeps(1, targetOutputReal)); - } + globalGen.WritePhonyBuild(this->GetBuildFileStream(), + "Alias for import library.", + cmNinjaDeps(1, targetOutputImplib), + cmNinjaDeps(1, targetOutputReal)); + } // Add aliases for the file name and the target name. - globalGenerator->AddTargetAlias(this->TargetNameOut, - this->GetTarget()); - globalGenerator->AddTargetAlias(this->GetTargetName(), - this->GetTarget()); + globalGen.AddTargetAlias(this->TargetNameOut, &target); + globalGen.AddTargetAlias(this->GetTargetName(), &target); } //---------------------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=04c3d7759905a8f811be35005e06bfa43b69dc13 commit 04c3d7759905a8f811be35005e06bfa43b69dc13 Author: Peter Kümmel <syntheti...@gmx.net> AuthorDate: Sun Apr 13 13:12:35 2014 +0200 Commit: Peter Kümmel <syntheti...@gmx.net> CommitDate: Sun Apr 13 14:41:31 2014 +0200 MinGW: link like on Unix and use compile flags when linking diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 5c5b360..ab7474c 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -113,11 +113,11 @@ macro(__windows_compiler_gnu lang) # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE - "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") set(CMAKE_${lang}_LINK_EXECUTABLE - "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") list(APPEND CMAKE_${lang}_ABI_FILES "Platform/Windows-GNU-${lang}-ABI") ----------------------------------------------------------------------- Summary of changes: Modules/Platform/Windows-GNU.cmake | 6 +- Source/cmNinjaNormalTargetGenerator.cxx | 312 ++++++++++++++++--------------- 2 files changed, 166 insertions(+), 152 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits