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).
This commit is contained in:
parent
7b1c305d86
commit
67f8c0fd10
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleLongVersionString</key>
|
|
||||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
|
||||||
<key>CSResourcesFileMapped</key>
|
|
||||||
<true/>
|
|
||||||
<key>LSRequiresCarbon</key>
|
|
||||||
<true/>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>English</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>${MACOSX_FRAMEWORK_NAME}</string>
|
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>${MACOSX_FRAMEWORK_INFO_STRING}</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>${MACOSX_FRAMEWORK_IDENTIFIER}</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>FMWK</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>${MACOSX_FRAMEWORK_SHORT_VERSION_STRING}</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>${MACOSX_FRAMEWORK_BUNDLE_VERSION}</string>
|
|
||||||
<key>CSResourcesFileMapped</key>
|
|
||||||
<true/>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>${MACOSX_FRAMEWORK_COPYRIGHT}</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -1482,18 +1482,15 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
|
||||||
if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
|
if(target.GetPropertyAsBool("MACOSX_BUNDLE"))
|
||||||
{
|
{
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
std::string f1 =
|
std::string plist = this->CurrentMakefile->GetCurrentOutputDirectory();
|
||||||
this->CurrentMakefile->GetModulesFile("MacOSXBundleInfo.plist.in");
|
plist += cmake::GetCMakeFilesDirectory();
|
||||||
if ( f1.size() == 0 )
|
plist += "/";
|
||||||
{
|
plist += target.GetName();
|
||||||
cmSystemTools::Error("could not find Mac OSX bundle template file.");
|
plist += "Info.plist";
|
||||||
}
|
this->CurrentLocalGenerator
|
||||||
std::string f2 = this->CurrentMakefile->GetCurrentOutputDirectory();
|
->GenerateAppleInfoPList(&target, productName.c_str(), plist.c_str());
|
||||||
f2 += "/Info.plist";
|
|
||||||
this->CurrentMakefile->ConfigureFile(f1.c_str(), f2.c_str(),
|
|
||||||
false, false, false);
|
|
||||||
std::string path =
|
std::string path =
|
||||||
this->ConvertToRelativeForXCode(f2.c_str());
|
this->ConvertToRelativeForXCode(plist.c_str());
|
||||||
buildSettings->AddAttribute("INFOPLIST_FILE",
|
buildSettings->AddAttribute("INFOPLIST_FILE",
|
||||||
this->CreateString(path.c_str()));
|
this->CreateString(path.c_str()));
|
||||||
|
|
||||||
|
|
|
@ -2732,3 +2732,86 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
|
||||||
// Assume it is supported.
|
// Assume it is supported.
|
||||||
return true;
|
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"
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
|
@ -269,6 +269,12 @@ public:
|
||||||
bool NeedBackwardsCompatibility(unsigned int major,
|
bool NeedBackwardsCompatibility(unsigned int major,
|
||||||
unsigned int minor,
|
unsigned int minor,
|
||||||
unsigned int patch = 0xFFu);
|
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:
|
protected:
|
||||||
/** Construct a comment for a custom command. */
|
/** Construct a comment for a custom command. */
|
||||||
std::string ConstructComment(const cmCustomCommand& cc,
|
std::string ConstructComment(const cmCustomCommand& cc,
|
||||||
|
|
|
@ -133,13 +133,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
outpath += "/";
|
outpath += "/";
|
||||||
|
|
||||||
// Make bundle directories
|
// 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;
|
std::vector<cmSourceFile*>::const_iterator sourceIt;
|
||||||
for ( sourceIt = this->Target->GetSourceFiles().begin();
|
for ( sourceIt = this->Target->GetSourceFiles().begin();
|
||||||
sourceIt != this->Target->GetSourceFiles().end();
|
sourceIt != this->Target->GetSourceFiles().end();
|
||||||
|
@ -162,11 +155,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
|
|
||||||
// Configure the Info.plist file. Note that it needs the executable name
|
// Configure the Info.plist file. Note that it needs the executable name
|
||||||
// to be set.
|
// to be set.
|
||||||
std::string f2 = macdir + "Info.plist";
|
std::string plist = macdir + "Info.plist";
|
||||||
this->Makefile->AddDefinition("MACOSX_BUNDLE_EXECUTABLE_NAME",
|
this->LocalGenerator->GenerateAppleInfoPList(this->Target,
|
||||||
targetName.c_str());
|
targetName.c_str(),
|
||||||
this->Makefile->ConfigureFile(f1.c_str(), f2.c_str(),
|
plist.c_str());
|
||||||
false, false, false);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
std::string outpathImp;
|
std::string outpathImp;
|
||||||
|
|
|
@ -364,22 +364,6 @@ void cmMakefileLibraryTargetGenerator::CreateFramework(
|
||||||
|
|
||||||
//cmSystemTools::MakeDirectory((macdir + "Libraries").c_str());
|
//cmSystemTools::MakeDirectory((macdir + "Libraries").c_str());
|
||||||
cmSystemTools::MakeDirectory((macdir + "Headers").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,
|
this->CopyFrameworkSources(targetName, outpath, version,
|
||||||
"PRIVATE_HEADER", "PrivateHeaders");
|
"PRIVATE_HEADER", "PrivateHeaders");
|
||||||
|
|
|
@ -510,7 +510,19 @@ void cmTarget::DefineProperties(cmake *cm)
|
||||||
"When this property is set to true the executable when built "
|
"When this property is set to true the executable when built "
|
||||||
"on Mac OS X will be created as an application bundle. "
|
"on Mac OS X will be created as an application bundle. "
|
||||||
"This makes it a GUI executable that can be launched from "
|
"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
|
cm->DefineProperty
|
||||||
("ENABLE_EXPORTS", cmProperty::TARGET,
|
("ENABLE_EXPORTS", cmProperty::TARGET,
|
||||||
|
|
Loading…
Reference in New Issue