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
49bcc1ad
Commit
49bcc1ad
authored
Mar 20, 2002
by
Bill Hoffman
Browse files
ENH: remove fltk dialog as it is no longer supported
parent
2990c3db
Changes
13
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
49bcc1ad
...
...
@@ -29,6 +29,6 @@ SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/Source CACHE PATH
"Where to put the executables for CMake"
)
INCLUDE_REGULAR_EXPRESSION
(
"^(
\\
.
\\
./)?(cm|
FLTK|
CMake|form).*"
)
INCLUDE_REGULAR_EXPRESSION
(
"^(
\\
.
\\
./)?(cm|CMake|form).*"
)
Source/CMakeLists.txt
View file @
49bcc1ad
INCLUDE
(
${
CMake_SOURCE_DIR
}
/Modules/FindFLTK.cmake
)
IF
(
FLTK_LIBRARY
)
IF
(
FLTK_INCLUDE_PATH
)
OPTION
(
BUILD_FLTK_GUI
"Build FLTK CMake GUI."
"OFF"
)
IF
(
BUILD_FLTK_GUI
)
SUBDIRS
(
FLTKDialog
)
ENDIF
(
BUILD_FLTK_GUI
)
ENDIF
(
FLTK_INCLUDE_PATH
)
ENDIF
(
FLTK_LIBRARY
)
SOURCE_FILES
(
SRCS
cmake.cxx
cmakewizard.cxx
...
...
Source/FLTKDialog/CMakeLists.txt
deleted
100644 → 0
View file @
2990c3db
SOURCE_FILES
(
SRCS
CMakeSetupGUIImplementation.cxx
FLTKDialog.cxx
FLTKPropertyItemRow.cxx
FLTKPropertyList.cxx
)
SOURCE_FILES
(
FLTK_GUI_Files_SRCS
CMakeSetupGUI.fl
)
LINK_LIBRARIES
(
${
FLTK_LIBRARY
}
)
IF
(
WIN32
)
IF
(
NOT UNIX
)
LINK_LIBRARIES
(
wsock32
)
ENDIF
(
NOT UNIX
)
ENDIF
(
WIN32
)
IF
(
UNIX
)
INCLUDE
(
${
CMAKE_ROOT
}
/Modules/FindOpenGL.cmake
)
LINK_LIBRARIES
(
${
OPENGL_LIBRARY
}
)
ENDIF
(
UNIX
)
INCLUDE_DIRECTORIES
(
${
FLTK_INCLUDE_PATH
}
)
ADD_EXECUTABLE
(
CMakeSetup SRCS
)
FLTK_WRAP_UI
(
CMakeSetup FLTK_GUI_Files_SRCS
)
INSTALL_TARGETS
(
/bin CMakeSetup
)
IF
(
CMAKE_HAS_X
)
LINK_LIBRARIES
(
-lXt -lm
)
LINK_LIBRARIES
(
${
CMAKE_X_LIBS
}
)
ADD_DEFINITIONS
(
${
CMAKE_X_CFLAGS
}
)
ENDIF
(
CMAKE_HAS_X
)
Source/FLTKDialog/CMakeSetupGUI.fl
deleted
100644 → 0
View file @
2990c3db
# data file for the Fltk User Interface Designer (fluid)
version 1.0009
header_name {.h}
code_name {.cxx}
gridx 5
gridy 5
snap 3
class CMakeSetupGUI {open
} {
Function {CMakeSetupGUI()} {open
} {
Fl_Window dialogWindow {
label CMakeSetupDialog
callback {recentSourceDirectoriesBrowser->hide();
recentBinaryDirectoriesBrowser->hide();}
xywh {646 144 562 373} resizable visible
} {
Fl_Input sourcePathTextInput {
label {Where is the source code: }
callback {SetSourcePath( sourcePathTextInput->value() );}
xywh {219 15 200 20} labelsize 11 when 8 textsize 11
}
Fl_Button {} {
label {Browse...}
callback {BrowseForSourcePath();}
xywh {453 14 65 22} shortcut 0x80073 labelsize 11
}
Fl_Input binaryPathTextInput {
label {Where do you want to build the binaries: }
callback {SetBinaryPath( binaryPathTextInput->value() );}
xywh {219 50 200 20} labelsize 11 when 8 textsize 11
}
Fl_Button {} {
label {Browse...}
callback {BrowseForBinaryPath();}
xywh {453 49 65 22} shortcut 0x80062 labelsize 11
}
Fl_Button m_CancelButton {
label Cancel
callback {ClickOnCancel();}
xywh {390 332 100 23} shortcut 0x80071 labelsize 11
}
Fl_Button m_ConfigureButton {
label Configure
callback {ClickOnConfigure();}
xywh {105 332 100 23} shortcut 0x8006d labelsize 11
}
Fl_Group {} {
xywh {25 80 515 222} box ENGRAVED_BOX labelsize 11 align 0 resizable
} {
Fl_Scroll cacheValuesScroll {
label {Cache Values} open
xywh {40 98 485 190} type BOTH_ALWAYS box DOWN_FRAME labelsize 11 align 5 when 1 resizable
} {
Fl_Pack propertyListPack {
xywh {40 99 485 185} resizable
} {}
}
}
Fl_Box {} {
label {Right click on cache entries for additional options}
xywh {160 305 275 25} labelsize 11
}
Fl_Button {} {
label {@\#2>}
callback {ShowRecentSourceDirectories();}
xywh {420 15 22 21} labeltype SYMBOL_LABEL
}
Fl_Button {} {
label {@\#2>}
callback {ShowRecentBinaryDirectories();}
xywh {420 50 22 21} labeltype SYMBOL_LABEL
}
Fl_Browser recentSourceDirectoriesBrowser {
callback {SelectOneRecentSourceDirectory();}
xywh {15 35 535 115} type Hold box BORDER_BOX hide
}
Fl_Browser recentBinaryDirectoriesBrowser {
callback {SelectOneRecentBinaryDirectory();}
xywh {15 70 535 115} type Hold box BORDER_BOX hide
}
Fl_Button m_OKButton {
label OK
callback {ClickOnOK();} selected
xywh {250 332 100 23} shortcut 0x8006d labelsize 11
}
}
}
Function {~CMakeSetupGUI()} {} {}
Function {Close(void)} {return_type {virtual void}
} {}
Function {BrowseForSourcePath(void)} {return_type {virtual void}
} {}
Function {BrowseForBinaryPath(void)} {return_type {virtual void}
} {}
Function {Show(void)} {return_type {virtual void}
} {}
Function {SetBinaryPath(const char *)} {return_type {virtual bool}
} {}
Function {SetSourcePath(const char *)} {return_type {virtual bool}
} {}
Function {ShowRecentBinaryDirectories(void)} {return_type {virtual void}
} {}
Function {ShowRecentSourceDirectories(void)} {return_type {virtual void}
} {}
Function {SelectOneRecentBinaryDirectory(void)} {return_type {virtual void}
} {}
Function {SelectOneRecentSourceDirectory(void)} {return_type {virtual void}
} {}
Function {ClickOnConfigure(void)} {return_type {virtual void}
} {}
Function {ClickOnOK(void)} {return_type {virtual void}
} {}
Function {ClickOnCancel(void)} {return_type {virtual void}
} {}
}
Source/FLTKDialog/CMakeSetupGUIImplementation.cxx
deleted
100644 → 0
View file @
2990c3db
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Insight Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "CMakeSetupGUIImplementation.h"
#include "FL/fl_file_chooser.H"
#include "FL/filename.H"
#include "FL/fl_ask.H"
#include "../cmCacheManager.h"
#include "../cmMakefile.h"
#include <iostream>
#include "FLTKPropertyList.h"
#include "FLTKPropertyItemRow.h"
#include "FL/fl_draw.H"
#include "../cmake.h"
#include "../cmMakefileGenerator.h"
void
FLTKMessageCallback
(
const
char
*
message
,
const
char
*
title
,
bool
&
nomore
)
{
std
::
string
msg
=
message
;
msg
+=
"
\n
Press cancel to suppress any further messages."
;
int
choice
=
fl_choice
(
msg
.
c_str
(),
"Cancel"
,
"Ok"
,
0
);
if
(
choice
==
0
)
{
nomore
=
true
;
}
}
/**
* Constructor
*/
CMakeSetupGUIImplementation
::
CMakeSetupGUIImplementation
()
:
m_CacheEntriesList
(
this
)
{
cmSystemTools
::
SetErrorCallback
(
FLTKMessageCallback
);
m_BuildPathChanged
=
false
;
}
/**
* Destructor
*/
CMakeSetupGUIImplementation
::~
CMakeSetupGUIImplementation
()
{
}
/**
* Show the graphic interface
*/
void
CMakeSetupGUIImplementation
::
Show
(
void
)
{
dialogWindow
->
show
();
}
/**
* Hide the graphic interface
*/
void
CMakeSetupGUIImplementation
::
Close
(
void
)
{
SaveRecentDirectories
();
dialogWindow
->
hide
();
}
/**
* Browse for the path to the sources
*/
void
CMakeSetupGUIImplementation
::
BrowseForSourcePath
(
void
)
{
const
char
*
path
=
fl_file_chooser
(
"Path to Sources"
,
""
,
sourcePathTextInput
->
value
()
);
if
(
!
path
)
{
return
;
}
SetSourcePath
(
path
);
}
/**
* Browse for the path to the binaries
*/
void
CMakeSetupGUIImplementation
::
BrowseForBinaryPath
(
void
)
{
const
char
*
path
=
fl_file_chooser
(
"Path to Binaries"
,
""
,
binaryPathTextInput
->
value
()
);
if
(
!
path
)
{
return
;
}
SetBinaryPath
(
path
);
}
/**
* Set path to executable. Used to get the path to CMake
*/
void
CMakeSetupGUIImplementation
::
SetPathToExecutable
(
const
char
*
path
)
{
char
expandedPath
[
1024
];
filename_expand
(
expandedPath
,
path
);
char
absolutePath
[
1024
];
filename_absolute
(
absolutePath
,
expandedPath
);
char
*
p
=
absolutePath
+
strlen
(
absolutePath
);
while
(
*
p
!=
'/'
&&
*
p
!=
'\\'
)
{
p
--
;
}
p
--
;
while
(
*
p
!=
'/'
&&
*
p
!=
'\\'
)
{
p
--
;
}
*
p
=
'\0'
;
m_PathToExecutable
=
absolutePath
;
#if defined(_WIN32)
m_PathToExecutable
+=
"/Debug/CMake.exe"
;
#else
m_PathToExecutable
+=
"/cmake"
;
#endif
}
/**
* Set the source path
*/
bool
CMakeSetupGUIImplementation
::
SetSourcePath
(
const
char
*
path
)
{
if
(
!
path
||
strlen
(
path
)
==
0
)
{
fl_alert
(
"Please select the path to the sources"
);
return
false
;
}
std
::
string
expandedAbsolutePath
=
ExpandPathAndMakeItAbsolute
(
path
);
sourcePathTextInput
->
value
(
expandedAbsolutePath
.
c_str
()
);
if
(
VerifySourcePath
(
expandedAbsolutePath
)
)
{
m_WhereSource
=
expandedAbsolutePath
;
return
true
;
}
return
false
;
}
/**
* Expand environment variables in the path and make it absolute
*/
std
::
string
CMakeSetupGUIImplementation
::
ExpandPathAndMakeItAbsolute
(
const
std
::
string
&
inputPath
)
const
{
char
expandedPath
[
3000
];
filename_expand
(
expandedPath
,
inputPath
.
c_str
()
);
char
absolutePath
[
3000
];
filename_absolute
(
absolutePath
,
expandedPath
);
std
::
string
expandedAbsolutePath
=
absolutePath
;
return
expandedAbsolutePath
;
}
/**
* Set the binary path
*/
bool
CMakeSetupGUIImplementation
::
SetBinaryPath
(
const
char
*
path
)
{
if
(
!
path
||
strlen
(
path
)
==
0
)
{
fl_alert
(
"Please select the path to the binaries"
);
return
false
;
}
std
::
string
expandedAbsolutePath
=
ExpandPathAndMakeItAbsolute
(
path
);
binaryPathTextInput
->
value
(
expandedAbsolutePath
.
c_str
()
);
if
(
!
VerifyBinaryPath
(
expandedAbsolutePath
.
c_str
()
)
)
{
return
false
;
}
if
(
m_WhereBuild
!=
expandedAbsolutePath
)
{
m_BuildPathChanged
=
true
;
m_WhereBuild
=
expandedAbsolutePath
;
m_CacheEntriesList
.
RemoveAll
();
// remove data from other project
this
->
LoadCacheFromDiskToGUI
();
}
else
{
m_BuildPathChanged
=
false
;
}
return
true
;
}
/**
* Verify the path to binaries
*/
bool
CMakeSetupGUIImplementation
::
VerifyBinaryPath
(
const
std
::
string
&
path
)
const
{
bool
pathIsOK
=
false
;
if
(
filename_isdir
(
path
.
c_str
()
)
)
{
pathIsOK
=
true
;
}
else
{
int
userWantsToCreateDirectory
=
fl_ask
(
"The directory
\n
%s
\n
Doesn't exist. Do you want to create it ?"
,
path
.
c_str
()
);
if
(
userWantsToCreateDirectory
)
{
std
::
string
command
=
"mkdir "
;
command
+=
path
;
system
(
command
.
c_str
()
);
pathIsOK
=
true
;
}
else
{
pathIsOK
=
false
;
}
}
return
pathIsOK
;
}
/**
* Verify the path to sources
*/
bool
CMakeSetupGUIImplementation
::
VerifySourcePath
(
const
std
::
string
&
path
)
const
{
if
(
!
filename_isdir
(
path
.
c_str
()
)
)
{
fl_alert
(
"The Source directory
\n
%s
\n
Doesn't exist or is not a directory"
,
path
.
c_str
()
);
return
false
;
}
return
true
;
}
/**
* Build the project files
*/
void
CMakeSetupGUIImplementation
::
RunCMake
(
bool
generateProjectFiles
)
{
if
(
!
cmSystemTools
::
FileExists
(
m_WhereBuild
.
c_str
()
))
{
std
::
string
message
=
"Build directory does not exist, should I create it?
\n\n
"
"Directory: "
;
message
+=
m_WhereBuild
;
int
userWantToCreateDirectory
=
fl_ask
(
message
.
c_str
());
if
(
userWantToCreateDirectory
)
{
cmSystemTools
::
MakeDirectory
(
m_WhereBuild
.
c_str
()
);
}
else
{
fl_alert
(
"Build Project aborted, nothing done."
);
return
;
}
}
// set the wait cursor
fl_cursor
(
FL_CURSOR_WAIT
,
FL_BLACK
,
FL_WHITE
);
// save the current GUI values to the cache
this
->
SaveCacheFromGUI
();
// Make sure we are working from the cache on disk
this
->
LoadCacheFromDiskToGUI
();
UpdateListOfRecentDirectories
();
SaveRecentDirectories
();
// create a cmake object
cmake
make
;
// create the arguments for the cmake object
std
::
vector
<
std
::
string
>
args
;
args
.
push_back
(
m_PathToExecutable
.
c_str
()
);
std
::
string
arg
;
arg
=
"-H"
;
arg
+=
m_WhereSource
;
args
.
push_back
(
arg
);
arg
=
"-B"
;
arg
+=
m_WhereBuild
;
args
.
push_back
(
arg
);
arg
=
"-G"
;
m_GeneratorChoiceString
=
"Unix Makefiles"
;
arg
+=
m_GeneratorChoiceString
;
args
.
push_back
(
arg
);
// run the generate process
if
(
make
.
Generate
(
args
,
generateProjectFiles
)
!=
0
)
{
cmSystemTools
::
Error
(
"Error in generation process, project files may be invalid"
);
cmSystemTools
::
ResetErrorOccuredFlag
();
}
// update the GUI with any new values in the caused by the
// generation process
this
->
LoadCacheFromDiskToGUI
();
// path is up-to-date now
m_BuildPathChanged
=
false
;
// put the cursor back
fl_cursor
(
FL_CURSOR_DEFAULT
,
FL_BLACK
,
FL_WHITE
);
fl_message
(
"Done !"
);
}
/**
* Load Cache from disk to GUI
*/
void
CMakeSetupGUIImplementation
::
LoadCacheFromDiskToGUI
(
void
)
{
if
(
m_WhereBuild
!=
""
)
{
cmCacheManager
::
GetInstance
()
->
LoadCache
(
m_WhereBuild
.
c_str
()
);
this
->
FillCacheGUIFromCacheManager
();
}
}
/**
* Save Cache from disk to GUI
*/
void
CMakeSetupGUIImplementation
::
SaveCacheFromGUI
(
void
)
{
this
->
FillCacheManagerFromCacheGUI
();
if
(
m_WhereBuild
!=
""
)
{
cmCacheManager
::
GetInstance
()
->
SaveCache
(
m_WhereBuild
.
c_str
()
);