[cmake-commits] king committed cmGlobalXCodeGenerator.cxx 1.184 1.185 cmLocalGenerator.cxx 1.264 1.265 cmLocalGenerator.h 1.102 1.103 cmMakefileExecutableTargetGenerator.cxx 1.41 1.42 cmMakefileLibraryTargetGenerator.cxx 1.54 1.55 cmTarget.cxx 1.195 1.196

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Feb 14 15:31:11 EST 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv11827/Source

Modified Files:
	cmGlobalXCodeGenerator.cxx cmLocalGenerator.cxx 
	cmLocalGenerator.h cmMakefileExecutableTargetGenerator.cxx 
	cmMakefileLibraryTargetGenerator.cxx cmTarget.cxx 
Log Message:
ENH: Allow multiple OS X applications bundles to be created in a single build directory.  Converted Info.plist files to be generated directly instead of configured with make variables.  The MACOSX_BUNDLE_* variables are now properties (and vars for compatibility).


Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -d -r1.264 -r1.265
--- cmLocalGenerator.cxx	1 Feb 2008 13:56:00 -0000	1.264
+++ cmLocalGenerator.cxx	14 Feb 2008 20:31:08 -0000	1.265
@@ -2732,3 +2732,86 @@
   // Assume it is supported.
   return true;
 }
