summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalCodeWarriorGenerator.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2003-04-16 18:47:44 (GMT)
committerKen Martin <ken.martin@kitware.com>2003-04-16 18:47:44 (GMT)
commit99b3152a60d9049d261da1dc3e70916aae09fa45 (patch)
tree9321dbecb789826a92fceebef4afa5fe27941ec5 /Source/cmLocalCodeWarriorGenerator.cxx
parent304582d2085cc2ff91fab3f6e5abbae9316ef934 (diff)
downloadCMake-99b3152a60d9049d261da1dc3e70916aae09fa45.zip
CMake-99b3152a60d9049d261da1dc3e70916aae09fa45.tar.gz
CMake-99b3152a60d9049d261da1dc3e70916aae09fa45.tar.bz2
add COdeWarrior back in for testing
Diffstat (limited to 'Source/cmLocalCodeWarriorGenerator.cxx')
-rw-r--r--Source/cmLocalCodeWarriorGenerator.cxx853
1 files changed, 733 insertions, 120 deletions
diff --git a/Source/cmLocalCodeWarriorGenerator.cxx b/Source/cmLocalCodeWarriorGenerator.cxx
index f9b406d..1b1fd74 100644
--- a/Source/cmLocalCodeWarriorGenerator.cxx
+++ b/Source/cmLocalCodeWarriorGenerator.cxx
@@ -1,17 +1,17 @@
/*=========================================================================
- Program: CMake - Cross-Platform Makefile Generator
- Module: $RCSfile$
- Language: C++
- Date: $Date$
- Version: $Revision$
+Program: CMake - Cross-Platform Makefile Generator
+Module: $RCSfile$
+Language: C++
+Date: $Date$
+Version: $Revision$
- Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
- See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
+See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "cmGlobalCodeWarriorGenerator.h"
@@ -20,6 +20,7 @@
#include "cmSystemTools.h"
#include "cmSourceFile.h"
#include "cmCacheManager.h"
+#include "cmake.h"
cmLocalCodeWarriorGenerator::cmLocalCodeWarriorGenerator()
{
@@ -37,7 +38,35 @@ void cmLocalCodeWarriorGenerator::Generate(bool /* fromTheTop */)
void cmLocalCodeWarriorGenerator::WriteTargets(std::ostream& fout)
{
+ // collect up the output names
+ // we do this here so any dependencies between targets will work,
+ // even if they are forward declared in the previous targets
cmTargets &tgts = m_Makefile->GetTargets();
+
+ for(cmTargets::iterator l = tgts.begin();
+ l != tgts.end(); l++)
+ {
+ std::string targetOutputName = l->first;
+ switch (l->second.GetType())
+ {
+ case cmTarget::STATIC_LIBRARY:
+ targetOutputName += ".lib";
+ break;
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ targetOutputName += ".dylib";
+ break;
+ case cmTarget::EXECUTABLE:
+ case cmTarget::WIN32_EXECUTABLE:
+ targetOutputName += cmSystemTools::GetExecutableExtension();
+ break;
+ default:;
+ }
+
+ m_TargetOutputFiles[l->first] = targetOutputName;
+ }
+
+ // write out the individual targets
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
@@ -71,8 +100,11 @@ void cmLocalCodeWarriorGenerator::AddFileMapping(std::ostream& fout,
bool ignored)
{
fout << "<SETTING>\n";
- fout << "<SETTING><NAME>FileType</NAME><VALUE>" << ftype <<
- "</VALUE></SETTING>\n";
+ if( strlen( ftype ) > 0 )
+ {
+ fout << "<SETTING><NAME>FileType</NAME><VALUE>" << ftype <<
+ "</VALUE></SETTING>\n";
+ }
fout << "<SETTING><NAME>FileExtension</NAME><VALUE>" << ext <<
"</VALUE></SETTING>\n";
fout << "<SETTING><NAME>Compiler</NAME><VALUE>" << comp <<
@@ -102,11 +134,24 @@ void cmLocalCodeWarriorGenerator::WriteSettingList(std::ostream& fout,
fout << "<SETTING><NAME>InterpretDOSAndUnixPaths</NAME><VALUE>false</VALUE></SETTING>\n";
fout << "<SETTING><NAME>RequireFrameworkStyleIncludes</NAME><VALUE>false</VALUE></SETTING>\n";
- // list the include paths
fout << "<SETTING><NAME>UserSearchPaths</NAME>\n";
- std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
- std::vector<std::string>::iterator i = includes.begin();
- for(;i != includes.end(); ++i)
+
+ // project relative path
+ fout << "<SETTING>\n";
+ fout << "<SETTING><NAME>SearchPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+
+ // list the include paths
+/* std::vector<std::string>& includes = l->GetIncludeDirectories();
+ std::vector<std::string>::iterator i = includes.begin();
+ for(;i != includes.end(); ++i)
{
fout << "<SETTING>\n";
fout << "<SETTING><NAME>SearchPath</NAME>\n";
@@ -118,9 +163,64 @@ void cmLocalCodeWarriorGenerator::WriteSettingList(std::ostream& fout,
fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>\n";
fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
fout << "</SETTING>\n";
+ }*/
+
+ // library paths
+
+ // now add in the libraries we depend on
+ cmRegularExpression isAframework("[ \t]*\\-framework");
+ cmRegularExpression isEnvironment("\\${");
+ cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
+ const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
+ cmTarget::LinkLibraries::const_iterator lib = libs.begin();
+ for(; lib != libs.end(); ++lib)
+ {
+ // no frameworks!
+ if( isAframework.find( lib->first.c_str() ) ) continue;
+
+ // no environment variables!
+ if( isEnvironment.find( lib->first.c_str() ) ) continue;
+
+ std::string libPath = lib->first + "_CMAKE_PATH";
+ // is this lib part of this project? Look in the cache
+ const char* cacheValue
+ = GetGlobalGenerator()->GetCMakeInstance()
+ ->GetCacheDefinition(libPath.c_str());
+
+ if( cacheValue )
+ {
+ // just tack it on
+ fout << "<SETTING>\n";
+ fout << "<SETTING><NAME>SearchPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>" << cacheValue << "</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ }
+ }
+
+ std::vector<std::string>& links = l->GetLinkDirectories();
+ std::vector<std::string>::iterator j = links.begin();
+ for(;j != links.end(); ++j)
+ {
+ fout << "<SETTING>\n";
+ fout << "<SETTING><NAME>SearchPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>" << j->c_str() << "</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
}
fout << "</SETTING>\n";
+ // system include and library paths
fout << "<SETTING><NAME>SystemSearchPaths</NAME>\n";
fout << "<SETTING>\n";
fout << "<SETTING><NAME>SearchPath</NAME>\n";
@@ -134,7 +234,7 @@ void cmLocalCodeWarriorGenerator::WriteSettingList(std::ostream& fout,
fout << "</SETTING>\n";
fout << "<SETTING>\n";
fout << "<SETTING><NAME>SearchPath</NAME>\n";
- fout << "<SETTING><NAME>Path</NAME><VALUE>:MacOS Support:</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>:MacOS X Support:</VALUE></SETTING>\n";
fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
fout << "<SETTING><NAME>PathRoot</NAME><VALUE>CodeWarrior</VALUE></SETTING>\n";
fout << "</SETTING>\n";
@@ -142,6 +242,46 @@ void cmLocalCodeWarriorGenerator::WriteSettingList(std::ostream& fout,
fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>\n";
fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
fout << "</SETTING>\n";
+ fout << "<SETTING>\n";
+ fout << "<SETTING><NAME>SearchPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>:usr:include:</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>OS X Volume</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING>\n";
+ fout << "<SETTING><NAME>SearchPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>:usr:lib:</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>OS X Volume</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING>\n";
+ fout << "<SETTING><NAME>SearchPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>:System:Library:Frameworks:</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>OS X Volume</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>true</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING>\n";
+ fout << "<SETTING><NAME>SearchPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE>:Library:Frameworks:</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>OS X Volume</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>FrameworkPath</NAME><VALUE>true</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
fout << "</SETTING>\n";
fout << "<SETTING><NAME>MWRuntimeSettings_WorkingDirectory</NAME><VALUE></VALUE></SETTING>\n";
@@ -154,107 +294,247 @@ void cmLocalCodeWarriorGenerator::WriteSettingList(std::ostream& fout,
fout << "<SETTING><NAME>MWRuntimeSettings_EnvVars</NAME><VALUE></VALUE></SETTING>\n";
// <!-- Settings for "Target Settings" panel -->
- fout << "<SETTING><NAME>Linker</NAME><VALUE>MacOS PPC Linker</VALUE></SETTING>\n";
+ if( l->GetType() == cmTarget::SHARED_LIBRARY ||
+ l->GetType() == cmTarget::MODULE_LIBRARY )
+ {
+ fout << "<SETTING><NAME>Linker</NAME><VALUE>Mach-O PPC Linker</VALUE></SETTING>\n";
+ }
+ else
+ {
+ fout << "<SETTING><NAME>Linker</NAME><VALUE>MacOS X PPC Linker</VALUE></SETTING>\n";
+ }
fout << "<SETTING><NAME>PreLinker</NAME><VALUE></VALUE></SETTING>\n";
fout << "<SETTING><NAME>PostLinker</NAME><VALUE></VALUE></SETTING>\n";
fout << "<SETTING><NAME>Targetname</NAME><VALUE>" << tgtName
<< "</VALUE></SETTING>\n";
fout << "<SETTING><NAME>OutputDirectory</NAME>\n";
- fout << "<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>Unix</VALUE></SETTING>\n";
fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>\n";
fout << "</SETTING>\n";
fout << "<SETTING><NAME>SaveEntriesUsingRelativePaths</NAME><VALUE>false</VALUE></SETTING>\n";
- // add the cxx file type
+ // add the cxx file type, and others
fout << "<SETTING><NAME>FileMappings</NAME>\n";
- this->AddFileMapping(fout,"TEXT",".cxx","MW C/C++ PPC","C/C++",
+
+ if( l->GetType() == cmTarget::SHARED_LIBRARY ||
+ l->GetType() == cmTarget::MODULE_LIBRARY )
+ {
+ this->AddFileMapping(fout,"TEXT",".cxx","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cpp","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".c","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cc","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cp","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cpp","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".h","MW C/C++ MachPPC","C/C++",
+ false,false,false,true);
+ this->AddFileMapping(fout,"TEXT",".hpp","MW C/C++ MachPPC","C/C++",
+ false,false,false,true);
+ this->AddFileMapping(fout,"TEXT",".m","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".mm","MW C/C++ MachPPC","C/C++",
+ false,false,false,false);
+ }
+ else
+ {
+ this->AddFileMapping(fout,"TEXT",".cxx","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cpp","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".c","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cc","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cp","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".cpp","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".h","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,true);
+ this->AddFileMapping(fout,"TEXT",".hpp","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,true);
+ this->AddFileMapping(fout,"TEXT",".m","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ this->AddFileMapping(fout,"TEXT",".mm","MW C/C++ PPC Mac OS X","C/C++",
+ false,false,false,false);
+ }
+ this->AddFileMapping(fout,"",".lib","MachO Importer","C/C++",
false,false,false,false);
- this->AddFileMapping(fout,"TEXT",".cpp","MW C/C++ PPC","C/C++",
+ this->AddFileMapping(fout,"",".dylib","MachO Importer","C/C++",
false,false,false,false);
- this->AddFileMapping(fout,"TEXT",".c","MW C/C++ PPC","C/C++",
+ this->AddFileMapping(fout,"",".a","MachO Importer","C/C++",
false,false,false,false);
- this->AddFileMapping(fout,"TEXT",".cc","MW C/C++ PPC","C/C++",
+ this->AddFileMapping(fout,"",".o","MachO Importer","C/C++",
false,false,false,false);
- this->AddFileMapping(fout,"TEXT",".cp","MW C/C++ PPC","C/C++",
+ this->AddFileMapping(fout,"MDYL","","MachO Importer","C/C++",
false,false,false,false);
- this->AddFileMapping(fout,"TEXT",".cpp","MW C/C++ PPC","C/C++",
+ this->AddFileMapping(fout,"MLIB","","MachO Importer","C/C++",
false,false,false,false);
- this->AddFileMapping(fout,"TEXT",".h","MW C/C++ PPC","C/C++",
- false,false,false,true);
- this->AddFileMapping(fout,"TEXT",".hpp","MW C/C++ PPC","C/C++",
- false,false,false,true);
- this->AddFileMapping(fout,"TEXT",".m","MW C/C++ PPC","C/C++",
+ this->AddFileMapping(fout,"MMLB","","MachO Importer","C/C++",
false,false,false,false);
- this->AddFileMapping(fout,"TEXT",".mm","MW C/C++ PPC","C/C++",
+ this->AddFileMapping(fout,"MPLF","","MachO Importer","C/C++",
false,false,false,false);
fout << "</SETTING>\n";
- // <!-- Settings for "MacOS Merge Panel" panel -->
- fout << "<SETTING><NAME>MWProject_PPC_type</NAME><VALUE>";
+ // <!-- Settings for "Build Extras" panel -->
+ fout << "<SETTING><NAME>CacheModDates</NAME><VALUE>true</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>DumpBrowserInfo</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>CacheSubprojects</NAME><VALUE>true</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>UseThirdPartyDebugger</NAME><VALUE>false</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>BrowserGenerator</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>DebuggerAppPath</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>DebuggerCmdLineArgs</NAME><VALUE></VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>DebuggerWorkingDir</NAME>\n";
+ fout << "<SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>\n";
+ fout << "</SETTING>\n";
+ fout << "<SETTING><NAME>CodeCompletionPrefixFileName</NAME>"
+ << "<VALUE>MacHeadersMach-O.c</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>CodeCompletionMacroFileName</NAME>"
+ << "<VALUE>MacOSX_MSL_C++_Macros.h</VALUE></SETTING>\n";
+
+ fout << "<SETTING><NAME>MWFrontEnd_C_prefixname</NAME>"
+ << "<VALUE>MSLCarbonPrefix.h</VALUE></SETTING>";
+
+ // <!-- Settings for "PPC Mac OS X Linker" panel -->
+ fout << "<SETTING><NAME>MWLinker_MacOSX_linksym</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_symfullpath</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_nolinkwarnings</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_linkmap</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_dontdeadstripinitcode</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_permitmultdefs</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_use_objectivec_semantics</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_strip_debug_symbols</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_split_segs</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_report_msl_overloads</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_objects_follow_linkorder</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_linkmode</NAME><VALUE>Fast</VALUE></SETTING>\n";
switch (l->GetType())
{
case cmTarget::STATIC_LIBRARY:
- fout << "Library" << "</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_outfile</NAME><VALUE>";
- fout << tgtName << ".lib";
- fout << "</VALUE></SETTING>\n";
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ fout << "<SETTING><NAME>MWLinker_MacOSX_exports</NAME><VALUE>All</VALUE></SETTING>\n";
+ break;
+
+ default:
+ fout << "<SETTING><NAME>MWLinker_MacOSX_exports</NAME><VALUE>ReferencedGlobals</VALUE></SETTING>\n";
+ }
+ fout << "<SETTING><NAME>MWLinker_MacOSX_sortcode</NAME><VALUE>None</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MacOSX_mainname</NAME><VALUE>start</VALUE></SETTING>\n";
+
+ // <!-- Settings for "PPC Mac OS X Project" panel -->
+ fout << "<SETTING><NAME>MWProject_MacOSX_type</NAME><VALUE>";
+
+ std::string targetOutputType;
+ switch (l->GetType())
+ {
+ case cmTarget::STATIC_LIBRARY:
+ targetOutputType = "MMLB";
+ fout << "Library";
break;
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
- // m_Makefile->GetDefinition("CMAKE_MODULE_SUFFIX");
- fout << "Shared Library" << "</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_outfile</NAME><VALUE>";
- fout << tgtName << ".dylib";
- fout << "</VALUE></SETTING>\n";
+ targetOutputType = "MDYL";
+ fout << "SharedLibrary";
break;
case cmTarget::EXECUTABLE:
case cmTarget::WIN32_EXECUTABLE:
- fout << "Application" << "</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_outfile</NAME><VALUE>";
- fout << tgtName << cmSystemTools::GetExecutableExtension();
- fout << "</VALUE></SETTING>\n";
+ targetOutputType = "APPL";
+ fout << "ApplicationPackage";
break;
default:;
}
-
- fout << "<SETTING><NAME>MWProject_PPC_filecreator</NAME><VALUE>????" << "</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_filetype</NAME><VALUE>APPL</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_size</NAME><VALUE>384</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_minsize</NAME><VALUE>384</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_stacksize</NAME><VALUE>64</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_flags</NAME><VALUE>22720</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_symfilename</NAME><VALUE></VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_rsrcname</NAME><VALUE></VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_rsrcheader</NAME><VALUE>Native</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_rsrctype</NAME><VALUE>????" << "</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_rsrcid</NAME><VALUE>0</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_rsrcflags</NAME><VALUE>0</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_rsrcstore</NAME><VALUE>0</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_rsrcmerge</NAME><VALUE>0</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_flatrsrc</NAME><VALUE>0</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_flatrsrcoutputdir</NAME>\n";
+ fout << "</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_outfile</NAME><VALUE>";
+ fout << m_TargetOutputFiles[std::string(tgtName)];
+ fout << "</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_filetype</NAME><VALUE>";
+ fout << targetOutputType << "</VALUE></SETTING>\n";
+
+ fout << "<SETTING><NAME>MWProject_MacOSX_vmaddress</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_usedefaultvmaddr</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_flatrsrc</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_flatrsrcfilename</NAME><VALUE></VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_flatrsrcoutputdir</NAME>\n";
fout << "<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>\n";
fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>\n";
fout << "</SETTING>\n";
- fout << "<SETTING><NAME>MWProject_PPC_flatrsrcfilename</NAME><VALUE></VALUE></SETTING>\n";
-
- /*
- fout << "<SETTING><NAME>MWMerge_MacOS_outputCreator</NAME><VALUE>????</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_outputType</NAME><VALUE>APPL</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_suppressWarning</NAME><VALUE>0</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_copyFragments</NAME><VALUE>1</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_copyResources</NAME><VALUE>1</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_flattenResource</NAME><VALUE>0</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_flatFileName</NAME><VALUE>a.rsrc</VALUE></SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_flatFileOutputPath</NAME>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_installpath</NAME><VALUE>./</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_dont_prebind</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_flat_namespace</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_frameworkversion</NAME><VALUE>A</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_currentversion</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MacOSX_flat_oldimpversion</NAME><VALUE>0</VALUE></SETTING>\n";
+
+ // <!-- Settings for "PPC Mach-O Linker" panel -->
+ fout << "<SETTING><NAME>MWLinker_MachO_exports</NAME><VALUE>All</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_mainname</NAME><VALUE>start</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_currentversion</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_compatibleversion</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_symfullpath</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_supresswarnings</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_multisymerror</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_prebind</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_deadstrip</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_objectivecsemantics</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_whichfileloaded</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_whyfileloaded</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_readonlyrelocs</NAME><VALUE>Errors</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_undefinedsymbols</NAME><VALUE>Errors</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_twolevelnamespace</NAME><VALUE>1</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWLinker_MachO_stripdebugsymbols</NAME><VALUE>0</VALUE></SETTING>\n";
+
+ // <!-- Settings for "PPC Mach-O Target" panel -->
+ fout << "<SETTING><NAME>MWProject_MachO_type</NAME><VALUE>";
+ switch (l->GetType())
+ {
+ case cmTarget::STATIC_LIBRARY:
+ targetOutputType = "MMLB";
+ fout << "Library";
+ break;
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ targetOutputType = "MDYL";
+ fout << "SharedLibrary";
+ break;
+ case cmTarget::EXECUTABLE:
+ case cmTarget::WIN32_EXECUTABLE:
+ targetOutputType = "APPL";
+ fout << "ApplicationPackage";
+ break;
+ default:;
+ }
+ fout << "</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_outfile</NAME><VALUE>";
+ fout << m_TargetOutputFiles[std::string(tgtName)];
+ fout << "</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_filecreator</NAME><VALUE>????</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_filetype</NAME><VALUE>";
+ fout << targetOutputType;
+ fout << "</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_vmaddress</NAME><VALUE>4096</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_flatrsrc</NAME><VALUE>0</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_flatrsrcfilename</NAME><VALUE></VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_flatrsrcoutputdir</NAME>\n";
fout << "<SETTING><NAME>Path</NAME><VALUE>:</VALUE></SETTING>\n";
fout << "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>\n";
fout << "<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>\n";
fout << "</SETTING>\n";
- fout << "<SETTING><NAME>MWMerge_MacOS_skipResources</NAME><VALUE></VALUE></SETTING>\n";
- */
+ fout << "<SETTING><NAME>MWProject_MachO_installpath</NAME><VALUE>./</VALUE></SETTING>\n";
+ fout << "<SETTING><NAME>MWProject_MachO_frameworkversion</NAME><VALUE></VALUE></SETTING>\n";
fout << "</SETTINGLIST>\n";
}
@@ -284,26 +564,115 @@ void cmLocalCodeWarriorGenerator::WriteFileList(std::ostream& fout,
}
// now add in the libraries we depend on
-
+ cmRegularExpression isAframework("[ \t]*\\-framework");
+ cmRegularExpression isEnvironment("\\${");
+ cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
+ const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
+ cmTarget::LinkLibraries::const_iterator lib = libs.begin();
+ for(; lib != libs.end(); ++lib)
+ {
+ // no frameworks!
+ if( isAframework.find( lib->first.c_str() ) ) continue;
+
+ // no environment variables!
+ if( isEnvironment.find( lib->first.c_str() ) ) continue;
+
+ std::string libPath = lib->first + "_CMAKE_PATH";
+ // is this lib part of this project? Look in the cache
+ const char* cacheValue
+ = GetGlobalGenerator()->GetCMakeInstance()
+ ->GetCacheDefinition(libPath.c_str());
+
+ if( cacheValue )
+ {
+ // just tack it on
+ fout << "<FILE>\n";
+ fout << "<PATHTYPE>RootRelative</PATHTYPE>\n";
+ fout << "<PATHROOT>Project</PATHROOT>\n";
+ fout << "<PATH>" << m_TargetOutputFiles[lib->first] << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "<FILEKIND>Library</FILEKIND>\n";
+ fout << "<FILEFLAGS>Debug, TargetOutputFile</FILEFLAGS>\n";
+ fout << "</FILE>\n";
+ }
+ else if( lib->first.find('/') != std::string::npos )
+ {
+ // it's a path-based library, so we'll include it directly by path
+ fout << "<FILE>\n";
+ fout << "<PATHTYPE>Absolute</PATHTYPE>\n";
+ fout << "<PATHROOT>Absolute</PATHROOT>\n";
+ fout << "<PATH>" << lib->first.c_str() << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "<FILEKIND>Text</FILEKIND>\n";
+ fout << "<FILEFLAGS>Debug</FILEFLAGS>\n";
+ fout << "</FILE>\n";
+ }
+ else if( isUNIX.find( lib->first.c_str() ) )
+ {
+ // now we need to search the library directories for this
+ // library name, and if we don't find it, we have to search
+ // in the cache to see if there's a target defining that lib.
+ // for the first search, we have to check for
+ // [lib]<name>[.<a|lib|so|dylib|dll>]
+ std::string libName = isUNIX.match(1);
+ }
+ else
+ {
+ // just tack it on
+ fout << "<FILE>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>" << lib->first.c_str() << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "<FILEKIND>Library</FILEKIND>\n";
+ fout << "<FILEFLAGS>Debug</FILEFLAGS>\n";
+ fout << "</FILE>\n";
+ }
+ }
// now add in the system libs (for an executable)
if (l->GetType() == cmTarget::EXECUTABLE)
{
fout << "<FILE>\n";
fout << "<PATHTYPE>Name</PATHTYPE>\n";
- fout << "<PATH>MSL RuntimePPC.Lib</PATH>\n";
+ fout << "<PATH>crt1.o</PATH>\n";
fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
fout << "<FILEKIND>Library</FILEKIND>\n";
fout << "<FILEFLAGS>Debug</FILEFLAGS>\n";
fout << "</FILE>\n";
+ fout << "<FILE>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>MSL_All_Mach-O.lib</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "<FILEKIND>Library</FILEKIND>\n";
+ fout << "<FILEFLAGS>Debug</FILEFLAGS>\n";
+ fout << "</FILE>\n";
+ fout << "<FILE>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>console_OS_X.c</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "<FILEKIND>Text</FILEKIND>\n";
+ fout << "<FILEFLAGS>Debug</FILEFLAGS>\n";
+ fout << "</FILE>\n";
}
+ // or a dynamic library
+/* else if (l->GetType() == cmTarget::SHARED_LIBRARY ||
+ l->GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ fout << "<FILE>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>dylib1.o</PATH>\n";
+ fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
+ fout << "<FILEKIND>Library</FILEKIND>\n";
+ fout << "<FILEFLAGS>Debug</FILEFLAGS>\n";
+ fout << "</FILE>\n";
+ }*/
fout << "</FILELIST>\n";
}
void cmLocalCodeWarriorGenerator::WriteLinkOrder(std::ostream& fout,
- const char* /*tgtName*/,
+ const char* tgtName,
cmTarget const *l)
{
fout << "<LINKORDER>\n";
@@ -324,28 +693,256 @@ void cmLocalCodeWarriorGenerator::WriteLinkOrder(std::ostream& fout,
fout << "</FILEREF>\n";
}
+ // now add in the libraries we depend on
+ cmRegularExpression isAframework("[ \t]*\\-framework");
+ cmRegularExpression isEnvironment("\\${");
+ cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
+ const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
+ cmTarget::LinkLibraries::const_iterator lib = libs.begin();
+
+ std::map<std::string, std::string> referencedTargets;
+
+ for(; lib != libs.end(); ++lib)
+ {
+ // no frameworks!
+ if( isAframework.find( lib->first.c_str() ) ) continue;
+
+ // no environment variables!
+ if( isEnvironment.find( lib->first.c_str() ) ) continue;
+
+ std::string libPath = lib->first + "_CMAKE_PATH";
+ // is this lib part of this project? Look in the cache
+ const char* cacheValue
+ = GetGlobalGenerator()->GetCMakeInstance()
+ ->GetCacheDefinition(libPath.c_str());
+
+ if( cacheValue )
+ {
+ // just tack it on
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>RootRelative</PATHTYPE>\n";
+ fout << "<PATHROOT>Project</PATHROOT>\n";
+ fout << "<PATH>" << m_TargetOutputFiles[lib->first] << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ referencedTargets[lib->first] = m_TargetOutputFiles[lib->first];
+ if( m_TargetReferencingList.count(m_TargetOutputFiles[lib->first]) == 0 )
+ {
+ m_TargetReferencingList[m_TargetOutputFiles[lib->first]] = std::string(tgtName);
+ }
+ }
+ else if( lib->first.find('/') != std::string::npos )
+ {
+ // it's a path-based library, so we'll include it directly by path
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>Absolute</PATHTYPE>\n";
+ fout << "<PATHROOT>Absolute</PATHROOT>\n";
+ fout << "<PATH>" << lib->first.c_str() << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ }
+ else if( isUNIX.find( lib->first.c_str() ) )
+ {
+ // now we need to search the library directories for this
+ // library name, and if we don't find it, we have to search
+ // in the cache to see if there's a target defining that lib.
+ // for the first search, we have to check for
+ // [lib]<name>[.<a|lib|so|dylib|dll>]
+ std::string libName = isUNIX.match(1);
+ }
+ else
+ {
+ // just tack it on
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>" << lib->first.c_str() << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ }
+ }
+
// now add in the system libs (for an executable)
if (l->GetType() == cmTarget::EXECUTABLE)
{
fout << "<FILEREF>\n";
fout << "<PATHTYPE>Name</PATHTYPE>\n";
- fout << "<PATH>MSL RuntimePPC.Lib</PATH>\n";
+ fout << "<PATH>crt1.o</PATH>\n";
fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
fout << "</FILEREF>\n";
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>MSL_All_Mach-O.lib</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>console_OS_X.c</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
}
+ // or a shared library
+/* else if (l->GetType() == cmTarget::SHARED_LIBRARY ||
+ l->GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>dylib1.o</PATH>\n";
+ fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ }*/
fout << "</LINKORDER>\n";
+
+ if( referencedTargets.size() )
+ {
+ fout << "<SUBTARGETLIST>\n";
+ // output subtarget list
+ std::map<std::string, std::string>::const_iterator target = referencedTargets.begin();
+ for( ; target != referencedTargets.end(); target++ )
+ {
+ fout << "<SUBTARGET>\n";
+ fout << "<TARGETNAME>" << target->first << "</TARGETNAME>\n";
+ fout << "<ATTRIBUTES>LinkAgainst</ATTRIBUTES>\n";
+ fout << "<FILEREF>\n<PATHTYPE>RootRelative</PATHTYPE>\n"
+ << "<PATHROOT>Project</PATHROOT>\n"
+ << "<PATH>" << target->second << "</PATH>\n"
+ << "<PATHFORMAT>Unix</PATHFORMAT></FILEREF>\n";
+ fout << "</SUBTARGET>\n";
+ }
+ fout << "</SUBTARGETLIST>\n";
+ }
+
+ // we need at least one framework for the XML to be valid
+ // generate framework list
+ cmRegularExpression reg("[ \t]*\\-framework[ \t]+([^ \t]+)");
+ std::vector<std::string> frameworks;
+
+ lib = libs.begin();
+ for(; lib != libs.end(); ++lib)
+ {
+ if( reg.find( lib->first.c_str() ) )
+ {
+ frameworks.push_back( reg.match(1) );
+ }
+ }
+
+ if( frameworks.size() > 0 || l->GetType() == cmTarget::EXECUTABLE )
+ {
+ fout << "<FRAMEWORKLIST>\n";
+
+ std::vector<std::string>::const_iterator framework = frameworks.begin();
+ for(; framework != frameworks.end(); ++framework)
+ {
+ fout << "<FRAMEWORK>\n";
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>" << framework->c_str() << ".framework</PATH>\n";
+ fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ // this isn't strictly always true, I believe, but Apple adheres to it
+ fout << "<DYNAMICLIBRARY>" << framework->c_str() << "</DYNAMICLIBRARY>\n";
+ fout << "</FRAMEWORK>\n";
+ }
+
+ // if it's an executable, it needs to link into System.framework
+ if (l->GetType() == cmTarget::EXECUTABLE)
+ {
+ fout << "<FRAMEWORK>\n";
+ fout << "<FILEREF>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>System.framework</PATH>\n";
+ fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ fout << "<DYNAMICLIBRARY>System</DYNAMICLIBRARY>\n";
+ fout << "</FRAMEWORK>\n";
+ }
+
+ fout << "</FRAMEWORKLIST>\n";
+ }
}
void cmLocalCodeWarriorGenerator::WriteGroups(std::ostream& fout)
{
+ bool hasExecutableTarget = false, hasDynamicLibTarget = false;
+ char *firstExecutableTarget = 0, *firstDynamicLibTarget = 0;
cmTargets &tgts = m_Makefile->GetTargets();
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
this->WriteGroup(fout,l->first.c_str(),&(l->second));
+ if (l->second.GetType() == cmTarget::EXECUTABLE)
+ {
+ hasExecutableTarget = true;
+ if (firstExecutableTarget == 0)
+ {
+ firstExecutableTarget = const_cast<char*>(l->first.c_str());
+ }
+ }
+ else if (l->second.GetType() == cmTarget::SHARED_LIBRARY ||
+ l->second.GetType() == cmTarget::MODULE_LIBRARY)
+ {
+ hasDynamicLibTarget = true;
+ if (firstDynamicLibTarget == 0)
+ {
+ firstDynamicLibTarget = const_cast<char*>(l->first.c_str());
+ }
+ }
}
+ // write out the libraries groups
+ if( hasExecutableTarget )
+ {
+ fout << "<GROUP><NAME>" << "App Support" << "</NAME>\n";
+ fout << "<FILEREF>\n";
+ fout << "<TARGETNAME>" << firstExecutableTarget << "</TARGETNAME>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>crt1.o</PATH>\n";
+ fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ fout << "<FILEREF>\n";
+ fout << "<TARGETNAME>" << firstExecutableTarget << "</TARGETNAME>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>MSL_All_Mach-O.lib</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ fout << "<FILEREF>\n";
+ fout << "<TARGETNAME>" << firstExecutableTarget << "</TARGETNAME>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>console_OS_X.c</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ fout << "</GROUP>\n";
+ }
+/* if (hasDynamicLibTarget)
+ {
+ fout << "<GROUP><NAME>" << "dylib Support" << "</NAME>\n";
+ fout << "<FILEREF>\n";
+ fout << "<TARGETNAME>" << firstDynamicLibTarget << "</TARGETNAME>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>dylib1.o</PATH>\n";
+ fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ fout << "</GROUP>\n";
+ }*/
+
+ // write out the referenced targets group
+ if( m_TargetReferencingList.size() > 0 )
+ {
+ fout << "<GROUP><NAME>Subtarget Files</NAME>\n";
+
+ std::map<std::string, std::string>::const_iterator subtarget = m_TargetReferencingList.begin();
+ for( ; subtarget != m_TargetReferencingList.end(); subtarget++ )
+ {
+ fout << "<FILEREF>\n"
+ << "<TARGETNAME>" << subtarget->second << "</TARGETNAME>\n";
+ fout << "<PATHTYPE>RootRelative</PATHTYPE>\n<PATHROOT>Project</PATHROOT>\n";
+ fout << "<PATH>" << subtarget->first << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>";
+ }
+
+ fout << "</GROUP>";
+ }
}
void cmLocalCodeWarriorGenerator::WriteGroup(std::ostream& fout,
@@ -369,46 +966,62 @@ void cmLocalCodeWarriorGenerator::WriteGroup(std::ostream& fout,
fout << "</FILEREF>\n";
}
- // write out the libraries groups
-/*
- <FILEREF>
- <TARGETNAME>Classic Release</TARGETNAME>
- <PATHTYPE>Name</PATHTYPE>
- <PATH>console.stubs.c</PATH>
- <PATHFORMAT>MacOS</PATHFORMAT>
- </FILEREF>
-*/
-
- if (l->GetType() == cmTarget::EXECUTABLE)
+ // now add in the libraries we depend on
+ cmRegularExpression isAframework("[ \t]*\\-framework");
+ cmRegularExpression isEnvironment("\\${");
+ cmRegularExpression isUNIX("[ \t]*\\-l([^ \t]+)");
+ const cmTarget::LinkLibraries& libs = l->GetLinkLibraries();
+ cmTarget::LinkLibraries::const_iterator lib = libs.begin();
+ for(; lib != libs.end(); ++lib)
{
- fout << "<FILEREF>\n";
- fout << "<TARGETNAME>" << tgtName << "</TARGETNAME>\n";
- fout << "<PATHTYPE>Name</PATHTYPE>\n";
- fout << "<PATH>MSL RuntimePPC.Lib</PATH>\n";
- fout << "<PATHFORMAT>MacOS</PATHFORMAT>\n";
- fout << "</FILEREF>\n";
+ // no frameworks!
+ if( isAframework.find( lib->first.c_str() ) ) continue;
+
+ // no environment variables!
+ if( isEnvironment.find( lib->first.c_str() ) ) continue;
+
+ std::string libPath = lib->first + "_CMAKE_PATH";
+ // is this lib part of this project? Look in the cache
+ const char* cacheValue
+ = GetGlobalGenerator()->GetCMakeInstance()
+ ->GetCacheDefinition(libPath.c_str());
+
+ if( cacheValue )
+ {
+ // this is a subtarget reference, it will be taken care of later
+ continue;
+ }
+ else if( lib->first.find('/') != std::string::npos )
+ {
+ // it's a path-based library, so we'll include it directly by path
+ fout << "<FILEREF>\n";
+ fout << "<TARGETNAME>" << tgtName << "</TARGETNAME>\n";
+ fout << "<PATHTYPE>Absolute</PATHTYPE>\n";
+ fout << "<PATHROOT>Absolute</PATHROOT>\n";
+ fout << "<PATH>" << lib->first.c_str() << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ }
+ else if( isUNIX.find( lib->first.c_str() ) )
+ {
+ // now we need to search the library directories for this
+ // library name, and if we don't find it, we have to search
+ // in the cache to see if there's a target defining that lib.
+ // for the first search, we have to check for
+ // [lib]<name>[.<a|lib|so|dylib|dll>]
+ std::string libName = isUNIX.match(1);
+ }
+ else
+ {
+ // just tack it on
+ fout << "<FILEREF>\n";
+ fout << "<TARGETNAME>" << tgtName << "</TARGETNAME>\n";
+ fout << "<PATHTYPE>Name</PATHTYPE>\n";
+ fout << "<PATH>" << lib->first.c_str() << "</PATH>\n";
+ fout << "<PATHFORMAT>Unix</PATHFORMAT>\n";
+ fout << "</FILEREF>\n";
+ }
}
-
-/*
- <FILEREF>
- <TARGETNAME>Classic Release</TARGETNAME>
- <PATHTYPE>Name</PATHTYPE>
- <PATH>MSL C++.PPC.Lib</PATH>
- <PATHFORMAT>MacOS</PATHFORMAT>
- </FILEREF>
- <FILEREF>
- <TARGETNAME>Classic Release</TARGETNAME>
- <PATHTYPE>Name</PATHTYPE>
- <PATH>MSL C.PPC.Lib</PATH>
- <PATHFORMAT>MacOS</PATHFORMAT>
- </FILEREF>
- <FILEREF>
- <TARGETNAME>Carbon Debug</TARGETNAME>
- <PATHTYPE>Name</PATHTYPE>
- <PATH>MSL C.CARBON.Lib</PATH>
- <PATHFORMAT>MacOS</PATHFORMAT>
- </FILEREF>
-*/
fout << "</GROUP>\n";
}