ENH: integrate borland support
This commit is contained in:
parent
ecd4acfb01
commit
d204791e45
|
@ -65,7 +65,7 @@ LIB32=link.exe -lib
|
||||||
# PROP Intermediate_Dir "Debug"
|
# PROP Intermediate_Dir "Debug"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /Gi- /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
|
@ -91,6 +91,10 @@ SOURCE=.\cmake.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\cmBorlandMakefileGenerator.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\cmCableClassSet.cxx
|
SOURCE=.\cmCableClassSet.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -85,32 +85,34 @@ BEGIN
|
||||||
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
|
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 376, 225
|
IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 389, 225
|
||||||
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||||
WS_SYSMENU | WS_THICKFRAME
|
WS_SYSMENU | WS_THICKFRAME
|
||||||
EXSTYLE WS_EX_APPWINDOW
|
EXSTYLE WS_EX_APPWINDOW
|
||||||
CAPTION "CMakeSetupDialog"
|
CAPTION "CMakeSetupDialog"
|
||||||
FONT 8, "MS Sans Serif"
|
FONT 8, "MS Sans Serif"
|
||||||
BEGIN
|
BEGIN
|
||||||
COMBOBOX IDC_WhereSource,147,6,135,66,CBS_DROPDOWN |
|
COMBOBOX IDC_WhereSource,96,6,133,66,CBS_DROPDOWN |
|
||||||
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
|
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON "Browse...",IDC_BUTTON2,286,5,43,13
|
PUSHBUTTON "Browse...",IDC_BUTTON2,230,6,34,13
|
||||||
COMBOBOX IDC_WhereBuild,148,26,133,68,CBS_DROPDOWN |
|
COMBOBOX IDC_WhereBuild,96,26,133,68,CBS_DROPDOWN |
|
||||||
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
|
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON "Browse...",IDC_BUTTON3,286,25,43,13
|
PUSHBUTTON "Browse...",IDC_BUTTON3,230,25,34,13
|
||||||
DEFPUSHBUTTON "Configure",IDC_BuildProjects,88,202,67,15
|
DEFPUSHBUTTON "Configure",IDC_BuildProjects,88,202,67,15
|
||||||
PUSHBUTTON "Cancel",IDCANCEL,220,201,67,15
|
PUSHBUTTON "Cancel",IDCANCEL,220,201,67,15
|
||||||
LISTBOX IDC_LIST2,15,55,344,122,LBS_OWNERDRAWVARIABLE |
|
LISTBOX IDC_LIST2,15,55,356,122,LBS_OWNERDRAWVARIABLE |
|
||||||
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
|
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
|
||||||
WS_HSCROLL
|
WS_HSCROLL
|
||||||
RTEXT "Where is the source code:",IDC_STATIC,52,6,86,9
|
RTEXT "Where is the source code:",IDC_STATIC,6,7,86,9
|
||||||
RTEXT "Where do you want to build the binaries:",IDC_STATIC,10,
|
RTEXT "Where to build the binaries:",IDC_STATIC,5,27,90,9
|
||||||
27,128,9
|
GROUPBOX "Cache Values",IDC_FRAME,9,43,369,141
|
||||||
GROUPBOX "Cache Values",IDC_FRAME,9,43,356,141
|
|
||||||
CTEXT "Right click on cache entries for additional options",
|
CTEXT "Right click on cache entries for additional options",
|
||||||
IDC_MouseHelpCaption,106,189,156,8
|
IDC_MouseHelpCaption,106,189,156,8
|
||||||
LTEXT "Static",IDC_CMAKE_VERSION,3,211,58,13,SS_CENTERIMAGE
|
LTEXT "Static",IDC_CMAKE_VERSION,3,211,58,13,SS_CENTERIMAGE
|
||||||
PUSHBUTTON "OK",IDC_OK,160,202,56,14
|
PUSHBUTTON "OK",IDC_OK,160,202,56,14
|
||||||
|
COMBOBOX IDC_Generator,275,25,103,50,CBS_DROPDOWN | CBS_SORT |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
LTEXT "Build For:",IDC_GeneratorLabel,279,10,103,12
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,7 +177,7 @@ BEGIN
|
||||||
|
|
||||||
IDD_CMakeSetupDialog_DIALOG, DIALOG
|
IDD_CMakeSetupDialog_DIALOG, DIALOG
|
||||||
BEGIN
|
BEGIN
|
||||||
RIGHTMARGIN, 375
|
RIGHTMARGIN, 388
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "CMakeCommandLineInfo.h"
|
#include "CMakeCommandLineInfo.h"
|
||||||
#include "../cmCacheManager.h"
|
#include "../cmCacheManager.h"
|
||||||
#include "../cmake.h"
|
#include "../cmake.h"
|
||||||
|
#include "../cmMakefileGenerator.h"
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
#undef THIS_FILE
|
#undef THIS_FILE
|
||||||
|
@ -72,6 +73,7 @@ CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo,
|
||||||
//{{AFX_DATA_INIT(CMakeSetupDialog)
|
//{{AFX_DATA_INIT(CMakeSetupDialog)
|
||||||
m_WhereSource = cmdInfo.m_WhereSource;
|
m_WhereSource = cmdInfo.m_WhereSource;
|
||||||
m_WhereBuild = cmdInfo.m_WhereBuild;
|
m_WhereBuild = cmdInfo.m_WhereBuild;
|
||||||
|
m_GeneratorChoiceString = _T("");
|
||||||
//}}AFX_DATA_INIT
|
//}}AFX_DATA_INIT
|
||||||
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
|
||||||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||||
|
@ -92,6 +94,7 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
CDialog::DoDataExchange(pDX);
|
CDialog::DoDataExchange(pDX);
|
||||||
//{{AFX_DATA_MAP(CMakeSetupDialog)
|
//{{AFX_DATA_MAP(CMakeSetupDialog)
|
||||||
|
DDX_Control(pDX, IDC_Generator, m_GeneratorChoice);
|
||||||
DDX_Control(pDX, IDC_OK, m_OKButton);
|
DDX_Control(pDX, IDC_OK, m_OKButton);
|
||||||
DDX_Control(pDX, IDCANCEL, m_CancelButton);
|
DDX_Control(pDX, IDCANCEL, m_CancelButton);
|
||||||
DDX_CBStringExact(pDX, IDC_WhereSource, m_WhereSource);
|
DDX_CBStringExact(pDX, IDC_WhereSource, m_WhereSource);
|
||||||
|
@ -103,6 +106,7 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
|
||||||
DDX_Control(pDX, IDC_MouseHelpCaption, m_MouseHelp);
|
DDX_Control(pDX, IDC_MouseHelpCaption, m_MouseHelp);
|
||||||
DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay);
|
DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay);
|
||||||
DDX_Control(pDX, IDC_BuildProjects, m_Configure);
|
DDX_Control(pDX, IDC_BuildProjects, m_Configure);
|
||||||
|
DDX_CBStringExact(pDX, IDC_Generator, m_GeneratorChoiceString);
|
||||||
//}}AFX_DATA_MAP
|
//}}AFX_DATA_MAP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +124,9 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
|
||||||
ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource)
|
ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource)
|
||||||
ON_WM_SIZE()
|
ON_WM_SIZE()
|
||||||
ON_WM_GETMINMAXINFO()
|
ON_WM_GETMINMAXINFO()
|
||||||
ON_BN_CLICKED(IDCANCEL, OnCancel)
|
|
||||||
ON_BN_CLICKED(IDC_OK, OnOk)
|
ON_BN_CLICKED(IDC_OK, OnOk)
|
||||||
|
ON_BN_CLICKED(IDCANCEL, OnCancel)
|
||||||
|
ON_CBN_EDITCHANGE(IDC_Generator, OnEditchangeGenerator)
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
@ -156,10 +161,22 @@ BOOL CMakeSetupDialog::OnInitDialog()
|
||||||
SetIcon(m_hIcon, FALSE); // Set small icon
|
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||||
// Load source and build dirs from registry
|
// Load source and build dirs from registry
|
||||||
this->LoadFromRegistry();
|
this->LoadFromRegistry();
|
||||||
|
cmake m; // force a register of generators
|
||||||
|
std::vector<std::string> names;
|
||||||
|
cmMakefileGenerator::GetRegisteredGenerators(names);
|
||||||
|
for(std::vector<std::string>::iterator i = names.begin();
|
||||||
|
i != names.end(); ++i)
|
||||||
|
{
|
||||||
|
m_GeneratorChoice.AddString(i->c_str());
|
||||||
|
}
|
||||||
|
m_GeneratorChoiceString = "Visual Studio 6";
|
||||||
|
|
||||||
// try to load the cmake cache from disk
|
// try to load the cmake cache from disk
|
||||||
this->LoadCacheFromDiskToGUI();
|
this->LoadCacheFromDiskToGUI();
|
||||||
m_WhereBuildControl.LimitText(2048);
|
m_WhereBuildControl.LimitText(2048);
|
||||||
m_WhereSourceControl.LimitText(2048);
|
m_WhereSourceControl.LimitText(2048);
|
||||||
|
m_GeneratorChoice.LimitText(2048);
|
||||||
|
|
||||||
// Set the version number
|
// Set the version number
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
sprintf(tmp,"Version %d.%d", cmMakefile::GetMajorVersion(),
|
sprintf(tmp,"Version %d.%d", cmMakefile::GetMajorVersion(),
|
||||||
|
@ -435,6 +452,9 @@ void CMakeSetupDialog::RunCMake(bool generateProjectFiles)
|
||||||
arg = "-B";
|
arg = "-B";
|
||||||
arg += m_WhereBuild;
|
arg += m_WhereBuild;
|
||||||
args.push_back(arg);
|
args.push_back(arg);
|
||||||
|
arg = "-G";
|
||||||
|
arg += m_GeneratorChoiceString;
|
||||||
|
args.push_back(arg);
|
||||||
// run the generate process
|
// run the generate process
|
||||||
if(make.Generate(args, generateProjectFiles) != 0)
|
if(make.Generate(args, generateProjectFiles) != 0)
|
||||||
{
|
{
|
||||||
|
@ -617,6 +637,26 @@ void CMakeSetupDialog::LoadCacheFromDiskToGUI()
|
||||||
{
|
{
|
||||||
cmCacheManager::GetInstance()->LoadCache(m_WhereBuild);
|
cmCacheManager::GetInstance()->LoadCache(m_WhereBuild);
|
||||||
this->FillCacheGUIFromCacheManager();
|
this->FillCacheGUIFromCacheManager();
|
||||||
|
if(cmCacheManager::GetInstance()->GetCacheEntry("CMAKE_GENERATOR"))
|
||||||
|
{
|
||||||
|
std::string curGen =
|
||||||
|
cmCacheManager::GetInstance()->GetCacheEntry("CMAKE_GENERATOR")->m_Value;
|
||||||
|
if(m_GeneratorChoiceString != curGen.c_str())
|
||||||
|
{
|
||||||
|
m_GeneratorChoiceString = curGen.c_str();
|
||||||
|
this->UpdateData(FALSE);
|
||||||
|
// m_GeneratorChoice.SetWindowText(m_GeneratorChoiceString);
|
||||||
|
// int c = m_GeneratorChoice.GetCount();
|
||||||
|
// int j = m_GeneratorChoice.FindStringExact(0, curGen.c_str());
|
||||||
|
// if (j != CB_ERR)
|
||||||
|
// {
|
||||||
|
// m_GeneratorChoice.SetCurSel(j);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// m_GeneratorChoice.SelectString(0, curGen.c_str());
|
||||||
|
// this->UpdateData(FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,3 +775,9 @@ void CMakeSetupDialog::OnOk()
|
||||||
this->RunCMake(true);
|
this->RunCMake(true);
|
||||||
CDialog::OnOK();
|
CDialog::OnOK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeSetupDialog::OnEditchangeGenerator()
|
||||||
|
{
|
||||||
|
// TODO: Add your control notification handler code here
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ protected:
|
||||||
// Dialog Data
|
// Dialog Data
|
||||||
//{{AFX_DATA(CMakeSetupDialog)
|
//{{AFX_DATA(CMakeSetupDialog)
|
||||||
enum { IDD = IDD_CMakeSetupDialog_DIALOG };
|
enum { IDD = IDD_CMakeSetupDialog_DIALOG };
|
||||||
|
CComboBox m_GeneratorChoice;
|
||||||
CButton m_OKButton;
|
CButton m_OKButton;
|
||||||
CButton m_CancelButton;
|
CButton m_CancelButton;
|
||||||
CString m_WhereSource;
|
CString m_WhereSource;
|
||||||
|
@ -48,6 +49,7 @@ protected:
|
||||||
CStatic m_MouseHelp;
|
CStatic m_MouseHelp;
|
||||||
CStatic m_VersionDisplay;
|
CStatic m_VersionDisplay;
|
||||||
CButton m_Configure;
|
CButton m_Configure;
|
||||||
|
CString m_GeneratorChoiceString;
|
||||||
//}}AFX_DATA
|
//}}AFX_DATA
|
||||||
|
|
||||||
// ClassWizard generated virtual function overrides
|
// ClassWizard generated virtual function overrides
|
||||||
|
@ -85,6 +87,7 @@ protected:
|
||||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
|
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
|
||||||
afx_msg void OnOk();
|
afx_msg void OnOk();
|
||||||
|
afx_msg void OnEditchangeGenerator();
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#define IDC_FRAME 1015
|
#define IDC_FRAME 1015
|
||||||
#define IDC_MouseHelpCaption 1016
|
#define IDC_MouseHelpCaption 1016
|
||||||
#define IDC_OK 1018
|
#define IDC_OK 1018
|
||||||
|
#define IDC_Generator 1019
|
||||||
|
#define IDC_GeneratorLabel 1020
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
|
@ -25,7 +27,7 @@
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 133
|
#define _APS_NEXT_RESOURCE_VALUE 133
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1019
|
#define _APS_NEXT_CONTROL_VALUE 1021
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,62 +5,113 @@
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmMakeDepend.h"
|
#include "cmMakeDepend.h"
|
||||||
#include "cmCacheManager.h"
|
#include "cmCacheManager.h"
|
||||||
#include <Sysutils.hpp>
|
|
||||||
using namespace std;
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
cmBorlandMakefileGenerator::cmBorlandMakefileGenerator() {
|
cmBorlandMakefileGenerator::cmBorlandMakefileGenerator()
|
||||||
|
{
|
||||||
m_CacheOnly = false;
|
m_CacheOnly = false;
|
||||||
m_Recurse = false;
|
m_Recurse = false;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void cmBorlandMakefileGenerator::GenerateMakefile() {
|
void cmBorlandMakefileGenerator::GenerateMakefile()
|
||||||
if (m_CacheOnly) {
|
{
|
||||||
|
// suppoirt override in output directories
|
||||||
|
if (m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"))
|
||||||
|
{
|
||||||
|
m_LibraryOutputPath = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
|
||||||
|
if(m_LibraryOutputPath.size())
|
||||||
|
{
|
||||||
|
if(m_LibraryOutputPath[m_LibraryOutputPath.size() -1] != '/')
|
||||||
|
{
|
||||||
|
m_LibraryOutputPath += "/";
|
||||||
|
}
|
||||||
|
if(!cmSystemTools::MakeDirectory(m_LibraryOutputPath.c_str()))
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Error failed create "
|
||||||
|
"LIBRARY_OUTPUT_PATH directory:",
|
||||||
|
m_LibraryOutputPath.c_str());
|
||||||
|
}
|
||||||
|
m_Makefile->AddLinkDirectory(m_LibraryOutputPath.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"))
|
||||||
|
{
|
||||||
|
m_ExecutableOutputPath =
|
||||||
|
m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
|
||||||
|
if(m_ExecutableOutputPath.size())
|
||||||
|
{
|
||||||
|
if(m_ExecutableOutputPath[m_ExecutableOutputPath.size() -1] != '/')
|
||||||
|
{
|
||||||
|
m_ExecutableOutputPath += "/";
|
||||||
|
}
|
||||||
|
if(!cmSystemTools::MakeDirectory(m_ExecutableOutputPath.c_str()))
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Error failed to create "
|
||||||
|
"EXECUTABLE_OUTPUT_PATH directory:",
|
||||||
|
m_ExecutableOutputPath.c_str());
|
||||||
|
}
|
||||||
|
m_Makefile->AddLinkDirectory(m_ExecutableOutputPath.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_CacheOnly)
|
||||||
|
{
|
||||||
// Generate the cache only stuff
|
// Generate the cache only stuff
|
||||||
this->GenerateCacheOnly();
|
this->GenerateCacheOnly();
|
||||||
// if recurse then generate for all sub- makefiles
|
// if recurse then generate for all sub- makefiles
|
||||||
if (m_Recurse) {
|
if (m_Recurse)
|
||||||
|
{
|
||||||
this->RecursiveGenerateCacheOnly();
|
this->RecursiveGenerateCacheOnly();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void cmBorlandMakefileGenerator::GenerateCacheOnly() {
|
void cmBorlandMakefileGenerator::GenerateCacheOnly()
|
||||||
|
{
|
||||||
cmSystemTools::MakeDirectory(m_Makefile->GetStartOutputDirectory());
|
cmSystemTools::MakeDirectory(m_Makefile->GetStartOutputDirectory());
|
||||||
string dest = m_Makefile->GetStartOutputDirectory();
|
std::string dest = m_Makefile->GetStartOutputDirectory();
|
||||||
dest += "/makefile.mak";
|
dest += "/makefile.mak";
|
||||||
this->OutputMakefile(dest.c_str());
|
this->OutputMakefile(dest.c_str());
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void cmBorlandMakefileGenerator::RecursiveGenerateCacheOnly() {
|
void cmBorlandMakefileGenerator::RecursiveGenerateCacheOnly()
|
||||||
vector<cmMakefile*> makefiles;
|
{
|
||||||
|
std::vector<cmMakefile*> makefiles;
|
||||||
m_Makefile->FindSubDirectoryCMakeListsFiles(makefiles);
|
m_Makefile->FindSubDirectoryCMakeListsFiles(makefiles);
|
||||||
for (vector<cmMakefile*>::iterator i=makefiles.begin(); i!=makefiles.end(); ++i) {
|
for (std::vector<cmMakefile*>::iterator i=makefiles.begin();
|
||||||
|
i!=makefiles.end(); ++i)
|
||||||
|
{
|
||||||
cmMakefile* mf = *i;
|
cmMakefile* mf = *i;
|
||||||
cmBorlandMakefileGenerator* gen = new cmBorlandMakefileGenerator;
|
cmBorlandMakefileGenerator* gen = new cmBorlandMakefileGenerator;
|
||||||
gen->SetCacheOnlyOn();
|
gen->SetCacheOnlyOn();
|
||||||
gen->SetRecurseOff();
|
gen->SetRecurseOff();
|
||||||
mf->SetMakefileGenerator(gen);
|
mf->SetMakefileGenerator(gen);
|
||||||
mf->GenerateMakefile();
|
mf->GenerateMakefile();
|
||||||
}
|
}
|
||||||
// CLEAN up the makefiles created
|
// CLEAN up the makefiles created
|
||||||
for (unsigned int i=0; i<makefiles.size(); ++i) {
|
for (unsigned int i=0; i<makefiles.size(); ++i)
|
||||||
|
{
|
||||||
delete makefiles[i];
|
delete makefiles[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void cmBorlandMakefileGenerator::OutputMakefile(const char* file) {
|
void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Create sub directories for aux source directories
|
// Create sub directories for aux source directories
|
||||||
//
|
//
|
||||||
vector<string>& auxSourceDirs = m_Makefile->GetAuxSourceDirectories();
|
std::vector<std::string>& auxSourceDirs =
|
||||||
if ( auxSourceDirs.size() ) {
|
m_Makefile->GetAuxSourceDirectories();
|
||||||
|
if ( auxSourceDirs.size() )
|
||||||
|
{
|
||||||
// For the case when this is running as a remote build
|
// For the case when this is running as a remote build
|
||||||
// on unix, make the directory
|
// on unix, make the directory
|
||||||
for (vector<string>::iterator i=auxSourceDirs.begin(); i!=auxSourceDirs.end(); ++i) {
|
for (std::vector<std::string>::iterator i=auxSourceDirs.begin();
|
||||||
|
i!=auxSourceDirs.end(); ++i)
|
||||||
|
{
|
||||||
cmSystemTools::MakeDirectory(i->c_str());
|
cmSystemTools::MakeDirectory(i->c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
std::ostrstream fout;
|
||||||
ostrstream fout;
|
|
||||||
//
|
//
|
||||||
// Begin writing to makefile.mak
|
// Begin writing to makefile.mak
|
||||||
//
|
//
|
||||||
|
@ -72,16 +123,18 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file) {
|
||||||
//
|
//
|
||||||
// Define all our compile and make flags/variables
|
// Define all our compile and make flags/variables
|
||||||
//
|
//
|
||||||
string replace;
|
std::string replace;
|
||||||
// Careful with these directory paths....\ vs /
|
// Careful with these directory paths....\ vs /
|
||||||
replace = "BCBBINPATH = @BCB_BIN_PATH@ \n";
|
replace = "BCBBINPATH = @BCB_BIN_PATH@ \n";
|
||||||
fout << m_Makefile->ExpandVariablesInString(replace);
|
fout << m_Makefile->ExpandVariablesInString(replace);
|
||||||
replace = "BCB = $(BCBBINPATH)/.. \n";
|
replace = "BCB = $(BCBBINPATH)/.. \n";
|
||||||
fout << m_Makefile->ExpandVariablesInString(replace);
|
fout << m_Makefile->ExpandVariablesInString(replace);
|
||||||
replace = "OUTDIRLIB = @LIBRARY_OUTPUT_PATH@ \n";
|
replace = "OUTDIRLIB = @LIBRARY_OUTPUT_PATH@ \n";
|
||||||
fout << cmSystemTools::ConvertToWindowsSlashes(m_Makefile->ExpandVariablesInString(replace));
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
|
fout << cmSystemTools::ConvertToWindowsSlashes(replace);
|
||||||
replace = "OUTDIREXE = @EXECUTABLE_OUTPUT_PATH@ \n";
|
replace = "OUTDIREXE = @EXECUTABLE_OUTPUT_PATH@ \n";
|
||||||
fout << m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
|
fout << cmSystemTools::ConvertToWindowsSlashes(replace);
|
||||||
replace = "USERDEFINES = @DEFS_USER@ \n";
|
replace = "USERDEFINES = @DEFS_USER@ \n";
|
||||||
fout << m_Makefile->ExpandVariablesInString(replace);
|
fout << m_Makefile->ExpandVariablesInString(replace);
|
||||||
replace = "SYSDEFINES = @DEFS_SYS@ \n";
|
replace = "SYSDEFINES = @DEFS_SYS@ \n";
|
||||||
|
@ -111,19 +164,22 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file) {
|
||||||
//
|
//
|
||||||
// create a make variable with all of the sources for this makefile for depend purposes.
|
// create a make variable with all of the sources for this makefile for depend purposes.
|
||||||
//
|
//
|
||||||
vector<string> lfiles = m_Makefile->GetListFiles();
|
std::vector<std::string> lfiles = m_Makefile->GetListFiles();
|
||||||
// sort the array
|
// sort the array
|
||||||
sort(lfiles.begin(), lfiles.end(), less<string>());
|
std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
|
||||||
// remove duplicates
|
// remove duplicates
|
||||||
vector<string>::iterator new_end = unique(lfiles.begin(), lfiles.end());
|
std::vector<std::string>::iterator new_end =
|
||||||
|
std::unique(lfiles.begin(), lfiles.end());
|
||||||
lfiles.erase(new_end, lfiles.end());
|
lfiles.erase(new_end, lfiles.end());
|
||||||
fout << "CMAKE_MAKEFILE_SOURCES = \\ \n";
|
fout << "CMAKE_MAKEFILE_SOURCES = \\ \n";
|
||||||
string dir;
|
std::string dir;
|
||||||
for (vector<string>::const_iterator i=lfiles.begin(); i!=lfiles.end(); ++i) {
|
for (std::vector<std::string>::const_iterator i=lfiles.begin();
|
||||||
|
i!=lfiles.end(); ++i)
|
||||||
|
{
|
||||||
dir = *i;
|
dir = *i;
|
||||||
cmSystemTools::ConvertToWindowsSlashes(dir);
|
cmSystemTools::ConvertToWindowsSlashes(dir);
|
||||||
fout << " " << dir << " \\\n";
|
fout << " " << dir << " \\\n";
|
||||||
}
|
}
|
||||||
dir = m_Makefile->GetHomeOutputDirectory();
|
dir = m_Makefile->GetHomeOutputDirectory();
|
||||||
dir += "/CMakeCache.txt";
|
dir += "/CMakeCache.txt";
|
||||||
cmSystemTools::ConvertToWindowsSlashes(dir);
|
cmSystemTools::ConvertToWindowsSlashes(dir);
|
||||||
|
@ -131,125 +187,156 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file) {
|
||||||
//
|
//
|
||||||
// Output Include paths
|
// Output Include paths
|
||||||
//
|
//
|
||||||
vector<string>& includes = m_Makefile->GetIncludeDirectories();
|
std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories();
|
||||||
fout << "INCLUDEPATH =";
|
fout << "INCLUDEPATH =";
|
||||||
for (vector<string>::iterator i=includes.begin(); i!=includes.end(); ++i) {
|
for (std::vector<std::string>::iterator i=includes.begin();
|
||||||
string include = *i;
|
i!=includes.end(); ++i)
|
||||||
|
{
|
||||||
|
std::string include = *i;
|
||||||
fout << "-I" << cmSystemTools::EscapeSpaces(i->c_str()) << "; \\\n ";
|
fout << "-I" << cmSystemTools::EscapeSpaces(i->c_str()) << "; \\\n ";
|
||||||
}
|
}
|
||||||
fout << "-I" << cmSystemTools::EscapeSpaces(m_Makefile->GetStartDirectory()) << "\n\n";
|
fout << "-I" <<
|
||||||
|
cmSystemTools::EscapeSpaces(m_Makefile->GetStartDirectory()) << "\n\n";
|
||||||
//
|
//
|
||||||
// for each target add to the list of targets
|
// for each target add to the list of targets
|
||||||
//
|
//
|
||||||
fout << "TARGETS = ";
|
fout << "TARGETS = ";
|
||||||
const cmTargets &tgts = m_Makefile->GetTargets();
|
const cmTargets &tgts = m_Makefile->GetTargets();
|
||||||
// list libraries first
|
// list libraries first
|
||||||
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++) {
|
for (cmTargets::const_iterator l=tgts.begin();
|
||||||
if ((l->second.GetType() == cmTarget::STATIC_LIBRARY) && l->second.IsInAll()) {
|
l!=tgts.end(); ++l)
|
||||||
|
{
|
||||||
|
if ((l->second.GetType() == cmTarget::STATIC_LIBRARY)
|
||||||
|
&& l->second.IsInAll())
|
||||||
|
{
|
||||||
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".lib";
|
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".lib";
|
||||||
}
|
}
|
||||||
if ((l->second.GetType() == cmTarget::SHARED_LIBRARY) && l->second.IsInAll()) {
|
if ((l->second.GetType() == cmTarget::SHARED_LIBRARY) && l->second.IsInAll())
|
||||||
|
{
|
||||||
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".dll";
|
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".dll";
|
||||||
}
|
}
|
||||||
if ((l->second.GetType() == cmTarget::MODULE_LIBRARY) && l->second.IsInAll()) {
|
if ((l->second.GetType() == cmTarget::MODULE_LIBRARY) && l->second.IsInAll())
|
||||||
|
{
|
||||||
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".bpl";
|
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".bpl";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// executables
|
// executables
|
||||||
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++) {
|
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++)
|
||||||
if ((l->second.GetType() == cmTarget::EXECUTABLE || l->second.GetType() == cmTarget::WIN32_EXECUTABLE) && l->second.IsInAll()) {
|
{
|
||||||
|
if ((l->second.GetType() == cmTarget::EXECUTABLE
|
||||||
|
|| l->second.GetType() == cmTarget::WIN32_EXECUTABLE) && l->second.IsInAll())
|
||||||
|
{
|
||||||
fout << " \\\n " << l->first.c_str() << ".exe";
|
fout << " \\\n " << l->first.c_str() << ".exe";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// list utilities last
|
// list utilities last
|
||||||
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++) {
|
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++)
|
||||||
if (l->second.GetType() == cmTarget::UTILITY && l->second.IsInAll()) {
|
{
|
||||||
|
if (l->second.GetType() == cmTarget::UTILITY && l->second.IsInAll())
|
||||||
|
{
|
||||||
fout << " \\\n " << l->first.c_str();
|
fout << " \\\n " << l->first.c_str();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fout << "\n\n";
|
fout << "\n\n";
|
||||||
//
|
//
|
||||||
// Now create the source file groups for each target
|
// Now create the source file groups for each target
|
||||||
//
|
//
|
||||||
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++) {
|
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++)
|
||||||
vector<cmSourceFile> classes = l->second.GetSourceFiles();
|
{
|
||||||
if (classes.begin() != classes.end()) {
|
std::vector<cmSourceFile> classes = l->second.GetSourceFiles();
|
||||||
fout << l->first << "_SRC_OBJS = ";
|
if (classes.begin() != classes.end())
|
||||||
for (vector<cmSourceFile>::iterator i=classes.begin(); i!=classes.end(); i++) {
|
{
|
||||||
string ext = i->GetSourceExtension();
|
fout << l->first << "_SRC_OBJS = ";
|
||||||
if (!i->IsAHeaderFileOnly() && (ext!="def" && ext!="rc")) {
|
for (std::vector<cmSourceFile>::iterator i=classes.begin(); i!=classes.end(); i++)
|
||||||
fout << " \\\n " << cmSystemTools::ConvertToWindowsSlashes(i->GetSourceName()) << ".obj ";
|
{
|
||||||
|
std::string ext = i->GetSourceExtension();
|
||||||
|
if (!i->IsAHeaderFileOnly() && (ext!="def" && ext!="rc"))
|
||||||
|
{
|
||||||
|
fout << " \\\n " <<
|
||||||
|
cmSystemTools::ConvertToWindowsSlashes(i->GetSourceName())
|
||||||
|
<< ".obj ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fout << "\n\n";
|
||||||
}
|
}
|
||||||
fout << "\n\n";
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// Create the link lib list for each target
|
// Create the link lib list for each target
|
||||||
//
|
//
|
||||||
// do .lib files
|
// do .lib files
|
||||||
string libname;
|
std::string libname;
|
||||||
for (cmTargets::const_iterator t=tgts.begin(); t!=tgts.end(); t++) {
|
for (cmTargets::const_iterator t=tgts.begin(); t!=tgts.end(); t++)
|
||||||
cmTarget::LinkLibraries& libs = t->second.GetLinkLibraries();
|
{
|
||||||
|
cmTarget::LinkLibraries const& libs = t->second.GetLinkLibraries();
|
||||||
|
|
||||||
if ((t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
if ((t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
(t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
||||||
(t->second.GetType() == cmTarget::EXECUTABLE) ||
|
(t->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
(t->second.GetType() == cmTarget::WIN32_EXECUTABLE))
|
(t->second.GetType() == cmTarget::WIN32_EXECUTABLE))
|
||||||
{
|
{
|
||||||
fout << t->first << "_LINK_LIB = ";
|
fout << t->first << "_LINK_LIB = ";
|
||||||
for (cmTarget::LinkLibraries::const_iterator l=libs.begin(); l!=libs.end(); l++) {
|
for (cmTarget::LinkLibraries::const_iterator l=libs.begin();
|
||||||
if ((t->first!=l->first) &&
|
l!=libs.end(); l++)
|
||||||
(t->second.GetType()!=cmTarget::INSTALL_FILES || t->second.GetType()!=cmTarget::INSTALL_PROGRAMS)) {
|
{
|
||||||
// if this lib is not a target then don't add OUTDIRLIB to it
|
if ((t->first!=l->first) &&
|
||||||
if (tgts.find(l->first)==tgts.end())
|
(t->second.GetType()!=cmTarget::INSTALL_FILES
|
||||||
libname = l->first;
|
|| t->second.GetType()!=cmTarget::INSTALL_PROGRAMS))
|
||||||
else
|
{
|
||||||
libname = "$(OUTDIRLIB)\\" + l->first;
|
// if this lib is not a target then don't add OUTDIRLIB to it
|
||||||
if (libname.find(".bpi")!=string::npos) continue;
|
if (tgts.find(l->first)==tgts.end())
|
||||||
cmSystemTools::ReplaceString(libname, ".lib", "");
|
libname = l->first;
|
||||||
libname += ".lib";
|
else
|
||||||
fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str());
|
libname = "$(OUTDIRLIB)\\" + l->first;
|
||||||
|
if (libname.find(".bpi")!=std::string::npos) continue;
|
||||||
|
cmSystemTools::ReplaceString(libname, ".lib", "");
|
||||||
|
libname += ".lib";
|
||||||
|
fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fout << "\n\n";
|
fout << "\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// do .bpi package files
|
// do .bpi package files
|
||||||
for (cmTargets::const_iterator t=tgts.begin(); t!=tgts.end(); t++) {
|
for (cmTargets::const_iterator t=tgts.begin(); t!=tgts.end(); t++)
|
||||||
cmTarget::LinkLibraries& libs = t->second.GetLinkLibraries();
|
{
|
||||||
|
cmTarget::LinkLibraries const& libs = t->second.GetLinkLibraries();
|
||||||
if ((t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
if ((t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
(t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
(t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
(t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
||||||
(t->second.GetType() == cmTarget::EXECUTABLE) ||
|
(t->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
(t->second.GetType() == cmTarget::WIN32_EXECUTABLE))
|
(t->second.GetType() == cmTarget::WIN32_EXECUTABLE))
|
||||||
{
|
{
|
||||||
fout << t->first << "_LINK_BPI = ";
|
fout << t->first << "_LINK_BPI = ";
|
||||||
for (cmTarget::LinkLibraries::const_iterator l=libs.begin(); l!=libs.end(); l++) {
|
for (cmTarget::LinkLibraries::const_iterator l=libs.begin();
|
||||||
if ((t->first!=l->first) &&
|
l!=libs.end(); l++)
|
||||||
(t->second.GetType()!=cmTarget::INSTALL_FILES || t->second.GetType()!=cmTarget::INSTALL_PROGRAMS)) {
|
{
|
||||||
// if this lib is not a target then don't add OUTDIRLIB to it
|
if ((t->first!=l->first) &&
|
||||||
if (tgts.find(l->first)==tgts.end())
|
(t->second.GetType()!=cmTarget::INSTALL_FILES
|
||||||
libname = l->first;
|
|| t->second.GetType()!=cmTarget::INSTALL_PROGRAMS))
|
||||||
else
|
{
|
||||||
libname = "$(OUTDIRLIB)\\" + l->first;
|
// if this lib is not a target then don't add OUTDIRLIB to it
|
||||||
if (libname.find(".bpi")==string::npos) continue;
|
if (tgts.find(l->first)==tgts.end())
|
||||||
fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str());
|
libname = l->first;
|
||||||
|
else
|
||||||
|
libname = "$(OUTDIRLIB)\\" + l->first;
|
||||||
|
if (libname.find(".bpi")==std::string::npos) continue;
|
||||||
|
fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fout << "\n\n";
|
fout << "\n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// Create the link dir list - use same for all targets
|
// Create the link dir list - use same for all targets
|
||||||
//
|
//
|
||||||
vector<string> dirs = m_Makefile->GetLinkDirectories();
|
std::vector<std::string> dirs = m_Makefile->GetLinkDirectories();
|
||||||
fout << "LINK_DIR =";
|
fout << "LINK_DIR =";
|
||||||
for (vector<string>::const_iterator d=dirs.begin(); d!=dirs.end(); d++) {
|
for (std::vector<std::string>::const_iterator d=dirs.begin(); d!=dirs.end(); d++)
|
||||||
string temp = cmSystemTools::EscapeSpaces(d->c_str());
|
{
|
||||||
|
std::string temp = cmSystemTools::EscapeSpaces(d->c_str());
|
||||||
fout << temp << ";";
|
fout << temp << ";";
|
||||||
}
|
}
|
||||||
fout << "$(OUTDIRLIB)\n\n";
|
fout << "$(OUTDIRLIB)\n\n";
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -278,67 +365,81 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file) {
|
||||||
this->OutputMakeRules(fout);
|
this->OutputMakeRules(fout);
|
||||||
//
|
//
|
||||||
// We'll omit current dir in path where possible
|
// We'll omit current dir in path where possible
|
||||||
string fullname, outpath = m_Makefile->GetStartOutputDirectory();
|
std::string fullname, outpath = m_Makefile->GetStartOutputDirectory();
|
||||||
outpath += "/";
|
outpath += "/";
|
||||||
//
|
//
|
||||||
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++) {
|
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++)
|
||||||
vector<cmSourceFile> classes = l->second.GetSourceFiles();
|
{
|
||||||
if (classes.begin() != classes.end()) {
|
std::vector<cmSourceFile> classes = l->second.GetSourceFiles();
|
||||||
for (vector<cmSourceFile>::iterator i=classes.begin(); i!=classes.end(); i++) {
|
if (classes.begin() != classes.end())
|
||||||
if (!i->IsAHeaderFileOnly()) {
|
{
|
||||||
|
for (std::vector<cmSourceFile>::iterator i=classes.begin(); i!=classes.end(); i++)
|
||||||
|
{
|
||||||
|
if (!i->IsAHeaderFileOnly())
|
||||||
|
{
|
||||||
fullname = i->GetFullPath();
|
fullname = i->GetFullPath();
|
||||||
cmSystemTools::ReplaceString(fullname, outpath.c_str(), "");
|
cmSystemTools::ReplaceString(fullname, outpath.c_str(), "");
|
||||||
fout << "" << cmSystemTools::ConvertToWindowsSlashes(i->GetSourceName()) << ".obj : " << fullname << "\n";
|
fout << ""
|
||||||
|
<< cmSystemTools::ConvertToWindowsSlashes(i->GetSourceName())
|
||||||
|
<< ".obj : " << fullname << "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
ofstream ffout(file);
|
std::ofstream ffout(file);
|
||||||
if (!ffout) {
|
if (!ffout)
|
||||||
|
{
|
||||||
cmSystemTools::Error("Error can not open for write: ", file);
|
cmSystemTools::Error("Error can not open for write: ", file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string makefileastext = fout.str();
|
fout << std::ends;
|
||||||
|
std::string makefileastext = fout.str();
|
||||||
// cmSystemTools::CleanUpWindowsSlashes(makefileastext);
|
// cmSystemTools::CleanUpWindowsSlashes(makefileastext);
|
||||||
// makefileastext = StringReplace(makefileastext.c_str(), "¬", "/", TReplaceFlags()<<rfReplaceAll).c_str();
|
// makefileastext = StringReplace(makefileastext.c_str(), "¬", "/", TReplaceFlags()<<rfReplaceAll).c_str();
|
||||||
ffout << makefileastext << "\n# End of File\n";
|
ffout << makefileastext << "\n# End of File\n";
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// output the list of libraries that the executables in this makefile will depend on.
|
// output the list of libraries that the executables in this makefile will depend on.
|
||||||
void cmBorlandMakefileGenerator::OutputDependencies(ostream& fout) {
|
void cmBorlandMakefileGenerator::OutputDependencies(std::ostream& fout)
|
||||||
// Each dependency should only be emitted once.
|
{
|
||||||
set<string> emitted;
|
// Each dependency should only be emitted once.
|
||||||
//
|
std::set<std::string> emitted;
|
||||||
// Output/Search the list of libraries that will be linked into the executable
|
//
|
||||||
//
|
// Output/Search the list of libraries that will be linked into the executable
|
||||||
fout << "DEPEND_LIBS = ";
|
//
|
||||||
cmTarget::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
|
fout << "DEPEND_LIBS = ";
|
||||||
emitted.clear();
|
cmTarget::LinkLibraries& libs = m_Makefile->GetLinkLibraries();
|
||||||
for (cmTarget::LinkLibraries::const_iterator lib2=libs.begin(); lib2!=libs.end(); ++lib2) {
|
emitted.clear();
|
||||||
|
for (cmTarget::LinkLibraries::const_iterator lib2=libs.begin();
|
||||||
|
lib2!=libs.end(); ++lib2)
|
||||||
|
{
|
||||||
|
|
||||||
// loop over the list of directories that the libraries might
|
// loop over the list of directories that the libraries might
|
||||||
// be in, looking for an ADD_LIBRARY(lib...) line. This would
|
// be in, looking for an ADD_LIBRARY(lib...) line. This would
|
||||||
// be stored in the cache
|
// be stored in the cache
|
||||||
if( ! emitted.insert(lib2->first).second ) continue;
|
if( ! emitted.insert(lib2->first).second ) continue;
|
||||||
|
|
||||||
const char* cacheValue = m_Makefile->GetDefinition(lib2->first.c_str());
|
const char* cacheValue = m_Makefile->GetDefinition(lib2->first.c_str());
|
||||||
if (cacheValue) {
|
if (cacheValue)
|
||||||
fout << "\\\n $(OUTDIRLIB)\\" << lib2->first << ".lib ";
|
{
|
||||||
|
fout << "\\\n $(OUTDIRLIB)\\" << lib2->first << ".lib ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fout << "\n\n";
|
fout << "\n\n";
|
||||||
//
|
//
|
||||||
// Same list, but this time output a rule to rebuild if they are out of date
|
// Same list, but this time output a rule to rebuild if they are out of date
|
||||||
//
|
//
|
||||||
emitted.clear();
|
emitted.clear();
|
||||||
for (cmTarget::LinkLibraries::const_iterator lib2=libs.begin(); lib2!=libs.end(); ++lib2) {
|
for (cmTarget::LinkLibraries::const_iterator lib2=libs.begin();
|
||||||
// loop over the list of directories that the libraries might
|
lib2!=libs.end(); ++lib2)
|
||||||
// be in, looking for an ADD_LIBRARY(lib...) line. This would
|
{
|
||||||
// be stored in the cache
|
// loop over the list of directories that the libraries might
|
||||||
if ( ! emitted.insert(lib2->first).second ) continue;
|
// be in, looking for an ADD_LIBRARY(lib...) line. This would
|
||||||
|
// be stored in the cache
|
||||||
|
if ( ! emitted.insert(lib2->first).second ) continue;
|
||||||
|
|
||||||
// const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
|
// const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue(lib2->first.c_str());
|
||||||
// if (cacheValue) {
|
// if (cacheValue) {
|
||||||
|
@ -349,74 +450,84 @@ void cmBorlandMakefileGenerator::OutputDependencies(ostream& fout) {
|
||||||
}
|
}
|
||||||
// fout << "\n";
|
// fout << "\n";
|
||||||
}
|
}
|
||||||
void cmBorlandMakefileGenerator::OutputTargets(ostream& fout) {
|
void cmBorlandMakefileGenerator::OutputTargets(std::ostream& fout)
|
||||||
// Do Libraries first as executables may depend on them
|
{
|
||||||
const cmTargets &tgts = m_Makefile->GetTargets();
|
// Do Libraries first as executables may depend on them
|
||||||
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++) {
|
const cmTargets &tgts = m_Makefile->GetTargets();
|
||||||
if (l->second.GetType() == cmTarget::STATIC_LIBRARY) {
|
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++)
|
||||||
//
|
{
|
||||||
// at the moment, static and shared are treated the same
|
if (l->second.GetType() == cmTarget::STATIC_LIBRARY)
|
||||||
// WARNING. TLIB fails with Unix style Forward slashes - use $(OUTDIRLIB)\\
|
{
|
||||||
// WARNING. IMPLIB works better with Forward slashes - use $(OUTDIRLIB)\\
|
//
|
||||||
//
|
// at the moment, static and shared are treated the same
|
||||||
fout << "# this should be a static library \n";
|
// WARNING. TLIB fails with Unix style Forward slashes - use $(OUTDIRLIB)\\
|
||||||
fout << "$(OUTDIRLIB)\\" << l->first << ".lib : ${" << l->first << "_SRC_OBJS} \n";
|
// WARNING. IMPLIB works better with Forward slashes - use $(OUTDIRLIB)\\
|
||||||
string Libname = "$(OUTDIRLIB)\\" + l->first + ".lib";
|
//
|
||||||
fout << " TLib.exe $(LINKFLAGS_STATIC) /u " << Libname.c_str() << " @&&| \n";
|
fout << "# this should be a static library \n";
|
||||||
fout << " $? \n";
|
fout << "$(OUTDIRLIB)\\" << l->first << ".lib : ${" << l->first << "_SRC_OBJS} \n";
|
||||||
fout << "| \n\n";
|
std::string Libname = "$(OUTDIRLIB)\\" + l->first + ".lib";
|
||||||
|
fout << " TLib.exe $(LINKFLAGS_STATIC) /u " << Libname.c_str() << " @&&| \n";
|
||||||
|
fout << " $? \n";
|
||||||
|
fout << "| \n\n";
|
||||||
}
|
}
|
||||||
if (l->second.GetType() == cmTarget::SHARED_LIBRARY) {
|
if (l->second.GetType() == cmTarget::SHARED_LIBRARY)
|
||||||
fout << "# this should be a shared (DLL) library \n";
|
{
|
||||||
fout << "$(OUTDIRLIB)\\" << l->first << ".dll : ${" << l->first << "_SRC_OBJS} \n";
|
fout << "# this should be a shared (DLL) library \n";
|
||||||
fout << " @ilink32.exe @&&| \n";
|
fout << "$(OUTDIRLIB)\\" << l->first << ".dll : ${" << l->first << "_SRC_OBJS} \n";
|
||||||
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_DLL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0d32.obj\" ";
|
fout << " @ilink32.exe @&&| \n";
|
||||||
fout << "$(" << l->first << "_SRC_OBJS) ";
|
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_DLL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0d32.obj\" ";
|
||||||
fout << "$(" << l->first << "_LINK_BPI) , $<, $*, ";
|
fout << "$(" << l->first << "_SRC_OBJS) ";
|
||||||
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
fout << "$(" << l->first << "_LINK_BPI) , $<, $*, ";
|
||||||
fout << "| \n";
|
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
||||||
fout << " @implib -w " << "$(OUTDIRLIB)\\" << l->first << ".lib " << "$(OUTDIRLIB)\\" << l->first << ".dll \n\n";
|
fout << "| \n";
|
||||||
|
fout << " @implib -w " << "$(OUTDIRLIB)\\" << l->first << ".lib " << "$(OUTDIRLIB)\\" << l->first << ".dll \n\n";
|
||||||
}
|
}
|
||||||
if (l->second.GetType() == cmTarget::MODULE_LIBRARY) {
|
if (l->second.GetType() == cmTarget::MODULE_LIBRARY)
|
||||||
fout << "# this should be a Borland Package library \n";
|
{
|
||||||
fout << "$(OUTDIRLIB)\\" << l->first << ".bpl : ${" << l->first << "_SRC_OBJS} \n";
|
fout << "# this should be a Borland Package library \n";
|
||||||
fout << " @ilink32.exe @&&| \n";
|
fout << "$(OUTDIRLIB)\\" << l->first << ".bpl : ${" << l->first << "_SRC_OBJS} \n";
|
||||||
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_BPL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0pkg32.obj\" ";
|
fout << " @ilink32.exe @&&| \n";
|
||||||
fout << "$(" << l->first << "_SRC_OBJS) ";
|
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_BPL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0pkg32.obj\" ";
|
||||||
fout << "$(" << l->first << "_LINK_BPI) , $<, $*, ";
|
fout << "$(" << l->first << "_SRC_OBJS) ";
|
||||||
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
fout << "$(" << l->first << "_LINK_BPI) , $<, $*, ";
|
||||||
fout << "| \n";
|
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
||||||
|
fout << "| \n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Do Executables
|
// Do Executables
|
||||||
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++) {
|
for (cmTargets::const_iterator l=tgts.begin(); l!=tgts.end(); l++)
|
||||||
if (l->second.GetType()==cmTarget::WIN32_EXECUTABLE) {
|
{
|
||||||
fout << l->first << ".exe : ${" << l->first << "_SRC_OBJS} \n";
|
if (l->second.GetType()==cmTarget::WIN32_EXECUTABLE)
|
||||||
fout << " @ilink32.exe @&&| \n";
|
{
|
||||||
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_EXE) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0w32.obj\" ";
|
fout << l->first << ".exe : ${" << l->first << "_SRC_OBJS} \n";
|
||||||
fout << "$(" << l->first << "_SRC_OBJS) ";
|
fout << " @ilink32.exe @&&| \n";
|
||||||
fout << "$(" << l->first << "_LINK_BPI) , $<, $*, ";
|
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_EXE) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0w32.obj\" ";
|
||||||
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
fout << "$(" << l->first << "_SRC_OBJS) ";
|
||||||
fout << "| \n\n";
|
fout << "$(" << l->first << "_LINK_BPI) , $<, $*, ";
|
||||||
|
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
||||||
|
fout << "| \n\n";
|
||||||
}
|
}
|
||||||
else if (l->second.GetType()==cmTarget::EXECUTABLE) {
|
else if (l->second.GetType()==cmTarget::EXECUTABLE)
|
||||||
fout << l->first << ".exe : ${" << l->first << "_SRC_OBJS} \n";
|
{
|
||||||
fout << " @ilink32.exe @&&| \n";
|
fout << l->first << ".exe : ${" << l->first << "_SRC_OBJS} \n";
|
||||||
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_EXE) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0x32.obj\" ";
|
fout << " @ilink32.exe @&&| \n";
|
||||||
fout << "$(" << l->first << "_SRC_OBJS) , $<, $*, ";
|
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_EXE) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0x32.obj\" ";
|
||||||
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
fout << "$(" << l->first << "_SRC_OBJS) , $<, $*, ";
|
||||||
fout << "| \n\n";
|
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
|
||||||
|
fout << "| \n\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void cmBorlandMakefileGenerator::OutputSubDirectoryRules(ostream& fout) {
|
void cmBorlandMakefileGenerator::OutputSubDirectoryRules(std::ostream& fout)
|
||||||
|
{
|
||||||
// output rules for decending into sub directories
|
// output rules for decending into sub directories
|
||||||
const vector<string>& SubDirectories = m_Makefile->GetSubDirectories();
|
const std::vector<std::string>& SubDirectories = m_Makefile->GetSubDirectories();
|
||||||
//
|
//
|
||||||
if ( SubDirectories.size() == 0) {
|
if ( SubDirectories.size() == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
this->OutputSubDirectoryVars(fout, "SUBDIR_BUILD", "build",
|
this->OutputSubDirectoryVars(fout, "SUBDIR_BUILD", "build",
|
||||||
0,
|
0,
|
||||||
|
@ -426,18 +537,18 @@ void cmBorlandMakefileGenerator::OutputSubDirectoryRules(ostream& fout) {
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// fix up names of directories so they can be used
|
// fix up names of directories so they can be used
|
||||||
// as targets in makefiles.
|
// as targets in makefiles.
|
||||||
inline string FixDirectoryName(const char* dir)
|
inline std::string FixDirectoryName(const char* dir)
|
||||||
{
|
{
|
||||||
string s = dir;
|
std::string s = dir;
|
||||||
// replace ../ with 3 under bars
|
// replace ../ with 3 under bars
|
||||||
size_t pos = s.find("../");
|
size_t pos = s.find("../");
|
||||||
if (pos != string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
s.replace(pos, 3, "___");
|
s.replace(pos, 3, "___");
|
||||||
}
|
}
|
||||||
// replace / directory separators with a single under bar
|
// replace / directory separators with a single under bar
|
||||||
pos = s.find("/");
|
pos = s.find("/");
|
||||||
while(pos != string::npos)
|
while(pos != std::string::npos)
|
||||||
{
|
{
|
||||||
s.replace(pos, 1, "_");
|
s.replace(pos, 1, "_");
|
||||||
pos = s.find("/");
|
pos = s.find("/");
|
||||||
|
@ -445,36 +556,41 @@ inline string FixDirectoryName(const char* dir)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::OutputSubDirectoryVars(ostream& fout,
|
void cmBorlandMakefileGenerator::OutputSubDirectoryVars(std::ostream& fout,
|
||||||
const char* var,
|
const char* var,
|
||||||
const char* target,
|
const char* target,
|
||||||
const char* target1,
|
const char* target1,
|
||||||
const char* target2,
|
const char* target2,
|
||||||
const vector<string>& SubDirectories)
|
const std::vector<std::string>& SubDirectories)
|
||||||
{
|
{
|
||||||
if (!SubDirectories.size()) return;
|
if (!SubDirectories.size()) return;
|
||||||
//
|
//
|
||||||
fout << "# Variable for making " << target << " in subdirectories.\n";
|
fout << "# Variable for making " << target << " in subdirectories.\n";
|
||||||
fout << var << " = \\\n";
|
fout << var << " = \\\n";
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i =0; i < SubDirectories.size(); i++) {
|
for (i =0; i < SubDirectories.size(); i++)
|
||||||
string subdir = FixDirectoryName(SubDirectories[i].c_str());
|
{
|
||||||
|
std::string subdir = FixDirectoryName(SubDirectories[i].c_str());
|
||||||
fout << " " << target << "_" << subdir.c_str();
|
fout << " " << target << "_" << subdir.c_str();
|
||||||
if (i == SubDirectories.size()-1) {
|
if (i == SubDirectories.size()-1)
|
||||||
|
{
|
||||||
fout << " \n\n";
|
fout << " \n\n";
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
fout << " \\\n";
|
fout << " \\\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//
|
//
|
||||||
fout << "# Targets for making " << target << " in subdirectories.\n";
|
fout << "# Targets for making " << target << " in subdirectories.\n";
|
||||||
for (unsigned int i=0; i<SubDirectories.size(); i++) {
|
for (unsigned int i=0; i<SubDirectories.size(); i++)
|
||||||
string subdir = FixDirectoryName(SubDirectories[i].c_str());
|
{
|
||||||
|
std::string subdir = FixDirectoryName(SubDirectories[i].c_str());
|
||||||
fout << target << "_" << subdir.c_str() << ":\n";
|
fout << target << "_" << subdir.c_str() << ":\n";
|
||||||
fout << " cd " << m_Makefile->GetStartOutputDirectory() << "/" << SubDirectories[i] << " \n";
|
fout << " cd " << m_Makefile->GetStartOutputDirectory() << "/" << SubDirectories[i] << " \n";
|
||||||
fout << " make -fmakefile.mak \n\n";
|
fout << " make makefile.mak\n";
|
||||||
}
|
fout << " make \n\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -484,7 +600,8 @@ void cmBorlandMakefileGenerator::OutputSubDirectoryVars(ostream& fout,
|
||||||
// (tab) command...
|
// (tab) command...
|
||||||
|
|
||||||
// This routine is copied direct from unix makefile generator
|
// This routine is copied direct from unix makefile generator
|
||||||
void cmBorlandMakefileGenerator::OutputCustomRules(ostream& fout) {
|
void cmBorlandMakefileGenerator::OutputCustomRules(std::ostream& fout)
|
||||||
|
{
|
||||||
// We may be modifying the source groups temporarily, so make a copy.
|
// We may be modifying the source groups temporarily, so make a copy.
|
||||||
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
|
std::vector<cmSourceGroup> sourceGroups = m_Makefile->GetSourceGroups();
|
||||||
|
|
||||||
|
@ -512,7 +629,9 @@ void cmBorlandMakefileGenerator::OutputCustomRules(ostream& fout) {
|
||||||
{
|
{
|
||||||
const cmSourceGroup::BuildRules& buildRules = sg->GetBuildRules();
|
const cmSourceGroup::BuildRules& buildRules = sg->GetBuildRules();
|
||||||
if(buildRules.empty())
|
if(buildRules.empty())
|
||||||
{ continue; }
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::string name = sg->GetName();
|
std::string name = sg->GetName();
|
||||||
if(name != "")
|
if(name != "")
|
||||||
|
@ -536,16 +655,16 @@ void cmBorlandMakefileGenerator::OutputCustomRules(ostream& fout) {
|
||||||
// with no outputs
|
// with no outputs
|
||||||
if(commandFiles.m_Outputs.size() == 0)
|
if(commandFiles.m_Outputs.size() == 0)
|
||||||
{
|
{
|
||||||
fout << source.c_str() << ": ";
|
fout << source.c_str() << ": ";
|
||||||
// Write out all the dependencies for this rule.
|
// Write out all the dependencies for this rule.
|
||||||
for(std::set<std::string>::const_iterator d =
|
for(std::set<std::string>::const_iterator d =
|
||||||
commandFiles.m_Depends.begin();
|
commandFiles.m_Depends.begin();
|
||||||
d != commandFiles.m_Depends.end(); ++d)
|
d != commandFiles.m_Depends.end(); ++d)
|
||||||
{
|
{
|
||||||
std::string dep = cmSystemTools::EscapeSpaces(d->c_str());
|
std::string dep = cmSystemTools::EscapeSpaces(d->c_str());
|
||||||
fout << " " << dep.c_str();
|
fout << " " << dep.c_str();
|
||||||
}
|
}
|
||||||
fout << "\n\t" << command.c_str() << "\n\n";
|
fout << "\n\t" << command.c_str() << "\n\n";
|
||||||
}
|
}
|
||||||
// Write a rule for every output generated by this command.
|
// Write a rule for every output generated by this command.
|
||||||
for(std::set<std::string>::const_iterator output =
|
for(std::set<std::string>::const_iterator output =
|
||||||
|
@ -576,7 +695,8 @@ void cmBorlandMakefileGenerator::OutputCustomRules(ostream& fout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::OutputMakeRules(ostream& fout) {
|
void cmBorlandMakefileGenerator::OutputMakeRules(std::ostream& fout)
|
||||||
|
{
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
"Rule to build c file(s)",
|
"Rule to build c file(s)",
|
||||||
".c.obj",
|
".c.obj",
|
||||||
|
@ -617,56 +737,64 @@ void cmBorlandMakefileGenerator::OutputMakeRules(ostream& fout) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::OutputMakeRule(ostream& fout,
|
void cmBorlandMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
||||||
const char* comment,
|
const char* comment,
|
||||||
const char* target,
|
const char* target,
|
||||||
const char* depends,
|
const char* depends,
|
||||||
const char* command)
|
const char* command)
|
||||||
{
|
{
|
||||||
string replace;
|
std::string replace;
|
||||||
if (comment) {
|
if (comment)
|
||||||
|
{
|
||||||
replace = comment;
|
replace = comment;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << "# " << comment << " \n";
|
fout << "# " << comment << " \n";
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
replace = target;
|
replace = target;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << replace.c_str() << ": ";
|
fout << replace.c_str() << ": ";
|
||||||
if (depends) {
|
if (depends)
|
||||||
|
{
|
||||||
replace = depends;
|
replace = depends;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << replace.c_str();
|
fout << replace.c_str();
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
//
|
//
|
||||||
if (command) {
|
if (command)
|
||||||
|
{
|
||||||
replace = command;
|
replace = command;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << " " << replace.c_str() << " \n";
|
fout << " " << replace.c_str() << " \n";
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::SetLocal (bool local) {
|
void cmBorlandMakefileGenerator::SetLocal (bool local)
|
||||||
if (local) {
|
{
|
||||||
|
if (local)
|
||||||
|
{
|
||||||
m_CacheOnly = false;
|
m_CacheOnly = false;
|
||||||
m_Recurse = false;
|
m_Recurse = false;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
m_CacheOnly = true;
|
m_CacheOnly = true;
|
||||||
m_Recurse = true;
|
m_Recurse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::ComputeSystemInfo() {
|
void cmBorlandMakefileGenerator::ComputeSystemInfo()
|
||||||
|
{
|
||||||
// now load the settings
|
// now load the settings
|
||||||
if (!m_Makefile->GetDefinition("CMAKE_ROOT")) {
|
if (!m_Makefile->GetDefinition("CMAKE_ROOT"))
|
||||||
|
{
|
||||||
cmSystemTools::Error("CMAKE_ROOT has not been defined, bad GUI or driver program");
|
cmSystemTools::Error("CMAKE_ROOT has not been defined, bad GUI or driver program");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string fpath = m_Makefile->GetDefinition("CMAKE_ROOT");
|
std::string fpath = m_Makefile->GetDefinition("CMAKE_ROOT");
|
||||||
fpath += "/Templates/CMakeWindowsBorlandConfig.cmake";
|
fpath += "/Templates/CMakeWindowsBorlandConfig.cmake";
|
||||||
m_Makefile->ReadListFile(NULL,fpath.c_str());
|
m_Makefile->ReadListFile(NULL,fpath.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,72 +10,82 @@
|
||||||
* cmBorlandMakefileGenerator produces a Unix makefile from its
|
* cmBorlandMakefileGenerator produces a Unix makefile from its
|
||||||
* member m_Makefile.
|
* member m_Makefile.
|
||||||
*/
|
*/
|
||||||
class cmBorlandMakefileGenerator : public cmMakefileGenerator {
|
class cmBorlandMakefileGenerator : public cmMakefileGenerator
|
||||||
public:
|
{
|
||||||
///! Set cache only and recurse to false by default.
|
public:
|
||||||
cmBorlandMakefileGenerator();
|
///! Set cache only and recurse to false by default.
|
||||||
|
cmBorlandMakefileGenerator();
|
||||||
|
|
||||||
|
///! Get the name for the generator.
|
||||||
|
virtual const char* GetName() {return "Borland Makefiles";}
|
||||||
|
|
||||||
//! just sets the Cache Only and Recurse flags
|
///! virtual copy constructor
|
||||||
virtual void SetLocal(bool local);
|
virtual cmMakefileGenerator* CreateObject()
|
||||||
|
{ return new cmBorlandMakefileGenerator;}
|
||||||
|
|
||||||
/**
|
//! just sets the Cache Only and Recurse flags
|
||||||
* If cache only is on.
|
virtual void SetLocal(bool local);
|
||||||
* Only stub makefiles are generated, and no depends, for speed.
|
|
||||||
* The default is OFF.
|
|
||||||
**/
|
|
||||||
void SetCacheOnlyOn() {m_CacheOnly = true;}
|
|
||||||
void SetCacheOnlyOff() {m_CacheOnly = false;}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If recurse is on, then all the makefiles below this one are parsed as well.
|
* If cache only is on.
|
||||||
*/
|
* Only stub makefiles are generated, and no depends, for speed.
|
||||||
void SetRecurseOn() {m_Recurse = true;}
|
* The default is OFF.
|
||||||
void SetRecurseOff() {m_Recurse = false;}
|
**/
|
||||||
|
void SetCacheOnlyOn() {m_CacheOnly = true;}
|
||||||
|
void SetCacheOnlyOff() {m_CacheOnly = false;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce the makefile (in this case a Unix makefile).
|
* If recurse is on, then all the makefiles below this one are parsed as well.
|
||||||
*/
|
*/
|
||||||
virtual void GenerateMakefile();
|
void SetRecurseOn() {m_Recurse = true;}
|
||||||
|
void SetRecurseOff() {m_Recurse = false;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output the depend information for all the classes
|
* Produce the makefile (in this case a Unix makefile).
|
||||||
* in the makefile. These would have been generated
|
*/
|
||||||
* by the class cmMakeDepend.
|
virtual void GenerateMakefile();
|
||||||
*/
|
|
||||||
void OutputObjectDepends(std::ostream&);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to determine system infomation such as shared library
|
* Output the depend information for all the classes
|
||||||
* extension, pthreads, byte order etc.
|
* in the makefile. These would have been generated
|
||||||
*/
|
* by the class cmMakeDepend.
|
||||||
virtual void ComputeSystemInfo();
|
*/
|
||||||
|
void OutputObjectDepends(std::ostream&);
|
||||||
|
|
||||||
private:
|
/**
|
||||||
void RecursiveGenerateCacheOnly();
|
* Try to determine system infomation such as shared library
|
||||||
void GenerateCacheOnly();
|
* extension, pthreads, byte order etc.
|
||||||
void OutputMakefile(const char* file);
|
*/
|
||||||
void OutputTargetRules(std::ostream& fout);
|
virtual void ComputeSystemInfo();
|
||||||
void OutputTargets(std::ostream&);
|
|
||||||
void OutputSubDirectoryRules(std::ostream&);
|
private:
|
||||||
void OutputDependInformation(std::ostream&);
|
void RecursiveGenerateCacheOnly();
|
||||||
void OutputDependencies(std::ostream&);
|
void GenerateCacheOnly();
|
||||||
void OutputCustomRules(std::ostream&);
|
void OutputMakefile(const char* file);
|
||||||
void OutputMakeVariables(std::ostream&);
|
void OutputTargetRules(std::ostream& fout);
|
||||||
void OutputMakeRules(std::ostream&);
|
void OutputTargets(std::ostream&);
|
||||||
void OutputSubDirectoryVars(std::ostream& fout,
|
void OutputSubDirectoryRules(std::ostream&);
|
||||||
const char* var,
|
void OutputDependInformation(std::ostream&);
|
||||||
const char* target,
|
void OutputDependencies(std::ostream&);
|
||||||
const char* target1,
|
void OutputCustomRules(std::ostream&);
|
||||||
const char* target2,
|
void OutputMakeVariables(std::ostream&);
|
||||||
const std::vector<std::string>& SubDirectories);
|
void OutputMakeRules(std::ostream&);
|
||||||
void OutputMakeRule(std::ostream&,
|
void OutputSubDirectoryVars(std::ostream& fout,
|
||||||
const char* comment,
|
const char* var,
|
||||||
const char* target,
|
const char* target,
|
||||||
const char* depends,
|
const char* target1,
|
||||||
const char* command);
|
const char* target2,
|
||||||
private:
|
const std::vector<std::string>& SubDirectories);
|
||||||
bool m_CacheOnly;
|
void OutputMakeRule(std::ostream&,
|
||||||
bool m_Recurse;
|
const char* comment,
|
||||||
|
const char* target,
|
||||||
|
const char* depends,
|
||||||
|
const char* command);
|
||||||
|
private:
|
||||||
|
bool m_CacheOnly;
|
||||||
|
bool m_Recurse;
|
||||||
|
std::string m_ExecutableOutputPath;
|
||||||
|
std::string m_LibraryOutputPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -55,22 +55,23 @@ class cmDSWWriter;
|
||||||
class cmMSProjectGenerator : public cmMakefileGenerator
|
class cmMSProjectGenerator : public cmMakefileGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
///! Constructor sets the generation of DSW files on.
|
||||||
* Constructor sets the generation of DSW files on.
|
|
||||||
*/
|
|
||||||
cmMSProjectGenerator();
|
cmMSProjectGenerator();
|
||||||
|
|
||||||
/**
|
///! Destructor.
|
||||||
* Destructor.
|
|
||||||
*/
|
|
||||||
~cmMSProjectGenerator();
|
~cmMSProjectGenerator();
|
||||||
|
|
||||||
|
///! Get the name for the generator.
|
||||||
|
virtual const char* GetName() {return "Visual Studio 6";}
|
||||||
|
|
||||||
/**
|
///! virtual copy constructor
|
||||||
* Produce the makefile (in this case a Microsoft Visual C++ project).
|
virtual cmMakefileGenerator* CreateObject()
|
||||||
*/
|
{ return new cmMSProjectGenerator;}
|
||||||
|
|
||||||
|
///! Produce the makefile (in this case a Microsoft Visual C++ project).
|
||||||
virtual void GenerateMakefile();
|
virtual void GenerateMakefile();
|
||||||
|
|
||||||
//! controls the DSW/DSP settings
|
///! controls the DSW/DSP settings
|
||||||
virtual void SetLocal(bool);
|
virtual void SetLocal(bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,20 +82,14 @@ public:
|
||||||
*/
|
*/
|
||||||
void BuildDSWOff() {m_BuildDSW = false;}
|
void BuildDSWOff() {m_BuildDSW = false;}
|
||||||
|
|
||||||
/**
|
///! Turn on the generation of a Microsoft Visual C++ DSW file.
|
||||||
* Turn on the generation of a Microsoft Visual C++ DSW file.
|
|
||||||
*/
|
|
||||||
void BuildDSWOn() {m_BuildDSW = true;}
|
void BuildDSWOn() {m_BuildDSW = true;}
|
||||||
|
|
||||||
/**
|
///! Retrieve a pointer to a cmDSWWriter instance.
|
||||||
* Retrieve a pointer to a cmDSWWriter instance.
|
|
||||||
*/
|
|
||||||
cmDSWWriter* GetDSWWriter()
|
cmDSWWriter* GetDSWWriter()
|
||||||
{return m_DSWWriter;}
|
{return m_DSWWriter;}
|
||||||
|
|
||||||
/**
|
///! Retrieve a pointer to a cmDSPWriter instance.
|
||||||
* Retrieve a pointer to a cmDSPWriter instance.
|
|
||||||
*/
|
|
||||||
cmDSPWriter* GetDSPWriter()
|
cmDSPWriter* GetDSPWriter()
|
||||||
{return m_DSPWriter;}
|
{return m_DSPWriter;}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,53 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmMakefileGenerator.h"
|
#include "cmMakefileGenerator.h"
|
||||||
|
|
||||||
|
// static list of registered generators
|
||||||
|
std::map<cmStdString, cmMakefileGenerator*>
|
||||||
|
cmMakefileGenerator::s_RegisteredGenerators;
|
||||||
|
|
||||||
|
|
||||||
void cmMakefileGenerator::SetMakefile(cmMakefile* mf)
|
void cmMakefileGenerator::SetMakefile(cmMakefile* mf)
|
||||||
{
|
{
|
||||||
m_Makefile = mf;
|
m_Makefile = mf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmMakefileGenerator::GetRegisteredGenerators(std::vector<std::string>& names)
|
||||||
|
{
|
||||||
|
for(std::map<cmStdString, cmMakefileGenerator*>::iterator i
|
||||||
|
= s_RegisteredGenerators.begin();
|
||||||
|
i != s_RegisteredGenerators.end(); ++i)
|
||||||
|
{
|
||||||
|
names.push_back(i->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
cmMakefileGenerator::RegisterGenerator(cmMakefileGenerator* mg)
|
||||||
|
{
|
||||||
|
std::map<cmStdString, cmMakefileGenerator*>::iterator i =
|
||||||
|
s_RegisteredGenerators.find(mg->GetName());
|
||||||
|
// delete re-registered objects
|
||||||
|
if(i != s_RegisteredGenerators.end())
|
||||||
|
{
|
||||||
|
delete i->second;
|
||||||
|
}
|
||||||
|
s_RegisteredGenerators[mg->GetName()] = mg;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cmMakefileGenerator*
|
||||||
|
cmMakefileGenerator::CreateGenerator(const char* name)
|
||||||
|
{
|
||||||
|
std::map<cmStdString, cmMakefileGenerator*>::iterator i;
|
||||||
|
for(i = s_RegisteredGenerators.begin();
|
||||||
|
i != s_RegisteredGenerators.end(); ++i)
|
||||||
|
{
|
||||||
|
cmMakefileGenerator* gen = i->second;
|
||||||
|
if(strcmp(name, gen->GetName()) == 0)
|
||||||
|
{
|
||||||
|
return gen->CreateObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -55,9 +55,20 @@ class cmClassFile;
|
||||||
class cmMakefileGenerator
|
class cmMakefileGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
///! Create a named generator
|
||||||
* Set the cmMakefile instance from which to generate the makefile.
|
static cmMakefileGenerator* CreateGenerator(const char* name);
|
||||||
*/
|
///! Register a generator
|
||||||
|
static void RegisterGenerator(cmMakefileGenerator*);
|
||||||
|
///! Get the names of the current registered generators
|
||||||
|
static void GetRegisteredGenerators(std::vector<std::string>& names);
|
||||||
|
|
||||||
|
///! Get the name for the generator.
|
||||||
|
virtual const char* GetName() = 0;
|
||||||
|
|
||||||
|
///! virtual copy constructor
|
||||||
|
virtual cmMakefileGenerator* CreateObject() = 0;
|
||||||
|
|
||||||
|
///! Set the cmMakefile instance from which to generate the makefile.
|
||||||
void SetMakefile(cmMakefile*);
|
void SetMakefile(cmMakefile*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,6 +95,7 @@ public:
|
||||||
|
|
||||||
virtual ~cmMakefileGenerator(){};
|
virtual ~cmMakefileGenerator(){};
|
||||||
protected:
|
protected:
|
||||||
|
static std::map<cmStdString, cmMakefileGenerator*> s_RegisteredGenerators;
|
||||||
cmMakefile* m_Makefile;
|
cmMakefile* m_Makefile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,13 @@ public:
|
||||||
///! Set cache only and recurse to false by default.
|
///! Set cache only and recurse to false by default.
|
||||||
cmUnixMakefileGenerator();
|
cmUnixMakefileGenerator();
|
||||||
|
|
||||||
|
///! Get the name for the generator.
|
||||||
|
virtual const char* GetName() {return "Unix Makefiles";}
|
||||||
|
|
||||||
|
///! virtual copy constructor
|
||||||
|
virtual cmMakefileGenerator* CreateObject()
|
||||||
|
{ return new cmUnixMakefileGenerator;}
|
||||||
|
|
||||||
//! just sets the Cache Only and Recurse flags
|
//! just sets the Cache Only and Recurse flags
|
||||||
virtual void SetLocal(bool local);
|
virtual void SetLocal(bool local);
|
||||||
|
|
||||||
|
|
129
Source/cmake.cxx
129
Source/cmake.cxx
|
@ -44,26 +44,48 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// include the generator
|
// include the generator
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
#include "cmMSProjectGenerator.h"
|
#include "cmMSProjectGenerator.h"
|
||||||
|
#include "cmBorlandMakefileGenerator.h"
|
||||||
#else
|
#else
|
||||||
#include "cmUnixMakefileGenerator.h"
|
#include "cmUnixMakefileGenerator.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
cmake::cmake()
|
||||||
|
{
|
||||||
|
m_Verbose = false;
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
cmMakefileGenerator::RegisterGenerator(new cmMSProjectGenerator);
|
||||||
|
cmMakefileGenerator::RegisterGenerator(new cmBorlandMakefileGenerator);
|
||||||
|
#else
|
||||||
|
cmMakefileGenerator::RegisterGenerator(new cmUnixMakefileGenerator);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void cmake::Usage(const char* program)
|
void cmake::Usage(const char* program)
|
||||||
{
|
{
|
||||||
std::cerr << "cmake version " << cmMakefile::GetMajorVersion()
|
std::cerr << "cmake version " << cmMakefile::GetMajorVersion()
|
||||||
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
<< "." << cmMakefile::GetMinorVersion() << "\n";
|
||||||
std::cerr << "Usage: " << program << " srcdir \n"
|
std::cerr << "Usage: " << program << " srcdir \n"
|
||||||
<< "Where cmake is run from the directory where you want the object files written\n";
|
<< "Where cmake is run from the directory where you want the object files written\n";
|
||||||
|
std::cerr << "[-GgeneratorName] (where generator name can be: ";
|
||||||
|
std::vector<std::string> names;
|
||||||
|
cmMakefileGenerator::GetRegisteredGenerators(names);
|
||||||
|
for(std::vector<std::string>::iterator i =names.begin();
|
||||||
|
i != names.end(); ++i)
|
||||||
|
{
|
||||||
|
std::cerr << i->c_str() << " ";
|
||||||
|
}
|
||||||
|
std::cerr << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the args
|
// Parse the args
|
||||||
void cmake::SetArgs(cmMakefile& builder, const std::vector<std::string>& args)
|
void cmake::SetArgs(cmMakefile& builder, const std::vector<std::string>& args)
|
||||||
{
|
{
|
||||||
m_Local = false;
|
m_Local = false;
|
||||||
|
bool directoriesSet = false;
|
||||||
// watch for cmake and cmake srcdir invocations
|
// watch for cmake and cmake srcdir invocations
|
||||||
if (args.size() <= 2)
|
if (args.size() <= 2)
|
||||||
{
|
{
|
||||||
|
directoriesSet = true;
|
||||||
builder.SetHomeOutputDirectory
|
builder.SetHomeOutputDirectory
|
||||||
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
builder.SetStartOutputDirectory
|
builder.SetStartOutputDirectory
|
||||||
|
@ -89,36 +111,78 @@ void cmake::SetArgs(cmMakefile& builder, const std::vector<std::string>& args)
|
||||||
std::string arg = args[i];
|
std::string arg = args[i];
|
||||||
if(arg.find("-H",0) == 0)
|
if(arg.find("-H",0) == 0)
|
||||||
{
|
{
|
||||||
|
directoriesSet = true;
|
||||||
std::string path = arg.substr(2);
|
std::string path = arg.substr(2);
|
||||||
builder.SetHomeDirectory(path.c_str());
|
builder.SetHomeDirectory(path.c_str());
|
||||||
}
|
}
|
||||||
if(arg.find("-S",0) == 0)
|
else if(arg.find("-S",0) == 0)
|
||||||
{
|
{
|
||||||
|
directoriesSet = true;
|
||||||
m_Local = true;
|
m_Local = true;
|
||||||
std::string path = arg.substr(2);
|
std::string path = arg.substr(2);
|
||||||
builder.SetStartDirectory(path.c_str());
|
builder.SetStartDirectory(path.c_str());
|
||||||
}
|
}
|
||||||
if(arg.find("-O",0) == 0)
|
else if(arg.find("-O",0) == 0)
|
||||||
{
|
{
|
||||||
|
directoriesSet = true;
|
||||||
std::string path = arg.substr(2);
|
std::string path = arg.substr(2);
|
||||||
builder.SetStartOutputDirectory(path.c_str());
|
builder.SetStartOutputDirectory(path.c_str());
|
||||||
}
|
}
|
||||||
if(arg.find("-B",0) == 0)
|
else if(arg.find("-B",0) == 0)
|
||||||
{
|
{
|
||||||
|
directoriesSet = true;
|
||||||
std::string path = arg.substr(2);
|
std::string path = arg.substr(2);
|
||||||
builder.SetHomeOutputDirectory(path.c_str());
|
builder.SetHomeOutputDirectory(path.c_str());
|
||||||
}
|
}
|
||||||
if(arg.find("-D",0) == 0)
|
else if(arg.find("-D",0) == 0)
|
||||||
{
|
{
|
||||||
std::string value = arg.substr(2);
|
std::string value = arg.substr(2);
|
||||||
builder.AddDefinition(value.c_str(), true);
|
builder.AddDefinition(value.c_str(), true);
|
||||||
}
|
}
|
||||||
if(arg.find("-V",0) == 0)
|
else if(arg.find("-V",0) == 0)
|
||||||
{
|
{
|
||||||
m_Verbose = true;
|
m_Verbose = true;
|
||||||
}
|
}
|
||||||
|
else if(arg.find("-G",0) == 0)
|
||||||
|
{
|
||||||
|
std::string value = arg.substr(2);
|
||||||
|
cmMakefileGenerator* gen =
|
||||||
|
cmMakefileGenerator::CreateGenerator(value.c_str());
|
||||||
|
if(!gen)
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Could not create named generator ",
|
||||||
|
value.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.SetMakefileGenerator(gen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// no option assume it is the path to the source
|
||||||
|
else
|
||||||
|
{
|
||||||
|
directoriesSet = true;
|
||||||
|
builder.SetHomeOutputDirectory
|
||||||
|
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
|
builder.SetStartOutputDirectory
|
||||||
|
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
|
builder.SetHomeDirectory
|
||||||
|
(cmSystemTools::CollapseFullPath(args[1].c_str()).c_str());
|
||||||
|
builder.SetStartDirectory
|
||||||
|
(cmSystemTools::CollapseFullPath(args[1].c_str()).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!directoriesSet)
|
||||||
|
{
|
||||||
|
builder.SetHomeOutputDirectory
|
||||||
|
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
|
builder.SetStartOutputDirectory
|
||||||
|
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
|
builder.SetHomeDirectory
|
||||||
|
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
|
builder.SetStartDirectory
|
||||||
|
(cmSystemTools::GetCurrentWorkingDirectory().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_Local)
|
if (!m_Local)
|
||||||
{
|
{
|
||||||
builder.SetStartDirectory(builder.GetHomeDirectory());
|
builder.SetStartDirectory(builder.GetHomeDirectory());
|
||||||
|
@ -244,23 +308,46 @@ int cmake::Generate(const std::vector<std::string>& args, bool buildMakefiles)
|
||||||
}
|
}
|
||||||
// Create a makefile
|
// Create a makefile
|
||||||
cmMakefile mf;
|
cmMakefile mf;
|
||||||
|
// extract the directory arguments, could create a Generator
|
||||||
// extract the directory arguments
|
this->SetArgs(mf, args);
|
||||||
cmake::SetArgs(mf, args);
|
|
||||||
|
|
||||||
// create the generator
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
||||||
cmMSProjectGenerator* gen = new cmMSProjectGenerator;
|
|
||||||
#else
|
|
||||||
cmUnixMakefileGenerator* gen = new cmUnixMakefileGenerator;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gen->SetLocal(m_Local);
|
|
||||||
|
|
||||||
// Read and parse the input makefile
|
// Read and parse the input makefile
|
||||||
mf.SetMakefileGenerator(gen);
|
|
||||||
mf.MakeStartDirectoriesCurrent();
|
mf.MakeStartDirectoriesCurrent();
|
||||||
cmCacheManager::GetInstance()->LoadCache(&mf);
|
cmCacheManager::GetInstance()->LoadCache(&mf);
|
||||||
|
// no generator specified on the command line
|
||||||
|
if(!mf.GetMakefileGenerator())
|
||||||
|
{
|
||||||
|
cmMakefileGenerator* gen;
|
||||||
|
const char* genName = mf.GetDefinition("CMAKE_GENERATOR");
|
||||||
|
if(genName)
|
||||||
|
{
|
||||||
|
gen = cmMakefileGenerator::CreateGenerator(genName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
gen = new cmMSProjectGenerator;
|
||||||
|
#else
|
||||||
|
gen = new cmUnixMakefileGenerator;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if(!gen)
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Could not create generator");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
mf.SetMakefileGenerator(gen);
|
||||||
|
// add the
|
||||||
|
}
|
||||||
|
cmMakefileGenerator* gen = mf.GetMakefileGenerator();
|
||||||
|
gen->SetLocal(m_Local);
|
||||||
|
if(!mf.GetDefinition("CMAKE_GENERATOR"))
|
||||||
|
{
|
||||||
|
mf.AddCacheDefinition("CMAKE_GENERATOR",
|
||||||
|
gen->GetName(),
|
||||||
|
"Name of generator.",
|
||||||
|
cmCacheManager::INTERNAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// setup CMAKE_ROOT and CMAKE_COMMAND
|
// setup CMAKE_ROOT and CMAKE_COMMAND
|
||||||
this->AddCMakePaths(args);
|
this->AddCMakePaths(args);
|
||||||
|
|
|
@ -79,9 +79,9 @@ class cmake
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*/
|
*/
|
||||||
cmake() {m_Verbose = false;}
|
cmake();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_Verbose;
|
bool m_Verbose;
|
||||||
bool m_Local;
|
bool m_Local;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,21 +13,11 @@ SET (CMAKE_CXX_COMPILER "Borland_BCB_5.5.1" CACHE STRING "C++ compiler used.")
|
||||||
|
|
||||||
FIND_PATH(BCB_BIN_PATH bcc32.exe
|
FIND_PATH(BCB_BIN_PATH bcc32.exe
|
||||||
"C:/Program Files/Borland/CBuilder5/Bin"
|
"C:/Program Files/Borland/CBuilder5/Bin"
|
||||||
|
"C:/Borland/Bcc55/Bin"
|
||||||
|
"/Borland/Bcc55/Bin"
|
||||||
[HKEY_LOCAL_MACHINE/SOFTWARE/Borland/C++Builder/5.0/RootDir]/Bin
|
[HKEY_LOCAL_MACHINE/SOFTWARE/Borland/C++Builder/5.0/RootDir]/Bin
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
|
||||||
# Set default exe and lib directories
|
|
||||||
#
|
|
||||||
|
|
||||||
IF (NOT LIBRARY_OUTPUT_PATH)
|
|
||||||
SET (LIBRARY_OUTPUT_PATH "c:/bin" CACHE STRING "Directory for libraries to be built into.")
|
|
||||||
ENDIF (NOT LIBRARY_OUTPUT_PATH)
|
|
||||||
|
|
||||||
IF (NOT EXECUTABLE_OUTPUT_PATH)
|
|
||||||
SET (EXECUTABLE_OUTPUT_PATH "" CACHE STRING "Directory for executables to be built into.")
|
|
||||||
ENDIF (NOT EXECUTABLE_OUTPUT_PATH)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# override opengl library as it is bound to import32.lib already
|
# override opengl library as it is bound to import32.lib already
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue