summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-11-28 23:07:27 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-11-28 23:07:27 (GMT)
commite7bb895afda0ccc5711906873040459942137dce (patch)
tree571e06a2919cb2922ca46ab0f64f5e969efe0ab5 /Source
parentb29e3f11cbdfa0dffb40eb394468b448066762e6 (diff)
downloadCMake-e7bb895afda0ccc5711906873040459942137dce.zip
CMake-e7bb895afda0ccc5711906873040459942137dce.tar.gz
CMake-e7bb895afda0ccc5711906873040459942137dce.tar.bz2
ENH: borland generator 2 is working more or less
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLib.dsp4
-rw-r--r--Source/cmBorlandMakefileGenerator2.cxx63
-rw-r--r--Source/cmBorlandMakefileGenerator2.h2
-rw-r--r--Source/cmNMakeMakefileGenerator.cxx2
-rw-r--r--Source/cmNMakeMakefileGenerator.h4
-rw-r--r--Source/cmUnixMakefileGenerator.cxx2
-rw-r--r--Source/cmUnixMakefileGenerator.h1
7 files changed, 55 insertions, 23 deletions
diff --git a/Source/CMakeLib.dsp b/Source/CMakeLib.dsp
index f2e63cc..53628cd 100644
--- a/Source/CMakeLib.dsp
+++ b/Source/CMakeLib.dsp
@@ -99,6 +99,10 @@ SOURCE=.\cmBorlandMakefileGenerator.cpp
# End Source File
# Begin Source File
+SOURCE=.\cmBorlandMakefileGenerator2.cxx
+# End Source File
+# Begin Source File
+
SOURCE=.\cmCableClassSet.cxx
# End Source File
# Begin Source File
diff --git a/Source/cmBorlandMakefileGenerator2.cxx b/Source/cmBorlandMakefileGenerator2.cxx
index 6efb40a..33609c8 100644
--- a/Source/cmBorlandMakefileGenerator2.cxx
+++ b/Source/cmBorlandMakefileGenerator2.cxx
@@ -52,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmBorlandMakefileGenerator2::cmBorlandMakefileGenerator2()
{
this->SetLibraryPathOption("-L");
+ this->SetLibraryLinkOption("");
}
cmBorlandMakefileGenerator2::~cmBorlandMakefileGenerator2()
@@ -85,9 +86,6 @@ void cmBorlandMakefileGenerator2::OutputMakeVariables(std::ostream& fout)
"# Path to cmake\n"
"CMAKE_COMMAND = ${CMAKE_COMMAND}\n"
"CMAKE_STANDARD_WINDOWS_LIBRARIES = @CMAKE_STANDARD_WINDOWS_LIBRARIES@\n"
- "FLAGS_LINK_EXE = @FLAGS_LINK_EXE@ \n"
- "FLAGS_LINK_LIB = @FLAGS_LINK_LIB@ \n"
- "FLAGS_LINK_STATIC = @FLAGS_LINK_STATIC@ \n"
"CMAKE_C_COMPILER = @CMAKE_C_COMPILER@ \n"
"CMAKE_CFLAGS = @CMAKE_CFLAGS@ @BUILD_FLAGS@\n"
"CMAKE_CXX_COMPILER = @CMAKE_CXX_COMPILER@\n"
@@ -244,7 +242,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
std::string comment = "Build ";
std::string objectFile = std::string(shortName) +
this->GetOutputExtension(source.GetSourceExtension().c_str());
-
+ cmSystemTools::ConvertToWindowsSlashes(objectFile);
comment += objectFile + " From ";
comment += source.GetFullPath();
std::string compileCommand;
@@ -257,15 +255,15 @@ OutputBuildObjectFromSource(std::ostream& fout,
{
compileCommand += "$(CMAKE_SHLIB_CFLAGS) ";
}
- compileCommand += "$(INCLUDE_FLAGS) -c ";
+ compileCommand += " -o";
+ compileCommand += objectFile;
+ compileCommand += " $(INCLUDE_FLAGS) -c ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
- compileCommand += " /Fo";
- compileCommand += objectFile;
}
else if (ext == "rc")
{
- compileCommand = "$(RC) /fo\"";
+ compileCommand = "$(RC) -o\"";
compileCommand += objectFile;
compileCommand += "\" ";
compileCommand +=
@@ -285,11 +283,11 @@ OutputBuildObjectFromSource(std::ostream& fout,
{
compileCommand += "$(CMAKE_SHLIB_CFLAGS) ";
}
- compileCommand += "$(INCLUDE_FLAGS) -c ";
+ compileCommand += " -o";
+ compileCommand += objectFile;
+ compileCommand += " $(INCLUDE_FLAGS) -c ";
compileCommand +=
cmSystemTools::EscapeSpaces(source.GetFullPath().c_str());
- compileCommand += " /Fo";
- compileCommand += objectFile;
}
m_QuoteNextCommand = false;
this->OutputMakeRule(fout,
@@ -308,32 +306,43 @@ void cmBorlandMakefileGenerator2::OutputSharedLibraryRule(std::ostream& fout,
std::string depend = "$(";
depend += name;
depend += "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)";
- std::string command = "ilink32 /dll $(FLAGS_LINK_LIB) @&&|\n";
- command += "$(" + std::string(name) + "_SRC_OBJS) /out:";
- std::string dllpath = m_LibraryOutputPath + std::string(name) + ".dll ";
+ std::string command = "$(CMAKE_CXX_COMPILER) -tWD @&&|\n";
+ std::string dllpath = m_LibraryOutputPath + std::string(name);
+ std::string libpath = dllpath + ".lib";
+ dllpath += ".dll";
cmSystemTools::ConvertToWindowsSlashes(dllpath);
+ // must be executable name
+ command += "-e";
command += cmSystemTools::EscapeSpaces(dllpath.c_str());
+ command += " ";
+ // then list of object files
+ command += " $(" + std::string(name) + "_SRC_OBJS) ";
std::strstream linklibs;
this->OutputLinkLibraries(linklibs, name, t);
linklibs << std::ends;
+ // then the linker options -L and libraries (any other order will fail!)
command += linklibs.str();
delete [] linklibs.str();
+ std::string command2 = "implib -w ";
+ command2 += libpath + " " + dllpath;
const std::vector<cmSourceFile>& sources = t.GetSourceFiles();
for(std::vector<cmSourceFile>::const_iterator i = sources.begin();
i != sources.end(); ++i)
{
if(i->GetSourceExtension() == "def")
{
- command += "/DEF:";
+ command += "";
command += i->GetFullPath();
}
}
command += "\n|\n";
m_QuoteNextCommand = false;
+
this->OutputMakeRule(fout, "rules for a shared library",
target.c_str(),
depend.c_str(),
- command.c_str());
+ command.c_str(),
+ command2.c_str());
}
void cmBorlandMakefileGenerator2::OutputModuleLibraryRule(std::ostream& fout,
@@ -350,12 +359,14 @@ void cmBorlandMakefileGenerator2::OutputStaticLibraryRule(std::ostream& fout,
std::string target = m_LibraryOutputPath + std::string(name) + ".lib";
std::string depend = "$(";
depend += std::string(name) + "_SRC_OBJS)";
- std::string command = "tlib $(FLAGS_LINK_STATIC) @&&|\n\t /u ";
- std::string deleteCommand = "del ";
- deleteCommand += target;
+ std::string command = "tlib @&&|\n\t /u ";
std::string libpath = m_LibraryOutputPath + std::string(name) + ".lib";
cmSystemTools::ConvertToWindowsSlashes(libpath);
command += cmSystemTools::EscapeSpaces(libpath.c_str());
+ std::string deleteCommand = "if exist ";
+ deleteCommand += libpath;
+ deleteCommand += " del ";
+ deleteCommand += libpath;
command += " $(";
command += std::string(name) + "_SRC_OBJS)";
command += "\n|\n";
@@ -380,7 +391,6 @@ void cmBorlandMakefileGenerator2::OutputExecutableRule(std::ostream& fout,
depend += std::string(name) + "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)";
std::string command =
"$(CMAKE_CXX_COMPILER) ";
- command += "$(" + std::string(name) + "_SRC_OBJS) ";
std::string path = m_ExecutableOutputPath + name + ".exe";
command += " -e" +
cmSystemTools::EscapeSpaces(path.c_str());
@@ -392,11 +402,13 @@ void cmBorlandMakefileGenerator2::OutputExecutableRule(std::ostream& fout,
{
command += " -tWC ";
}
-
std::strstream linklibs;
this->OutputLinkLibraries(linklibs, 0, t);
linklibs << std::ends;
command += linklibs.str();
+ delete [] linklibs.str();
+ command += " $(" + std::string(name) + "_SRC_OBJS) ";
+
std::string comment = "rule to build executable: ";
comment += name;
m_QuoteNextCommand = false;
@@ -450,3 +462,12 @@ void cmBorlandMakefileGenerator2::OutputBuildLibraryInDir(std::ostream& fout,
{
cmNMakeMakefileGenerator::OutputBuildLibraryInDir(fout, path, s, fullpath);
}
+
+
+std::string cmBorlandMakefileGenerator2::ConvertToNativePath(const char* s)
+{
+ std::string ret = s;
+ cmSystemTools::ConvertToWindowsSlashes(ret);
+ return ret;
+}
+
diff --git a/Source/cmBorlandMakefileGenerator2.h b/Source/cmBorlandMakefileGenerator2.h
index 58fb2fd..f8440fa 100644
--- a/Source/cmBorlandMakefileGenerator2.h
+++ b/Source/cmBorlandMakefileGenerator2.h
@@ -102,6 +102,8 @@ protected:
const char* fullpath);
///! return true if the two paths are the same (checks short paths)
virtual bool SamePath(const char* path1, const char* path2);
+ virtual std::string ConvertToNativePath(const char* s);
+
private:
bool m_QuoteNextCommand; // if this is true, OutputMakeRule
// will not quote the next commands
diff --git a/Source/cmNMakeMakefileGenerator.cxx b/Source/cmNMakeMakefileGenerator.cxx
index 3ac21c1..bab4406 100644
--- a/Source/cmNMakeMakefileGenerator.cxx
+++ b/Source/cmNMakeMakefileGenerator.cxx
@@ -482,6 +482,7 @@ void cmNMakeMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
if(emitted.insert(libpath).second)
{
linkLibs += m_LibraryPathOption;
+ cmSystemTools::ConvertToWindowsSlashes(libpath);
linkLibs += libpath;
linkLibs += " ";
}
@@ -514,6 +515,7 @@ void cmNMakeMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
}
else
{
+ librariesLinked += m_LibraryLinkOption;
librariesLinked += lib->first;
librariesLinked += ".lib ";
}
diff --git a/Source/cmNMakeMakefileGenerator.h b/Source/cmNMakeMakefileGenerator.h
index 30be86a..78d54fa 100644
--- a/Source/cmNMakeMakefileGenerator.h
+++ b/Source/cmNMakeMakefileGenerator.h
@@ -109,12 +109,14 @@ protected:
///! return true if the two paths are the same (checks short paths)
virtual bool SamePath(const char* path1, const char* path2);
void SetLibraryPathOption(const char* lib){ m_LibraryPathOption = lib;}
+ void SetLibraryLinkOption(const char* lib){ m_LibraryLinkOption = lib;}
private:
bool m_QuoteNextCommand; // if this is true, OutputMakeRule
// will not quote the next commands
// it is reset to false after each
// call to OutputMakeRule
- std::string m_LibraryPathOption;
+ std::string m_LibraryPathOption;// option to specifiy a link path -LIBPATH
+ std::string m_LibraryLinkOption; // option to specify a library (like -l, empty for nmake)
};
#endif
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index e59b8b4..1a28b71 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -367,7 +367,7 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout)
std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str()));
if(outExt.size())
{
- fout << "\\\n" << i->GetSourceName()
+ fout << "\\\n" << this->ConvertToNativePath(i->GetSourceName().c_str())
<< outExt.c_str() << " ";
}
}
diff --git a/Source/cmUnixMakefileGenerator.h b/Source/cmUnixMakefileGenerator.h
index 6018721c..277635c 100644
--- a/Source/cmUnixMakefileGenerator.h
+++ b/Source/cmUnixMakefileGenerator.h
@@ -164,6 +164,7 @@ protected:
void SetStaticLibraryExtension(const char* e) {m_StaticLibraryExtension = e;}
void SetSharedLibraryExtension(const char* e) {m_SharedLibraryExtension = e;}
void SetLibraryPrefix(const char* e) { m_LibraryPrefix = e;}
+ virtual std::string ConvertToNativePath(const char* s) { return s; }
protected:
std::string m_ExecutableOutputPath;
std::string m_LibraryOutputPath;