ENH: clean up cmake GUI and remove the parsing of CMakeLists.txt files by configure

This commit is contained in:
Bill Hoffman 2001-04-25 16:09:17 -04:00
parent 61091234c3
commit 5c83326fb4
11 changed files with 234 additions and 206 deletions

View File

@ -48,11 +48,12 @@ protected:
afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint(); afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon(); afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnChangeEdit1();
afx_msg void OnBrowse(); afx_msg void OnBrowse();
virtual void OnOK(); virtual void OnOK();
afx_msg void OnButton3(); afx_msg void OnButton3();
afx_msg void OnBuildProjects(); afx_msg void OnBuildProjects();
afx_msg void OnChangeWhereBuild();
afx_msg void OnChangeWhereSource();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };

View File

@ -81,7 +81,7 @@ BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "CMakeSetup Version 1.0",IDC_STATIC,40,10,119,8, LTEXT "CMakeSetup Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX SS_NOPREFIX
LTEXT "Copyright (C) 2000",IDC_STATIC,40,25,119,8 LTEXT "Kitware Inc.",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END END

View File

@ -7,6 +7,7 @@
#include "../cmDSWMakefile.h" #include "../cmDSWMakefile.h"
#include "../cmMSProjectGenerator.h" #include "../cmMSProjectGenerator.h"
#include "../cmCacheManager.h" #include "../cmCacheManager.h"
#include "../cmMakefile.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
#undef THIS_FILE #undef THIS_FILE
@ -95,55 +96,7 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
} }
m_WhereSource = startPath; m_WhereSource = startPath;
this->LoadFromRegistry(); this->LoadFromRegistry();
m_InitMakefile = false; m_BuildPathChanged = false;
m_GUIInitialized = false;
this->InitMakefile();
}
void CMakeSetupDialog::InitMakefile()
{
if(m_InitMakefile)
{
// if no change in source or build then
// do not re-init the m_Makefile
if(m_WhereSource == m_WhereSourceLast
&& m_WhereBuild == m_WhereBuildLast)
{
return;
}
}
if(m_WhereBuild == "")
{
m_WhereBuild = m_WhereSource;
}
if(m_WhereSource == "")
{
return;
}
// save the values for these so we can detect
// when the GUI has changed them
m_WhereBuildLast = m_WhereBuild;
m_WhereSourceLast = m_WhereSource;
m_InitMakefile = true;
// set up the cmMakefile member
m_Makefile.SetMakefileGenerator(new cmMSProjectGenerator);
m_Makefile.SetHomeDirectory(m_WhereSource);
// Set the output directory
m_Makefile.SetStartOutputDirectory(m_WhereBuild);
m_Makefile.SetHomeOutputDirectory(m_WhereBuild);
// set the directory which contains the CMakeLists.txt
m_Makefile.SetStartDirectory(m_WhereSource);
// Create the master DSW file and all children dsp files for ITK
// Set the CMakeLists.txt file
m_Makefile.MakeStartDirectoriesCurrent();
// Create a string for the cache file
cmCacheManager::GetInstance()->LoadCache(&m_Makefile);
// if the GUI is already up, then reset it to the loaded cache
if(m_GUIInitialized)
{
this->FillCacheEditorFromCacheManager();
}
} }
void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX) void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
@ -161,11 +114,12 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_WM_SYSCOMMAND() ON_WM_SYSCOMMAND()
ON_WM_PAINT() ON_WM_PAINT()
ON_WM_QUERYDRAGICON() ON_WM_QUERYDRAGICON()
ON_EN_CHANGE(IDC_WhereSource, OnChangeEdit1) ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource)
ON_BN_CLICKED(IDC_BUTTON2, OnBrowse) ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects) ON_EN_CHANGE(IDC_WhereBuild, OnChangeWhereBuild)
//}}AFX_MSG_MAP ON_EN_CHANGE(IDC_WhereSource, OnChangeWhereSource)
//}}AFX_MSG_MAP
END_MESSAGE_MAP() END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -197,13 +151,7 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
// when the application's main window is not a dialog // when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon SetIcon(m_hIcon, FALSE); // Set small icon
this->LoadCacheFromDiskToGUI();
// TODO: Add extra initialization here
if(m_InitMakefile)
{
this->FillCacheEditorFromCacheManager();
}
m_GUIInitialized = true;
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
} }
@ -256,18 +204,8 @@ HCURSOR CMakeSetupDialog::OnQueryDragIcon()
return (HCURSOR) m_hIcon; return (HCURSOR) m_hIcon;
} }
void CMakeSetupDialog::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CMakeSetupDialog::OnBrowse() void CMakeSetupDialog::OnBrowseWhereSource()
{ {
this->UpdateData(); this->UpdateData();
Browse(m_WhereSource, "Enter Path to Insight Source"); Browse(m_WhereSource, "Enter Path to Insight Source");
@ -298,13 +236,8 @@ bool CMakeSetupDialog::Browse(CString &result, const char *title)
return bSuccess; return bSuccess;
} }
void CMakeSetupDialog::OnOK()
{
CDialog::OnOK();
}
void CMakeSetupDialog::OnButton3() void CMakeSetupDialog::OnBrowseWhereBuild()
{ {
this->UpdateData(); this->UpdateData();
Browse(m_WhereBuild, "Enter Path to Insight Build"); Browse(m_WhereBuild, "Enter Path to Insight Build");
@ -385,27 +318,45 @@ void CMakeSetupDialog::OnBuildProjects()
::SetCursor(LoadCursor(NULL, IDC_WAIT)); ::SetCursor(LoadCursor(NULL, IDC_WAIT));
// get all the info from the screen // get all the info from the screen
this->UpdateData(); this->UpdateData();
// re-init the m_Makefile if(!m_BuildPathChanged)
this->InitMakefile(); {
// copy the GUI cache values into the cache manager // if the build path has not changed save the
this->FillCacheManagerFromCacheEditor(); // current GUI values to the cache
this->SaveCacheFromGUI();
}
// Make sure we are working from the cache on disk
this->LoadCacheFromDiskToGUI();
// Create a makefile object
cmMakefile makefile;
makefile.SetMakefileGenerator(new cmMSProjectGenerator);
makefile.SetHomeDirectory(m_WhereSource);
makefile.SetStartOutputDirectory(m_WhereBuild);
makefile.SetHomeOutputDirectory(m_WhereBuild);
makefile.SetStartDirectory(m_WhereSource);
makefile.MakeStartDirectoriesCurrent();
CString makefileIn = m_WhereSource; CString makefileIn = m_WhereSource;
makefileIn += "/CMakeLists.txt"; makefileIn += "/CMakeLists.txt";
m_Makefile.ReadListFile(makefileIn); makefile.ReadListFile(makefileIn);
// Move this to the cache editor // Generate the project files
m_Makefile.GenerateMakefile(); makefile.GenerateMakefile();
cmCacheManager::GetInstance()->SaveCache(&m_Makefile); // Save the cache
cmCacheManager::GetInstance()->SaveCache(&makefile);
// update the GUI with any new values in the caused by the // update the GUI with any new values in the caused by the
// generation process // generation process
this->FillCacheEditorFromCacheManager(); this->LoadCacheFromDiskToGUI();
// save source and build paths to registry
this->SaveToRegistry(); this->SaveToRegistry();
// path is not up-to-date
m_BuildPathChanged = false;
::SetCursor(LoadCursor(NULL, IDC_ARROW)); ::SetCursor(LoadCursor(NULL, IDC_ARROW));
} }
// copy from the cache manager to the cache edit list box // copy from the cache manager to the cache edit list box
void CMakeSetupDialog::FillCacheEditorFromCacheManager() void CMakeSetupDialog::FillCacheGUIFromCacheManager()
{ {
// Clear the current GUI
m_CacheEntriesList.RemoveAll();
const cmCacheManager::CacheEntryMap &cache = const cmCacheManager::CacheEntryMap &cache =
cmCacheManager::GetInstance()->GetCacheMap(); cmCacheManager::GetInstance()->GetCacheMap();
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin(); for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
@ -420,26 +371,26 @@ void CMakeSetupDialog::FillCacheEditorFromCacheManager()
{ {
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
"ON", "ON",
PIT_CHECKBOX,""); CPropertyList::CHECKBOX,"");
} }
else else
{ {
m_CacheEntriesList.AddProperty(key, m_CacheEntriesList.AddProperty(key,
"OFF", "OFF",
PIT_CHECKBOX,""); CPropertyList::CHECKBOX,"");
} }
break; break;
case cmCacheManager::PATH: case cmCacheManager::PATH:
m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(), m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),
PIT_FILE,""); CPropertyList::PATH,"");
break; break;
case cmCacheManager::FILEPATH: case cmCacheManager::FILEPATH:
m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(), m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),
PIT_FILE,""); CPropertyList::FILE,"");
break; break;
case cmCacheManager::STRING: case cmCacheManager::STRING:
m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(), m_CacheEntriesList.AddProperty(key, value.m_Value.c_str(),
PIT_EDIT,""); CPropertyList::EDIT,"");
break; break;
case cmCacheManager::INTERNAL: case cmCacheManager::INTERNAL:
break; break;
@ -449,7 +400,7 @@ void CMakeSetupDialog::FillCacheEditorFromCacheManager()
} }
// copy from the list box to the cache manager // copy from the list box to the cache manager
void CMakeSetupDialog::FillCacheManagerFromCacheEditor() void CMakeSetupDialog::FillCacheManagerFromCacheGUI()
{ {
cmCacheManager::GetInstance()->GetCacheMap(); cmCacheManager::GetInstance()->GetCacheMap();
std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems(); std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
@ -476,3 +427,46 @@ void CMakeSetupDialog::FillCacheManagerFromCacheEditor()
void CMakeSetupDialog::OnChangeWhereBuild()
{
this->UpdateData();
std::string cachefile = m_WhereBuild;
cachefile += "/CMakeCache.txt";
if(cmSystemTools::FileExists(cachefile.c_str()))
{
m_CacheEntriesList.ShowWindow(SW_SHOW);
this->LoadCacheFromDiskToGUI();
m_BuildPathChanged = true;
}
else
{
m_CacheEntriesList.RemoveAll();
}
}
void CMakeSetupDialog::OnChangeWhereSource()
{
this->UpdateData();
}
//! Load cache file from m_WhereBuild and display in GUI editor
void CMakeSetupDialog::LoadCacheFromDiskToGUI()
{
if(m_WhereBuild != "")
{
cmCacheManager::GetInstance()->LoadCache(m_WhereBuild);
this->FillCacheGUIFromCacheManager();
}
}
//! Save GUI values to cmCacheManager and then save to disk.
void CMakeSetupDialog::SaveCacheFromGUI()
{
this->FillCacheManagerFromCacheGUI();
if(m_WhereBuild != "")
{
cmCacheManager::GetInstance()->SaveCache(m_WhereBuild);
}
}

View File

@ -7,7 +7,8 @@
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#include "../cmMakefile.h"
#include "PropertyList.h" #include "PropertyList.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CMakeSetupDialog dialog // CMakeSetupDialog dialog
@ -18,10 +19,13 @@ class CMakeSetupDialog : public CDialog
public: public:
CMakeSetupDialog(CWnd* pParent = NULL); // standard constructor CMakeSetupDialog(CWnd* pParent = NULL); // standard constructor
protected: protected:
bool Browse(CString&, const char* title); //! Load cache file from m_WhereBuild and display in GUI editor
void LoadCacheFromDiskToGUI();
//! Save GUI values to cmCacheManager and then save to disk.
void SaveCacheFromGUI();
void SaveToRegistry(); void SaveToRegistry();
void LoadFromRegistry(); void LoadFromRegistry();
void InitMakefile(); bool Browse(CString&, const char* title);
void ReadRegistryValue(HKEY hKey, void ReadRegistryValue(HKEY hKey,
CString *val, CString *val,
const char *key, const char *key,
@ -29,13 +33,9 @@ protected:
// Dialog Data // Dialog Data
//{{AFX_DATA(CMakeSetupDialog) //{{AFX_DATA(CMakeSetupDialog)
enum { IDD = IDD_CMakeSetupDialog_DIALOG }; enum { IDD = IDD_CMakeSetupDialog_DIALOG };
cmMakefile m_Makefile;
bool m_InitMakefile;
bool m_GUIInitialized;
CString m_WhereSource; CString m_WhereSource;
CString m_WhereBuild; CString m_WhereBuild;
CString m_WhereSourceLast; bool m_BuildPathChanged;
CString m_WhereBuildLast;
CPropertyList m_CacheEntriesList; CPropertyList m_CacheEntriesList;
//}}AFX_DATA //}}AFX_DATA
@ -48,6 +48,12 @@ protected:
// Implementation // Implementation
protected: protected:
// copy from the cache manager to the cache edit list box
void FillCacheGUIFromCacheManager();
// copy from the list box to the cache manager
void FillCacheManagerFromCacheGUI();
HICON m_hIcon; HICON m_hIcon;
CString m_RegistryKey; CString m_RegistryKey;
// Generated message map functions // Generated message map functions
@ -56,17 +62,11 @@ protected:
afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint(); afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon(); afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnChangeEdit1(); afx_msg void OnBrowseWhereSource();
afx_msg void OnBrowse();
virtual void OnOK();
virtual void OnBuildProjects(); virtual void OnBuildProjects();
afx_msg void OnButton3(); afx_msg void OnBrowseWhereBuild();
afx_msg void OnChangeWhereBuild();
// copy from the cache manager to the cache edit list box afx_msg void OnChangeWhereSource();
void FillCacheEditorFromCacheManager();
// copy from the list box to the cache manager
void FillCacheManagerFromCacheEditor();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };

View File

@ -4,11 +4,10 @@
#include "stdafx.h" #include "stdafx.h"
#include "PropertyList.h" #include "PropertyList.h"
#ifdef _DEBUG #define IDC_PROPCMBBOX 712
#define new DEBUG_NEW #define IDC_PROPEDITBOX 713
#undef THIS_FILE #define IDC_PROPBTNCTRL 714
static char THIS_FILE[] = __FILE__; #define IDC_PROPCHECKBOXCTRL 715
#endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CPropertyList // CPropertyList
@ -154,6 +153,8 @@ int CPropertyList::AddProperty(const char* name,
{ {
pItem = *p; pItem = *p;
pItem->m_Removed = false; pItem->m_Removed = false;
pItem->m_curValue = value;
Invalidate();
} }
} }
// if it is not found, then create a new one // if it is not found, then create a new one
@ -197,7 +198,7 @@ void CPropertyList::OnSelchange()
if (m_CheckBoxControl) if (m_CheckBoxControl)
m_CheckBoxControl.ShowWindow(SW_HIDE); m_CheckBoxControl.ShowWindow(SW_HIDE);
if (pItem->m_nItemType==PIT_COMBO) if (pItem->m_nItemType==CPropertyList::COMBO)
{ {
//display the combo box. If the combo box has already been //display the combo box. If the combo box has already been
//created then simply move it to the new location, else create it //created then simply move it to the new location, else create it
@ -207,7 +208,9 @@ void CPropertyList::OnSelchange()
else else
{ {
rect.bottom += 100; rect.bottom += 100;
m_cmbBox.Create(CBS_DROPDOWNLIST | CBS_NOINTEGRALHEIGHT | WS_VISIBLE | WS_CHILD | WS_BORDER, m_cmbBox.Create(CBS_DROPDOWNLIST
| CBS_NOINTEGRALHEIGHT | WS_VISIBLE
| WS_CHILD | WS_BORDER,
rect,this,IDC_PROPCMBBOX); rect,this,IDC_PROPCMBBOX);
m_cmbBox.SetFont(&m_SSerif8Font); m_cmbBox.SetFont(&m_SSerif8Font);
} }
@ -237,7 +240,7 @@ void CPropertyList::OnSelchange()
else else
m_cmbBox.SetCurSel(0); m_cmbBox.SetCurSel(0);
} }
else if (pItem->m_nItemType==PIT_EDIT) else if (pItem->m_nItemType==CPropertyList::EDIT)
{ {
//display edit box //display edit box
m_nLastBox = 1; m_nLastBox = 1;
@ -247,7 +250,8 @@ void CPropertyList::OnSelchange()
m_editBox.MoveWindow(rect); m_editBox.MoveWindow(rect);
else else
{ {
m_editBox.Create(ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE | WS_CHILD | WS_BORDER, m_editBox.Create(ES_LEFT | ES_AUTOHSCROLL | WS_VISIBLE
| WS_CHILD | WS_BORDER,
rect,this,IDC_PROPEDITBOX); rect,this,IDC_PROPEDITBOX);
m_editBox.SetFont(&m_SSerif8Font); m_editBox.SetFont(&m_SSerif8Font);
} }
@ -259,14 +263,16 @@ void CPropertyList::OnSelchange()
//set the text in the edit box to the property's current value //set the text in the edit box to the property's current value
m_editBox.SetWindowText(lBoxSelText); m_editBox.SetWindowText(lBoxSelText);
} }
else if (pItem->m_nItemType == PIT_CHECKBOX) else if (pItem->m_nItemType == CPropertyList::CHECKBOX)
{ {
rect.bottom -= 3; rect.bottom -= 3;
if (m_CheckBoxControl) if (m_CheckBoxControl)
m_CheckBoxControl.MoveWindow(rect); m_CheckBoxControl.MoveWindow(rect);
else else
{ {
m_CheckBoxControl.Create("check",BS_CHECKBOX | BM_SETCHECK |BS_LEFTTEXT | WS_VISIBLE | WS_CHILD, m_CheckBoxControl.Create("check",BS_CHECKBOX
| BM_SETCHECK |BS_LEFTTEXT
| WS_VISIBLE | WS_CHILD,
rect,this,IDC_PROPCHECKBOXCTRL); rect,this,IDC_PROPCHECKBOXCTRL);
m_CheckBoxControl.SetFont(&m_SSerif8Font); m_CheckBoxControl.SetFont(&m_SSerif8Font);
} }
@ -377,7 +383,7 @@ void CPropertyList::OnButton()
//display the appropriate common dialog depending on what type //display the appropriate common dialog depending on what type
//of chooser is associated with the property //of chooser is associated with the property
if (pItem->m_nItemType == PIT_COLOR) if (pItem->m_nItemType == CPropertyList::COLOR)
{ {
COLORREF initClr; COLORREF initClr;
CString currClr = pItem->m_curValue; CString currClr = pItem->m_curValue;
@ -413,7 +419,7 @@ void CPropertyList::OnButton()
Invalidate(); Invalidate();
} }
} }
else if (pItem->m_nItemType == PIT_FILE) else if (pItem->m_nItemType == CPropertyList::FILE)
{ {
CString SelectedFile; CString SelectedFile;
CString Filter("Gif Files (*.gif)|*.gif||"); CString Filter("Gif Files (*.gif)|*.gif||");
@ -438,7 +444,32 @@ void CPropertyList::OnButton()
Invalidate(); Invalidate();
} }
} }
else if (pItem->m_nItemType == PIT_FONT) else if (pItem->m_nItemType == CPropertyList::PATH)
{
char szPathName[4096];
BROWSEINFO bi;
bi.hwndOwner = m_hWnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = (LPTSTR)szPathName;
bi.lpszTitle = "Select Directory";
bi.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
BOOL bSuccess = SHGetPathFromIDList(pidl, szPathName);
CString SelectedFile;
if(bSuccess)
{
SelectedFile = szPathName;
m_btnCtrl.ShowWindow(SW_HIDE);
pItem->m_curValue = SelectedFile;
m_Dirty = true;
Invalidate();
}
}
else if (pItem->m_nItemType == CPropertyList::FONT)
{ {
CFontDialog FontDlg(NULL,CF_EFFECTS | CF_SCREENFONTS,NULL,this); CFontDialog FontDlg(NULL,CF_EFFECTS | CF_SCREENFONTS,NULL,this);
@ -598,3 +629,14 @@ void CPropertyList::OnDelete()
Invalidate(); Invalidate();
} }
void CPropertyList::RemoveAll()
{
int c = this->GetCount();
for(int i =0; i < c; ++i)
{
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(0);
pItem->m_Removed = true;
this->DeleteString(0);
}
Invalidate();
}

