diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index 0bb3c2991a..adaa483bf2 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -197,13 +197,6 @@ if(MSVC) set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005") - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) - # The following warning is generated over 800 times from a qwt header only - # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced - # local function has been removed - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505") - endif() - message(STATUS "BUILD_FLAGS_FOR_MSVC ${BUILD_FLAGS_FOR_MSVC}") set_target_properties( ResInsight PROPERTIES COMPILE_FLAGS ${BUILD_FLAGS_FOR_MSVC} @@ -444,8 +437,8 @@ if(RESINSIGHT_PRIVATE_INSTALL) add_custom_command( TARGET ResInsight POST_BUILD - COMMAND ${WINDEPLOYQT_EXECUTABLE} $ --release - --no-translations + COMMAND ${WINDEPLOYQT_EXECUTABLE} $ + "$,--debug,--release>" --no-translations COMMENT "Running windeployqt to deploy Qt dependencies to the build folder, required by install()" ) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 205e8209c1..a6dc82d4c3 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -48,7 +48,6 @@ #include "Rim2dIntersectionViewCollection.h" #include "RimCellFilterCollection.h" -#include "RimCommandObject.h" #include "RimCommandRouter.h" #include "RimCompletionTemplateCollection.h" #include "RimEclipseCaseCollection.h" @@ -789,18 +788,6 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct // Default behavior for scripts is to use current active view for data read/write onProjectOpened(); - // Loop over command objects and execute them - for ( size_t i = 0; i < m_project->commandObjects.size(); i++ ) - { - m_commandQueue.push_back( m_project->commandObjects[i] ); - } - - // Lock the command queue - m_commandQueueLock.lock(); - - // Execute command objects, and release the mutex when the queue is empty - executeCommandObjects(); - // Recalculate the results from grid property calculations. // Has to be done late since the results are filtered by view cell visibility for ( auto gridCalculation : m_project->gridCalculationCollection()->sortedGridCalculations() ) @@ -883,7 +870,6 @@ void RiaApplication::closeProject() onProjectBeingClosed(); m_project->close(); - m_commandQueue.clear(); RiaWellNameComparer::clearCache(); @@ -1383,81 +1369,6 @@ void RiaApplication::executeCommandFile( const QString& commandFile ) RicfCommandFileExecutor::instance()->executeCommands( in ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::addCommandObject( RimCommandObject* commandObject ) -{ - m_commandQueue.push_back( commandObject ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::executeCommandObjects() -{ - { - auto currentCommandQueue = m_commandQueue; - for ( auto command : currentCommandQueue ) - { - if ( !command->isAsyncronous() ) - { - command->redo(); - m_commandQueue.remove( command ); - } - } - } - - if ( !m_commandQueue.empty() ) - { - auto it = m_commandQueue.begin(); - if ( it->notNull() ) - { - RimCommandObject* first = *it; - first->redo(); - } - m_commandQueue.pop_front(); - } - else - { - // Unlock the command queue lock when the command queue is empty - // Required to lock the mutex before unlocking to avoid undefined behavior - m_commandQueueLock.tryLock(); - m_commandQueueLock.unlock(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaApplication::waitUntilCommandObjectsHasBeenProcessed() -{ - auto start = std::chrono::system_clock::now(); - const double timeoutThreshold = 5.0; - - // Wait until all command objects have completed - bool mutexLockedSuccessfully = m_commandQueueLock.tryLock(); - - while ( !mutexLockedSuccessfully ) - { - invokeProcessEvents(); - - mutexLockedSuccessfully = m_commandQueueLock.tryLock(); - - std::chrono::duration elapsed_seconds = std::chrono::system_clock::now() - start; - if ( timeoutThreshold < elapsed_seconds.count() ) - { - // This can happen if the octave plugins fails to execute during regression testing. - - RiaLogging::warning( - QString( "Timeout waiting for command objects to complete, timeout set to %1 seconds." ).arg( timeoutThreshold ) ); - break; - } - } - - m_commandQueueLock.unlock(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaApplication.h b/ApplicationLibCode/Application/RiaApplication.h index 5d9d046c2e..2246705003 100644 --- a/ApplicationLibCode/Application/RiaApplication.h +++ b/ApplicationLibCode/Application/RiaApplication.h @@ -49,7 +49,6 @@ class RiaSocketServer; class RigEclipseCaseData; -class RimCommandObject; class RimCommandRouter; class RimEclipseCase; class RimEclipseView; @@ -180,9 +179,6 @@ class RiaApplication QVariant cacheDataObject( const QString& key ) const; void executeCommandFile( const QString& commandFile ); - void addCommandObject( RimCommandObject* commandObject ); - void executeCommandObjects(); - void waitUntilCommandObjectsHasBeenProcessed(); const QString startDir() const; void setStartDir( const QString& startDir ); @@ -253,9 +249,6 @@ class RiaApplication QString m_commandLineHelpText; QMap m_sessionCache; // Session cache used to store username/passwords per session - std::list> m_commandQueue; - QMutex m_commandQueueLock; - bool m_runningWorkerProcess; private: diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 83edacb759..02c08654ca 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -50,7 +50,6 @@ #include "RimAnnotationCollection.h" #include "RimAnnotationInViewCollection.h" #include "RimAnnotationTextAppearance.h" -#include "RimCommandObject.h" #include "RimEclipseCaseCollection.h" #include "RimEclipseView.h" #include "RimFlowPlotCollection.h" @@ -1574,9 +1573,6 @@ void RiaGuiApplication::slotWorkerProcessFinished( int exitCode, QProcess::ExitS } m_workerProcess = nullptr; - // Always make sure the command objects are executed before any return statement - executeCommandObjects(); - // Either the work process crashed or was aborted by the user if ( exitStatus == QProcess::CrashExit ) { diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index 2e293d380b..7d4a97a58f 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -43,7 +43,6 @@ class RiaSocketServer; class RigEclipseCaseData; -class RimCommandObject; class RimEclipseCase; class RimEclipseView; class RimGridView; diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index 13a2581a26..3ba8b88b48 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -240,9 +240,6 @@ void RiaRegressionTestRunner::runRegressionTest() app->loadProject( testCaseFolder.filePath( projectFileName ), RiaApplication::ProjectLoadAction::PLA_NONE, projectModifier.p() ); - // Wait until all command objects have completed - app->waitUntilCommandObjectsHasBeenProcessed(); - QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName ); if ( regressionTestConfig.exportSnapshots3dViews ) { diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index 5ba4d90f68..796f5a5ccd 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -277,13 +277,6 @@ if(MSVC) message(STATUS "CMAKE_CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}") - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) - # The following warning is generated over 800 times from a qwt header only - # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced - # local function has been removed - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505") - endif() - if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38) # https://github.com/OPM/ResInsight/issues/10844 set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index b4ae51064e..b497b2adba 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -123,13 +123,6 @@ if(MSVC) set(BUILD_FLAGS_FOR_MSVC "/W3 /wd4190 /wd4100 /wd4127") - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) - # The following warning is generated over 800 times from a qwt header only - # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced - # local function has been removed - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505") - endif() - if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38) # https://github.com/OPM/ResInsight/issues/10844 set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") diff --git a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp index 6e3d4d24aa..4713c43bd8 100644 --- a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp +++ b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp @@ -88,7 +88,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const // extract last word which may contain formation color QString colorWord = RiaTextStringTools::splitSkipEmptyParts( numberString ).last(); - if ( QColor::isValidColor( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line + if ( QColor::isValidColorName( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line // extract words containing formation number(s) QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) ); @@ -110,7 +110,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const startK = tmp < endK ? tmp : endK; endK = tmp > endK ? tmp : endK; - if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line + if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line { cvf::Color3f formationColor; @@ -133,7 +133,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const continue; } - if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line + if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line { cvf::Color3f formationColor; diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 617e3b95fb..1ebf9cddf8 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -30,7 +30,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.h ${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.h ${CMAKE_CURRENT_LIST_DIR}/RimMimeData.h - ${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.h ${CMAKE_CURRENT_LIST_DIR}/RimTools.h ${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.h ${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.h @@ -168,7 +167,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMimeData.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RimTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.cpp diff --git a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp b/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp deleted file mode 100644 index d6fc849771..0000000000 --- a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp +++ /dev/null @@ -1,318 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2011- Statoil ASA -// Copyright (C) 2013- Ceetron Solutions AS -// Copyright (C) 2011-2012 Ceetron AS -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RimCommandObject.h" - -#include "RiaApplication.h" -#include "RimCalcScript.h" -#include "RimEclipseStatisticsCase.h" -#include "RimProject.h" - -#include "cafPdmObjectGroup.h" -#include "cafPdmUiPushButtonEditor.h" -#include "cafPdmUiTextEditor.h" -#include "cafPdmValueField.h" - -#include - -CAF_PDM_SOURCE_INIT( RimCommandObject, "RimCommandObject" ); -CAF_PDM_SOURCE_INIT( RimCommandExecuteScript, "RimCommandExecuteScript" ); -CAF_PDM_SOURCE_INIT( RimCommandIssueFieldChanged, "RimCommandIssueFieldChanged" ); - -//------------------------------------------------------------------------------------------------ -/// -//-------------------------------------------------------------------------------------------------- -RimCommandObject::RimCommandObject() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandObject::~RimCommandObject() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandExecuteScript::RimCommandExecuteScript() -{ - CAF_PDM_InitFieldNoDefault( &name, "Name", "Name" ); - - CAF_PDM_InitField( &scriptText, "ScriptText", QString(), "Script Text" ); - scriptText.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &isEnabled, "IsEnabled", true, "Enabled " ); - - CAF_PDM_InitField( &execute, "Execute", true, "Execute" ); - caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &execute ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandExecuteScript::~RimCommandExecuteScript() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::redo() -{ - if ( !isEnabled ) return; - - RiaApplication* app = RiaApplication::instance(); - QString octavePath = app->octavePath(); - if ( !octavePath.isEmpty() ) - { - QStringList arguments = app->octaveArguments(); - - arguments.append( "--eval" ); - arguments << scriptText(); - - RiaApplication::instance()->launchProcess( octavePath, arguments, app->octaveProcessEnvironment() ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::undo() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) -{ - caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast( attribute ); - if ( myAttr ) - { - myAttr->showSaveButton = true; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimCommandExecuteScript::userDescriptionField() -{ - return &name; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandExecuteScript::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) -{ - if ( &execute == changedField ) - { - RiaApplication* app = RiaApplication::instance(); - app->addCommandObject( this ); - app->executeCommandObjects(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimCommandExecuteScript::isAsyncronous() -{ - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandFactory::createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector* commandObjects ) -{ - for ( size_t i = 0; i < selectedObjects.objects.size(); i++ ) - { - caf::PdmObjectHandle* pdmObject = selectedObjects.objects[i]; - - if ( dynamic_cast( pdmObject ) ) - { - RimCalcScript* calcScript = dynamic_cast( pdmObject ); - - QFile file( calcScript->absoluteFileName ); - if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) ) - { - QTextStream in( &file ); - QByteArray byteArray = file.readAll(); - QString scriptText( byteArray ); - - RimCommandExecuteScript* command = new RimCommandExecuteScript; - command->scriptText = scriptText; - - commandObjects->push_back( command ); - } - } - else if ( dynamic_cast( pdmObject ) ) - { - RimEclipseStatisticsCase* statisticsCase = dynamic_cast( pdmObject ); - - RimCommandIssueFieldChanged* command = new RimCommandIssueFieldChanged; - command->objectName = statisticsCase->uiName(); - command->fieldName = statisticsCase->m_calculateEditCommand.keyword(); - command->fieldValueToApply = "true"; - - commandObjects->push_back( command ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandIssueFieldChanged::RimCommandIssueFieldChanged() -{ - CAF_PDM_InitFieldNoDefault( &commandName, "CommandName", "CommandName" ); - - CAF_PDM_InitField( &objectName, "ObjectName", QString(), "ObjectName" ); - CAF_PDM_InitField( &fieldName, "FieldName", QString(), "FieldName" ); - CAF_PDM_InitField( &fieldValueToApply, "FieldValueToApply", QString(), "FieldValueToApply" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimCommandIssueFieldChanged::~RimCommandIssueFieldChanged() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandIssueFieldChanged::redo() -{ - RiaApplication* app = RiaApplication::instance(); - PdmObject* project = app->project(); - - caf::PdmObjectHandle* pdmObject = findObjectByName( project, objectName ); - - if ( pdmObject ) - { - caf::PdmFieldHandle* fieldHandle = findFieldByKeyword( pdmObject, fieldName ); - - if ( fieldHandle && fieldHandle->uiCapability() ) - { - caf::PdmValueField* valueField = dynamic_cast( fieldHandle ); - CVF_ASSERT( valueField ); - - QVariant oldValue = valueField->toQVariant(); - QVariant newValue( fieldValueToApply ); - - valueField->setFromQVariant( newValue ); - - caf::PdmUiFieldHandle* uiFieldHandle = fieldHandle->uiCapability(); - uiFieldHandle->notifyFieldChanged( oldValue, newValue ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandIssueFieldChanged::undo() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimCommandIssueFieldChanged::userDescriptionField() -{ - return &commandName; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCommandIssueFieldChanged::childObjects( caf::PdmObject* pdmObject, std::vector& children ) -{ - if ( !pdmObject ) return; - - std::vector fields = pdmObject->fields(); - - size_t fIdx; - for ( fIdx = 0; fIdx < fields.size(); ++fIdx ) - { - if ( fields[fIdx] ) - { - auto other = fields[fIdx]->children(); - children.insert( children.end(), other.begin(), other.end() ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObjectHandle* RimCommandIssueFieldChanged::findObjectByName( caf::PdmObjectHandle* pdmObject, const QString& name ) -{ - std::vector fields = pdmObject->fields(); - - caf::PdmUiObjectHandle* uiObjectHandle = uiObj( pdmObject ); - - if ( uiObjectHandle && uiObjectHandle->uiName() == name ) - { - return pdmObject; - } - - for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ ) - { - if ( fields[fIdx] ) - { - std::vector children = fields[fIdx]->children(); - - for ( size_t cIdx = 0; cIdx < children.size(); cIdx++ ) - { - PdmObjectHandle* candidateObj = findObjectByName( children[cIdx], name ); - if ( candidateObj ) - { - return candidateObj; - } - } - } - } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimCommandIssueFieldChanged::findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& keywordName ) -{ - std::vector fields = pdmObject->fields(); - - for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ ) - { - if ( fields[fIdx] && fields[fIdx]->keyword() == keywordName ) - { - return fields[fIdx]; - } - } - - return nullptr; -} diff --git a/ApplicationLibCode/ProjectDataModel/RimCommandObject.h b/ApplicationLibCode/ProjectDataModel/RimCommandObject.h deleted file mode 100644 index f9d4bedcb0..0000000000 --- a/ApplicationLibCode/ProjectDataModel/RimCommandObject.h +++ /dev/null @@ -1,108 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2011- Statoil ASA -// Copyright (C) 2013- Ceetron Solutions AS -// Copyright (C) 2011-2012 Ceetron AS -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafPdmField.h" -#include "cafPdmObject.h" -#include "cafPdmObjectGroup.h" - -#include "cvfObject.h" - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandObject : public caf::PdmObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimCommandObject(); - ~RimCommandObject() override; - - virtual bool isAsyncronous() { return false; }; - - virtual void redo(){}; - virtual void undo(){}; -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandExecuteScript : public RimCommandObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimCommandExecuteScript(); - ~RimCommandExecuteScript() override; - - caf::PdmField name; - caf::PdmField isEnabled; - caf::PdmField execute; - caf::PdmField scriptText; - - void redo() override; - void undo() override; - - void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - - caf::PdmFieldHandle* userDescriptionField() override; - - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - - bool isAsyncronous() override; -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandIssueFieldChanged : public RimCommandObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimCommandIssueFieldChanged(); - ~RimCommandIssueFieldChanged() override; - - caf::PdmField commandName; - caf::PdmField objectName; - caf::PdmField fieldName; - caf::PdmField fieldValueToApply; - - void redo() override; - void undo() override; - - caf::PdmFieldHandle* userDescriptionField() override; - -private: - void childObjects( caf::PdmObject* pdmObject, std::vector& children ); - caf::PdmObjectHandle* findObjectByName( caf::PdmObjectHandle* root, const QString& name ); - caf::PdmFieldHandle* findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& fieldName ); -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RimCommandFactory -{ -public: - static void createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector* commandObjects ); -}; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 6144efaefe..c2a6f89685 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -45,7 +45,6 @@ #include "RimCase.h" #include "RimCaseCollection.h" #include "RimColorLegendCollection.h" -#include "RimCommandObject.h" #include "RimCompletionTemplateCollection.h" #include "RimContextCommandBuilder.h" #include "RimCorrelationPlotCollection.h" @@ -172,8 +171,6 @@ RimProject::RimProject() CAF_PDM_InitFieldNoDefault( &gridCalculationCollection, "GridCalculationCollection", "Grid Calculation Collection" ); gridCalculationCollection = new RimGridCalculationCollection; - CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" ); - CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" ); CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" ); @@ -267,8 +264,6 @@ void RimProject::close() casesObsolete.deleteChildren(); caseGroupsObsolete.deleteChildren(); - commandObjects.deleteChildren(); - multiSnapshotDefinitions.deleteChildren(); m_dialogData->clearProjectSpecificData(); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 77998ebb52..92b414698f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -43,8 +43,6 @@ class RimPolylinesAnnotation; class RimSummaryCalculationCollection; class RimSummaryCalculation; class RimCase; -class RimCommandObject; -class RimCommandObject; class RimDialogData; class RimEclipseCase; class RimGeoMechCase; @@ -101,7 +99,6 @@ class RimProject : public caf::PdmDocument caf::PdmChildField viewLinkerCollection; caf::PdmChildField calculationCollection; caf::PdmChildField gridCalculationCollection; - caf::PdmChildArrayField commandObjects; RimMainPlotCollection* mainPlotCollection() const; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 511f776eb9..59fcdc9b7e 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -32,7 +32,6 @@ #include "Rim2dIntersectionView.h" #include "Rim3dView.h" #include "RimCellEdgeColors.h" -#include "RimCommandObject.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" #include "RimEclipseContourMapView.h" @@ -358,7 +357,6 @@ void RiuMainWindow::createActions() m_snapshotAllViewsToFile = new QAction( QIcon( ":/SnapShotSaveViews.svg" ), "Snapshot All Views To File", this ); - m_createCommandObject = new QAction( "Create Command Object", this ); m_showRegressionTestDialog = new QAction( "Regression Test Dialog", this ); m_executePaintEventPerformanceTest = new QAction( "&Paint Event Performance Test", this ); @@ -370,7 +368,6 @@ void RiuMainWindow::createActions() connect( m_snapshotAllViewsToFile, SIGNAL( triggered() ), SLOT( slotSnapshotAllViewsToFile() ) ); - connect( m_createCommandObject, SIGNAL( triggered() ), SLOT( slotCreateCommandObject() ) ); connect( m_showRegressionTestDialog, SIGNAL( triggered() ), SLOT( slotShowRegressionTestDialog() ) ); connect( m_executePaintEventPerformanceTest, SIGNAL( triggered() ), SLOT( slotExecutePaintEventPerformanceTest() ) ); @@ -532,8 +529,6 @@ void RiuMainWindow::createMenus() testMenu->addAction( m_mockModelCustomizedAction ); testMenu->addAction( m_mockInputModelAction ); testMenu->addSeparator(); - testMenu->addAction( m_createCommandObject ); - testMenu->addSeparator(); testMenu->addAction( m_showRegressionTestDialog ); testMenu->addAction( m_executePaintEventPerformanceTest ); testMenu->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) ); @@ -1928,44 +1923,6 @@ void RiuMainWindow::selectedCases( std::vector& cases ) caf::SelectionManager::instance()->objectsByType( &cases ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindow::slotCreateCommandObject() -{ - RiaApplication* app = RiaApplication::instance(); - if ( !app->project() ) return; - - caf::PdmUiTreeView* projectTree = dynamic_cast( sender() ); - if ( !projectTree ) return; - - std::vector selectedUiItems; - projectTree->selectedUiItems( selectedUiItems ); - - caf::PdmObjectGroup selectedObjects; - for ( auto* selectedUiItem : selectedUiItems ) - { - caf::PdmUiObjectHandle* uiObj = dynamic_cast( selectedUiItem ); - if ( uiObj ) - { - selectedObjects.addObject( uiObj->objectHandle() ); - } - } - - if ( !selectedObjects.objects.empty() ) - { - std::vector commandObjects; - RimCommandFactory::createCommandObjects( selectedObjects, &commandObjects ); - - for ( auto* commandObject : commandObjects ) - { - app->project()->commandObjects.push_back( commandObject ); - } - - app->project()->updateConnectedEditors(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index c2e48906a7..ae7a6baad3 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -173,7 +173,6 @@ class RiuMainWindow : public RiuMainWindowBase QAction* m_snapshotAllViewsToFile; - QAction* m_createCommandObject; QAction* m_showRegressionTestDialog; QAction* m_executePaintEventPerformanceTest; @@ -235,8 +234,6 @@ private slots: // Debug slots void slotSnapshotAllViewsToFile(); - void slotCreateCommandObject(); - void slotShowRegressionTestDialog(); void slotExecutePaintEventPerformanceTest(); diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eb05d323c..f95a22a662 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(VIZ_MODULES_FOLDER_NAME Fwk/VizFwk) -# !!! For now, we force Qt to version 5 +message(STATUS "Set CEE_USE_QT6 to ON") set(CEE_USE_QT5 OFF) -message(STATUS "Forcing setting of CEE_USE_QT6 to ON") set(CEE_USE_QT6 ON) -message(STATUS "CEE_USE_QT6=${CEE_USE_QT6}") cmake_policy(SET CMP0020 NEW) if(POLICY CMP0077) @@ -1079,36 +1077,6 @@ install(TARGETS extract-projectfile-versions DESTINATION ${RESINSIGHT_INSTALL_FOLDER} ) -# ############################################################################## -# Add OpenSSL 1.1.1 libraries The OpenSSL libraries are needed for the -# NetworkAuth module in Qt 5 Installed by adding openssl-windows in vcpkg.json -# Required to use fully specified path to the dlls, as it is not trivial to find -# the path. OpenSSL 3 is installed and used by other modules -# ############################################################################## - -if(MSVC) - FetchContent_Declare( - openssl_1_1_1 - URL https://github.com/CeetronSolutions/resinsight-dependencies/releases/download/2024.05/openssl_1_1_1.zip - ) - FetchContent_Populate(openssl_1_1_1) - - set(FILE_PATH_LIBCRYPTO_1_1 - "${openssl_1_1_1_SOURCE_DIR}/libcrypto-1_1-x64.dll" - ) - set(FILE_PATH_LIBOPENSSL_1_1 "${openssl_1_1_1_SOURCE_DIR}/libssl-1_1-x64.dll") - - message(STATUS "FILE_PATH_LIBCRYPTO_1_1: ${FILE_PATH_LIBCRYPTO_1_1}") - message(STATUS "FILE_PATH_LIBOPENSSL_1_1: ${FILE_PATH_LIBOPENSSL_1_1}") - - install( - FILES ${FILE_PATH_LIBCRYPTO_1_1} ${FILE_PATH_LIBOPENSSL_1_1} - DESTINATION ${RESINSIGHT_INSTALL_FOLDER} - OPTIONAL - ) - -endif() # MSVC - # ############################################################################## # Visual Studio : Create the ruleset file to be used by Static Code Analysis # https://stackoverflow.com/questions/75031903/how-to-enable-static-analysis-with-custom-ruleset-in-msvc-via-cmakelists-txt diff --git a/Fwk/AppFwk/CommonCode/CMakeLists.txt b/Fwk/AppFwk/CommonCode/CMakeLists.txt index 0bf5a214e8..1f9e198804 100644 --- a/Fwk/AppFwk/CommonCode/CMakeLists.txt +++ b/Fwk/AppFwk/CommonCode/CMakeLists.txt @@ -14,23 +14,13 @@ find_package(OpenGL) # These headers need to go through Qt's MOC compiler set(MOC_HEADER_FILES cafMessagePanel.h) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) +qt_standard_project_setup() add_library( ${PROJECT_NAME} diff --git a/Fwk/AppFwk/cafAnimControl/CMakeLists.txt b/Fwk/AppFwk/cafAnimControl/CMakeLists.txt index c8dc1fc27d..7d10739f2c 100644 --- a/Fwk/AppFwk/cafAnimControl/CMakeLists.txt +++ b/Fwk/AppFwk/cafAnimControl/CMakeLists.txt @@ -11,23 +11,13 @@ set(MOC_HEADER_FILES cafFrameAnimationControl.h cafAnimationToolBar.h cafPopupMenuButton.h ) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() # NOTE! Resources in this subfolder appends to the variable QRC_FILES in parent # scope CMakeList.txt in the application folder (parent scope) must use the diff --git a/Fwk/AppFwk/cafCommand/CMakeLists.txt b/Fwk/AppFwk/cafCommand/CMakeLists.txt index f6900a07ab..e68a3c2f27 100644 --- a/Fwk/AppFwk/cafCommand/CMakeLists.txt +++ b/Fwk/AppFwk/cafCommand/CMakeLists.txt @@ -10,23 +10,13 @@ endif() set(MOC_HEADER_FILES cafCmdFeature.h cafCmdFeatureManager.h) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafCmdExecCommandManager.cpp diff --git a/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt b/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt index 090e820da6..3396102b5f 100644 --- a/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt +++ b/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt @@ -10,23 +10,13 @@ endif() set(MOC_HEADER_FILES) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES # Default features diff --git a/Fwk/AppFwk/cafDataLoader/CMakeLists.txt b/Fwk/AppFwk/cafDataLoader/CMakeLists.txt index 28a736c7e8..e3473b1873 100644 --- a/Fwk/AppFwk/cafDataLoader/CMakeLists.txt +++ b/Fwk/AppFwk/cafDataLoader/CMakeLists.txt @@ -7,22 +7,13 @@ if(CAF_ENABLE_UNITY_BUILD) endif() # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafDataLoader.h cafDataLoader.cpp cafDataLoadTask.h cafDataLoadTask.cpp diff --git a/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt b/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt index 61c2954cdc..b800f4591a 100644 --- a/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt +++ b/Fwk/AppFwk/cafPdmCvf/CMakeLists.txt @@ -6,23 +6,12 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) add_library( ${PROJECT_NAME} diff --git a/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt index acc5691ffa..e1d2701318 100644 --- a/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafPdmCvf/cafPdmCvf_UnitTests/CMakeLists.txt @@ -1,20 +1,9 @@ -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt6::Core) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt5::Core) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core +) +set(QT_LIBRARIES Qt6::Core) project(cafPdmCvf_UnitTests) @@ -31,44 +20,8 @@ set(PROJECT_FILES # add the executable add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -if(Qt5Core_FOUND) - set(QT_LIBRARIES Qt5::Core) -endif() - source_group("" FILES ${PROJECT_FILES}) target_link_libraries( ${PROJECT_NAME} cafPdmCore cafPdmXml LibCore cafPdmCvf ${QT_LIBRARIES} ) - -# Copy Qt Dlls -if(Qt5Core_FOUND) - foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) - endforeach(qtlib) - # Copy Qt Dlls -else() - # Copy Qt Dlls - if(MSVC) - set(QTLIBLIST QtCore) - foreach(qtlib ${QTLIBLIST}) - - # Debug - execute_process( - COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll - ${CMAKE_BINARY_DIR}/Debug/${qtlib}d4.dll - ) - - # Release - execute_process( - COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll - ${CMAKE_BINARY_DIR}/Release/${qtlib}4.dll - ) - endforeach(qtlib) - endif(MSVC) -endif(Qt5Core_FOUND) diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt index 3af7bad1c3..20ce6e346b 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/CMakeLists.txt @@ -1,20 +1,11 @@ project(cafPdmScripting_UnitTests) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml Gui - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -29,11 +20,7 @@ set(PROJECT_FILES cafPdmScripting_UnitTests.cpp gtest/gtest-all.cpp cafPdmScriptingBasicTest.cpp cafPdmFieldSerializationTest.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options( @@ -47,29 +34,14 @@ target_link_libraries( source_group("" FILES ${PROJECT_FILES}) -# Copy Qt Dlls -if(Qt5Core_FOUND) - foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) - endforeach(qtlib) -endif(Qt5Core_FOUND) - -# Install install( TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt index 42100ff574..c85916f470 100644 --- a/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/CMakeLists.txt @@ -6,23 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafFactory.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt index b33de76ebe..7416c8ae41 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt @@ -6,22 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt6::Core) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core - ) - set(QT_LIBRARIES Qt5::Core) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core +) +set(QT_LIBRARIES Qt6::Core) +qt_standard_project_setup() set(PROJECT_FILES cafAssert.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt index 0b6a4b059b..02252476d0 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/CMakeLists.txt @@ -3,21 +3,12 @@ cmake_minimum_required(VERSION 3.15) project(cafPdmCore_UnitTests) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Widgets Gui - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Gui) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Widgets Gui +) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -43,11 +34,7 @@ set(PROJECT_FILES TestObj.h ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") @@ -59,10 +46,6 @@ endif() source_group("" FILES ${PROJECT_FILES}) -if(Qt5Core_FOUND) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) -endif() - target_link_libraries( ${PROJECT_NAME} PRIVATE cafPdmCore ${QT_LIBRARIES} ${THREAD_LIBRARY} ) @@ -84,10 +67,8 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt index c686570d1f..72e9dea4a3 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/CMakeLists.txt @@ -11,24 +11,13 @@ set(MOC_HEADER_FILES cafPdmUiEditorHandle.h cafPdmUiFieldEditorHandle.h cafPdmUiSelection3dEditorVisualizer.h cafQShortenedLabel.h ) -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets) +qt_standard_project_setup() set(PROJECT_FILES cafInternalPdmFieldTypeSpecializations.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp index 3648b65dab..08aa84b5ae 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp @@ -162,7 +162,7 @@ std::unique_ptr IconProvider::icon( const QSize& size ) const bool validIcon = false; if ( !m_backgroundColorStrings.empty() ) { - if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColor( m_backgroundColorStrings.front() ) ) + if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColorName( m_backgroundColorStrings.front() ) ) { pixmap.fill( QColor( m_backgroundColorStrings.front() ) ); validIcon = true; @@ -176,7 +176,7 @@ std::unique_ptr IconProvider::icon( const QSize& size ) const QLinearGradient gradient( QPointF( 0.0f, 0.0f ), QPoint( size.width(), 0.0f ) ); for ( size_t i = 0; i < m_backgroundColorStrings.size(); ++i ) { - if ( !QColor::isValidColor( m_backgroundColorStrings[i] ) ) + if ( !QColor::isValidColorName( m_backgroundColorStrings[i] ) ) { validIcon = false; break; @@ -303,7 +303,7 @@ bool IconProvider::backgroundColorsAreValid() const bool validBackgroundColors = true; for ( QString colorName : m_backgroundColorStrings ) { - if ( !QColor::isValidColor( colorName ) ) + if ( !QColor::isValidColorName( colorName ) ) { validBackgroundColors = false; break; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt index de12c881f7..885ca2cf2e 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/CMakeLists.txt @@ -6,23 +6,13 @@ if(CAF_ENABLE_UNITY_BUILD) set(CMAKE_UNITY_BUILD true) endif() -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt6::Core Qt6::Xml) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Xml +) +set(QT_LIBRARIES Qt6::Core Qt6::Xml) +qt_standard_project_setup() set(PROJECT_FILES cafInternalPdmFieldIoHelper.cpp diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt index 974509c4ef..3d5ece722d 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/CMakeLists.txt @@ -2,22 +2,13 @@ cmake_minimum_required(VERSION 3.15) project(cafPdmXml_UnitTests) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt6::Core Qt6::Xml) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Xml +) +set(QT_LIBRARIES Qt6::Core Qt6::Xml) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -34,11 +25,7 @@ set(PROJECT_FILES cafPdmPtrArrayTest.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES}) @@ -46,29 +33,14 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE cafPdmXml ${QT_LIBRARIES} ${THREAD_LIBRARY} ) -# Copy Qt Dlls -if(Qt5Core_FOUND) - foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) - endforeach(qtlib) -endif(Qt5Core_FOUND) - -# Install install( TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt index 768ca2b7c1..8b86a7abcd 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/CMakeLists.txt @@ -2,22 +2,12 @@ cmake_minimum_required(VERSION 3.15) project(cafProjectDataModel_UnitTests) -# Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Widgets - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Xml Gui - ) - set(QT_LIBRARIES Qt5::Core Qt5::Xml Qt5::Gui) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Widgets +) +qt_standard_project_setup() if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) # VS 2017 : Disable warnings from from gtest code, using deprecated code @@ -38,11 +28,7 @@ set(PROJECT_FILES gtest/gtest-all.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options( @@ -57,27 +43,14 @@ target_link_libraries( source_group("" FILES ${PROJECT_FILES}) -# Copy Qt Dlls -foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) -endforeach(qtlib) - -# Install install( TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt index 872198ae96..d134adef6b 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt +++ b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt @@ -16,24 +16,13 @@ set(MOC_HEADER_FILES MainWindow.h WidgetLayoutTest.h CustomObjectEditor.h set(QRC_FILES ${QRC_FILES} textedit.qrc) message("QRC_FILES: ${QRC_FILES}") -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL Svg - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL Svg +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) +qt_standard_project_setup() option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON) @@ -60,28 +49,11 @@ set(PROJECT_FILES LineEditAndPushButtons.cpp ) -if(CEE_USE_QT6) - qt_add_executable( - ${PROJECT_NAME} - ${PROJECT_FILES} - ${MOC_SOURCE_FILES} - ${QRC_FILES} - $ # Needed for cmake version < 3.12. - # Remove - # when we can use target_link_libraries with OBJECT libraries - ) -else() - add_executable( - ${PROJECT_NAME} - ${PROJECT_FILES} - ${MOC_SOURCE_FILES} - ${QRC_FILES_CPP} - $ # Needed for cmake version < 3.12. - # Remove when we can use - # target_link_libraries with OBJECT - # libraries - ) -endif(CEE_USE_QT6) +qt_add_executable( + ${PROJECT_NAME} ${PROJECT_FILES} ${MOC_SOURCE_FILES} ${QRC_FILES} + $ # Needed for cmake version < 3.12. Remove + # when we can use target_link_libraries with OBJECT libraries +) set(TAP_LINK_LIBRARIES cafUserInterface) @@ -122,19 +94,16 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) - - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(CPACK_GENERATOR TGZ) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(CPACK_GENERATOR ZIP) - endif() +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) - include(CPack) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(CPACK_GENERATOR TGZ) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(CPACK_GENERATOR ZIP) +endif() -endif(CEE_USE_QT6) +include(CPack) diff --git a/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt b/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt index 48ca8821f1..e040960bfc 100644 --- a/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt +++ b/Fwk/AppFwk/cafTests/cafTestCvfApplication/CMakeLists.txt @@ -8,23 +8,12 @@ set(MOC_HEADER_FILES MainWindow.h WidgetLayoutTest.h) # Resource file set(QRC_FILES textedit.qrc) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL Svg - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - qt5_add_resources(QRC_FILES_CPP ${QRC_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL Svg +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL Qt6::Svg) option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON) diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt index 06453f27ec..ae7afa59d9 100644 --- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt @@ -55,23 +55,13 @@ set(MOC_HEADER_FILES cafPdmUiValueRangeEditor.h ) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets Svg - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Svg) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets Svg - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets Svg +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Svg) +qt_standard_project_setup() set(PROJECT_FILES # field editors diff --git a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt index 352c64f868..52cd936e95 100644 --- a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt @@ -3,21 +3,12 @@ cmake_minimum_required(VERSION 3.15) project(cafUserInterface_UnitTests) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets Svg - ) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets Svg +) +qt_standard_project_setup() include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp ) @@ -26,11 +17,7 @@ set(PROJECT_FILES cafUserInterface_UnitTests.cpp cafPdmUiTreeViewModelTest.cpp cafPdmUiTreeSelectionQModelTest.cpp gtest/gtest-all.cpp ) -if(CEE_USE_QT6) - qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -else() - add_executable(${PROJECT_NAME} ${PROJECT_FILES}) -endif(CEE_USE_QT6) +qt_add_executable(${PROJECT_NAME} ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES}) @@ -38,16 +25,6 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE cafUserInterface ${QT_LIBRARIES} ${THREAD_LIBRARY} ) -# Copy Qt Dlls -foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) -endforeach(qtlib) - # Install install( TARGETS ${PROJECT_NAME} @@ -55,10 +32,8 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -if(CEE_USE_QT6) - qt_generate_deploy_app_script( - TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script - NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS - ) - install(SCRIPT ${deploy_script}) -endif(CEE_USE_QT6) +qt_generate_deploy_app_script( + TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR NO_TRANSLATIONS +) +install(SCRIPT ${deploy_script}) diff --git a/Fwk/AppFwk/cafViewer/CMakeLists.txt b/Fwk/AppFwk/cafViewer/CMakeLists.txt index a3f0d1f83a..95aeb8093e 100644 --- a/Fwk/AppFwk/cafViewer/CMakeLists.txt +++ b/Fwk/AppFwk/cafViewer/CMakeLists.txt @@ -11,25 +11,13 @@ endif() # These headers need to go through Qt's MOC compiler set(MOC_HEADER_FILES cafViewer.h) -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) - qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) - - set(QT5_OPENGL_FILES cafOpenGLWidget.cpp cafOpenGLWidget.h) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) +qt_standard_project_setup() add_library( ${PROJECT_NAME} diff --git a/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt b/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt index bc552e2022..3135539089 100644 --- a/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt +++ b/Fwk/AppFwk/cafVizExtensions/CMakeLists.txt @@ -10,26 +10,16 @@ endif() find_package(OpenGL) # Qt -if(CEE_USE_QT6) - find_package( - Qt6 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) - qt_standard_project_setup() - set_property( - SOURCE cafTransparentWBRenderConfiguration.cpp PROPERTY SKIP_AUTOMOC ON - ) -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets OpenGL - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) - qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES}) -endif() +find_package( + Qt6 + COMPONENTS + REQUIRED Core Gui Widgets OpenGL +) +set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGL) +qt_standard_project_setup() +set_property( + SOURCE cafTransparentWBRenderConfiguration.cpp PROPERTY SKIP_AUTOMOC ON +) add_library( ${PROJECT_NAME} diff --git a/Fwk/CMakeLists.txt b/Fwk/CMakeLists.txt index bb17d9c9ea..e6ccecd21c 100644 --- a/Fwk/CMakeLists.txt +++ b/Fwk/CMakeLists.txt @@ -32,7 +32,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNO_DEBUG") endif() -if(CEE_USE_QT6) find_package( Qt6 COMPONENTS @@ -40,14 +39,6 @@ if(CEE_USE_QT6) ) set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::Widgets) qt_standard_project_setup() -else() - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui OpenGL Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Widgets) -endif() # Libraries add_subdirectory(AppFwk/cafProjectDataModel/cafPdmCore)