+
+//----------------------------------------------------------------------------
+static std::string cmLGInfoProp(cmTarget* target, const char* prop)
+{
+  if(const char* val = target->GetProperty(prop))
+    {
+    return val;
+    }
+  else
+    {
+    // For compatibility check for a variable.
+    return target->GetMakefile()->GetSafeDefinition(prop);
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
+                                              const char* targetName,
+                                              const char* fname)
+{
+  std::string info_EXECUTABLE_NAME = targetName;
+
+  // Lookup the properties.
+  std::string info_INFO_STRING =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_INFO_STRING");
+  std::string info_ICON_FILE =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_ICON_FILE");
+  std::string info_GUI_IDENTIFIER =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_GUI_IDENTIFIER");
+  std::string info_LONG_VERSION_STRING =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_LONG_VERSION_STRING");
+  std::string info_BUNDLE_NAME =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_BUNDLE_NAME");
+  std::string info_SHORT_VERSION_STRING =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_SHORT_VERSION_STRING");
+  std::string info_BUNDLE_VERSION =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_BUNDLE_VERSION");
+  std::string info_COPYRIGHT =
+    cmLGInfoProp(target, "MACOSX_BUNDLE_COPYRIGHT");
+
+  // Generate the file.
+  cmGeneratedFileStream fout(fname);
+  fout.SetCopyIfDifferent(true);
+  fout <<
+    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+    "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n"
+    "  \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
+    "<plist version=\"1.0\">\n"
+    "<dict>\n"
+    "\t<key>CFBundleDevelopmentRegion</key>\n"
+    "\t<string>English</string>\n"
+    "\t<key>CFBundleExecutable</key>\n"
+    "\t<string>" << info_EXECUTABLE_NAME << "</string>\n"
+    "\t<key>CFBundleGetInfoString</key>\n"
+    "\t<string>" << info_INFO_STRING << "</string>\n"
+    "\t<key>CFBundleIconFile</key>\n"
+    "\t<string>" << info_ICON_FILE << "</string>\n"
+    "\t<key>CFBundleIdentifier</key>\n"
+    "\t<string>" << info_GUI_IDENTIFIER << "</string>\n"
+    "\t<key>CFBundleInfoDictionaryVersion</key>\n"
+    "\t<string>6.0</string>\n"
+    "\t<key>CFBundleLongVersionString</key>\n"
+    "\t<string>" << info_LONG_VERSION_STRING << "</string>\n"
+    "\t<key>CFBundleName</key>\n"
+    "\t<string>" << info_BUNDLE_NAME << "</string>\n"
+    "\t<key>CFBundlePackageType</key>\n"
+    "\t<string>APPL</string>\n"
+    "\t<key>CFBundleShortVersionString</key>\n"
+    "\t<string>" << info_SHORT_VERSION_STRING << "</string>\n"
+    "\t<key>CFBundleSignature</key>\n"
+    "\t<string>????" /* break string to avoid trigraph */ "</string>\n"
+    "\t<key>CFBundleVersion</key>\n"
+    "\t<string>" << info_BUNDLE_VERSION << "</string>\n"
+    "\t<key>CSResourcesFileMapped</key>\n"
+    "\t<true/>\n"
+    "\t<key>LSRequiresCarbon</key>\n"
+    "\t<true/>\n"
+    "\t<key>NSHumanReadableCopyright</key>\n"
+    "\t<string>" << info_COPYRIGHT << "</string>\n"
+    "</dict>\n"
+    "</plist>\n"
+    ;
+}

Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- cmLocalGenerator.h	30 Jan 2008 02:16:49 -0000	1.102
+++ cmLocalGenerator.h	14 Feb 2008 20:31:08 -0000	1.103
@@ -269,6 +269,12 @@
   bool NeedBackwardsCompatibility(unsigned int major,
                                   unsigned int minor,
                                   unsigned int patch = 0xFFu);
+
+  /**
+   * Generate a Mac OS X application bundle Info.plist file.
+   */
+  void GenerateAppleInfoPList(cmTarget* target, const char* targetName,
+                              const char* fname);
 protected:
   /** Construct a comment for a custom command.  */
   std::string ConstructComment(const cmCustomCommand& cc,

Index: cmGlobalXCodeGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- cmGlobalXCodeGenerator.cxx	7 Feb 2008 21:49:11 -0000	1.184
+++ cmGlobalXCodeGenerator.cxx	14 Feb 2008 20:31:08 -0000	1.185
@@ -1482,18 +1482,15 @@
     if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
       {
       productType = "com.apple.product-type.application";
-      std::string f1 =
-        this->CurrentMakefile->GetModulesFile("MacOSXBundleInfo.plist.in");
-      if ( f1.size() == 0 )
-        {
-        cmSystemTools::Error("could not find Mac OSX bundle template file.");
-        }
-      std::string f2 = this->CurrentMakefile->GetCurrentOutputDirectory();
-      f2 += "/Info.plist";
-      this->CurrentMakefile->ConfigureFile(f1.c_str(), f2.c_str(),
-                                       false, false, false);
-      std::string path = 
-        this->ConvertToRelativeForXCode(f2.c_str());
+      std::string plist = this->CurrentMakefile->GetCurrentOutputDirectory();
+      plist += cmake::GetCMakeFilesDirectory();
+      plist += "/";
+      plist += target.GetName();
+      plist += "Info.plist";
+      this->CurrentLocalGenerator
+        ->GenerateAppleInfoPList(&target, productName.c_str(), plist.c_str());
+      std::string path =
+        this->ConvertToRelativeForXCode(plist.c_str());
       buildSettings->AddAttribute("INFOPLIST_FILE", 
                                   this->CreateString(path.c_str()));
 

Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- cmMakefileLibraryTargetGenerator.cxx	7 Feb 2008 21:49:11 -0000	1.54
+++ cmMakefileLibraryTargetGenerator.cxx	14 Feb 2008 20:31:08 -0000	1.55
@@ -364,22 +364,6 @@
 
   //cmSystemTools::MakeDirectory((macdir + "Libraries").c_str());
   cmSystemTools::MakeDirectory((macdir + "Headers").c_str());
-  // Configure the Info.plist file.  Note that it needs the executable name
-  // to be set
-  std::string rsrcDir = macdir + "Resources/";
-  cmSystemTools::MakeDirectory(rsrcDir.c_str());
-  this->Makefile->AddDefinition("MACOSX_FRAMEWORK_NAME",
-                                targetName.c_str());
-  std::string f1 = 
-    this->Makefile->GetModulesFile("MacOSXFrameworkInfo.plist.in");
-  if ( f1.size() == 0 )
-    {
-    cmSystemTools::Error(
-      "could not find Mac OSX framework Info.plist template file.");
-    }
-  std::string f2 = rsrcDir + "Info.plist";
-  this->Makefile->ConfigureFile(f1.c_str(), f2.c_str(),
-                                false, false, false);
 
   this->CopyFrameworkSources(targetName, outpath, version,
     "PRIVATE_HEADER", "PrivateHeaders");

Index: cmMakefileExecutableTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileExecutableTargetGenerator.cxx,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- cmMakefileExecutableTargetGenerator.cxx	30 Jan 2008 02:16:49 -0000	1.41
+++ cmMakefileExecutableTargetGenerator.cxx	14 Feb 2008 20:31:08 -0000	1.42
@@ -133,13 +133,6 @@
     outpath += "/";
 
     // Make bundle directories
-    std::string f1 =
-      this->Makefile->GetModulesFile("MacOSXBundleInfo.plist.in");
-    if ( f1.size() == 0 )
-      {
-      cmSystemTools::Error("could not find Mac OSX bundle template file.");
-      }
-
     std::vector<cmSourceFile*>::const_iterator sourceIt;
     for ( sourceIt = this->Target->GetSourceFiles().begin();
       sourceIt != this->Target->GetSourceFiles().end();
@@ -162,11 +155,10 @@
 
     // Configure the Info.plist file.  Note that it needs the executable name
     // to be set.
-    std::string f2 = macdir + "Info.plist";
-    this->Makefile->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME",
-                                  targetName.c_str());
-    this->Makefile->ConfigureFile(f1.c_str(), f2.c_str(), 
-                                  false, false, false);
+    std::string plist = macdir + "Info.plist";
+    this->LocalGenerator->GenerateAppleInfoPList(this->Target,
+                                                 targetName.c_str(),
+                                                 plist.c_str());
     }
 #endif
   std::string outpathImp;

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- cmTarget.cxx	11 Feb 2008 18:35:39 -0000	1.195
+++ cmTarget.cxx	14 Feb 2008 20:31:08 -0000	1.196
@@ -510,7 +510,19 @@
      "When this property is set to true the executable when built "
      "on Mac OS X will be created as an application bundle.  "
      "This makes it a GUI executable that can be launched from "
-     "the Finder.");
+     "the Finder.\n"
+     "The bundle Info.plist file is generated automatically.  "
+     "The following target properties may be set to specify "
+     "its content:"
+     "  MACOSX_BUNDLE_INFO_STRING\n"
+     "  MACOSX_BUNDLE_ICON_FILE\n"
+     "  MACOSX_BUNDLE_GUI_IDENTIFIER\n"
+     "  MACOSX_BUNDLE_LONG_VERSION_STRING\n"
+     "  MACOSX_BUNDLE_BUNDLE_NAME\n"
+     "  MACOSX_BUNDLE_SHORT_VERSION_STRING\n"
+     "  MACOSX_BUNDLE_BUNDLE_VERSION\n"
+     "  MACOSX_BUNDLE_COPYRIGHT\n"
+      );
 
   cm->DefineProperty
     ("ENABLE_EXPORTS", cmProperty::TARGET,



More information about the Cmake-commits mailing list