Commit afb32501 authored by Gregor Jasny's avatar Gregor Jasny

Xcode: Require at least Xcode 5

parent 657b3090
......@@ -102,9 +102,6 @@ if(CMake_INSTALL_COMPONENTS)
if(WIN32 AND NOT CYGWIN)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmcldeps)
endif()
if(APPLE)
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmakexbuild)
endif()
if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME)
set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME
${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
......
......@@ -109,16 +109,6 @@ if(CPACK_GENERATOR MATCHES "IFW")
set(CPACK_IFW_COMPONENT_CMCLDEPS_VERSION
"@CMake_IFW_ROOT_COMPONENT_VERSION@")
set(CPACK_COMPONENT_CMAKEXBUILD_DISPLAY_NAME "cmakexbuild")
set(CPACK_COMPONENT_CMAKEXBUILD_DESCRIPTION
"The \"cmakexbuild\" executable is a wrapper program for \"xcodebuild\"")
set(CPACK_COMPONENT_CMAKEXBUILD_REQUIRED TRUE)
set(CPACK_COMPONENT_CMAKEXBUILD_GROUP Tools)
set(CPACK_IFW_COMPONENT_CMAKEXBUILD_NAME "CMakeXBuild")
set(CPACK_IFW_COMPONENT_CMAKEXBUILD_PRIORITY 85)
set(CPACK_IFW_COMPONENT_CMAKEXBUILD_VERSION
"@CMake_IFW_ROOT_COMPONENT_VERSION@")
# Dialogs
set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs")
set(CPACK_COMPONENT_GROUP_DIALOGS_DESCRIPTION
......
......@@ -3,9 +3,7 @@ Xcode
Generate Xcode project files.
This supports Xcode 3.0 and above. Support for Xcode versions prior
to Xcode 5 is deprecated and will be dropped in a future version of
CMake.
This supports Xcode 5.0 and above.
Toolset Selection
^^^^^^^^^^^^^^^^^
......
require-xcode-5
---------------
* The :generator:`Xcode` generator now requires at least Xcode 5.
......@@ -19,15 +19,11 @@ to configure the project:
This generator stores ``CMAKE_MAKE_PROGRAM`` in the CMake cache
so that it may be edited by the user.
* The :generator:`Xcode` generator sets this to ``xcodebuild`` (or possibly an
otherwise undocumented ``cmakexbuild`` wrapper implementing some
workarounds).
* The :generator:`Xcode` generator sets this to ``xcodebuild``.
This generator prefers to lookup the build tool at build time
rather than to store ``CMAKE_MAKE_PROGRAM`` in the CMake cache
ahead of time. This is because ``xcodebuild`` is easy to find,
the ``cmakexbuild`` wrapper is needed only for older Xcode versions,
and the path to ``cmakexbuild`` may be outdated if CMake itself moves.
ahead of time. This is because ``xcodebuild`` is easy to find.
For compatibility with versions of CMake prior to 3.2, if
a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to
......
......@@ -1060,9 +1060,6 @@ if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARI
endif()
if(APPLE)
add_executable(cmakexbuild cmakexbuild.cxx)
list(APPEND _tools cmakexbuild)
target_link_libraries(cmakexbuild CMakeLib)
add_executable(OSXScriptLauncher
CPack/OSXScriptLauncher.cxx)
target_link_libraries(OSXScriptLauncher cmsys)
......
......@@ -217,7 +217,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
sscanf(version_string.c_str(), "%u.%u", &v[0], &v[1]);
unsigned int version_number = 10 * v[0] + v[1];
if (version_number < 30) {
if (version_number < 50) {
cm->IssueMessage(MessageType::FATAL_ERROR,
"Xcode " + version_string + " not supported.");
return nullptr;
......@@ -256,15 +256,11 @@ std::string const& cmGlobalXCodeGenerator::GetXcodeBuildCommand()
std::string cmGlobalXCodeGenerator::FindXcodeBuildCommand()
{
if (this->XcodeVersion >= 40) {
std::string makeProgram = cmSystemTools::FindProgram("xcodebuild");
if (makeProgram.empty()) {
makeProgram = "xcodebuild";
}
return makeProgram;
std::string makeProgram = cmSystemTools::FindProgram("xcodebuild");
if (makeProgram.empty()) {
makeProgram = "xcodebuild";
}
// Use cmakexbuild wrapper to suppress environment dump from output.
return cmSystemTools::GetCMakeCommand() + "xbuild";
return makeProgram;
}
bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
......@@ -550,12 +546,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// run the depend check makefile as a post build rule
// this will make sure that when the next target is built
// things are up-to-date
if (target->GetType() == cmStateEnums::OBJECT_LIBRARY ||
(this->XcodeVersion < 50 &&
(target->GetType() == cmStateEnums::EXECUTABLE ||
target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::SHARED_LIBRARY ||
target->GetType() == cmStateEnums::MODULE_LIBRARY))) {
if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
makeHelper.back() = // fill placeholder
this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
cmCustomCommandLines commandLines;
......@@ -1183,23 +1174,6 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
}
}
if (this->XcodeVersion < 50) {
// Add object library contents as external objects. (Equivalent to
// the externalObjFiles above, except each one is not a cmSourceFile
// within the target.)
std::vector<cmSourceFile const*> objs;
gtgt->GetExternalObjects(objs, "");
for (auto sourceFile : objs) {
if (sourceFile->GetObjectLibrary().empty()) {
continue;
}
std::string const& obj = sourceFile->GetFullPath();
cmXCodeObject* xsf =
this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr);
externalObjFiles.push_back(xsf);
}
}
// some build phases only apply to bundles and/or frameworks
bool isFrameworkTarget = gtgt->IsFrameworkOnApple();
bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE");
......@@ -2123,9 +2097,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
default:
break;
}
if (this->XcodeVersion < 40) {
buildSettings->AddAttribute("PREBINDING", this->CreateString("NO"));
}
BuildObjectListOrString dirs(this, true);
BuildObjectListOrString fdirs(this, true);
......@@ -2775,8 +2746,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// Loop over configuration types and set per-configuration info.
for (auto const& configName : this->CurrentConfigurationTypes) {
// Get the current configuration name.
if (this->XcodeVersion >= 50) {
{
// Add object library contents as link flags.
std::string linkObjs;
const char* sep = "";
......@@ -2886,7 +2856,7 @@ bool cmGlobalXCodeGenerator::CreateGroups(
// Put cmSourceFile instances in proper groups:
for (auto const& si : gtgt->GetAllConfigSources()) {
cmSourceFile const* sf = si.Source;
if (this->XcodeVersion >= 50 && !sf->GetObjectLibrary().empty()) {
if (!sf->GetObjectLibrary().empty()) {
// Object library files go on the link line instead.
continue;
}
......@@ -3076,16 +3046,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
v << std::setfill('0') << std::setw(4) << XcodeVersion * 10;
group->AddAttribute("LastUpgradeCheck", this->CreateString(v.str()));
this->RootObject->AddAttribute("attributes", group);
if (this->XcodeVersion >= 32) {
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.2"));
} else if (this->XcodeVersion >= 31) {
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.1"));
} else {
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.0"));
}
this->RootObject->AddAttribute("compatibilityVersion",
this->CreateString("Xcode 3.2"));
// Point Xcode at the top of the source tree.
{
std::string pdir =
......@@ -3540,13 +3502,7 @@ void cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
cmXCodeObject::Indent(1, fout);
fout << "};\n";
cmXCodeObject::Indent(1, fout);
if (this->XcodeVersion >= 32) {
fout << "objectVersion = 46;\n";
} else if (this->XcodeVersion >= 31) {
fout << "objectVersion = 45;\n";
} else {
fout << "objectVersion = 44;\n";
}
fout << "objectVersion = 46;\n";
cmXCode21Object::PrintList(this->XCodeObjects, fout);
cmXCodeObject::Indent(1, fout);
fout << "rootObject = " << this->RootObject->GetId()
......@@ -3714,11 +3670,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags,
// Flag value with escaped quotes and backslashes.
for (auto c : flag) {
if (c == '\'') {
if (this->XcodeVersion >= 40) {
flags += "'\\''";
} else {
flags += "\\'";
}
flags += "'\\''";
} else if (c == '\\') {
flags += "\\\\";
} else {
......
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmsys/Process.h"
#include <iostream>
#include <string>
#include <vector>
#include "cmDuration.h"
#include "cmSystemTools.h"
// This is a wrapper program for xcodebuild
// it calls xcodebuild, and does two things
// it removes much of the output, all the setenv
// stuff. Also, it checks for the text file busy
// error, and re-runs xcodebuild until that error does
// not show up.
int RunXCode(std::vector<const char*>& argv, bool& hitbug)
{
hitbug = false;
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, argv.data());
cmsysProcess_SetTimeout(cp, 0);
cmsysProcess_Execute(cp);
std::vector<char> out;
std::vector<char> err;
std::string line;
int pipe =
cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out, err);
while (pipe != cmsysProcess_Pipe_None) {
if (line.find("/bin/sh: bad interpreter: Text file busy") !=
std::string::npos) {
hitbug = true;
std::cerr << "Hit xcodebuild bug : " << line << "\n";
}
// if the bug is hit, no more output should be generated
// because it may contain bogus errors
// also remove all output with setenv in it to tone down
// the verbosity of xcodebuild
if (!hitbug && (line.find("setenv") == std::string::npos)) {
if (pipe == cmsysProcess_Pipe_STDERR) {
std::cerr << line << "\n";
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
std::cout << line << "\n";
}
}
pipe = cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out,
err);
}
cmsysProcess_WaitForExit(cp, nullptr);
if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
return cmsysProcess_GetExitValue(cp);
}
if (cmsysProcess_GetState(cp) == cmsysProcess_State_Error) {
return -1;
}
return -1;
}
int main(int ac, char* av[])
{
std::vector<const char*> argv;
argv.push_back("xcodebuild");
for (int i = 1; i < ac; i++) {
argv.push_back(av[i]);
}
argv.push_back(nullptr);
bool hitbug = true;
int ret = 0;
while (hitbug) {
ret = RunXCode(argv, hitbug);
}
if (ret < 0) {
return 255;
}
return ret;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment