new borland generator moved into place

This commit is contained in:
Bill Hoffman 2001-11-30 16:48:52 -05:00
parent e9d0ad180f
commit 0d3eefb1f1
12 changed files with 94 additions and 172 deletions

View File

@ -95,11 +95,7 @@ SOURCE=.\cmNMakeMakefileGenerator.cxx
# End Source File
# Begin Source File
SOURCE=.\cmBorlandMakefileGenerator.cpp
# End Source File
# Begin Source File
SOURCE=.\cmBorlandMakefileGenerator2.cxx
SOURCE=.\cmBorlandMakefileGenerator.cxx
# End Source File
# Begin Source File
@ -119,6 +115,10 @@ SOURCE=.\cmCustomCommand.cxx
# End Source File
# Begin Source File
SOURCE=.\cmakewizard.cxx
# End Source File
# Begin Source File
SOURCE=.\cmDirectory.cxx
# End Source File
# Begin Source File

View File

@ -10,6 +10,7 @@ ENDIF(FLTK_LIBRARY)
SOURCE_FILES(SRCS
cmake.cxx
cmakewizard.cxx
cmMakeDepend.cxx
cmMakefile.cxx
cmMakefileGenerator.cxx
@ -37,8 +38,7 @@ ADD_DEFINITIONS(-DCMAKE_BUILD_WITH_CMAKE)
IF (WIN32)
SOURCE_FILES(SRCS cmDSWWriter.cxx cmDSPWriter.cxx cmMSProjectGenerator.cxx)
SOURCE_FILES(SRCS cmBorlandMakefileGenerator2.cxx)
SOURCE_FILES(SRCS cmBorlandMakefileGenerator.cpp)
SOURCE_FILES(SRCS cmBorlandMakefileGenerator.cxx)
SOURCE_FILES(SRCS cmNMakeMakefileGenerator.cxx)
IF(NOT UNIX)
IF( NOT BORLAND )
@ -67,7 +67,6 @@ LINK_LIBRARIES(CMakeLib)
LINK_DIRECTORIES(${CMake_BINARY_DIR}/Source)
ADD_EXECUTABLE(cmake cmakemain)
ADD_EXECUTABLE(cmakewizard cmakewizard)
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
ADD_EXECUTABLE(ctest ctest.cxx cmSystemTools.cxx cmRegularExpression.cxx)

View File

@ -9,9 +9,6 @@
.cxx.obj:
bcc32 -Pcxx -c -DCMAKE_ROOT_DIR='"."' {$< }
.cpp.obj:
bcc32 -Pcxx -c -DCMAKE_ROOT_DIR='"."' {$< }
OBJS = \
cmake.obj \
@ -28,7 +25,6 @@ cmMSProjectGenerator.obj \
cmDSPWriter.obj \
cmDSWWriter.obj \
cmNMakeMakefileGenerator.obj \
cmBorlandMakefileGenerator2.obj \
cmBorlandMakefileGenerator.obj \
cmCommands.obj \
cmTarget.obj \

View File

@ -15,6 +15,7 @@ all: cmake
OBJS = \
cmake.o \
cmakewizard.o \
cmakemain.o \
cmMakeDepend.o \
cmMakefile.o \

View File

@ -38,7 +38,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "cmBorlandMakefileGenerator2.h"
#include "cmBorlandMakefileGenerator.h"
#include "cmMakefile.h"
#include "cmStandardIncludes.h"
#include "cmSystemTools.h"
@ -49,18 +49,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "windows.h"
cmBorlandMakefileGenerator2::cmBorlandMakefileGenerator2()
cmBorlandMakefileGenerator::cmBorlandMakefileGenerator()
{
this->SetLibraryPathOption("-L");
this->SetLibraryLinkOption("");
}
cmBorlandMakefileGenerator2::~cmBorlandMakefileGenerator2()
cmBorlandMakefileGenerator::~cmBorlandMakefileGenerator()
{
}
void cmBorlandMakefileGenerator2::ComputeSystemInfo()
void cmBorlandMakefileGenerator::ComputeSystemInfo()
{
// now load the settings
if(!m_Makefile->GetDefinition("CMAKE_ROOT"))
@ -71,13 +71,13 @@ void cmBorlandMakefileGenerator2::ComputeSystemInfo()
}
std::string fpath =
m_Makefile->GetDefinition("CMAKE_ROOT");
fpath += "/Templates/CMakeWindowsBorlandConfig2.cmake";
fpath += "/Templates/CMakeBorlandWindowsSystemConfig.cmake";
m_Makefile->ReadListFile(NULL,fpath.c_str());
}
void cmBorlandMakefileGenerator2::OutputMakeVariables(std::ostream& fout)
void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
{
fout << "# NMake Makefile generated by cmake\n";
const char* variables =
@ -146,7 +146,7 @@ void cmBorlandMakefileGenerator2::OutputMakeVariables(std::ostream& fout)
}
void cmBorlandMakefileGenerator2::BuildInSubDirectory(std::ostream& fout,
void cmBorlandMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
const char* directory,
const char* target1,
const char* target2)
@ -176,7 +176,7 @@ void cmBorlandMakefileGenerator2::BuildInSubDirectory(std::ostream& fout,
// This needs to be overriden because nmake requires commands to be quoted
// if the are full paths to the executable????
void cmBorlandMakefileGenerator2::OutputMakeRule(std::ostream& fout,
void cmBorlandMakefileGenerator::OutputMakeRule(std::ostream& fout,
const char* comment,
const char* target,
const char* depends,
@ -247,7 +247,7 @@ void cmBorlandMakefileGenerator2::OutputMakeRule(std::ostream& fout,
}
void
cmBorlandMakefileGenerator2::
cmBorlandMakefileGenerator::
OutputBuildObjectFromSource(std::ostream& fout,
const char* shortName,
const cmSourceFile& source,
@ -313,7 +313,7 @@ OutputBuildObjectFromSource(std::ostream& fout,
compileCommand.c_str());
}
void cmBorlandMakefileGenerator2::OutputSharedLibraryRule(std::ostream& fout,
void cmBorlandMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout,
const char* name,
const cmTarget &t)
{
@ -362,14 +362,14 @@ void cmBorlandMakefileGenerator2::OutputSharedLibraryRule(std::ostream& fout,
command2.c_str());
}
void cmBorlandMakefileGenerator2::OutputModuleLibraryRule(std::ostream& fout,
void cmBorlandMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout,
const char* name,
const cmTarget &target)
{
this->OutputSharedLibraryRule(fout, name, target);
}
void cmBorlandMakefileGenerator2::OutputStaticLibraryRule(std::ostream& fout,
void cmBorlandMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
const char* name,
const cmTarget &)
{
@ -398,7 +398,7 @@ void cmBorlandMakefileGenerator2::OutputStaticLibraryRule(std::ostream& fout,
command.c_str());
}
void cmBorlandMakefileGenerator2::OutputExecutableRule(std::ostream& fout,
void cmBorlandMakefileGenerator::OutputExecutableRule(std::ostream& fout,
const char* name,
const cmTarget &t)
{
@ -438,7 +438,7 @@ void cmBorlandMakefileGenerator2::OutputExecutableRule(std::ostream& fout,
std::string cmBorlandMakefileGenerator2::GetOutputExtension(const char* s)
std::string cmBorlandMakefileGenerator::GetOutputExtension(const char* s)
{
std::string sourceExtension = s;
if(sourceExtension == "def")
@ -458,7 +458,7 @@ std::string cmBorlandMakefileGenerator2::GetOutputExtension(const char* s)
bool cmBorlandMakefileGenerator2::SamePath(const char* path1, const char* path2)
bool cmBorlandMakefileGenerator::SamePath(const char* path1, const char* path2)
{
// first check to see if they are the same anyway
if (strcmp(path1, path2) == 0)
@ -471,7 +471,7 @@ bool cmBorlandMakefileGenerator2::SamePath(const char* path1, const char* path2)
cmSystemTools::LowerCase(ShortPath(path2));
}
void cmBorlandMakefileGenerator2::OutputBuildLibraryInDir(std::ostream& fout,
void cmBorlandMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout,
const char* path,
const char* s,
const char* fullpath)
@ -480,7 +480,7 @@ void cmBorlandMakefileGenerator2::OutputBuildLibraryInDir(std::ostream& fout,
}
std::string cmBorlandMakefileGenerator2::ConvertToNativePath(const char* s)
std::string cmBorlandMakefileGenerator::ConvertToNativePath(const char* s)
{
std::string ret = s;
cmSystemTools::ConvertToWindowsSlashes(ret);

View File

@ -38,31 +38,31 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef cmBorlandMakefileGenerator2_h
#define cmBorlandMakefileGenerator2_h
#ifndef cmBorlandMakefileGenerator_h
#define cmBorlandMakefileGenerator_h
#include "cmNMakeMakefileGenerator.h"
/** \class cmBorlandMakefileGenerator2
/** \class cmBorlandMakefileGenerator
* \brief Write an NMake makefile.
*
* cmBorlandMakefileGenerator2 produces a Unix makefile from its
* cmBorlandMakefileGenerator produces a Unix makefile from its
* member m_Makefile.
*/
class cmBorlandMakefileGenerator2 : public cmNMakeMakefileGenerator
class cmBorlandMakefileGenerator : public cmNMakeMakefileGenerator
{
public:
///! Set cache only and recurse to false by default.
cmBorlandMakefileGenerator2();
cmBorlandMakefileGenerator();
virtual ~cmBorlandMakefileGenerator2();
virtual ~cmBorlandMakefileGenerator();
///! Get the name for the generator.
virtual const char* GetName() {return "Borland Makefiles2";}
virtual const char* GetName() {return "Borland Makefiles";}
///! virtual copy constructor
virtual cmMakefileGenerator* CreateObject()
{ return new cmBorlandMakefileGenerator2;}
{ return new cmBorlandMakefileGenerator;}
///! figure out about the current system information
virtual void ComputeSystemInfo();

View File

@ -93,7 +93,7 @@ IsFunctionBlocked(const char *name, const std::vector<std::string> &args,
bool cmForEachFunctionBlocker::
ShouldRemove(const char *name, const std::vector<std::string> &args,
cmMakefile &mf)
cmMakefile &)
{
if (!strcmp(name,"ENDFOREACH") && args[0] == m_Args[0])
{

View File

@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if defined(_WIN32) && !defined(__CYGWIN__)
#include "cmMSProjectGenerator.h"
#include "cmBorlandMakefileGenerator.h"
#include "cmBorlandMakefileGenerator2.h"
#include "cmNMakeMakefileGenerator.h"
#else
#include "cmUnixMakefileGenerator.h"
@ -58,7 +57,6 @@ cmake::cmake()
cmMakefileGenerator::RegisterGenerator(new cmMSProjectGenerator);
cmMakefileGenerator::RegisterGenerator(new cmNMakeMakefileGenerator);
cmMakefileGenerator::RegisterGenerator(new cmBorlandMakefileGenerator);
cmMakefileGenerator::RegisterGenerator(new cmBorlandMakefileGenerator2);
#else
cmMakefileGenerator::RegisterGenerator(new cmUnixMakefileGenerator);
#endif

View File

@ -1,15 +1,31 @@
#include "cmakewizard.h"
#include "cmake.h"
#include "cmMakefileGenerator.h"
int main(int ac, char** av)
{
cmake cm;
bool wiz = false;
std::vector<std::string> args;
for(int i =0; i < ac; ++i)
{
args.push_back(av[i]);
if(strcmp(av[i], "-i") == 0)
{
wiz = true;
}
else
{
args.push_back(av[i]);
}
}
int ret = cm.Generate(args);
if(!wiz)
{
cmake cm;
int ret = cm.Generate(args);
cmMakefileGenerator::UnRegisterGenerators();
return ret;
}
cmakewizard wizard;
wizard.RunWizard(args);
cmMakefileGenerator::UnRegisterGenerators();
return ret;
return 0;
}

View File

@ -1,18 +1,15 @@
#include "cmCacheManager.h"
#include "cmakewizard.h"
#include "cmake.h"
#include "cmCacheManager.h"
bool advanced = false;
void Ask(const char* key, cmCacheManager::CacheEntry & entry)
cmakewizard::cmakewizard()
{
if(!advanced)
{
if(cmCacheManager::GetInstance()->IsAdvanced(key))
{
return;
}
}
m_ShowAdvanced = false;
}
void cmakewizard::AskUser(const char* key, cmCacheManager::CacheEntry & entry)
{
std::cout << "Variable Name: " << key << "\n";
std::cout << "Description: " << entry.m_HelpString << "\n";
std::cout << "Current Value: " << entry.m_Value.c_str() << "\n";
@ -36,15 +33,8 @@ void Ask(const char* key, cmCacheManager::CacheEntry & entry)
std::cout << "\n";
}
int main(int ac, char** av)
bool cmakewizard::AskAdvanced()
{
std::vector<std::string> args;
for(int j=0; j < ac; ++j)
{
args.push_back(av[j]);
}
cmSystemTools::DisableRunCommandOutput();
std::cout << "Would you like to see advanced options? [No]:";
char buffer[4096];
buffer[0] = 0;
@ -53,9 +43,24 @@ int main(int ac, char** av)
{
if(buffer[0] == 'y' || buffer[0] == 'Y')
{
advanced = true;
return true;
}
}
return false;
}
void cmakewizard::ShowMessage(const char* m)
{
std::cout << m << "\n";
}
void cmakewizard::RunWizard(std::vector<std::string> const& args)
{
m_ShowAdvanced = this->AskAdvanced();
cmSystemTools::DisableRunCommandOutput();
cmake make;
cmCacheManager::CacheEntryMap askedCache;
bool asked = false;
@ -64,9 +69,9 @@ int main(int ac, char** av)
{
asked = false;
// run cmake
std::cout << "Please wait while cmake processes CMakeLists.txt files....\n";
this->ShowMessage("Please wait while cmake processes CMakeLists.txt files....\n");
make.Generate(args);
std::cout << "\n";
this->ShowMessage("\n");
// load the cache from disk
cmCacheManager::GetInstance()->
LoadCache(cmSystemTools::GetCurrentWorkingDirectory().c_str());
@ -88,22 +93,26 @@ int main(int ac, char** av)
cmCacheManager::CacheEntry& e = askedCache.find(key)->second;
if(e.m_Value != ce.m_Value)
{
Ask(key.c_str(), ce);
asked = true;
if(m_ShowAdvanced || !cmCacheManager::GetInstance()->IsAdvanced(key.c_str()))
{
this->AskUser(key.c_str(), ce);
asked = true;
}
}
}
else
{
Ask(key.c_str(), ce);
asked = true;
if(m_ShowAdvanced || !cmCacheManager::GetInstance()->IsAdvanced(key.c_str()))
{
this->AskUser(key.c_str(), ce);
asked = true;
}
}
askedCache[key] = i->second;
}
cmCacheManager::GetInstance()->
SaveCache(cmSystemTools::GetCurrentWorkingDirectory().c_str());
}
while(asked);
std::cout << "CMake complete, run make to build project.\n";
return 0;
this->ShowMessage("CMake complete, run make to build project.\n");
}

View File

@ -1,97 +0,0 @@
#
# Borland configuration.
# Note that this is valid for Borland C++Builder 5 with patch #1
#
SET (WORDS_BIGENDIAN )
SET (CMAKE_CXX_COMPILER "Borland_BCB_5.5.1" CACHE STRING "C++ compiler used.")
#
# We need the Borland compiler path
#
FIND_PATH(BCB_BIN_PATH bcc32.exe
"C:/Program Files/Borland/CBuilder5/Bin"
"C:/Borland/Bcc55/Bin"
"/Borland/Bcc55/Bin"
[HKEY_LOCAL_MACHINE/SOFTWARE/Borland/C++Builder/5.0/RootDir]/Bin
)
#
# override opengl library as it is bound to import32.lib already
#
IF (OPENGL_LIBRARY)
SET (OPENGL_LIBRARY import32 CACHE STRING "OpenGL library linked by Borland's import32.lib")
ENDIF (OPENGL_LIBRARY)
#
# Set debug compile flags if not already set/edited by user
#
IF (NOT FLAGS_CPP_DEBUG)
SET (FLAGS_CPP_DEBUG "-a8 -c -d -tWM -tWR -Ve -Vx -k -Od -r- -v -vi- -y" CACHE STRING "Flags used by CPP compiler in DEBUG mode")
ENDIF (NOT FLAGS_CPP_DEBUG)
#
# Set release compile flags if not already set/edited by user
#
IF (NOT FLAGS_CPP_RELEASE)
SET (FLAGS_CPP_RELEASE "-a8 -c -d -tWM -tWR -Ve -Vx -k- -O2 -r -v-" CACHE STRING "Flags used by CPP compiler in RELEASE mode")
ENDIF (NOT FLAGS_CPP_RELEASE)
#
# Set compiler warning flags if not already set/edited by user
#
IF (NOT FLAGS_CPP_WARNING)
SET (FLAGS_CPP_WARNING "-w- -whid -waus -wpar" CACHE STRING "Flags used to control compiler warnings")
ENDIF (NOT FLAGS_CPP_WARNING)
#
# Set link flags if not already set/edited by user
#
IF (NOT FLAGS_LINK_DLL)
SET (FLAGS_LINK_DLL "-aa -Tpd -x -Gn -Gl" CACHE STRING "Flags used by Linker for DLL")
ENDIF (NOT FLAGS_LINK_DLL)
IF (NOT FLAGS_LINK_BPL)
SET (FLAGS_LINK_BPL "-aa -Tpp -x -Gn -Gi" CACHE STRING "Flags used by Linker for BPL")
ENDIF (NOT FLAGS_LINK_BPL)
IF (NOT FLAGS_LINK_LIB)
SET (FLAGS_LINK_LIB "-aa -x -Gn -Gl -P128" CACHE STRING "Flags used by Linker for LIB")
ENDIF (NOT FLAGS_LINK_LIB)
IF (NOT FLAGS_LINK_EXE)
SET (FLAGS_LINK_EXE "-aa -Tpe -x -Gn" CACHE STRING "Flags used by Linker for EXE")
ENDIF (NOT FLAGS_LINK_EXE)
IF (NOT FLAGS_LINK_DEBUG)
SET (FLAGS_LINK_DEBUG "-v" CACHE STRING "Flags used by Linker in DEBUG mode")
ENDIF (NOT FLAGS_LINK_DEBUG)
IF (NOT FLAGS_LINK_STATIC)
SET (FLAGS_LINK_STATIC "/P128" CACHE STRING "Set default Page size to 128 for static libraries")
ENDIF (NOT FLAGS_LINK_STATIC)
#
# Set User Conditional Defines to Defaults
#
IF (NOT DEFS_USER)
SET (DEFS_USER "" CACHE STRING "Compiler conditional defines set by the user")
ENDIF (NOT DEFS_USER)
#
# Set SYS Conditional Defines to Defaults
#
IF (NOT DEFS_SYS)
SET (DEFS_SYS "-DWIN32;WIN32_LEAN_AND_MEAN;STRICT;_RTLDLL;USEPACKAGES" CACHE STRING "Compiler conditional defines required for correct compilation")
ENDIF (NOT DEFS_SYS)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM make ${BCB_BIN_PATH} )