Janitor issues

* Use horizontalAdvance
* Remove unused code
* Hide some warnings from Qt code
* Remove message for _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
* Use CMP0077 NEW
* Move roff libraries to folder Thirdparty
* avoid operator()==
* Remove cmake_minimum_required and set version to 3.15
This commit is contained in:
Magne Sjaastad 2023-01-24 12:29:27 +01:00 committed by GitHub
parent c8dbf3d125
commit 583c248cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 24 additions and 112 deletions

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(ApplicationExeCode) project(ApplicationExeCode)
# set packaging dir # set packaging dir
@ -597,7 +595,6 @@ if(RESINSIGHT_PRIVATE_INSTALL)
TARGET "Boost::filesystem" TARGET "Boost::filesystem"
PROPERTY LOCATION_RELEASE PROPERTY LOCATION_RELEASE
) )
message("_filepath: ${_filepath}")
# The location of Boost is based on the file structure as installed by vcpkg # The location of Boost is based on the file structure as installed by vcpkg
# The DLLs are located in the /bin folder # The DLLs are located in the /bin folder
@ -607,8 +604,6 @@ if(RESINSIGHT_PRIVATE_INSTALL)
# Use file clobbing, as the dlls are decorated with local compiler info # Use file clobbing, as the dlls are decorated with local compiler info
file(GLOB RI_BOOST_DLLS ${_dir}/boost_filesystem*.dll) file(GLOB RI_BOOST_DLLS ${_dir}/boost_filesystem*.dll)
message("RI_BOOST_DLLS : ${RI_BOOST_DLLS}")
install( install(
FILES ${RI_BOOST_DLLS} FILES ${RI_BOOST_DLLS}
DESTINATION ${RESINSIGHT_INSTALL_FOLDER} DESTINATION ${RESINSIGHT_INSTALL_FOLDER}

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(ApplicationLibCode) project(ApplicationLibCode)
# set packaging dir # set packaging dir

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(Commands) project(Commands)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(RigGeoMechDataModel) project(RigGeoMechDataModel)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(RifOdbReader) project(RifOdbReader)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(ResultStatisticsCache) project(ResultStatisticsCache)
include_directories(${LibCore_SOURCE_DIR}) include_directories(${LibCore_SOURCE_DIR})

View File

@ -7,7 +7,7 @@ set(VIZ_MODULES_FOLDER_NAME Fwk/VizFwk)
cmake_policy(SET CMP0020 NEW) cmake_policy(SET CMP0020 NEW)
if(POLICY CMP0077) if(POLICY CMP0077)
cmake_policy(SET CMP0077 OLD) cmake_policy(SET CMP0077 NEW)
endif() endif()
if(UNIX) if(UNIX)
@ -504,6 +504,7 @@ list(APPEND THIRD_PARTY_LIBRARIES clipper)
add_subdirectory(ThirdParty/roffcpp) add_subdirectory(ThirdParty/roffcpp)
list(APPEND THIRD_PARTY_LIBRARIES roffcpp) list(APPEND THIRD_PARTY_LIBRARIES roffcpp)
set_property(TARGET roffcpp-tests gtest gtest_main PROPERTY FOLDER "Thirdparty")
# ############################################################################## # ##############################################################################
# Thirdparty libraries are put in ThirdParty solution folder # Thirdparty libraries are put in ThirdParty solution folder
@ -615,11 +616,16 @@ add_subdirectory(Fwk/AppFwk/cafTensor)
add_subdirectory(Fwk/AppFwk/cafHexInterpolator) add_subdirectory(Fwk/AppFwk/cafHexInterpolator)
if(MSVC) if(MSVC)
target_compile_options(cafViewer PRIVATE /wd4996) target_compile_options(cafAnimControl PRIVATE /wd5054)
target_compile_options(cafPdmCore PRIVATE /wd4996) target_compile_options(cafViewer PRIVATE /wd4996 /wd5054)
target_compile_options(cafPdmCore PRIVATE /wd4996) target_compile_options(cafPdmCore PRIVATE /wd4996)
target_compile_options(cafPdmUiCore PRIVATE /wd5054)
target_compile_options(cafCommandFeatures PRIVATE /wd4996 /wd5054)
target_compile_options(cafCommand PRIVATE /wd5054)
target_compile_options(cafPdmXml PRIVATE /wd4996) target_compile_options(cafPdmXml PRIVATE /wd4996)
target_compile_options(cafUserInterface PRIVATE /wd4996) target_compile_options(cafUserInterface PRIVATE /wd4996 /wd5054)
target_compile_options(qwt PRIVATE /wd5055)
target_compile_options(CommonCode PRIVATE /wd5054)
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(CommonCode) project(CommonCode)
# Unity Build # Unity Build

View File

@ -217,7 +217,6 @@ std::vector<caf::ContourLines::ListOfLineSegments> caf::ContourLines::create( co
const std::vector<double>& yPositions, const std::vector<double>& yPositions,
const std::vector<double>& contourLevels ) const std::vector<double>& contourLevels )
{ {
const double eps = 1.0e-4;
std::vector<std::vector<cvf::Vec2d>> contourLineSegments; std::vector<std::vector<cvf::Vec2d>> contourLineSegments;
caf::ContourLines::create( dataXY, xPositions, yPositions, contourLevels, &contourLineSegments ); caf::ContourLines::create( dataXY, xPositions, yPositions, contourLevels, &contourLineSegments );

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafAnimControl) project(cafAnimControl)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafCommand) project(cafCommand)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafCommandFeatures) project(cafCommandFeatures)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafPdmCvf) project(cafPdmCvf)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafPdmScripting) project(cafPdmScripting)
option(CAF_CVF_SCRIPTING "Enable CVF-data support in Scripting" OFF) option(CAF_CVF_SCRIPTING "Enable CVF-data support in Scripting" OFF)

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 2.8.12)
project(cafPdmScripting_UnitTests) project(cafPdmScripting_UnitTests)
find_package( find_package(
@ -13,10 +11,6 @@ if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
# related to TR1 # related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
message(
STATUS
"Add flag to disable warings from gtest - _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
)
endif() endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafProjectDataModel) project(cafProjectDataModel)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafPdmCore) project(cafPdmCore)
# Unity Build # Unity Build

View File

@ -108,9 +108,6 @@ public:
{ {
} }
bool operator==( T value ) const { return m_value == value; }
bool operator!=( T value ) const { return m_value != value; }
operator T() const { return m_value; } operator T() const { return m_value; }
T value() const { return m_value; } T value() const { return m_value; }
@ -346,22 +343,6 @@ private:
} // namespace caf } // namespace caf
//==================================================================================================
/// Cant remember why we need those comparison operators...
//==================================================================================================
template <class T>
bool operator==( T value, const caf::AppEnum<T>& appEnum )
{
return ( appEnum == value );
}
template <class T>
bool operator!=( T value, const caf::AppEnum<T>& appEnum )
{
return ( appEnum != value );
}
//================================================================================================== //==================================================================================================
/// Implementation of stream operators to make PdmField<AppEnum<> > work smoothly /// Implementation of stream operators to make PdmField<AppEnum<> > work smoothly
/// Assumes that the stream ends at the end of the enum text /// Assumes that the stream ends at the end of the enum text

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.15)
project(cafPdmCore_UnitTests) project(cafPdmCore_UnitTests)
@ -14,10 +14,6 @@ if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
# related to TR1 # related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
message(
STATUS
"Add flag to disable warings from gtest - _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
)
endif() endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafPdmUiCore) project(cafPdmUiCore)
# Unity Build # Unity Build

View File

@ -84,7 +84,7 @@ QSize QShortenedLabel::minimumSizeHint() const
QFontMetrics fontMetrics = QApplication::fontMetrics(); QFontMetrics fontMetrics = QApplication::fontMetrics();
QString fullLabelText = fullText(); QString fullLabelText = fullText();
QString shortenedText = fullLabelText.left( minimumNumberOfCharacters ); QString shortenedText = fullLabelText.left( minimumNumberOfCharacters );
int minimumWidth = fontMetrics.width( shortenedText ); int minimumWidth = fontMetrics.horizontalAdvance( shortenedText );
if ( !fullLabelText.isEmpty() ) if ( !fullLabelText.isEmpty() )
{ {
@ -94,12 +94,12 @@ QSize QShortenedLabel::minimumSizeHint() const
QStringList labelLines = fullLabelText.split( "\n" ); QStringList labelLines = fullLabelText.split( "\n" );
for ( QString line : labelLines ) for ( QString line : labelLines )
{ {
int lineWidth = fontMetrics.width( line ); int lineWidth = fontMetrics.horizontalAdvance( line );
maxLineWidth = std::max( maxLineWidth, lineWidth ); maxLineWidth = std::max( maxLineWidth, lineWidth );
QStringList words = line.split( " " ); QStringList words = line.split( " " );
if ( !words.empty() ) if ( !words.empty() )
{ {
int wordWidth = fontMetrics.width( words.front() + "..." ); int wordWidth = fontMetrics.horizontalAdvance( words.front() + "..." );
maxFirstWordWidth = std::max( maxFirstWordWidth, wordWidth ); maxFirstWordWidth = std::max( maxFirstWordWidth, wordWidth );
} }
} }
@ -127,7 +127,7 @@ QSize QShortenedLabel::sizeHint() const
int maxLineWidth = 0; int maxLineWidth = 0;
for ( const QString& line : labelLines ) for ( const QString& line : labelLines )
{ {
maxLineWidth = std::max( maxLineWidth, fontMetrics.width( line ) ); maxLineWidth = std::max( maxLineWidth, fontMetrics.horizontalAdvance( line ) );
} }
// increase size hint with a few pixels to avoid linux gui issues // increase size hint with a few pixels to avoid linux gui issues
@ -156,7 +156,7 @@ void caf::QShortenedLabel::resizeText( QSize paintSize )
int maxLineWidth = 0; int maxLineWidth = 0;
for ( const QString& line : labelLines ) for ( const QString& line : labelLines )
{ {
maxLineWidth += fontMetrics.width( line ); maxLineWidth += fontMetrics.horizontalAdvance( line );
} }
if ( maxLineWidth < paintSize.width() ) if ( maxLineWidth < paintSize.width() )

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafPdmXml) project(cafPdmXml)
# Unity Build # Unity Build

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.15)
project(cafPdmXml_UnitTests) project(cafPdmXml_UnitTests)
@ -13,10 +13,6 @@ if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
# related to TR1 # related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
message(
STATUS
"Add flag to disable warings from gtest - _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
)
endif() endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.15)
project(cafProjectDataModel_UnitTests) project(cafProjectDataModel_UnitTests)
@ -14,10 +14,6 @@ if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code # VS 2017 : Disable warnings from from gtest code, using deprecated code
# related to TR1 # related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
message(
STATUS
"Add flag to disable warings from gtest - _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
)
endif() endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp include_directories(${CMAKE_CURRENT_SOURCE_DIR} # required for gtest-all.cpp

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafTensor) project(cafTensor)
set(PROJECT_FILES cafTensor3.cpp cafTensor3.h cafTensor3.inl) set(PROJECT_FILES cafTensor3.cpp cafTensor3.h cafTensor3.inl)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.15)
project(cafTestApplication) project(cafTestApplication)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 3.15)
project(cafTestCvfApplication) project(cafTestCvfApplication)

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafUserInterface) project(cafUserInterface)
# Unity Build # Unity Build

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.15)
project(cafUserInterface_UnitTests) project(cafUserInterface_UnitTests)

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafViewer) project(cafViewer)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(cafVizExtensions) project(cafVizExtensions)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 2.8)
project(LibCore) project(LibCore)
# CMake Unity Build # CMake Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(LibGeometry) project(LibGeometry)
# CMake Unity Build # CMake Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(LibGuiQt) project(LibGuiQt)
# CMake Unity Build # CMake Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(LibRender) project(LibRender)
# Unity Build # Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(LibViewing) project(LibViewing)
# CMake Unity Build # CMake Unity Build

View File

@ -1,5 +1,3 @@
cmake_minimum_required(VERSION 3.12)
project(GrpcInterface) project(GrpcInterface)
message(STATUS "GRPC enabled") message(STATUS "GRPC enabled")

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8.12)
# Languages and global compiler settings # Languages and global compiler settings
if(CMAKE_VERSION VERSION_LESS 3.8) if(CMAKE_VERSION VERSION_LESS 3.8)

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8.12)
project ( opm-parser-tests ) project ( opm-parser-tests )
@ -15,7 +15,6 @@ endif()
if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11)) if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
# VS 2017 : Disable warnings from from gtest code, using deprecated code related to TR1 # VS 2017 : Disable warnings from from gtest code, using deprecated code related to TR1
add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING) add_definitions(-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING)
message(STATUS "Add flag to disable warings from gtest - _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
endif() endif()
CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/OpmTestDataDirectory.h.cmake CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/OpmTestDataDirectory.h.cmake

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8.12)
project (custom-opm-flowdiagnostics) project (custom-opm-flowdiagnostics)