summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/MFCDialog/CMakeSetup.rc48
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp17
-rw-r--r--Source/MFCDialog/resource.h5
-rw-r--r--Source/cmGlobalGenerator.cxx20
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmake.cxx17
-rw-r--r--Source/cmake.h15
7 files changed, 91 insertions, 33 deletions
diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc
index d950240..5f0cff0 100644
--- a/Source/MFCDialog/CMakeSetup.rc
+++ b/Source/MFCDialog/CMakeSetup.rc
@@ -1,4 +1,4 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
@@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// TEXTINCLUDE
//
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
@@ -66,15 +66,15 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
-IDR_MAINFRAME ICON DISCARDABLE "res\\CMakeSetupDialog.ico"
+IDR_MAINFRAME ICON "res\\CMakeSetupDialog.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
-IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+IDD_ABOUTBOX DIALOG 0, 0, 235, 55
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About CMakeSetup"
FONT 8, "MS Sans Serif"
BEGIN
@@ -86,11 +86,11 @@ BEGIN
END
IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 446, 241
-STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
- WS_SYSMENU | WS_THICKFRAME
+STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE |
+ WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "CMakeSetupDialog"
-FONT 8, "MS Sans Serif"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
COMBOBOX IDC_WhereSource,96,6,169,66,CBS_DROPDOWN |
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
@@ -116,10 +116,11 @@ BEGIN
PUSHBUTTON "Help",IDC_HELP_BUTTON,278,223,51,15
CONTROL "Show Advanced Values",IDC_AdvancedValues,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,305,28,98,9
+ RTEXT "Static",IDC_PROGRESS,341,226,100,12,SS_CENTERIMAGE
END
-IDD_CMAKE_HELP_DIALOG DIALOG DISCARDABLE 0, 0, 365, 183
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+IDD_CMAKE_HELP_DIALOG DIALOG 0, 0, 365, 183
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "CMake Help"
FONT 8, "MS Sans Serif"
BEGIN
@@ -129,7 +130,6 @@ BEGIN
END
-#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
@@ -152,15 +152,13 @@ BEGIN
BEGIN
BLOCK "040904B0"
BEGIN
- VALUE "CompanyName", "\0"
- VALUE "FileDescription", "CMakeSetup MFC Application\0"
- VALUE "FileVersion", "1, 0, 0, 1\0"
- VALUE "InternalName", "CMakeSetup\0"
- VALUE "LegalCopyright", "Copyright (C) 2000\0"
- VALUE "LegalTrademarks", "\0"
- VALUE "OriginalFilename", "CMakeSetup.EXE\0"
- VALUE "ProductName", "CMakeSetup Application\0"
- VALUE "ProductVersion", "1, 0, 0, 1\0"
+ VALUE "FileDescription", "CMakeSetup MFC Application"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "CMakeSetup"
+ VALUE "LegalCopyright", "Copyright (C) 2000"
+ VALUE "OriginalFilename", "CMakeSetup.EXE"
+ VALUE "ProductName", "CMakeSetup Application"
+ VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
@@ -169,8 +167,6 @@ BEGIN
END
END
-#endif // !_MAC
-
/////////////////////////////////////////////////////////////////////////////
//
@@ -178,7 +174,7 @@ END
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
+GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
@@ -210,7 +206,7 @@ END
// String Table
//
-STRINGTABLE DISCARDABLE
+STRINGTABLE
BEGIN
IDS_ABOUTBOX "&About CMakeSetup..."
IDS_CREATESHORTCUT "&Create shortcut"
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index 11324c8..fc8ccd6 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -103,6 +103,20 @@ void MFCMessageCallback(const char* m, const char* title, bool& nomore, void*)
/////////////////////////////////////////////////////////////////////////////
// CMakeSetupDialog dialog
+void updateProgress(const char *msg, float prog, void *cd)
+{
+ char tmp[1024];
+ if (prog >= 0)
+ {
+ sprintf(tmp,"%s %i%%",msg,(int)(100*prog));
+ }
+ else
+ {
+ sprintf(tmp,"%s",msg);
+ }
+ CMakeSetupDialog *self = (CMakeSetupDialog *)cd;
+ self->SetDlgItemText(IDC_PROGRESS, tmp);
+}
CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo,
CWnd* pParent /*=NULL*/)
@@ -147,6 +161,8 @@ CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo,
m_oldCX = -1;
m_deltaXRemainder = 0;
m_CMakeInstance = new cmake;
+ m_CMakeInstance->SetProgressCallback(updateProgress, (void *)this);
+
}
void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
@@ -268,6 +284,7 @@ BOOL CMakeSetupDialog::OnInitDialog()
sprintf(tmp,"Version %d.%d - %s", cmake::GetMajorVersion(),
cmake::GetMinorVersion(), cmake::GetReleaseVersion());
SetDlgItemText(IDC_CMAKE_VERSION, tmp);
+ SetDlgItemText(IDC_PROGRESS, "");
this->UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
diff --git a/Source/MFCDialog/resource.h b/Source/MFCDialog/resource.h
index d581f29..efa4060 100644
--- a/Source/MFCDialog/resource.h
+++ b/Source/MFCDialog/resource.h
@@ -1,5 +1,5 @@
//{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
+// Microsoft Visual C++ generated include file.
// Used by CMakeSetup.rc
//
#define IDM_ABOUTBOX 0x0010
@@ -26,6 +26,7 @@
#define IDC_HELP_BUTTON 1021
#define IDC_EDIT1 1025
#define IDC_AdvancedValues 1027
+#define IDC_PROGRESS 1028
// Next default values for new objects
//
@@ -33,7 +34,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1028
+#define _APS_NEXT_CONTROL_VALUE 1029
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index bc69b82..eec9999 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -69,23 +69,31 @@ void cmGlobalGenerator::Configure()
lg->GetMakefile()->MakeStartDirectoriesCurrent();
// now do it
- this->RecursiveConfigure(lg);
+ this->RecursiveConfigure(lg,0.0f,0.9f);
// after it is all done do a ConfigureFinalPass
for (i = 0; i < m_LocalGenerators.size(); ++i)
{
m_LocalGenerators[i]->ConfigureFinalPass();
+ m_CMakeInstance->UpdateProgress("Configuring",
+ 0.9f+0.1f*(i+1.0f)/m_LocalGenerators.size());
}
+ m_CMakeInstance->UpdateProgress("Configuring done", -1);
}
// loop through the directories creating cmLocalGenerators and Configure()
-void cmGlobalGenerator::RecursiveConfigure(cmLocalGenerator *lg)
+void cmGlobalGenerator::RecursiveConfigure(cmLocalGenerator *lg,
+ float startProgress,
+ float endProgress)
{
// configure the current directory
lg->Configure();
-
+
// get all the subdirectories
std::vector<std::string> subdirs = lg->GetMakefile()->GetSubDirectories();
+ float progressPiece = (endProgress - startProgress)/(1.0f+subdirs.size());
+ m_CMakeInstance->UpdateProgress("Configuring",
+ startProgress + progressPiece);
// for each subdir recurse
unsigned int i;
@@ -107,7 +115,9 @@ void cmGlobalGenerator::RecursiveConfigure(cmLocalGenerator *lg)
lg2->GetMakefile()->SetStartDirectory(currentDir.c_str());
lg2->GetMakefile()->MakeStartDirectoriesCurrent();
- this->RecursiveConfigure(lg2);
+ this->RecursiveConfigure(lg2,
+ startProgress + (i+1.0f)*progressPiece,
+ startProgress + (i+2.0f)*progressPiece);
}
}
@@ -118,6 +128,8 @@ void cmGlobalGenerator::Generate()
for (i = 0; i < m_LocalGenerators.size(); ++i)
{
m_LocalGenerators[i]->Generate(true);
+ m_CMakeInstance->UpdateProgress("Generating",
+ (i+1.0f)/m_LocalGenerators.size());
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 226a67b..4a585bc 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -103,7 +103,7 @@ protected:
std::vector<cmLocalGenerator *> m_LocalGenerators;
///! used by Configure()
- void RecursiveConfigure(cmLocalGenerator *lg);
+ void RecursiveConfigure(cmLocalGenerator *lg, float start, float end);
private:
std::map<cmStdString, bool> m_LanguageEnabled;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index da5eef9..684116a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -41,6 +41,9 @@ cmake::cmake()
m_InTryCompile = false;
m_CacheManager = new cmCacheManager;
m_GlobalGenerator = 0;
+ m_ProgressCallback = 0;
+ m_ProgressCallbackClientData = 0;
+
this->AddDefaultCommands();
}
@@ -907,3 +910,17 @@ int cmake::LoadCache()
return 0;
}
+void cmake::SetProgressCallback(ProgressCallback f, void *cd)
+{
+ m_ProgressCallback = f;
+ m_ProgressCallbackClientData = cd;
+}
+
+void cmake::UpdateProgress(const char *msg, float prog)
+{
+ if(m_ProgressCallback && !m_InTryCompile)
+ {
+ (*m_ProgressCallback)(msg, prog, m_ProgressCallbackClientData);
+ return;
+ }
+}
diff --git a/Source/cmake.h b/Source/cmake.h
index 3a9c165..09daa14 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -211,6 +211,19 @@ class cmake
///! Parse command line arguments that might set cache values
void SetCacheArgs(const std::vector<std::string>&);
+ typedef void (*ProgressCallback)(const char*msg, float progress, void *);
+ /**
+ * Set the function used by GUI's to receive progress updates
+ * Function gets passed: message as a const char*, a progress
+ * amount ranging from 0 to 1.0 and client data. The progress
+ * number provided may be negative in cases where a message is
+ * to be displayed without any progress percentage.
+ */
+ void SetProgressCallback(ProgressCallback f, void* clientData=0);
+
+ ///! this is called by generators to update the progress
+ void UpdateProgress(const char *msg, float prog);
+
protected:
typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
RegisteredCommandsMap m_Commands;
@@ -235,6 +248,8 @@ protected:
int AddCMakePaths(const char *arg0);
private:
+ ProgressCallback m_ProgressCallback;
+ void* m_ProgressCallbackClientData;
bool m_Verbose;
bool m_Local;
bool m_InTryCompile;