[Cmake-commits] CMake branch, next, updated. v2.8.7-3389-g4008d9c

Brad King brad.king at kitware.com
Mon Apr 2 11:08:50 EDT 2012


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  4008d9c99bd56571da012ce1831632484558ac94 (commit)
       via  3fd0dde23ea692419fe2399cc6e0c4ee089c2ae3 (commit)
       via  d2c764ad8db1a2d920e43f5c78d4ff4b1f643cee (commit)
       via  89987c21027af53a97db07babf91d718e52676c3 (commit)
      from  ccdc38ec35cbb3658e7fc4a97ad7b4b54f279cd2 (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=4008d9c99bd56571da012ce1831632484558ac94
commit 4008d9c99bd56571da012ce1831632484558ac94
Merge: ccdc38e 3fd0dde
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 2 11:08:44 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Apr 2 11:08:44 2012 -0400

    Merge topic 'ninja-generated-def' into next
    
    3fd0dde Merge branch 'test-generated-def' into ninja-generated-def
    d2c764a Ninja: Fix module .def file path conversion
    89987c2 Test generated module .def files

diff --cc Source/cmNinjaTargetGenerator.cxx
index c76d175,3f7c925..c6469f2
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@@ -409,18 -400,12 +409,23 @@@ cmNinjaTargetGenerato
      {
      this->WriteObjectBuildStatement(*si);
      }
+   if(!this->GeneratorTarget->ModuleDefinitionFile.empty())
+     {
+     this->ModuleDefinitionFile = this->ConvertToNinjaPath(
+       this->GeneratorTarget->ModuleDefinitionFile.c_str());
+     }
  
 +  {
 +  // Add object library contents as external objects.
 +  std::vector<std::string> objs;
 +  this->GeneratorTarget->UseObjectLibraries(objs);
 +  for(std::vector<std::string>::iterator oi = objs.begin();
 +      oi != objs.end(); ++oi)
 +    {
 +    this->Objects.push_back(ConvertToNinjaPath(oi->c_str()));
 +    }
 +  }
 +
    this->GetBuildFileStream() << "\n";
  }
  

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3fd0dde23ea692419fe2399cc6e0c4ee089c2ae3
commit 3fd0dde23ea692419fe2399cc6e0c4ee089c2ae3
Merge: d2c764a 89987c2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 2 11:00:42 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Apr 2 11:00:42 2012 -0400

    Merge branch 'test-generated-def' into ninja-generated-def


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d2c764ad8db1a2d920e43f5c78d4ff4b1f643cee
commit d2c764ad8db1a2d920e43f5c78d4ff4b1f643cee
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 2 10:55:01 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Apr 2 10:58:56 2012 -0400

    Ninja: Fix module .def file path conversion
    
    Refactoring in commit a2514f15 (Simplify cmNinjaTargetGenerator using
    cmGeneratorTarget, 2012-03-13) accidentally removed mapping of .def file
    paths through ConvertToNinjaPath (via GetSourceFilePath).  Take the
    ModuleDefinitionFile value from cmGeneratorTarget and map it correctly
    through ConvertToNinjaPath.
    
    In addition to generating cleaner paths in the ninja build files this
    correctly links up references to a generated .def file with the custom
    command output that produces it.

diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 23662d9..3f7c925 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -234,9 +234,9 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const
   std::transform(deps.begin(), deps.end(), result.begin(), MapToNinjaPath());
 
   // Add a dependency on the link definitions file, if any.
-  if(!this->GeneratorTarget->ModuleDefinitionFile.empty())
+  if(!this->ModuleDefinitionFile.empty())
     {
-    result.push_back(this->GeneratorTarget->ModuleDefinitionFile);
+    result.push_back(this->ModuleDefinitionFile);
     }
 
   return result;
@@ -400,6 +400,11 @@ cmNinjaTargetGenerator
     {
     this->WriteObjectBuildStatement(*si);
     }
+  if(!this->GeneratorTarget->ModuleDefinitionFile.empty())
+    {
+    this->ModuleDefinitionFile = this->ConvertToNinjaPath(
+      this->GeneratorTarget->ModuleDefinitionFile.c_str());
+    }
 
   this->GetBuildFileStream() << "\n";
 }
@@ -478,7 +483,7 @@ void
 cmNinjaTargetGenerator
 ::AddModuleDefinitionFlag(std::string& flags)
 {
-  if(this->GeneratorTarget->ModuleDefinitionFile.empty())
+  if(this->ModuleDefinitionFile.empty())
     {
     return;
     }
@@ -495,6 +500,6 @@ cmNinjaTargetGenerator
   // vs6's "cl -link" pass it to the linker.
   std::string flag = defFileFlag;
   flag += (this->LocalGenerator->ConvertToLinkReference(
-             this->GeneratorTarget->ModuleDefinitionFile.c_str()));
+             this->ModuleDefinitionFile.c_str()));
   this->LocalGenerator->AppendFlags(flags, flag.c_str());
 }
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index f639116..b64ce1e 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -118,6 +118,9 @@ private:
   cmLocalNinjaGenerator* LocalGenerator;
   /// List of object files for this target.
   cmNinjaDeps Objects;
