diff --git a/Source/cmGlobalCodeWarriorGenerator.cxx b/Source/cmGlobalCodeWarriorGenerator.cxx deleted file mode 100644 index 9db7e54a1..000000000 --- a/Source/cmGlobalCodeWarriorGenerator.cxx +++ /dev/null @@ -1,300 +0,0 @@ -/*========================================================================= - - 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. - - 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" -#include "cmLocalCodeWarriorGenerator.h" -#include "cmMakefile.h" -#include "cmake.h" -#include "cmTarget.h" - -void cmGlobalCodeWarriorGenerator::EnableLanguage(std::vectorconst& , - cmMakefile *mf) -{ - // now load the settings - if(!mf->GetDefinition("CMAKE_ROOT")) - { - cmSystemTools::Error( - "CMAKE_ROOT has not been defined, bad GUI or driver program"); - return; - } - if(!this->GetLanguageEnabled("CXX")) - { - std::string fpath = - mf->GetRequiredDefinition("CMAKE_ROOT"); - fpath += "/Templates/CMakeCodeWarriorConfig.cmake"; - mf->ReadListFile(0,fpath.c_str()); - this->SetLanguageEnabled("CXX", mf); - } -} - -int cmGlobalCodeWarriorGenerator::TryCompile(const char *, - const char* /*bindir*/, - const char* /*projectName*/, - const char* /*targetName*/, - std::string* /*output*/, - cmMakefile* /*mf*/) -{ - return 1; -} - -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalCodeWarriorGenerator::CreateLocalGenerator() -{ - cmLocalGenerator *lg = new cmLocalCodeWarriorGenerator; - lg->SetGlobalGenerator(this); - return lg; -} - -void cmGlobalCodeWarriorGenerator::Generate() -{ - // first do the superclass method - this->cmGlobalGenerator::Generate(); - - // Now write out the Project File - this->OutputProject(); -} - -void cmGlobalCodeWarriorGenerator::OutputProject() -{ - // if this is an out of source build, create the output directory - if(strcmp(m_CMakeInstance->GetStartOutputDirectory(), - m_CMakeInstance->GetHomeDirectory()) != 0) - { - if(!cmSystemTools::MakeDirectory(m_CMakeInstance->GetStartOutputDirectory())) - { - cmSystemTools::Error("Error creating output directory for Project file", - m_CMakeInstance->GetStartOutputDirectory()); - } - } - // create the project file name - std::string fname; - fname = m_CMakeInstance->GetStartOutputDirectory(); - fname += "/"; - if(strlen(m_LocalGenerators[0]->GetMakefile()->GetProjectName()) == 0) - { - m_LocalGenerators[0]->GetMakefile()->SetProjectName("Project"); - } - fname += m_LocalGenerators[0]->GetMakefile()->GetProjectName(); - fname += ".xml"; - std::ofstream fout(fname.c_str()); - if(!fout) - { - cmSystemTools::Error("Error can not open project file for write: " - ,fname.c_str()); - cmSystemTools::ReportLastSystemError(""); - return; - } - this->WriteProject(fout); -} - -void cmGlobalCodeWarriorGenerator::WriteProject(std::ostream& fout) -{ - // Write out the header for a SLN file - this->WriteProjectHeader(fout); - - // start the project - fout << "\n"; - - // write the target list - this->WriteTargetList(fout); - - // write the target order - this->WriteTargetOrder(fout); - - // write the group list - this->WriteGroupList(fout); - - // close the project - fout << "\n"; -} - -void cmGlobalCodeWarriorGenerator::WriteProjectHeader(std::ostream& fout) -{ - fout << "\n"; - fout << "\n"; - - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "\n"; - fout << "]>\n\n"; -} - -void cmGlobalCodeWarriorGenerator::WriteTargetList(std::ostream& fout) -{ - fout << "\n"; - - unsigned int i; - // for each local generator - for (i = 0; i < m_LocalGenerators.size(); ++i) - { - static_cast(m_LocalGenerators[i])->WriteTargets(fout); - } - fout << "\n"; -} - -cmTarget *cmGlobalCodeWarriorGenerator::GetTargetFromName(const char *tgtName) -{ - // for each local generator, and each target - unsigned int i; - for(i = 0; i < m_LocalGenerators.size(); ++i) - { - cmMakefile* mf = m_LocalGenerators[i]->GetMakefile(); - cmTargets &tgts = mf->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) - { - if (l->first == tgtName) - { - return &(l->second); - } - } - } - return 0; -} - -void cmGlobalCodeWarriorGenerator::ComputeTargetOrder( - std::vector &tgtOrder, const char *tgtName, - cmTarget const *target) -{ - // if the target is already listed then we are done - if (std::find(tgtOrder.begin(),tgtOrder.end(),tgtName) != tgtOrder.end()) - { - return; - } - - // otherwise find all this target depends on and add them first - cmTarget::LinkLibraries::const_iterator j, jend; - j = target->GetLinkLibraries().begin(); - jend = target->GetLinkLibraries().end(); - for(;j!= jend; ++j) - { - if(j->first != tgtName) - { - // is the library part of this Project ? - std::string libPath = j->first + "_CMAKE_PATH"; - const char* cacheValue - = m_CMakeInstance->GetCacheDefinition(libPath.c_str()); - if(cacheValue && *cacheValue) - { - // so add it to the tgtOrder vector if it isn't already there - // to do this we need the actual target - cmTarget *tgt = this->GetTargetFromName(j->first.c_str()); - this->ComputeTargetOrder(tgtOrder,j->first.c_str(), tgt); - } - } - } - // finally add the target - tgtOrder.push_back(tgtName); -} - -void cmGlobalCodeWarriorGenerator::WriteTargetOrder(std::ostream& fout) -{ - fout << "\n"; - - std::vector tgtOrder; - unsigned int i; - // for each local generator, and each target - for(i = 0; i < m_LocalGenerators.size(); ++i) - { - cmMakefile* mf = m_LocalGenerators[i]->GetMakefile(); - cmTargets &tgts = mf->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) - { - this->ComputeTargetOrder(tgtOrder, l->first.c_str(), &(l->second)); - } - } - - // now write out the target order - for(i = 0; i < tgtOrder.size(); ++i) - { - fout << "" << tgtOrder[i] - << "\n"; - } - fout << "\n"; -} - -void cmGlobalCodeWarriorGenerator::WriteGroupList(std::ostream& fout) -{ - fout << "\n"; - - unsigned int i; - // for each local generator - for (i = 0; i < m_LocalGenerators.size(); ++i) - { - static_cast(m_LocalGenerators[i])->WriteGroups(fout); - } - - - fout << "\n"; -} - -void cmGlobalCodeWarriorGenerator::LocalGenerate() -{ - this->cmGlobalGenerator::LocalGenerate(); -} - - -//---------------------------------------------------------------------------- -void cmGlobalCodeWarriorGenerator::GetDocumentation(cmDocumentationEntry& entry) const -{ - entry.name = this->GetName(); - entry.brief = "Generates CodeWarrior project files."; - entry.full = ""; -} diff --git a/Source/cmGlobalCodeWarriorGenerator.h b/Source/cmGlobalCodeWarriorGenerator.h deleted file mode 100644 index 4549f68b7..000000000 --- a/Source/cmGlobalCodeWarriorGenerator.h +++ /dev/null @@ -1,89 +0,0 @@ -/*========================================================================= - - 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. - - 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. - -=========================================================================*/ -#ifndef cmGlobalCodeWarriorGenerator_h -#define cmGlobalCodeWarriorGenerator_h - -#include "cmGlobalGenerator.h" - -class cmTarget; - -/** \class cmGlobalCodeWarriorGenerator - * \brief Write a Unix makefiles. - * - * cmGlobalCodeWarriorGenerator manages UNIX build process for a tree - */ -class cmGlobalCodeWarriorGenerator : public cmGlobalGenerator -{ -public: - static cmGlobalGenerator* New() { return new cmGlobalCodeWarriorGenerator; } - - ///! Get the name for the generator. - virtual const char* GetName() const { - return cmGlobalCodeWarriorGenerator::GetActualName();} - static const char* GetActualName() {return "Code Warrior Not Working";} - - /** Get the documentation entry for this generator. */ - virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - ///! Create a local generator appropriate to this Global Generator - virtual cmLocalGenerator *CreateLocalGenerator(); - - /** - * Try to determine system infomation such as shared library - * extension, pthreads, byte order etc. - */ - virtual void EnableLanguage(std::vectorconst& languages, cmMakefile *); - - /** - * Try running cmake and building a file. This is used for dynalically - * loaded commands, not as part of the usual build process. - */ - virtual int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, - std::string *output, cmMakefile* mf); - - /** - * Generate the all required files for building this project/tree. This - * basically creates a series of LocalGenerators for each directory and - * requests that they Generate. - */ - virtual void Generate(); - - /** - * Generate the required files for building this directory. This - * basically creates a single LocalGenerators and - * requests that it Generate. - */ - virtual void LocalGenerate(); - - /** - * Generate the DSW workspace file. - */ - virtual void OutputProject(); - -private: - cmTarget *GetTargetFromName(const char *tgtName); - void WriteProject(std::ostream & fout); - void WriteProjectHeader(std::ostream & fout); - void WriteTargetList(std::ostream & fout); - void WriteTargetOrder(std::ostream & fout); - void WriteGroupList(std::ostream & fout); - void ComputeTargetOrder(std::vector &tgtOrder, - const char *tgtName, cmTarget const *tgt); -}; - -#endif diff --git a/Source/cmLocalCodeWarriorGenerator.cxx b/Source/cmLocalCodeWarriorGenerator.cxx deleted file mode 100644 index f1bcd770a..000000000 --- a/Source/cmLocalCodeWarriorGenerator.cxx +++ /dev/null @@ -1,1026 +0,0 @@ -/*========================================================================= - -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. - -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" -#include "cmLocalCodeWarriorGenerator.h" -#include "cmMakefile.h" -#include "cmSystemTools.h" -#include "cmSourceFile.h" -#include "cmCacheManager.h" -#include "cmake.h" - -#include - -cmLocalCodeWarriorGenerator::cmLocalCodeWarriorGenerator() -{ -} - -cmLocalCodeWarriorGenerator::~cmLocalCodeWarriorGenerator() -{ -} - - -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: - 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++) - { - this->WriteTarget(fout,l->first.c_str(),&(l->second)); - } -} - -void cmLocalCodeWarriorGenerator::WriteTarget(std::ostream& fout, - const char *tgtName, - cmTarget const *l) -{ - fout << "\n"; - fout << "" << tgtName << "\n"; - - this->WriteSettingList(fout, tgtName,l); - this->WriteFileList(fout, tgtName,l); - this->WriteLinkOrder(fout, tgtName, l); - // this->WriteSubTargetList(fout,l); - - fout << "\n"; -} - -void cmLocalCodeWarriorGenerator::AddFileMapping(std::ostream& fout, - const char *ftype, - const char *ext, - const char *comp, - const char *edit, - bool precomp, - bool launch, - bool res, - bool ignored) -{ - fout << "\n"; - if( strlen( ftype ) > 0 ) - { - fout << "FileType" << ftype << - "\n"; - } - fout << "FileExtension" << ext << - "\n"; - fout << "Compiler" << comp << - "\n"; - fout << "EditLanguage" << edit << - "\n"; - fout << "Precompile" - << (precomp ? "true" : "false") << "\n"; - fout << "Launchable" - << (launch ? "true" : "false") << "\n"; - fout << "ResourceFile" - << (res ? "true" : "false") << "\n"; - fout << "IgnoredByMake" - << (ignored ? "true" : "false") << "\n"; - fout << "\n"; -} - - -void cmLocalCodeWarriorGenerator::WriteSettingList(std::ostream& fout, - const char *tgtName, - cmTarget const *l) -{ - fout << "\n"; - - fout << "UserSourceTrees\n"; - fout << "AlwaysSearchUserPathsfalse\n"; - fout << "InterpretDOSAndUnixPathsfalse\n"; - fout << "RequireFrameworkStyleIncludesfalse\n"; - - fout << "UserSearchPaths\n"; - - // project relative path - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootProject\n"; - fout << "\n"; - fout << "Recursivetrue\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - - // list the include paths -/* std::vector& includes = l->GetIncludeDirectories(); - std::vector::iterator i = includes.begin(); - for(;i != includes.end(); ++i) - { - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path" << i->c_str() << "\n"; - fout << "PathFormatGeneric\n"; - fout << "PathRootAbsolute\n"; - fout << "\n"; - fout << "Recursivefalse\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - }*/ - - // library paths - - // now add in the libraries we depend on - cmsys::RegularExpression isAframework("[ \t]*\\-framework"); - cmsys::RegularExpression isEnvironment("\\${"); - cmsys::RegularExpression 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 && *cacheValue ) - { - // just tack it on - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path" << cacheValue << "\n"; - fout << "PathFormatGeneric\n"; - fout << "PathRootAbsolute\n"; - fout << "\n"; - fout << "Recursivefalse\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - } - } - - const std::vector& links = l->GetLinkDirectories(); - std::vector::const_iterator j = links.begin(); - for(;j != links.end(); ++j) - { - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path" << j->c_str() << "\n"; - fout << "PathFormatGeneric\n"; - fout << "PathRootAbsolute\n"; - fout << "\n"; - fout << "Recursivefalse\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - } - fout << "\n"; - - // system include and library paths - fout << "SystemSearchPaths\n"; - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path:MSL:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootCodeWarrior\n"; - fout << "\n"; - fout << "Recursivetrue\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path:MacOS X Support:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootCodeWarrior\n"; - fout << "\n"; - fout << "Recursivetrue\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path:usr:include:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootOS X Volume\n"; - fout << "\n"; - fout << "Recursivefalse\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path:usr:lib:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootOS X Volume\n"; - fout << "\n"; - fout << "Recursivefalse\n"; - fout << "FrameworkPathfalse\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path:System:Library:Frameworks:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootOS X Volume\n"; - fout << "\n"; - fout << "Recursivefalse\n"; - fout << "FrameworkPathtrue\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - fout << "\n"; - fout << "SearchPath\n"; - fout << "Path:Library:Frameworks:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootOS X Volume\n"; - fout << "\n"; - fout << "Recursivefalse\n"; - fout << "FrameworkPathtrue\n"; - fout << "HostFlagsAll\n"; - fout << "\n"; - fout << "\n"; - - fout << "MWRuntimeSettings_WorkingDirectory\n"; - fout << "MWRuntimeSettings_CommandLine\n"; - fout << "MWRuntimeSettings_HostApplication\n"; - fout << "Path\n"; - fout << "PathFormatGeneric\n"; - fout << "PathRootAbsolute\n"; - fout << "\n"; - fout << "MWRuntimeSettings_EnvVars\n"; - - // - if( l->GetType() == cmTarget::SHARED_LIBRARY || - l->GetType() == cmTarget::MODULE_LIBRARY ) - { - fout << "LinkerMach-O PPC Linker\n"; - } - else - { - fout << "LinkerMacOS X PPC Linker\n"; - } - fout << "PreLinker\n"; - fout << "PostLinker\n"; - fout << "Targetname" << tgtName - << "\n"; - fout << "OutputDirectory\n"; - fout << "Path\n"; - fout << "PathFormatUnix\n"; - fout << "PathRootProject\n"; - fout << "\n"; - fout << "SaveEntriesUsingRelativePathsfalse\n"; - - // add the cxx file type, and others - fout << "FileMappings\n"; - - 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,"",".dylib","MachO Importer","C/C++", - false,false,false,false); - this->AddFileMapping(fout,"",".a","MachO Importer","C/C++", - false,false,false,false); - this->AddFileMapping(fout,"",".o","MachO Importer","C/C++", - false,false,false,false); - this->AddFileMapping(fout,"MDYL","","MachO Importer","C/C++", - false,false,false,false); - this->AddFileMapping(fout,"MLIB","","MachO Importer","C/C++", - false,false,false,false); - this->AddFileMapping(fout,"MMLB","","MachO Importer","C/C++", - false,false,false,false); - this->AddFileMapping(fout,"MPLF","","MachO Importer","C/C++", - false,false,false,false); - fout << "\n"; - - // - fout << "CacheModDatestrue\n"; - fout << "DumpBrowserInfofalse\n"; - fout << "CacheSubprojectstrue\n"; - fout << "UseThirdPartyDebuggerfalse\n"; - fout << "BrowserGenerator1\n"; - fout << "DebuggerAppPath\n"; - fout << "Path\n"; - fout << "PathFormatGeneric\n"; - fout << "PathRootAbsolute\n"; - fout << "\n"; - fout << "DebuggerCmdLineArgs\n"; - fout << "DebuggerWorkingDir\n"; - fout << "Path\n"; - fout << "PathFormatGeneric\n"; - fout << "PathRootAbsolute\n"; - fout << "\n"; - fout << "CodeCompletionPrefixFileName" - << "MacHeadersMach-O.c\n"; - fout << "CodeCompletionMacroFileName" - << "MacOSX_MSL_C++_Macros.h\n"; - - fout << "MWFrontEnd_C_prefixname" - << "MSLCarbonPrefix.h"; - - // - fout << "MWLinker_MacOSX_linksym1\n"; - fout << "MWLinker_MacOSX_symfullpath1\n"; - fout << "MWLinker_MacOSX_nolinkwarnings0\n"; - fout << "MWLinker_MacOSX_linkmap0\n"; - fout << "MWLinker_MacOSX_dontdeadstripinitcode0\n"; - fout << "MWLinker_MacOSX_permitmultdefs0\n"; - fout << "MWLinker_MacOSX_use_objectivec_semantics1\n"; - fout << "MWLinker_MacOSX_strip_debug_symbols0\n"; - fout << "MWLinker_MacOSX_split_segs0\n"; - fout << "MWLinker_MacOSX_report_msl_overloads0\n"; - fout << "MWLinker_MacOSX_objects_follow_linkorder0\n"; - fout << "MWLinker_MacOSX_linkmodeFast\n"; - switch (l->GetType()) - { - case cmTarget::STATIC_LIBRARY: - case cmTarget::SHARED_LIBRARY: - case cmTarget::MODULE_LIBRARY: - fout << "MWLinker_MacOSX_exportsAll\n"; - break; - - default: - fout << "MWLinker_MacOSX_exportsReferencedGlobals\n"; - } - fout << "MWLinker_MacOSX_sortcodeNone\n"; - fout << "MWLinker_MacOSX_mainnamestart\n"; - - // - fout << "MWProject_MacOSX_type"; - - std::string targetOutputType; - 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: - targetOutputType = "APPL"; - fout << "ApplicationPackage"; - break; - default:; - } - fout << "\n"; - fout << "MWProject_MacOSX_outfile"; - fout << m_TargetOutputFiles[std::string(tgtName)]; - fout << "\n"; - fout << "MWProject_MacOSX_filetype"; - fout << targetOutputType << "\n"; - - fout << "MWProject_MacOSX_vmaddress0\n"; - fout << "MWProject_MacOSX_usedefaultvmaddr1\n"; - fout << "MWProject_MacOSX_flatrsrc1\n"; - fout << "MWProject_MacOSX_flatrsrcfilename\n"; - fout << "MWProject_MacOSX_flatrsrcoutputdir\n"; - fout << "Path:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootProject\n"; - fout << "\n"; - fout << "MWProject_MacOSX_installpath./\n"; - fout << "MWProject_MacOSX_dont_prebind0\n"; - fout << "MWProject_MacOSX_flat_namespace0\n"; - fout << "MWProject_MacOSX_frameworkversionA\n"; - fout << "MWProject_MacOSX_currentversion0\n"; - fout << "MWProject_MacOSX_flat_oldimpversion0\n"; - - // - fout << "MWLinker_MachO_exportsAll\n"; - fout << "MWLinker_MachO_mainnamestart\n"; - fout << "MWLinker_MachO_currentversion0\n"; - fout << "MWLinker_MachO_compatibleversion0\n"; - fout << "MWLinker_MachO_symfullpath0\n"; - fout << "MWLinker_MachO_supresswarnings0\n"; - fout << "MWLinker_MachO_multisymerror0\n"; - fout << "MWLinker_MachO_prebind1\n"; - fout << "MWLinker_MachO_deadstrip1\n"; - fout << "MWLinker_MachO_objectivecsemantics0\n"; - fout << "MWLinker_MachO_whichfileloaded0\n"; - fout << "MWLinker_MachO_whyfileloaded0\n"; - fout << "MWLinker_MachO_readonlyrelocsErrors\n"; - fout << "MWLinker_MachO_undefinedsymbolsErrors\n"; - fout << "MWLinker_MachO_twolevelnamespace1\n"; - fout << "MWLinker_MachO_stripdebugsymbols0\n"; - - // - fout << "MWProject_MachO_type"; - 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: - targetOutputType = "APPL"; - fout << "ApplicationPackage"; - break; - default:; - } - fout << "\n"; - fout << "MWProject_MachO_outfile"; - fout << m_TargetOutputFiles[std::string(tgtName)]; - fout << "\n"; - fout << "MWProject_MachO_filecreator????" << "\n"; - fout << "MWProject_MachO_filetype"; - fout << targetOutputType; - fout << "\n"; - fout << "MWProject_MachO_vmaddress4096\n"; - fout << "MWProject_MachO_flatrsrc0\n"; - fout << "MWProject_MachO_flatrsrcfilename\n"; - fout << "MWProject_MachO_flatrsrcoutputdir\n"; - fout << "Path:\n"; - fout << "PathFormatMacOS\n"; - fout << "PathRootProject\n"; - fout << "\n"; - fout << "MWProject_MachO_installpath./\n"; - fout << "MWProject_MachO_frameworkversion\n"; - - fout << "\n"; -} - -void cmLocalCodeWarriorGenerator::WriteFileList(std::ostream& fout, - const char* /*tgtName*/, - cmTarget const *l) -{ - fout << "\n"; - - // for each file - std::vector const& classes = l->GetSourceFiles(); - for(std::vector::const_iterator i = classes.begin(); - i != classes.end(); i++) - { - // Add the file to the list of sources. - std::string source = (*i)->GetFullPath(); - fout << "\n"; - fout << "Absolute\n"; - fout << "Absolute\n"; - //fout << "common\n"; - fout << "" << source << "\n"; - fout << "Generic\n"; - fout << "Text\n"; - fout << "Debug\n"; - fout << "\n"; - } - - // now add in the libraries we depend on - cmsys::RegularExpression isAframework("[ \t]*\\-framework"); - cmsys::RegularExpression isEnvironment("\\${"); - cmsys::RegularExpression 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 && *cacheValue ) - { - // just tack it on - fout << "\n"; - fout << "RootRelative\n"; - fout << "Project\n"; - fout << "" << m_TargetOutputFiles[lib->first] << "\n"; - fout << "Unix\n"; - fout << "Library\n"; - fout << "Debug, TargetOutputFile\n"; - fout << "\n"; - } - else if( lib->first.find('/') != std::string::npos ) - { - // it's a path-based library, so we'll include it directly by path - fout << "\n"; - fout << "Absolute\n"; - fout << "Absolute\n"; - fout << "" << lib->first.c_str() << "\n"; - fout << "Unix\n"; - fout << "Text\n"; - fout << "Debug\n"; - fout << "\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][.] - std::string libName = isUNIX.match(1); - } - else - { - // just tack it on - fout << "\n"; - fout << "Name\n"; - fout << "" << lib->first.c_str() << "\n"; - fout << "Unix\n"; - fout << "Library\n"; - fout << "Debug\n"; - fout << "\n"; - } - } - - // now add in the system libs (for an executable) - if (l->GetType() == cmTarget::EXECUTABLE) - { - fout << "\n"; - fout << "Name\n"; - fout << "crt1.o\n"; - fout << "MacOS\n"; - fout << "Library\n"; - fout << "Debug\n"; - fout << "\n"; - fout << "\n"; - fout << "Name\n"; - fout << "MSL_All_Mach-O.lib\n"; - fout << "Unix\n"; - fout << "Library\n"; - fout << "Debug\n"; - fout << "\n"; - fout << "\n"; - fout << "Name\n"; - fout << "console_OS_X.c\n"; - fout << "Unix\n"; - fout << "Text\n"; - fout << "Debug\n"; - fout << "\n"; - } - // or a dynamic library -/* else if (l->GetType() == cmTarget::SHARED_LIBRARY || - l->GetType() == cmTarget::MODULE_LIBRARY) - { - fout << "\n"; - fout << "Name\n"; - fout << "dylib1.o\n"; - fout << "MacOS\n"; - fout << "Library\n"; - fout << "Debug\n"; - fout << "\n"; - }*/ - - fout << "\n"; -} - - -void cmLocalCodeWarriorGenerator::WriteLinkOrder(std::ostream& fout, - const char* tgtName, - cmTarget const *l) -{ - fout << "\n"; - - // for each file - std::vector const& classes = l->GetSourceFiles(); - for(std::vector::const_iterator i = classes.begin(); - i != classes.end(); i++) - { - // Add the file to the list of sources. - std::string source = (*i)->GetFullPath(); - fout << "\n"; - fout << "Absolute\n"; - fout << "Absolute\n"; - //fout << "common\n"; - fout << "" << source << "\n"; - fout << "Generic\n"; - fout << "\n"; - } - - // now add in the libraries we depend on - cmsys::RegularExpression isAframework("[ \t]*\\-framework"); - cmsys::RegularExpression isEnvironment("\\${"); - cmsys::RegularExpression isUNIX("[ \t]*\\-l([^ \t]+)"); - const cmTarget::LinkLibraries& libs = l->GetLinkLibraries(); - cmTarget::LinkLibraries::const_iterator lib = libs.begin(); - - std::map 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 && *cacheValue ) - { - // just tack it on - fout << "\n"; - fout << "RootRelative\n"; - fout << "Project\n"; - fout << "" << m_TargetOutputFiles[lib->first] << "\n"; - fout << "Unix\n"; - fout << "\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 << "\n"; - fout << "Absolute\n"; - fout << "Absolute\n"; - fout << "" << lib->first.c_str() << "\n"; - fout << "Unix\n"; - fout << "\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][.] - std::string libName = isUNIX.match(1); - } - else - { - // just tack it on - fout << "\n"; - fout << "Name\n"; - fout << "" << lib->first.c_str() << "\n"; - fout << "Unix\n"; - fout << "\n"; - } - } - - // now add in the system libs (for an executable) - if (l->GetType() == cmTarget::EXECUTABLE) - { - fout << "\n"; - fout << "Name\n"; - fout << "crt1.o\n"; - fout << "MacOS\n"; - fout << "\n"; - fout << "\n"; - fout << "Name\n"; - fout << "MSL_All_Mach-O.lib\n"; - fout << "Unix\n"; - fout << "\n"; - fout << "\n"; - fout << "Name\n"; - fout << "console_OS_X.c\n"; - fout << "Unix\n"; - fout << "\n"; - } - // or a shared library -/* else if (l->GetType() == cmTarget::SHARED_LIBRARY || - l->GetType() == cmTarget::MODULE_LIBRARY) - { - fout << "\n"; - fout << "Name\n"; - fout << "dylib1.o\n"; - fout << "MacOS\n"; - fout << "\n"; - }*/ - - fout << "\n"; - - if( referencedTargets.size() ) - { - fout << "\n"; - // output subtarget list - std::map::const_iterator target = referencedTargets.begin(); - for( ; target != referencedTargets.end(); target++ ) - { - fout << "\n"; - fout << "" << target->first << "\n"; - fout << "LinkAgainst\n"; - fout << "\nRootRelative\n" - << "Project\n" - << "" << target->second << "\n" - << "Unix\n"; - fout << "\n"; - } - fout << "\n"; - } - - // we need at least one framework for the XML to be valid - // generate framework list - cmsys::RegularExpression reg("[ \t]*\\-framework[ \t]+([^ \t]+)"); - std::vector 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 << "\n"; - - std::vector::const_iterator framework = frameworks.begin(); - for(; framework != frameworks.end(); ++framework) - { - fout << "\n"; - fout << "\n"; - fout << "Name\n"; - fout << "" << framework->c_str() << ".framework\n"; - fout << "MacOS\n"; - fout << "\n"; - // this isn't strictly always true, I believe, but Apple adheres to it - fout << "" << framework->c_str() << "\n"; - fout << "\n"; - } - - // if it's an executable, it needs to link into System.framework - if (l->GetType() == cmTarget::EXECUTABLE) - { - fout << "\n"; - fout << "\n"; - fout << "Name\n"; - fout << "System.framework\n"; - fout << "MacOS\n"; - fout << "\n"; - fout << "System\n"; - fout << "\n"; - } - - fout << "\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(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(l->first.c_str()); - } - } - } - - // write out the libraries groups - if( hasExecutableTarget ) - { - fout << "" << "App Support" << "\n"; - fout << "\n"; - fout << "" << firstExecutableTarget << "\n"; - fout << "Name\n"; - fout << "crt1.o\n"; - fout << "MacOS\n"; - fout << "\n"; - fout << "\n"; - fout << "" << firstExecutableTarget << "\n"; - fout << "Name\n"; - fout << "MSL_All_Mach-O.lib\n"; - fout << "Unix\n"; - fout << "\n"; - fout << "\n"; - fout << "" << firstExecutableTarget << "\n"; - fout << "Name\n"; - fout << "console_OS_X.c\n"; - fout << "Unix\n"; - fout << "\n"; - fout << "\n"; - } -/* if (hasDynamicLibTarget) - { - fout << "" << "dylib Support" << "\n"; - fout << "\n"; - fout << "" << firstDynamicLibTarget << "\n"; - fout << "Name\n"; - fout << "dylib1.o\n"; - fout << "MacOS\n"; - fout << "\n"; - fout << "\n"; - }*/ - - // write out the referenced targets group - if( m_TargetReferencingList.size() > 0 ) - { - fout << "Subtarget Files\n"; - - std::map::const_iterator subtarget = m_TargetReferencingList.begin(); - for( ; subtarget != m_TargetReferencingList.end(); subtarget++ ) - { - fout << "\n" - << "" << subtarget->second << "\n"; - fout << "RootRelative\nProject\n"; - fout << "" << subtarget->first << "\n"; - fout << "Unix\n"; - fout << ""; - } - - fout << ""; - } -} - -void cmLocalCodeWarriorGenerator::WriteGroup(std::ostream& fout, - const char *tgtName, - cmTarget const *l) -{ - fout << "" << tgtName << "\n"; - - // for each file - std::vector const& classes = l->GetSourceFiles(); - for(std::vector::const_iterator i = classes.begin(); - i != classes.end(); i++) - { - std::string source = (*i)->GetFullPath(); - fout << "\n"; - fout << "" << tgtName << "\n"; - fout << "Absolute\n"; - fout << "Absolute\n"; - fout << "" << source << "\n"; - fout << "Generic\n"; - fout << "\n"; - } - - // now add in the libraries we depend on - cmsys::RegularExpression isAframework("[ \t]*\\-framework"); - cmsys::RegularExpression isEnvironment("\\${"); - cmsys::RegularExpression 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 && *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 << "\n"; - fout << "" << tgtName << "\n"; - fout << "Absolute\n"; - fout << "Absolute\n"; - fout << "" << lib->first.c_str() << "\n"; - fout << "Unix\n"; - fout << "\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][.] - std::string libName = isUNIX.match(1); - } - else - { - // just tack it on - fout << "\n"; - fout << "" << tgtName << "\n"; - fout << "Name\n"; - fout << "" << lib->first.c_str() << "\n"; - fout << "Unix\n"; - fout << "\n"; - } - } - - fout << "\n"; -} diff --git a/Source/cmLocalCodeWarriorGenerator.h b/Source/cmLocalCodeWarriorGenerator.h deleted file mode 100644 index c415bc4ca..000000000 --- a/Source/cmLocalCodeWarriorGenerator.h +++ /dev/null @@ -1,82 +0,0 @@ -/*========================================================================= - - 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. - - 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. - -=========================================================================*/ -#ifndef cmLocalCodeWarriorGenerator_h -#define cmLocalCodeWarriorGenerator_h - -#include "cmLocalGenerator.h" - -class cmMakeDepend; -class cmTarget; -class cmSourceFile; - -// please remove me.... Yuck -#include "cmSourceGroup.h" - -/** \class cmLocalCodeWarriorGenerator - * \brief Write a LocalUnix makefiles. - * - * cmLocalCodeWarriorGenerator produces a LocalUnix makefile from its - * member m_Makefile. - */ -class cmLocalCodeWarriorGenerator : public cmLocalGenerator -{ -public: - ///! Set cache only and recurse to false by default. - cmLocalCodeWarriorGenerator(); - - virtual ~cmLocalCodeWarriorGenerator(); - - /** - * Generate the makefile for this directory. fromTheTop indicates if this - * is being invoked as part of a global Generate or specific to this - * directory. The difference is that when done from the Top we might skip - * some steps to save time, such as dependency generation for the - * makefiles. This is done by a direct invocation from make. - */ - virtual void Generate(bool fromTheTop); - - enum BuildType {STATIC_LIBRARY, DLL, EXECUTABLE, WIN32_EXECUTABLE, UTILITY}; - - /** - * Specify the type of the build: static, dll, or executable. - */ - void SetBuildType(BuildType,const char *name); - - void WriteTargets(std::ostream& fout); - void WriteGroups(std::ostream& fout); - -private: - void WriteTarget(std::ostream& fout, const char *name, cmTarget const *l); - void WriteGroup(std::ostream& fout, const char *name, cmTarget const *l); - void WriteSettingList(std::ostream& fout, const char *name, - cmTarget const *l); - void WriteFileList(std::ostream& fout, const char *name, cmTarget const *l); - void WriteLinkOrder(std::ostream& fout, const char *name, cmTarget const *l); - void AddFileMapping(std::ostream& fout, const char *ftype, - const char *ext, const char *comp, - const char *edit, bool precomp, - bool launch, bool res, bool ignored); - -private: - // lists the names of the output files of the various targets - std::map m_TargetOutputFiles; - // lists which target first references another target's output - std::map m_TargetReferencingList; -}; - -#endif -