Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
90e56122
Commit
90e56122
authored
Apr 23, 2001
by
Bill Hoffman
Browse files
ENH: new GUI editor for cmake cache file
parent
619dd8c4
Changes
17
Hide whitespace changes
Inline
Side-by-side
Source/CMakeLib.dsp
View file @
90e56122
...
...
@@ -135,10 +135,6 @@ SOURCE=.\cmSourceGroup.cxx
SOURCE=.\cmSystemTools.cxx
# End Source File
# Begin Source File
SOURCE=.\cmWindowsConfigure.cxx
# End Source File
# End Group
# Begin Group "Header Files"
...
...
@@ -415,14 +411,6 @@ SOURCE=..\cmWin32LibrariesCommand.h
SOURCE=.\cmWin32LibrariesCommand.h
# End Source File
# Begin Source File
SOURCE=..\cmWindowsConfigure.h
# End Source File
# Begin Source File
SOURCE=.\cmWindowsConfigure.h
# End Source File
# End Group
# End Target
# End Project
Source/MFCDialog/CMakeDialog.h
View file @
90e56122
...
...
@@ -26,10 +26,11 @@ protected:
char
*
adefault
);
// Dialog Data
//{{AFX_DATA(CMakeSetupDialog)
enum
{
IDD
=
IDD_CMakeSetupDialog_DIALOG
};
enum
{
IDD
=
IDD_CMakeSetupDialog_DIALOG
};
CListBox
m_CacheEntriesList
;
CString
m_WhereITK
;
CString
m_WhereBuildITK
;
//}}AFX_DATA
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMakeSetupDialog)
...
...
@@ -51,8 +52,8 @@ protected:
afx_msg
void
OnBrowse
();
virtual
void
OnOK
();
afx_msg
void
OnButton3
();
//}}AFX_MSG
afx_msg
void
OnBuildProjects
();
//}}AFX_MSG
DECLARE_MESSAGE_MAP
()
};
...
...
Source/MFCDialog/CMakeSetup.dsp
View file @
90e56122
...
...
@@ -107,6 +107,10 @@ SOURCE=.\CMakeSetupDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\PropertyList.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
...
...
Source/MFCDialog/CMakeSetup.rc
View file @
90e56122
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\CMakeSetupDialog.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\CMakeSetupDialog.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About CMakeSetup"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "CMakeSetup Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2000",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "CMakeSetupDialog"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,260,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,260,23,50,14
EDITTEXT IDC_WhereSource,13,27,135,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON2,150,28,43,13
LTEXT "Where is the source code:",IDC_STATIC,15,15,104,9
EDITTEXT IDC_WhereBuild,14,67,133,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON3,151,66,43,13
LTEXT "Where do you want to build the binaries:",IDC_STATIC,16,
56,128,9
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
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"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About CMakeSetup..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\CMakeSetupDialog.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\CMakeSetupDialog.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\CMakeSetupDialog.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 235, 55
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About CMakeSetup"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "CMakeSetup Version 1.0",IDC_STATIC,40,10,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 2000",IDC_STATIC,40,25,119,8
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
END
IDD_CMakeSetupDialog_DIALOG DIALOGEX 0, 0, 375, 226
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "CMakeSetupDialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Close",IDOK,319,39,50,14
EDITTEXT IDC_WhereSource,129,4,135,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON2,269,5,43,13
LTEXT "Where is the source code:",IDC_STATIC,39,6,86,9
EDITTEXT IDC_WhereBuild,129,25,133,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",IDC_BUTTON3,268,25,43,13
LTEXT "Where do you want to build the binaries:",IDC_STATIC,1,
27,128,9
PUSHBUTTON "Build Project Files",IDC_BuildProjects,6,39,67,15
GROUPBOX "Cache Values",IDC_STATIC,2,67,370,156
LISTBOX IDC_LIST2,13,84,344,122,LBS_OWNERDRAWVARIABLE |
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_TABSTOP
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
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"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 228
TOPMARGIN, 7
BOTTOMMARGIN, 48
END
IDD_CMakeSetupDialog_DIALOG, DIALOG
BEGIN
BOTTOMMARGIN, 215
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About CMakeSetup..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\CMakeSetupDialog.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
Source/MFCDialog/CMakeSetupDialog.cpp
View file @
90e56122
...
...
@@ -5,7 +5,6 @@
#include
"CMakeSetup.h"
#include
"CMakeSetupDialog.h"
#include
"../cmDSWMakefile.h"
#include
"../cmWindowsConfigure.h"
#include
"../cmMSProjectGenerator.h"
#include
"../cmCacheManager.h"
#ifdef _DEBUG
...
...
@@ -79,7 +78,7 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
//{{AFX_DATA_INIT(CMakeSetupDialog)
m_WhereSource
=
_T
(
""
);
m_WhereBuild
=
_T
(
""
);
//}}AFX_DATA_INIT
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon
=
AfxGetApp
()
->
LoadIcon
(
IDR_MAINFRAME
);
// Guess the initial source directory based on the location
...
...
@@ -96,15 +95,49 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
}
m_WhereSource
=
startPath
;
this
->
LoadFromRegistry
();
m_InitMakefile
=
false
;
this
->
InitMakefile
();
}
void
CMakeSetupDialog
::
InitMakefile
()
{
if
(
m_InitMakefile
)
{
return
;
}
if
(
m_WhereBuild
==
""
)
{
m_WhereBuild
=
m_WhereSource
;
}
if
(
m_WhereSource
==
""
)
{
return
;
}
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
);
}
void
CMakeSetupDialog
::
DoDataExchange
(
CDataExchange
*
pDX
)
{
CDialog
::
DoDataExchange
(
pDX
);
//{{AFX_DATA_MAP(CMakeSetupDialog)
DDX_Control
(
pDX
,
IDC_LIST2
,
m_CacheEntriesList
);
DDX_Text
(
pDX
,
IDC_WhereSource
,
m_WhereSource
);
DDX_Text
(
pDX
,
IDC_WhereBuild
,
m_WhereBuild
);
//}}AFX_DATA_MAP
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP
(
CMakeSetupDialog
,
CDialog
)
...
...
@@ -115,7 +148,8 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_EN_CHANGE
(
IDC_WhereSource
,
OnChangeEdit1
)
ON_BN_CLICKED
(
IDC_BUTTON2
,
OnBrowse
)
ON_BN_CLICKED
(
IDC_BUTTON3
,
OnButton3
)
//}}AFX_MSG_MAP
ON_BN_CLICKED
(
IDC_BuildProjects
,
OnBuildProjects
)
//}}AFX_MSG_MAP
END_MESSAGE_MAP
()
/////////////////////////////////////////////////////////////////////////////
...
...
@@ -149,7 +183,10 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
SetIcon
(
m_hIcon
,
FALSE
);
// Set small icon
// TODO: Add extra initialization here
if
(
m_InitMakefile
)
{
this
->
FillCacheEditorFromCacheManager
();
}
return
TRUE
;
// return TRUE unless you set the focus to a control
}
...
...
@@ -246,51 +283,7 @@ bool CMakeSetupDialog::Browse(CString &result, const char *title)
void
CMakeSetupDialog
::
OnOK
()
{
// get all the info from the screen
this
->
UpdateData
();
if
(
m_WhereBuild
==
""
)
{
m_WhereBuild
=
m_WhereSource
;
}
cmMakefile
mf
;
mf
.
SetMakefileGenerator
(
new
cmMSProjectGenerator
);
mf
.
SetHomeDirectory
(
m_WhereSource
);
// Set the output directory
mf
.
SetStartOutputDirectory
(
m_WhereBuild
);
mf
.
SetHomeOutputDirectory
(
m_WhereBuild
);
// set the directory which contains the CMakeLists.txt
mf
.
SetStartDirectory
(
m_WhereSource
);
// Create the master DSW file and all children dsp files for ITK
// Set the CMakeLists.txt file
CString
makefileIn
=
m_WhereSource
;
makefileIn
+=
"/CMakeLists.txt"
;
mf
.
MakeStartDirectoriesCurrent
();
// Create a string for the cache file
cmCacheManager
::
GetInstance
()
->
LoadCache
(
&
mf
);
mf
.
ReadListFile
(
makefileIn
);
// Move this to the cache editor
mf
.
GenerateMakefile
();
cmCacheManager
::
GetInstance
()
->
SaveCache
(
&
mf
);
std
::
string
command
;
command
=
"notepad "
;
std
::
string
cachefile
=
m_WhereBuild
;
cachefile
+=
"/CMakeCache.txt"
;
command
+=
cachefile
.
c_str
();
long
int
originalMT
=
cmSystemTools
::
ModifiedTime
(
cachefile
.
c_str
());
system
(
command
.
c_str
());
long
int
afterEditMT
=
cmSystemTools
::
ModifiedTime
(
cachefile
.
c_str
());
// if the cache was changed, re-generate the project
if
(
originalMT
!=
afterEditMT
)
{
cmCacheManager
::
GetInstance
()
->
LoadCache
(
&
mf
);
mf
.
GenerateMakefile
();
cmCacheManager
::
GetInstance
()
->
SaveCache
(
&
mf
);
}
// parent class
this
->
SaveToRegistry
();
CDialog
::
OnOK
();
}
...
...
@@ -369,3 +362,86 @@ void CMakeSetupDialog::LoadFromRegistry()
}
RegCloseKey
(
hKey
);
}
void
CMakeSetupDialog
::
OnBuildProjects
()
{
::
SetCursor
(
LoadCursor
(
NULL
,
IDC_WAIT
));
// copy the GUI cache values into the cache manager
this
->
FillCacheManagerFromCacheEditor
();
// get all the info from the screen
this
->
UpdateData
();
CString
makefileIn
=
m_WhereSource
;
makefileIn
+=
"/CMakeLists.txt"
;
m_Makefile
.
ReadListFile
(
makefileIn
);
// Move this to the cache editor
m_Makefile
.
GenerateMakefile
();
cmCacheManager
::
GetInstance
()
->
SaveCache
(
&
m_Makefile
);
// update the GUI with any new values in the caused by the
// generation process
this
->
FillCacheEditorFromCacheManager
();