[Cmake-commits] CMake branch, next, updated. v2.8.12.2-7715-gf251a27

Brad King brad.king at kitware.com
Thu Feb 13 10:27:54 EST 2014


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  f251a2747abb394ec6ef1618c55c3c8bf50f0868 (commit)
       via  26762e16818749beeaa65149035e17a24cae5b1f (commit)
      from  eb3e90889a61574b93a89eedde9da49c9c3b003e (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=f251a2747abb394ec6ef1618c55c3c8bf50f0868
commit f251a2747abb394ec6ef1618c55c3c8bf50f0868
Merge: eb3e908 26762e1
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 13 10:27:53 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 13 10:27:53 2014 -0500

    Merge topic 'dev/ninja-speedup' into next
    
    26762e16 Ninja: Cache target-level flags


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26762e16818749beeaa65149035e17a24cae5b1f
commit 26762e16818749beeaa65149035e17a24cae5b1f
Author:     Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Wed Feb 12 00:00:29 2014 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 13 10:20:56 2014 -0500

    Ninja: Cache target-level flags
    
    Instead of figuring out target flags per-source file, cache the flags
    that are being used. This results in a *much* faster generate time for
    Ninja.

diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 82f8d1b..900af8d 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -129,15 +129,6 @@ std::string
 cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
                                               const std::string& language)
 {
-  std::string flags;
-
-  this->AddFeatureFlags(flags, language.c_str());
-
-  this->GetLocalGenerator()->AddArchitectureFlags(flags,
-                                                  this->GeneratorTarget,
-                                                  language.c_str(),
-                                                  this->GetConfigName());
-
   // TODO: Fortran support.
   // // Fortran-specific flags computed for this target.
   // if(*l == "Fortran")
@@ -145,42 +136,56 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
   //   this->AddFortranFlags(flags);
   //   }
 
-  // Add shared-library flags if needed.
-  this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
-                                        language.c_str(),
-                                        this->GetConfigName());
-
-  this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target,
-                                                 language.c_str());
-
-  // Add include directory flags.
-  const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
-  {
-  std::vector<std::string> includes;
-  this->LocalGenerator->GetIncludeDirectories(includes,
-                                              this->GeneratorTarget,
-                                              language.c_str(), config);
-  std::string includeFlags =
-    this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
-                                          language.c_str(),
-    language == "RC" ? true : false); // full include paths for RC
-                                      // needed by cmcldeps
-  if(cmGlobalNinjaGenerator::IsMinGW())
-    cmSystemTools::ReplaceString(includeFlags, "\\", "/");
-
-  this->LocalGenerator->AppendFlags(flags, includeFlags.c_str());
-  }
-
-  // Append old-style preprocessor definition flags.
-  this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags());
+  bool hasLangCached = this->LanguageFlags.count(language) != 0;
+  std::string& languageFlags = this->LanguageFlags[language];
+  if(!hasLangCached)
+    {
+    this->AddFeatureFlags(languageFlags, language.c_str());
+
+    this->GetLocalGenerator()->AddArchitectureFlags(languageFlags,
+                                                    this->GeneratorTarget,
+                                                    language.c_str(),
+                                                    this->GetConfigName());
+
+    // Add shared-library flags if needed.
+    this->LocalGenerator->AddCMP0018Flags(languageFlags, this->Target,
+                                          language,
+                                          this->GetConfigName());
+
+    this->LocalGenerator->AddVisibilityPresetFlags(languageFlags, this->Target,
+                                                   language.c_str());
+
+    std::vector<std::string> includes;
+    this->LocalGenerator->GetIncludeDirectories(includes,
+                                                this->GeneratorTarget,
+                                                language.c_str(),
+                                                this->GetConfigName());
+    // Add include directory flags.
+    std::string includeFlags =
+      this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget,
+                                            language.c_str(),
+      language == "RC" ? true : false); // full include paths for RC
+                                        // needed by cmcldeps
+    if(cmGlobalNinjaGenerator::IsMinGW())
+      cmSystemTools::ReplaceString(includeFlags, "\\", "/");
+
+    this->LocalGenerator->AppendFlags(languageFlags, includeFlags.c_str());
+
+    // Append old-style preprocessor definition flags.
+    this->LocalGenerator->AppendFlags(languageFlags,
+                                      this->Makefile->GetDefineFlags());
+
+    // Add target-specific flags.
+    this->LocalGenerator->AddCompileOptions(languageFlags, this->Target,
+                                            language.c_str(),
+                                            this->GetConfigName());
+    }
 
-  // Add target-specific flags.
-  this->LocalGenerator->AddCompileOptions(flags, this->Target,
-                                          language.c_str(), config);
+  std::string flags = languageFlags;
 
-    // Add source file specific flags.
-    this->LocalGenerator->AppendFlags(flags,
-      source->GetProperty("COMPILE_FLAGS"));
+  // Add source file specific flags.
+  this->LocalGenerator->AppendFlags(flags,
+    source->GetProperty("COMPILE_FLAGS"));
 
   // TODO: Handle Apple frameworks.
 
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 2ce1ed7..43f2279 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -154,6 +154,9 @@ private:
   /// List of object files for this target.
   cmNinjaDeps Objects;
 
+  typedef std::map<std::string, std::string> LanguageFlagMap;
+  LanguageFlagMap LanguageFlags;
+
   // The windows module definition source file (.def), if any.
   std::string ModuleDefinitionFile;
 };

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list