View File

@ -1,23 +1,7 @@
#if !defined(AFX_PROPERTYLIST_H__74205380_1B56_11D4_BC48_00105AA2186F__INCLUDED_) #ifndef CPROPERTYLIST_H
#define AFX_PROPERTYLIST_H__74205380_1B56_11D4_BC48_00105AA2186F__INCLUDED_ #define CPROPERTYLIST_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PropertyList.h : header file
//
#define PIT_COMBO 0 //PIT = property item type
#define PIT_EDIT 1
#define PIT_COLOR 2
#define PIT_FONT 3
#define PIT_FILE 4
#define PIT_CHECKBOX 5
#define IDC_PROPCMBBOX 712
#define IDC_PROPEDITBOX 713
#define IDC_PROPBTNCTRL 714
#define IDC_PROPCHECKBOXCTRL 715
#include "../cmStandardIncludes.h" #include "../cmStandardIncludes.h"
@ -51,6 +35,16 @@ class CPropertyList : public CListBox
{ {
// Construction // Construction
public: public:
enum ItemType
{
COMBO = 0,
EDIT,
COLOR,
FONT,
FILE,
CHECKBOX,
PATH
};
CPropertyList(); CPropertyList();
// Attributes // Attributes
@ -67,7 +61,7 @@ public:
{ {
return m_PropertyItems; return m_PropertyItems;
} }
void RemoveAll();
CPropertyItem* GetItem(int index); CPropertyItem* GetItem(int index);
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
@ -76,7 +70,6 @@ public:
virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct); virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
protected: protected:
int AddPropItem(CPropertyItem* pItem);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void PreSubclassWindow(); virtual void PreSubclassWindow();
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
@ -85,7 +78,7 @@ protected:
public: public:
virtual ~CPropertyList(); virtual ~CPropertyList();
// Generated message map functions // Generated message map functions
protected: protected:
//{{AFX_MSG(CPropertyList) //{{AFX_MSG(CPropertyList)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
@ -104,12 +97,11 @@ protected:
afx_msg void OnDelete(); afx_msg void OnDelete();
afx_msg void OnCheckBox(); afx_msg void OnCheckBox();
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo); void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo);
void DisplayButton(CRect region); void DisplayButton(CRect region);
int AddPropItem(CPropertyItem* pItem);
CComboBox m_cmbBox; CComboBox m_cmbBox;
CEdit m_editBox; CEdit m_editBox;

