From 9cfa10483670a250de215322e0c2799b2d59277e Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 13 Mar 2023 17:37:19 +0100 Subject: [PATCH] Build against Qt5 by default. Uses --qt4 to force uses of Qt4. * Change: In bootstrap, FindBootstrap.cmake, ccb (builder) & socInstaller, suppress the "--qt5" argument as it the default now. Create a "--qt4" to force building against the old one. --- bootstrap/builder/Builder.py | 6 +-- bootstrap/builder/CompileWidget.py | 4 +- bootstrap/builder/OptionsWidget.py | 12 ++--- bootstrap/ccb.py | 6 +-- bootstrap/cmake_modules/FindBootstrap.cmake | 52 ++++++++++----------- bootstrap/socInstaller.py | 7 ++- 6 files changed, 43 insertions(+), 44 deletions(-) diff --git a/bootstrap/builder/Builder.py b/bootstrap/builder/Builder.py index 7cabbadb..68a29c7d 100644 --- a/bootstrap/builder/Builder.py +++ b/bootstrap/builder/Builder.py @@ -40,7 +40,7 @@ class Builder: self._devtoolset = 0 self._llvmtoolset = 0 self._bfd = "OFF" - self._qt5 = False + self._qt4 = False self._openmp = False self._enableShared = "ON" self._enableDoc = "OFF" @@ -71,7 +71,7 @@ class Builder: elif attribute == "llvmtoolset": self._llvmtoolset = value elif attribute == "bfd": self._bfd = value - elif attribute == "qt5": self._qt5 = value + elif attribute == "qt4": self._qt4 = value elif attribute == "openmp": self._openmp = value elif attribute == "enableDoc": self._enableDoc = value elif attribute == "enableShared": self._enableShared = value @@ -175,7 +175,7 @@ class Builder: #, "-D", "BOOST_LIBRARYDIR:STRING=/usr/lib64/boost169" ] if self._bfd: command += [ "-D", "USE_LIBBFD:STRING=%s" % self._bfd ] - if self._qt5: command += [ "-D", "WITH_QT5:STRING=TRUE" ] + if self._qt4: command += [ "-D", "WITH_QT4:STRING=TRUE" ] if self._openmp: command += [ "-D", "WITH_OPENMP:STRING=TRUE" ] command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode #, "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared diff --git a/bootstrap/builder/CompileWidget.py b/bootstrap/builder/CompileWidget.py index e442bc7d..ba821e36 100644 --- a/bootstrap/builder/CompileWidget.py +++ b/bootstrap/builder/CompileWidget.py @@ -2,7 +2,7 @@ # -*- mode:Python -*- # # This file is part of the Coriolis Software. -# Copyright (c) Sorbonne Université 2012-2021, All Rights Reserved +# Copyright (c) Sorbonne Université 2012-2023, All Rights Reserved # # +-----------------------------------------------------------------+ # | C O R I O L I S | @@ -122,7 +122,7 @@ class CompileWidget ( QWidget ): #if self.options.svnStatus: command += [ '--svn-update' ] if self.options.enableDoc: command += [ '--doc' ] if self.options.devtoolset: command += [ '--devtoolset-8' ] - if self.options.qt5: command += [ '--qt5' ] + if self.options.qt4: command += [ '--qt4' ] if self.options.noCache: command += [ '--no-cache' ] if self.options.rmBuild: command += [ '--rm-build' ] if self.options.verbose: command += [ '--verbose' ] diff --git a/bootstrap/builder/OptionsWidget.py b/bootstrap/builder/OptionsWidget.py index 6f91e28c..05d43522 100644 --- a/bootstrap/builder/OptionsWidget.py +++ b/bootstrap/builder/OptionsWidget.py @@ -57,7 +57,7 @@ class OptionsWidget ( QWidget ): self._make = QCheckBox( 'Build' ) self._enableDoc = QCheckBox( 'Build Documentation' ) self._devtoolset = QCheckBox( 'Build with devtoolset 8' ) - self._qt5 = QCheckBox( 'Build with Qt 5 (Qt 4 default)' ) + self._qt4 = QCheckBox( 'Build with Qt 4 (Qt 5 default)' ) self._noCache = QCheckBox( 'Remove previous CMake cache' ) self._rmBuild = QCheckBox( 'Cleanup Build Directory' ) self._verbose = QCheckBox( 'Display Compiler Commands' ) @@ -83,7 +83,7 @@ class OptionsWidget ( QWidget ): vLayout.addWidget( self._buildMode ) vLayout.addWidget( self._enableDoc ) vLayout.addWidget( self._devtoolset ) - vLayout.addWidget( self._qt5 ) + vLayout.addWidget( self._qt4 ) vLayout.addWidget( self._noCache ) vLayout.addWidget( self._rmBuild ) vLayout.addStretch() @@ -121,7 +121,7 @@ class OptionsWidget ( QWidget ): def _getMake ( self ): return self._make.isChecked() def _getEnableDoc ( self ): return self._enableDoc.isChecked() def _getDevtoolset ( self ): return self._devtoolset.isChecked() - def _getQt5 ( self ): return self._qt5.isChecked() + def _getQt4 ( self ): return self._qt4.isChecked() def _getNoCache ( self ): return self._noCache.isChecked() def _getRmBuild ( self ): return self._rmBuild.isChecked() def _getVerbose ( self ): return self._verbose.isChecked() @@ -134,7 +134,7 @@ class OptionsWidget ( QWidget ): make = property( _getMake ) enableDoc = property( _getEnableDoc ) devtoolset = property( _getDevtoolset ) - qt5 = property( _getQt5 ) + qt4 = property( _getQt4 ) noCache = property( _getNoCache ) rmBuild = property( _getRmBuild ) verbose = property( _getVerbose ) @@ -146,7 +146,7 @@ class OptionsWidget ( QWidget ): self._make .setChecked( bool(settings.value('builder/make' )) ) self._enableDoc .setChecked( bool(settings.value('builder/enableDoc' )) ) self._devtoolset .setChecked( bool(settings.value('builder/devtoolset')) ) - self._qt5 .setChecked( bool(settings.value('builder/qt5' )) ) + self._qt4 .setChecked( bool(settings.value('builder/qt4' )) ) self._noCache .setChecked( bool(settings.value('builder/noCache' )) ) self._rmBuild .setChecked( bool(settings.value('builder/rmBuild' )) ) self._verbose .setChecked( bool(settings.value('builder/verbose' )) ) @@ -169,7 +169,7 @@ class OptionsWidget ( QWidget ): settings.setValue('builder/make' , self._make .isChecked() ) settings.setValue('builder/enableDoc' , self._enableDoc .isChecked() ) settings.setValue('builder/devtoolset', self._devtoolset.isChecked() ) - settings.setValue('builder/qt5' , self._qt5 .isChecked() ) + settings.setValue('builder/qt4' , self._qt4 .isChecked() ) settings.setValue('builder/buildMode' , self._buildMode .currentText() ) settings.setValue('builder/noCache' , self._noCache .isChecked() ) settings.setValue('builder/rmBuild' , self._rmBuild .isChecked() ) diff --git a/bootstrap/ccb.py b/bootstrap/ccb.py index 96bfd663..1e454757 100755 --- a/bootstrap/ccb.py +++ b/bootstrap/ccb.py @@ -206,8 +206,8 @@ parser.add_option ( "--rm-build" , action="store_true" , parser.add_option ( "--macports" , action="store_true" , dest="macports" , help="Build against MacPorts." ) parser.add_option ( "--devtoolset" , action="store" , type="int" , dest="devtoolset" , help="Build against TUV Dev Toolset N." ) parser.add_option ( "--llvm-toolset" , action="store" , type="int" , dest="llvmtoolset" , help="Build against TUV Dev LLVM Toolset N." ) -parser.add_option ( "--qt5" , action="store_true" , dest="qt5" , help="Build against Qt 5 (default: Qt 4)." ) -parser.add_option ( "--bfd" , action="store_true" , dest="bfd" , help="Build against Qt 5 (default: Qt 4)." ) +parser.add_option ( "--qt4" , action="store_true" , dest="qt4" , help="Build against Qt 4 (default: Qt 5)." ) +parser.add_option ( "--bfd" , action="store_true" , dest="bfd" , help="Link against BFD to enable stack trace display." ) parser.add_option ( "--openmp" , action="store_true" , dest="openmp" , help="Enable the use of OpenMP in Gcc." ) parser.add_option ( "--ninja" , action="store_true" , dest="ninja" , help="Use Ninja instead of UNIX Makefile." ) parser.add_option ( "--clang" , action="store_true" , dest="clang" , help="Force use of Clang C/C++ compiler instead of system default." ) @@ -281,7 +281,7 @@ else: if options.devtoolset: builder.devtoolset = options.devtoolset if options.llvmtoolset: builder.llvmtoolset = options.llvmtoolset if options.bfd: builder.bfd = "ON" - if options.qt5: builder.qt5 = True + if options.qt4: builder.qt4 = True if options.openmp: builder.openmp = True if options.makeArguments: builder.makeArguments = options.makeArguments #if options.svnMethod: builder.svnMethod = options.svnMethod diff --git a/bootstrap/cmake_modules/FindBootstrap.cmake b/bootstrap/cmake_modules/FindBootstrap.cmake index 494c463d..0fb7e836 100644 --- a/bootstrap/cmake_modules/FindBootstrap.cmake +++ b/bootstrap/cmake_modules/FindBootstrap.cmake @@ -227,7 +227,17 @@ endif() # Find Qt, the union of all the modules we need for the whole project. # macro(setup_qt) - if(WITH_QT5) + if(WITH_QT4) + message(STATUS "Attempt to find Qt 4...") + # For Qt4. + #set(QT_USE_QTXML "true") + set(QT_USE_QTSVG "true") + find_package(Qt4 REQUIRED) + include(${QT_USE_FILE}) + # ${QT_QTSVG_LIBRARY} + set(QtX_INCLUDE_DIRS ${QT_INCLUDE_DIR}) + set(QtX_LIBRARIES ${QT_LIBRARIES}) + else() message(STATUS "Attempt to find Qt 5...") # For Qt5 find_package(Qt5Core REQUIRED) @@ -247,32 +257,22 @@ endif() ${Qt5Core_LIBRARIES} ) #message(STATUS "QtX_INCLUDE_DIRS: ${QtX_INCLUDE_DIRS}") #message(STATUS "QtX_LIBRARIES: ${QtX_LIBRARIES}") - else() - message(STATUS "Attempt to find Qt 4...") - # For Qt4. - #set(QT_USE_QTXML "true") - set(QT_USE_QTSVG "true") - find_package(Qt4 REQUIRED) - include(${QT_USE_FILE}) - # ${QT_QTSVG_LIBRARY} - set(QtX_INCLUDE_DIRS ${QT_INCLUDE_DIR}) - set(QtX_LIBRARIES ${QT_LIBRARIES}) endif() endmacro() macro(qtX_wrap_cpp variable) - if (WITH_QT5) - qt5_wrap_cpp(${variable} ${ARGN}) - else() + if (WITH_QT4) qt4_wrap_cpp(${variable} ${ARGN}) + else() + qt5_wrap_cpp(${variable} ${ARGN}) endif() endmacro() macro(qtX_add_resources variable) - if (WITH_QT5) - qt5_add_resources(${variable} ${ARGN}) - else() + if (WITH_QT4) qt4_add_resources(${variable} ${ARGN}) + else() + qt5_add_resources(${variable} ${ARGN}) endif() endmacro() @@ -281,15 +281,7 @@ endif() # Find Qwt, correlated to the Qt version. # macro(setup_qwt) - if(WITH_QT5) - find_path(QWT_INCLUDE_DIR NAMES qwt.h - PATHS /usr/include/qt5 - /usr/include - PATH_SUFFIXES qwt ) - find_library(QWT_LIBRARY NAMES qwt-qt5 qwt - PATHS /usr/lib64 - /usr/lib ) - else() + if(WITH_QT4) find_path(QWT_INCLUDE_DIR NAMES qwt.h PATHS /usr/include/qwt-qt4 /opt/local/libexec/qt4/include @@ -300,6 +292,14 @@ endif() PATHS /opt/local/libexec/qt4/lib /usr/lib64 /usr/lib ) + else() + find_path(QWT_INCLUDE_DIR NAMES qwt.h + PATHS /usr/include/qt5 + /usr/include + PATH_SUFFIXES qwt ) + find_library(QWT_LIBRARY NAMES qwt-qt5 qwt + PATHS /usr/lib64 + /usr/lib ) endif() if( QWT_INCLUDE_DIR AND QWT_LIBRARY) diff --git a/bootstrap/socInstaller.py b/bootstrap/socInstaller.py index e4836551..f9c381dd 100755 --- a/bootstrap/socInstaller.py +++ b/bootstrap/socInstaller.py @@ -440,19 +440,18 @@ class Configuration ( object ): raise ErrorMessage( 1, [ 'Cannot find , should be here:' , ' "{}"'.format(self.ccbBin) ] ) - otherArgs = [ '--qt5' ] + otherArgs = [] if self.debugArg: otherArgs.append( self.debugArg ) if target == 'EL9': #otherArgs.append( '--project=support' ) commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 3, otherArgs , fdLog=self.fds['coriolis'] ) ) #commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 1, otherArgs+['--doc'], fdLog=self.fds['coriolis'] ) ) if target == 'SL7_64': - otherArgs.append( '--project=support' ) + otherArgs += [ '--project=support', '--qt4' ] commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 3, otherArgs , fdLog=self.fds['coriolis'] ) ) commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 1, otherArgs+['--doc'], fdLog=self.fds['coriolis'] ) ) elif target == 'SL6_64' or target == 'SL6': - otherArgs.append( '--project=support' ) - otherArgs.append( '--devtoolset=8' ) + otherArgs += [ '--project=support', '--devtoolset=8', '--qt4' ] commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 6, otherArgs , fdLog=self.fds['coriolis'] ) ) commands.append( CoriolisCommand( self.ccbBin, self.rootDir, 1, otherArgs+['--doc'], fdLog=self.fds['coriolis'] ) ) elif target == 'Ubuntu18' or target == 'Debian9' or target == 'Debian10':