summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-03-31 18:17:23 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-03-31 18:17:23 (GMT)
commitae10b3578d3234db1e379b663657fbdb9d1ac543 (patch)
tree39fd57f7548112c5bb1d3501c9a80fb686911bbf /Source
parentbc649db7cc51acbd56c145fd884a49f049c8393f (diff)
downloadCMake-ae10b3578d3234db1e379b663657fbdb9d1ac543.zip
CMake-ae10b3578d3234db1e379b663657fbdb9d1ac543.tar.gz
CMake-ae10b3578d3234db1e379b663657fbdb9d1ac543.tar.bz2
ENH: add a wrapper for xcodebuild to get around bug and verbose output
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt9
-rw-r--r--Source/cmGlobalGenerator.cxx23
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
-rw-r--r--Source/cmTryCompileCommand.cxx14
-rw-r--r--Source/cmakemain.cxx11
-rw-r--r--Source/cmakexbuild.cxx25
6 files changed, 52 insertions, 38 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 077872b..03f5155 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -282,6 +282,11 @@ SET(CPACK_SRCS
ADD_LIBRARY(CPackLib ${CPACK_SRCS})
TARGET_LINK_LIBRARIES(CPackLib CMakeLib)
+IF(APPLE)
+ ADD_EXECUTABLE(cmakexbuild cmakexbuild.cxx)
+ TARGET_LINK_LIBRARIES(cmakexbuild CMakeLib)
+ENDIF(APPLE)
+
# Build CMake executable
ADD_EXECUTABLE(cmake cmakemain.cxx)
TARGET_LINK_LIBRARIES(cmake CMakeLib)
@@ -1088,4 +1093,8 @@ INCLUDE (${CMAKE_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
INSTALL_TARGETS(/bin cmake)
INSTALL_TARGETS(/bin ctest)
INSTALL_TARGETS(/bin cpack)
+IF(APPLE)
+ INSTALL_TARGETS(/bin cmakexbuild)
+ENDIF(APPLE)
+
INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h)
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 29ac5b1..51dac3a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -99,7 +99,25 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
"make program",
cmCacheManager::FILEPATH);
}
-
+ if(makeProgram.find("xcodebuild") != makeProgram.npos)
+ {
+ // due to the text file busy /bin/sh problem with xcodebuild
+ // use the cmakexbuild wrapper instead. This program
+ // will run xcodebuild and if it sees the error text file busy
+ // it will stop forwarding output, and let the build finish.
+ // Then it will retry the build. It will continue this
+ // untill no text file busy errors occur.
+ std::string cmakexbuild =
+ this->CMakeInstance->GetCacheManager()->GetCacheValue("CMAKE_COMMAND");
+ cmakexbuild = cmakexbuild.substr(0, cmakexbuild.length()-5);
+ cmakexbuild += "cmakexbuild";
+
+ this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM",
+ cmakexbuild.c_str(),
+ "make program",
+ cmCacheManager::FILEPATH);
+
+ }
}
// enable the given language
@@ -1313,9 +1331,8 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
else
{
singleLine.push_back(cmakeCommand);
- singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
- singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
singleLine.push_back("-i");
+ singleLine.push_back(".");
cpackCommandLines.push_back(singleLine);
(*targets)[editCacheTargetName] =
this->CreateGlobalTarget(
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 3d5dce7..5e01987 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1148,8 +1148,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CreateString("mh_bundle"));
buildSettings->AddAttribute("GCC_DYNAMIC_NO_PIC",
this->CreateString("NO"));
- buildSettings->AddAttribute("PREBINDING",
- this->CreateString("NO"));
buildSettings->AddAttribute("GCC_SYMBOLS_PRIVATE_EXTERN",
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
@@ -1245,7 +1243,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
default:
break;
}
-
+ if(this->XcodeVersion >= 22)
+ {
+ buildSettings->AddAttribute("PREBINDING",
+ this->CreateString("NO"));
+ }
std::string dirs;
std::vector<std::string> includes;
this->CurrentLocalGenerator->GetIncludeDirectories(includes);
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index 1094664..e524b77 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -231,20 +231,6 @@ int cmTryCompileCommand::CoreTryCompileCode(
// actually do the try compile now that everything is setup
int res = mf->TryCompile(sourceDirectory, binaryDirectory,
projectName, targetName, &cmakeFlags, &output);
- // for the xcode generator
- if(strcmp(mf->GetCMakeInstance()->GetGlobalGenerator()->GetName() ,
- "Xcode") == 0)
- {
- int numTrys = 0;
- while(output.find("/bin/sh: bad interpreter: Text file busy")
- != output.npos && numTrys < 4)
- {
- output = "";
- res = mf->TryCompile(sourceDirectory, binaryDirectory,
- projectName, targetName, &cmakeFlags, &output);
- numTrys++;
- }
- }
if ( erroroc )
{
cmSystemTools::SetErrorOccured();
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index d4bbd8d..a3bb75c 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -17,9 +17,9 @@
#include "cmake.h"
#include "cmCacheManager.h"
#include "cmListFileCache.h"
+#include "cmakewizard.h"
#ifdef CMAKE_BUILD_WITH_CMAKE
-#include "cmakewizard.h"
#include "cmDynamicLoader.h"
#include "cmDocumentation.h"
@@ -182,9 +182,7 @@ int do_cmake(int ac, char** av)
}
#endif
-#if defined(CMAKE_BUILD_WITH_CMAKE)
bool wiz = false;
-#endif
bool command = false;
bool list_cached = false;
bool list_all_cached = false;
@@ -194,16 +192,13 @@ int do_cmake(int ac, char** av)
std::vector<std::string> args;
for(int i =0; i < ac; ++i)
{
-#if defined(CMAKE_BUILD_WITH_CMAKE)
if(strcmp(av[i], "-i") == 0)
{
wiz = true;
}
- else
-#endif
// if command has already been set, then
// do not eat the -E
- if (!command && strcmp(av[i], "-E") == 0)
+ else if (!command && strcmp(av[i], "-E") == 0)
{
command = true;
}
@@ -251,13 +246,11 @@ int do_cmake(int ac, char** av)
int ret = cmake::ExecuteCMakeCommand(args);
return ret;
}
-#if defined(CMAKE_BUILD_WITH_CMAKE)
if (wiz)
{
cmakewizard wizard;
return wizard.RunWizard(args);
}
-#endif
cmake cm;
cm.SetProgressCallback(updateProgress, 0);
cm.SetScriptMode(script_mode);
diff --git a/Source/cmakexbuild.cxx b/Source/cmakexbuild.cxx
index b0728aa..6bf4da4 100644
--- a/Source/cmakexbuild.cxx
+++ b/Source/cmakexbuild.cxx
@@ -1,6 +1,13 @@
#include <cmsys/Process.h>
#include "cmStandardIncludes.h"
+// This is a wrapper program for xcodebuild
+// it calls xcodebuild, and does two things
+// it removes much of the output, all the setevn
+// stuff. Also, it checks for the text file busy
+// error, and re-runs xcodebuild until that error does
+// not show up.
+
int WaitForLine(cmsysProcess* process, std::string& line,
double timeout,
std::vector<char>& out,
@@ -113,29 +120,31 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
std::vector<char> out;
std::vector<char> err;
std::string line;
- int pipe =WaitForLine(cp, line, 0, out, err);
+ int pipe =WaitForLine(cp, line, 100.0, out, err);
while(pipe != cmsysProcess_Pipe_None)
{
if(line.find("/bin/sh: bad interpreter: Text file busy")
!= line.npos)
{
hitbug = true;
- std::cerr << "Found xcodebuild bug: " << line << "\n";
+ std::cerr << "Hit xcodebuild bug : " << line << "\n";
}
// if the bug is hit, no more output should be generated
// because it may contain bogus errors
- if(!hitbug)
+ // also remove all output with setenv in it to tone down
+ // the verbosity of xcodebuild
+ if(!hitbug && (line.find("setenv") == line.npos))
{
if(pipe == cmsysProcess_Pipe_STDERR)
{
- std::cerr << line;
+ std::cerr << line << "\n";
}
else if(pipe == cmsysProcess_Pipe_STDOUT)
{
- std::cout << line;
+ std::cout << line << "\n";
}
- pipe =WaitForLine(cp, line, 0, out, err);
}
+ pipe =WaitForLine(cp, line, 100, out, err);
}
cmsysProcess_WaitForExit(cp, 0);
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited)
@@ -144,7 +153,6 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
}
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Error)
{
- std::cerr << "error\n";
return -1;
}
return -1;
@@ -160,12 +168,11 @@ int main(int ac, char*av[])
}
argv.push_back(0);
bool hitbug = true;
- int ret;
+ int ret = 0;
while(hitbug)
{
ret = RunXCode(argv, hitbug);
}
- std::cerr << "ret " << ret << "\n";
if(ret < 0)
{
return 255;