View File

@ -27,7 +27,7 @@ cmCustomCommand.o \
cmCacheManager.o \ cmCacheManager.o \
cmSourceGroup.o cmSourceGroup.o
DEPENDS = $(srcdir)/*.h $(srcdir)/*.cxx ${CMAKE_CONFIG_DIR}/CMake/Source/cmConfigure.h DEPENDS = $(srcdir)/*.h ${CMAKE_CONFIG_DIR}/CMake/Source/cmConfigure.h
cmCollectFlags.o : $(DEPENDS) cmCollectFlags.o : $(DEPENDS)
CMakeBuildTargets.o : $(DEPENDS) CMakeBuildTargets.o : $(DEPENDS)
@ -40,7 +40,7 @@ cmSourceFile.o : $(DEPENDS)
cmDirectory.o : $(DEPENDS) cmDirectory.o : $(DEPENDS)
cmCustomCommand.o : $(DEPENDS) cmCustomCommand.o : $(DEPENDS)
cmUnixMakefileGenerator.o : $(DEPENDS) cmUnixMakefileGenerator.o : $(DEPENDS)
cmCommands.o : $(DEPENDS) cmCommands.o : $(DEPENDS) $(srcdir)/*.cxx
cmTarget.o : $(DEPENDS) cmTarget.o : $(DEPENDS)
cmCacheManager.o : $(DEPENDS) cmCacheManager.o : $(DEPENDS)
cmSourceGroup.o : $(DEPENDS) cmSourceGroup.o : $(DEPENDS)

View File

@ -59,7 +59,13 @@ cmCacheManager* cmCacheManager::GetInstance()
bool cmCacheManager::LoadCache(cmMakefile* mf) bool cmCacheManager::LoadCache(cmMakefile* mf)
{ {
std::string cacheFile = mf->GetHomeOutputDirectory(); return this->LoadCache(mf->GetHomeOutputDirectory());
}
bool cmCacheManager::LoadCache(const char* path)
{
std::string cacheFile = path;
cacheFile += "/CMakeCache.txt"; cacheFile += "/CMakeCache.txt";
// clear the old cache // clear the old cache
m_Cache.clear(); m_Cache.clear();
@ -98,7 +104,13 @@ bool cmCacheManager::LoadCache(cmMakefile* mf)
bool cmCacheManager::SaveCache(cmMakefile* mf) const bool cmCacheManager::SaveCache(cmMakefile* mf) const
{ {
std::string cacheFile = mf->GetHomeOutputDirectory(); return this->SaveCache(mf->GetHomeOutputDirectory());
}
bool cmCacheManager::SaveCache(const char* path) const
{
std::string cacheFile = path;
cacheFile += "/CMakeCache.txt"; cacheFile += "/CMakeCache.txt";
std::string tempFile = cacheFile; std::string tempFile = cacheFile;
tempFile += ".tmp"; tempFile += ".tmp";
@ -110,6 +122,7 @@ bool cmCacheManager::SaveCache(cmMakefile* mf) const
return false; return false;
} }
fout << "# This is the CMakeCache file.\n" fout << "# This is the CMakeCache file.\n"
<< "# For build in directory: " << path << "\n"
<< "# You can edit this file to change values found and used by cmake.\n" << "# You can edit this file to change values found and used by cmake.\n"
<< "# If you do not want to change any of the values, simply exit the editor.\n" << "# If you do not want to change any of the values, simply exit the editor.\n"
<< "# If you do want to change a value, simply edit, save, and exit the editor.\n" << "# If you do want to change a value, simply edit, save, and exit the editor.\n"

View File

@ -50,10 +50,14 @@ public:
//! Load a cache for given makefile. Loads from ouput home. //! Load a cache for given makefile. Loads from ouput home.
bool LoadCache(cmMakefile*); bool LoadCache(cmMakefile*);
//! Load a cache for given makefile. Loads from path/CMakeCache.txt.
bool LoadCache(const char* path);
//! Save cache for given makefile. Saves to ouput home CMakeCache.txt //! Save cache for given makefile. Saves to ouput home CMakeCache.txt.
bool SaveCache(cmMakefile*) const; bool SaveCache(cmMakefile*) const;
//! Save cache for given makefile. Saves to ouput path/CMakeCache.txt
bool SaveCache(const char* path) const;
//! Add an entry into the cache //! Add an entry into the cache
void AddCacheEntry(const char* key, const char* value, CacheEntryType type); void AddCacheEntry(const char* key, const char* value, CacheEntryType type);

View File

@ -609,6 +609,37 @@ void cmMakefile::GenerateCacheOnly()
{ {
std::vector<cmMakefile*> makefiles; std::vector<cmMakefile*> makefiles;
this->FindSubDirectoryCMakeListsFiles(makefiles); this->FindSubDirectoryCMakeListsFiles(makefiles);
for(std::vector<cmMakefile*>::iterator i = makefiles.begin();
i != makefiles.end(); ++i)
{
cmMakefile* mf = *i;
std::string source = mf->GetHomeDirectory();
source += "/CMake/CMakeMakefileTemplate.in";
cmSystemTools::MakeDirectory(mf->GetStartOutputDirectory());
std::string dest = mf->GetStartOutputDirectory();
dest += "/Makefile";
std::ofstream fout(dest.c_str());
if(!fout)
{
cmSystemTools::Error("Failed to open file for write " , dest.c_str());
}
else
{
if(strcmp(mf->GetHomeDirectory(),
mf->GetHomeOutputDirectory()) == 0)
{
fout << "srcdir = .\n\n";
}
else
{
fout << "srcdir = " << mf->GetStartDirectory() << "\n";
fout << "VPATH = " << mf->GetStartDirectory() << "\n";
}
}
fout << "include "
<< mf->GetHomeOutputDirectory() << "/CMake/CMakeMaster.make\n";
}
for(unsigned int i =0; i < makefiles.size(); ++i) for(unsigned int i =0; i < makefiles.size(); ++i)
{ {
delete makefiles[i]; delete makefiles[i];

View File

@ -573,53 +573,6 @@ AC_CONFIG_SUBDIRS(Code/Numerics/vxl/vcl)
# and any sub directories recursivley # and any sub directories recursivley
# #
echo "Searching CMakeLists.txt files for all sub directories"
# the result of a the directories found is stored in allDirs
allDirs=
# start looking in the current directory .
searchDirs=$srcdir
# loop until the flag dirHasListsFile is set to falls
dirHasListsFile=:
while $dirHasListsFile; do
# reset the varible used to store the full paths to the directory
# outside the for loop
fullPathDirs=
# loop over all directorirs in the current searchDirs varible
for currentDir in $searchDirs;do
# look for a CMakeLists.txt file in the current directory
if test -e$currentDir/CMakeLists.txt; then
# extract the SUBDIRS varible from the CMakeLists.txt file
dirsInListsFile=`cat $currentDir/CMakeLists.txt | sed -e :a -e '/SUBDIRS.*\\\\$/N; s/\\\\\\n//; ta' | grep SUBDIRS | sed -e "s/SUBDIRS//g; s/(//g;s/)//g" `
# add the current directory to any sub dirs found
# in the above search of CMakeLists.txt
for subdir in $dirsInListsFile;do
fullPathDirs="$fullPathDirs $currentDir/$subdir"
allDirs="$allDirs $currentDir/$subdir"
done
fi
done
# now get ready to search any directories found in the above for loop
searchDirs=$fullPathDirs
# check to see if searchDirs is emtpy
if test "x$searchDirs" = x; then
dirHasListsFile=false
fi
done # continue while loop until dirHasListsFile=false
if test "x$srcdir" = x.; then
allDirs=`echo $allDirs | sed -e "s|\./||g"`
else
allDirs=`echo $allDirs | sed -e "s|$srcdir/||g"`
fi
SUBDIR_MAKEFILES=`echo $allDirs | sed -e 's|\\([[A-Za-z0-9_/]][[A-Za-z0-9_/]]*\\)|\1/Makefile:CMake/CMakeMakefileTemplate.in|g'`
SUBDIR_CMAKE_TARGETS=`echo $allDirs | sed -e 's|\\([[A-Za-z0-9_/]][[A-Za-z0-9_/]]*\\)|\1/CMakeTargets.make:CMake/CMakeTargets.make.in|g'`
#
# *****************************************
# end of extract SUBDIRS out of CMakeLists.txt files
#
# #
# Build two variables (SITE, INSTANCE) used for setting up testing # Build two variables (SITE, INSTANCE) used for setting up testing
# #
@ -673,8 +626,6 @@ CMake/CMakeVariables.make
CMake/CMakeRules.make CMake/CMakeRules.make
CMake/Source/CMakeTargets.make:CMake/dummy.in CMake/Source/CMakeTargets.make:CMake/dummy.in
CMake/Source/Makefile CMake/Source/Makefile
$SUBDIR_MAKEFILES
$SUBDIR_CMAKE_TARGETS
) )