Restore support for both Qt4 & Qt5.

* Change: In bootstrap, in ccb & builder, build by default with Qt4 and
    provide a --qt5 command line switch to enable Qt5.
      FindBootstrap.cmake now provides a qtX_wrap_cpp() macros to be
    independant of the version of Qt being used.
      Add all thoses options to the graphical interface to the builder.
* Change: In all the tools using Qt, switch to the qtX_*() macros from
    FindBootstrap.cmake.
* Change: In Hurricane, in CellViewer, revert to the Qt4 way of connecting
    signal/slots for backward compatibility.
This commit is contained in:
Jean-Paul Chaput 2014-07-22 11:06:26 +02:00
parent 25e82fc701
commit 520b9ae382
20 changed files with 141 additions and 103 deletions

View File

@ -54,7 +54,7 @@ class AboutWidget ( QWidget ):
subTitle.setFont( QFont('Courier',10,QFont.Bold) )
authors = QLabel( 'Coriolis CAD System 1.0 . . . . . . . . ccb 1.0\n'
'Copyright (c) 2008-2013 . . . . . . . . . . UPMC\n'
'Copyright (c) 2008-2014 . . . . . . . . . . UPMC\n'
'Authors . . . . . . . . . . . . . Damien Dupuis\n'
' . . . . . . . . . . . . Jean-Paul Chaput\n'
'E-Mail . . . . . . . . Jean-Paul.Chaput@lip6.fr'

View File

@ -35,6 +35,7 @@ class Builder:
self._noCache = False
self._ninja = False
self._devtoolset2 = False
self._qt5 = False
self._enableShared = "ON"
self._enableDoc = "OFF"
self._checkDatabase = "OFF"
@ -58,6 +59,7 @@ class Builder:
elif attribute == "noCache": self._noCache = value
elif attribute == "ninja": self._ninja = value
elif attribute == "devtoolset2": self._devtoolset2 = value
elif attribute == "qt5": self._qt5 = value
elif attribute == "enableDoc": self._enableDoc = value
elif attribute == "enableShared": self._enableShared = value
elif attribute == "checkDatabase": self._checkDatabase = value
@ -170,6 +172,7 @@ class Builder:
command = [ 'cmake' ]
if self._ninja: command += [ "-G", "Ninja" ]
if self._devtoolset2: command += [ "-D", "Boost_NO_SYSTEM_PATHS:STRING=TRUE" ]
if self._qt5: command += [ "-D", "WITH_QT5:STRING=TRUE" ]
command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode
, "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared

View File

@ -142,6 +142,8 @@ class CompileWidget ( QWidget ):
#if self.options.svnUpdate: command += [ '--svn-update' ]
#if self.options.svnStatus: command += [ '--svn-update' ]
if self.options.enableDoc: command += [ '--doc' ]
if self.options.devtoolset2: command += [ '--devtoolset-2' ]
if self.options.qt5: command += [ '--qt5' ]
if self.options.noCache: command += [ '--no-cache' ]
if self.options.rmBuild: command += [ '--rm-build' ]
if self.options.verbose: command += [ '--verbose' ]

View File

@ -65,6 +65,8 @@ class OptionsWidget ( QWidget ):
#self._svnStatus = QCheckBox( 'SVN Status' )
self._make = QCheckBox( 'Build' )
self._enableDoc = QCheckBox( 'Build Documentation' )
self._devtoolset2 = QCheckBox( 'Build with devtoolset 2' )
self._qt5 = QCheckBox( 'Build with Qt 5 (Qt 4 default)' )
self._noCache = QCheckBox( 'Remove previous CMake cache' )
self._rmBuild = QCheckBox( 'Cleanup Build Directory' )
self._verbose = QCheckBox( 'Display Compiler Commands' )
@ -89,6 +91,8 @@ class OptionsWidget ( QWidget ):
vLayout = QVBoxLayout()
vLayout.addWidget( self._buildMode )
vLayout.addWidget( self._enableDoc )
vLayout.addWidget( self._devtoolset2 )
vLayout.addWidget( self._qt5 )
vLayout.addWidget( self._noCache )
vLayout.addWidget( self._rmBuild )
vLayout.addStretch()
@ -126,6 +130,8 @@ class OptionsWidget ( QWidget ):
#def _getSvnStatus ( self ): return self._svnStatus.isChecked()
def _getMake ( self ): return self._make.isChecked()
def _getEnableDoc ( self ): return self._enableDoc.isChecked()
def _getDevtoolset2 ( self ): return self._devtoolset2.isChecked()
def _getQt5 ( self ): return self._qt5.isChecked()
def _getNoCache ( self ): return self._noCache.isChecked()
def _getRmBuild ( self ): return self._rmBuild.isChecked()
def _getVerbose ( self ): return self._verbose.isChecked()
@ -137,6 +143,8 @@ class OptionsWidget ( QWidget ):
#svnStatus = property( _getSvnStatus )
make = property( _getMake )
enableDoc = property( _getEnableDoc )
devtoolset2 = property( _getDevtoolset2 )
qt5 = property( _getQt5 )
noCache = property( _getNoCache )
rmBuild = property( _getRmBuild )
verbose = property( _getVerbose )
@ -144,10 +152,12 @@ class OptionsWidget ( QWidget ):
def readSettings ( self ):
settings = QSettings()
#self._svnUpdate.setChecked( settings.value('builder/svnUpdate').toBool() )
#self._svnStatus.setChecked( settings.value('builder/svnStatus').toBool() )
#self._svnUpdate .setChecked( settings.value('builder/svnUpdate').toBool() )
#self._svnStatus .setChecked( settings.value('builder/svnStatus').toBool() )
self._make .setChecked( settings.value('builder/make' ).toBool() )
self._enableDoc.setChecked( settings.value('builder/enableDoc').toBool() )
self._enableDoc .setChecked( settings.value('builder/enableDoc').toBool() )
self._devtoolset2.setChecked( settings.value('builder/devtoolset2').toBool() )
self._qt5 .setChecked( settings.value('builder/qt5').toBool() )
self._noCache .setChecked( settings.value('builder/noCache' ).toBool() )
self._rmBuild .setChecked( settings.value('builder/rmBuild' ).toBool() )
self._verbose .setChecked( settings.value('builder/verbose' ).toBool() )
@ -166,11 +176,13 @@ class OptionsWidget ( QWidget ):
def saveSettings ( self ):
settings = QSettings()
#settings.setValue('builder/svnUpdate', self._svnUpdate.isChecked() )
#settings.setValue('builder/svnStatus', self._svnStatus.isChecked() )
#settings.setValue('builder/svnUpdate' , self._svnUpdate .isChecked() )
#settings.setValue('builder/svnStatus' , self._svnStatus .isChecked() )
settings.setValue('builder/make' , self._make .isChecked() )
settings.setValue('builder/enableDoc', self._enableDoc.isChecked() )
settings.setValue('builder/buildMode', self._buildMode.currentText() )
settings.setValue('builder/enableDoc' , self._enableDoc .isChecked() )
settings.setValue('builder/devtoolset2', self._devtoolset2.isChecked() )
settings.setValue('builder/qt5' , self._qt5 .isChecked() )
settings.setValue('builder/buildMode' , self._buildMode .currentText() )
settings.setValue('builder/noCache' , self._noCache .isChecked() )
settings.setValue('builder/rmBuild' , self._rmBuild .isChecked() )
settings.setValue('builder/verbose' , self._verbose .isChecked() )

View File

@ -184,6 +184,7 @@ parser.add_option ( "--no-build" , action="store_true" ,
parser.add_option ( "--no-cache" , action="store_true" , dest="noCache" , help="Remove previous CMake cache before building." )
parser.add_option ( "--rm-build" , action="store_true" , dest="rmBuild" , help="Remove previous build directoty before building." )
parser.add_option ( "--devtoolset-2", action="store_true" , dest="devtoolset2" , help="Build against TUV Dev Toolset 2." )
parser.add_option ( "--qt5" , action="store_true" , dest="qt5" , help="Build against Qt 5 (default: Qt 4)." )
parser.add_option ( "--ninja" , action="store_true" , dest="ninja" , help="Use Ninja instead of UNIX Makefile." )
parser.add_option ( "--make" , action="store" , type="string", dest="makeArguments", help="Arguments to pass to make (ex: \"-j4 install\")." )
parser.add_option ( "--project" , action="append" , type="string", dest="projects" , help="The name of a project to build (may appears any number of time)." )
@ -257,6 +258,7 @@ else:
if options.rmBuild: builder.rmBuild = True
if options.ninja: builder.ninja = True
if options.devtoolset2: builder.devtoolset2 = True
if options.qt5: builder.qt5 = True
if options.makeArguments: builder.makeArguments = options.makeArguments
#if options.svnMethod: builder.svnMethod = options.svnMethod
#if options.svnTag: builder.svnTag = options.svnTag

View File

@ -206,10 +206,7 @@
# Find Qt, the union of all the modules we need for the whole project.
#
macro(setup_qt)
# For Qt4.
#set(QT_USE_QTXML "true")
#find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
if(WITH_QT5)
# For Qt5
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
@ -224,6 +221,29 @@
${Qt5Widgets_LIBRARIES}
${Qt5Gui_LIBRARIES}
${Qt5Core_LIBRARIES} )
else()
# For Qt4.
#set(QT_USE_QTXML "true")
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
set(QtX_LIBRARIES ${QT_LIBRARIES})
endif()
endmacro()
macro(qtX_wrap_cpp variable)
if (WITH_QT5)
qt5_wrap_cpp(${variable} ${ARGN})
else()
qt4_wrap_cpp(${variable} ${ARGN})
endif()
endmacro()
macro(qtX_add_resources variable)
if (WITH_QT5)
qt5_add_resources(${variable} ${ARGN})
else()
qt4_add_resources(${variable} ${ARGN})
endif()
endmacro()

View File

@ -277,7 +277,7 @@
set_source_files_properties ( ${AcmSigdaParserGrammarCpp} GENERATED )
qt5_wrap_cpp ( moc_cpps ${mocincludes} )
qtX_wrap_cpp ( moc_cpps ${mocincludes} )
add_library ( crlcore ${ccore_cpps}
${moc_cpps}

View File

@ -17,11 +17,11 @@
CyclopMain.cpp
)
qt5_wrap_cpp ( MOCcpps ${mocincludes} )
qtX_wrap_cpp ( mocCpps ${mocincludes} )
link_directories ( ${CRLCORE_BINARY_DIR}/src/ccore )
add_executable ( cyclop ${cpps} )
add_executable ( cyclop ${cpps} ${mocCpps} )
target_link_libraries ( cyclop crlcore
${HURRICANE_PYTHON_LIBRARIES}
${HURRICANE_GRAPHICAL_LIBRARIES}

View File

@ -36,7 +36,7 @@
set ( intervalTreeIncludes intervalTree/src/equinox/Interval.h
intervalTree/src/equinox/IntervalTree.h )
set ( intervalTreeCpps intervalTree/src/IntervalTree.cpp )
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( intervalTree ${intervalTreeCpps} )
set_target_properties ( intervalTree PROPERTIES VERSION 1.0 SOVERSION 1 )

View File

@ -72,7 +72,7 @@
PyGraphicEtesianEngine.cpp
)
# set ( etesiancpps EtesianMain.cpp )
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( etesian ${cpps} ${mocCpps} ${pyCpps} )
set_target_properties ( etesian PROPERTIES VERSION 1.0 SOVERSION 1 )

View File

@ -121,8 +121,8 @@
set ( sources2 Script.cpp )
set ( includes2 hurricane/viewer/Script.h )
qt5_wrap_cpp ( MOC_SRCS ${mocincludes} )
qt5_add_resources ( RCC_SRCS CellViewer.qrc )
qtX_wrap_cpp ( MOC_SRCS ${mocincludes} )
qtX_add_resources ( RCC_SRCS CellViewer.qrc )
add_library ( viewer ${cpps} ${MOC_SRCS} ${RCC_SRCS} ${sources2} ${pycpps} )
set_target_properties ( viewer PROPERTIES VERSION 1.0 SOVERSION 1 )

View File

@ -357,7 +357,7 @@ namespace Hurricane {
);
action->setVisible( false );
addAction( action );
connect( action, &QAction::triggered, this, &CellViewer::raiseToolInterrupt );
connect( action, SIGNAL(triggered()), this, SLOT(raiseToolInterrupt()) );
action = addToMenu( "file.openCell"
, tr("&Open Cell")
@ -376,7 +376,7 @@ namespace Hurricane {
_cellHistoryAction[i]->setVisible( false );
_cellHistoryAction[i]->setData ( i );
_cellHistoryAction[i]->setFont ( Graphics::getFixedFont(QFont::Bold,false,false) );
connect( _cellHistoryAction[i], &QAction::triggered, this, &CellViewer::openHistoryCell );
connect( _cellHistoryAction[i], SIGNAL(triggered()), this, SLOT(openHistoryCell()) );
}
addToMenu( "file.========" );
@ -406,14 +406,14 @@ namespace Hurricane {
, tr("Print the displayed area")
, QKeySequence(tr("CTRL+P"))
);
connect( action, &QAction::triggered, this, &CellViewer::printDisplay );
connect( action, SIGNAL(triggered()), this, SLOT(printDisplay()) );
action = addToMenu( "file.image"
, tr("Save to &Image")
, tr("Save the displayed area to image")
, QKeySequence()
);
connect( action, &QAction::triggered, this, &CellViewer::imageDisplay );
connect( action, SIGNAL(triggered()), this, SLOT(imageDisplay()) );
action = addToMenu( "file.nextBreakpoint"
, tr("&Next Breakpoint")
@ -427,7 +427,7 @@ namespace Hurricane {
, tr("Close This Coriolis CellViewer")
, QKeySequence(tr("CTRL+W"))
);
connect( action, &QAction::triggered, this, &CellViewer::close );
connect( action, SIGNAL(triggered()), this, SLOT(close()) );
action = addToMenu( "file.close"
, tr("&Close")
@ -440,7 +440,7 @@ namespace Hurricane {
, tr("Exit All Coriolis CellViewer")
, QKeySequence(tr("CTRL+Q"))
);
connect ( action, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) );
connect( action, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) );
// Building the "View" menu.
action = addToMenu( "view.refresh"
@ -448,21 +448,21 @@ namespace Hurricane {
, tr("Force full redrawing of the display")
, QKeySequence(tr("CTRL+L"))
);
connect( action, &QAction::triggered, _cellWidget, &CellWidget::refresh );
connect( action, SIGNAL(triggered()), _cellWidget, SLOT(refresh()) );
action = addToMenu( "view.fit"
, tr("&Fit to Contents")
, tr("Adjust zoom to fit the whole cell's contents")
, Qt::Key_F
);
connect( action, &QAction::triggered, _cellWidget, &CellWidget::fitToContents );
connect( action, SIGNAL(triggered()), _cellWidget, SLOT(fitToContents()) );
action = addToMenu( "view.goto"
, tr("&Goto")
, tr("Center view on that point, with zoom adjustment")
, Qt::Key_G
);
connect( action, &QAction::triggered, this, &CellViewer::doGoto );
connect( action, SIGNAL(triggered()), this, SLOT(doGoto()) );
_showSelectionAction = addToMenu( "view.showSelection"
, tr("&Show Selection")
@ -470,21 +470,21 @@ namespace Hurricane {
, Qt::Key_S
);
_showSelectionAction->setCheckable( true );
connect( _showSelectionAction, &QAction::toggled, this, &CellViewer::setShowSelection );
connect( _showSelectionAction, SIGNAL(toggled()), this, SLOT(setShowSelection()) );
action = addToMenu( "view.changeRubber"
, tr("Change Rubber Style")
, tr("Cycle through all avalaibles rubber drawing styles")
, Qt::Key_Asterisk
);
connect( action, &QAction::triggered, _cellWidget, &CellWidget::rubberChange );
connect( action, SIGNAL(triggered()), _cellWidget, SLOT(rubberChange()) );
action = addToMenu( "view.clearRulers"
, tr("Clear Rulers")
, tr("Remove all rulers")
, QKeySequence()
);
connect( action, &QAction::triggered, _cellWidget, &CellWidget::clearRulers );
connect( action, SIGNAL(triggered()), _cellWidget, SLOT(clearRulers()) );
// Building the "Tools" menu.
action = addToMenu( "tools.controller"
@ -493,7 +493,7 @@ namespace Hurricane {
, QKeySequence(tr("CTRL+I"))
, QIcon(":/images/swiss-knife.png")
);
connect( action, &QAction::triggered, _controller, &ControllerWidget::toggleShow );
connect( action, SIGNAL(triggered()), _controller, SLOT(toggleShow()) );
action = addToMenu( "tools.script"
, tr("Python Script")
@ -501,7 +501,7 @@ namespace Hurricane {
, QKeySequence(tr("SHIFT+P,SHIFT+S"))
, QIcon(":/images/python-logo-v3.png")
);
connect( action, &QAction::triggered, this, &CellViewer::runScriptWidget );
connect( action, SIGNAL(triggered()), this, SLOT(runScriptWidget()) );
}

View File

@ -62,7 +62,7 @@ endif ( CHECK_DETERMINISM )
#GraphicKatabaticEngine.cpp
)
set ( pyCpps PyKatabatic.cpp )
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( katabatic ${cpps} )

View File

@ -71,7 +71,7 @@
PyGraphicKiteEngine.cpp
)
set ( kitecpps KiteMain.cpp )
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( kite ${cpps} ${mocCpps} ${pyCpps} )

View File

@ -41,7 +41,7 @@
)
set ( fluteIncludes flute-2.4/src/knik/flute.h )
set ( fluteCpps flute-2.4/src/flute.cpp )
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( flute ${fluteCpps} )

View File

@ -45,7 +45,7 @@
PyMaukaEngine.cpp
PyGraphicMaukaEngine.cpp
)
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( mauka ${cpps} ${mocCpps} ${pyCpps} )

View File

@ -186,7 +186,7 @@ namespace Mauka {
_viewer->clearToolInterrupt();
_viewer->getCellWidget()->fitToContents();
_viewer->redrawCellWidget();
//_viewer->redrawCellWidget();
}
@ -199,7 +199,7 @@ namespace Mauka {
_viewer->getCellWidget()->fitToContents ();
mauka->Run ();
_viewer->redrawCellWidget();
//_viewer->redrawCellWidget();
}
@ -222,7 +222,7 @@ namespace Mauka {
MaukaEngine* mauka = getForFramework( NoFlags );
_viewer->clearToolInterrupt ();
_viewer->redrawCellWidget();
//_viewer->redrawCellWidget();
mauka->Save ();
}

View File

@ -37,7 +37,7 @@
)
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
add_library ( solstice ${cpps} ${mocCpps} )
set_target_properties ( solstice PROPERTIES VERSION 1.0 SOVERSION 1 )