+
+  // The windows module definition source file (.def), if any.
+  std::string ModuleDefinitionFile;
 };
 
 #endif // ! cmNinjaTargetGenerator_h

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89987c21027af53a97db07babf91d718e52676c3
commit 89987c21027af53a97db07babf91d718e52676c3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 2 10:40:13 2012 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Apr 2 10:54:25 2012 -0400

    Test generated module .def files
    
    Teach the ModuleDefinition test to cover the case that a .def file is
    generated by a custom command.

diff --git a/Tests/ModuleDefinition/CMakeLists.txt b/Tests/ModuleDefinition/CMakeLists.txt
index b463a3c..a30f643 100644
--- a/Tests/ModuleDefinition/CMakeLists.txt
+++ b/Tests/ModuleDefinition/CMakeLists.txt
@@ -4,6 +4,14 @@ project(ModuleDefinition C)
 # Test .def file source recognition for DLLs.
 add_library(example_dll SHARED example_dll.c example_dll.def)
 
+# Test generated .def file.
+add_custom_command(OUTPUT example_dll_gen.def
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/example_dll_gen.def.in
+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/example_dll_gen.def.in
+                                   ${CMAKE_CURRENT_BINARY_DIR}/example_dll_gen.def
+  )
+add_library(example_dll_gen SHARED example_dll_gen.c example_dll_gen.def)
+
 # Test /DEF:<file> flag recognition for VS.
 if(MSVC OR "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
   add_library(example_dll_2 SHARED example_dll_2.c)
@@ -16,7 +24,7 @@ endif()
 # Test .def file source recognition for EXEs.
 add_executable(example_exe example_exe.c example_exe.def)
 set_property(TARGET example_exe PROPERTY ENABLE_EXPORTS 1)
-target_link_libraries(example_exe example_dll ${example_dll_2})
+target_link_libraries(example_exe example_dll example_dll_gen ${example_dll_2})
 
 # Test linking to the executable.
 add_library(example_mod_1 MODULE example_mod_1.c)
diff --git a/Tests/ModuleDefinition/example_dll_gen.c b/Tests/ModuleDefinition/example_dll_gen.c
new file mode 100644
index 0000000..be5d1ee
--- /dev/null
+++ b/Tests/ModuleDefinition/example_dll_gen.c
@@ -0,0 +1 @@
+int example_dll_gen_function(void) { return 0; }
diff --git a/Tests/ModuleDefinition/example_dll_gen.def.in b/Tests/ModuleDefinition/example_dll_gen.def.in
new file mode 100644
index 0000000..c489dbc
--- /dev/null
+++ b/Tests/ModuleDefinition/example_dll_gen.def.in
@@ -0,0 +1,2 @@
+EXPORTS
+example_dll_gen_function
diff --git a/Tests/ModuleDefinition/example_exe.c b/Tests/ModuleDefinition/example_exe.c
index c521b3a..253ae8b 100644
--- a/Tests/ModuleDefinition/example_exe.c
+++ b/Tests/ModuleDefinition/example_exe.c
@@ -1,4 +1,5 @@
 extern int __declspec(dllimport) example_dll_function(void);
+extern int __declspec(dllimport) example_dll_gen_function(void);
 #ifdef EXAMPLE_DLL_2
 extern int __declspec(dllimport) example_dll_2_function(void);
 #endif
@@ -7,6 +8,7 @@ int main(void)
 {
   return
     example_dll_function() +
+    example_dll_gen_function() +
 #ifdef EXAMPLE_DLL_2
     example_dll_2_function() +
 #endif

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

Summary of changes:
 Source/cmNinjaTargetGenerator.cxx             |   13 +++++++++----
 Source/cmNinjaTargetGenerator.h               |    3 +++
 Tests/ModuleDefinition/CMakeLists.txt         |   10 +++++++++-
 Tests/ModuleDefinition/example_dll_gen.c      |    1 +
 Tests/ModuleDefinition/example_dll_gen.def.in |    2 ++
 Tests/ModuleDefinition/example_exe.c          |    2 ++
 6 files changed, 26 insertions(+), 5 deletions(-)
 create mode 100644 Tests/ModuleDefinition/example_dll_gen.c
 create mode 100644 Tests/ModuleDefinition/example_dll_gen.def.in


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list