View File

@ -34,10 +34,10 @@
)
set ( cgtcpp CgtMain.cpp )
qt5_wrap_cpp ( MOCcpps ${mocincludes} )
qt5_add_resources ( RCC_SRCS Unicorn.qrc )
qtX_wrap_cpp ( mocCpps ${mocincludes} )
qtX_add_resources ( RCC_SRCS Unicorn.qrc )
add_library ( unicorn ${cpps} ${MOCcpps} ${pyCpps} )
add_library ( unicorn ${cpps} ${mocCpps} ${pyCpps} )
set_target_properties ( unicorn PROPERTIES VERSION 1.0 SOVERSION 1 )
target_link_libraries ( unicorn ${SOLSTICE_GRAPHICAL_LIBRARIES}
${SOLSTICE_LIBRARIES}

View File

@ -1,6 +1,5 @@
# include ( ${QT_USE_FILE} )
include_directories ( ${VLSISAPD_SOURCE_DIR}/src/utilities/src
${VLSISAPD_SOURCE_DIR}/src/configuration/src
${VLSISAPD_SOURCE_DIR}/src/openChams/src
@ -37,8 +36,8 @@
set ( pycpps PyConfiguration.cpp )
set ( editorcpp ConfEditorMain.cpp )
qt5_wrap_cpp ( mocCpps ${mocIncludes} )
qt5_add_resources ( RCC_SRCS Configuration.qrc )
qtX_wrap_cpp ( mocCpps ${mocIncludes} )
qtX_add_resources ( RCC_SRCS Configuration.qrc )
add_library ( configuration ${cpps} ${mocCpps} ${RCC_SRCS} )
set_target_properties ( configuration PROPERTIES VERSION 1.0 SOVERSION 1 )