mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
#4448 Clean up ResInsight Qt5-checks
This commit is contained in:
parent
9cf0b7cb86
commit
6691dca4ca
@ -5,19 +5,6 @@ project (ApplicationCode)
|
||||
# Open GL
|
||||
find_package( OpenGL )
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS Core QUIET)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGL Network Script Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Script Qt5::Widgets)
|
||||
else()
|
||||
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork QtScript)
|
||||
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
# NB: The generated file is written to Cmake binary folder to avoid source tree pollution
|
||||
# This folder is added to include_directories
|
||||
CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/ApplicationCode/Adm/RiaVersionInfo.h.cmake
|
||||
@ -98,6 +85,7 @@ list( APPEND CPP_SOURCES
|
||||
${UNIT_TEST_FILES}
|
||||
)
|
||||
|
||||
option(RESINSIGHT_ENABLE_GRPC "Enable the gRPC scripting framework" OFF)
|
||||
if (RESINSIGHT_ENABLE_GRPC)
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
GrpcInterface/CMakeLists.cmake
|
||||
@ -250,15 +238,6 @@ set ( QT_MOC_HEADERS
|
||||
SocketInterface/RiaSocketServer.h
|
||||
)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt5_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
else()
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
endif()
|
||||
|
||||
|
||||
# NOTE! Resources in subfolders must append to QRC_FILES using the following statement
|
||||
# set( QRC_FILES
|
||||
# ${QRC_FILES}
|
||||
@ -271,18 +250,19 @@ set( QRC_FILES
|
||||
Resources/ResInsight.qrc
|
||||
)
|
||||
|
||||
# Runs RCC on specified files
|
||||
if ( NOT CMAKE_AUTOMOC)
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
else()
|
||||
qt4_add_resources( QRC_FILES_CPP
|
||||
${QRC_FILES}
|
||||
)
|
||||
endif(Qt5Core_FOUND)
|
||||
endif(NOT CMAKE_AUTOMOC)
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Gui OpenGL Network Script Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Network Qt5::Script Qt5::Widgets)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS})
|
||||
qt5_wrap_ui(FORM_FILES_CPP ${QT_UI_FILES})
|
||||
qt5_add_resources(QRC_FILES_CPP ${QRC_FILES})
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl QtNetwork QtScript REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS})
|
||||
qt4_wrap_ui(FORM_FILES_CPP ${QT_UI_FILES})
|
||||
qt4_add_resources(QRC_FILES_CPP ${QRC_FILES})
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
# Adding resource (RC) files for Windows
|
||||
if ( MSVC )
|
||||
@ -486,7 +466,7 @@ endif()
|
||||
if (MSVC)
|
||||
|
||||
# Qt DLLs
|
||||
if (Qt5Core_FOUND)
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
message(STATUS "Creating post build step for copying Qt DLLs")
|
||||
foreach (qtlib ${QT_LIBRARIES})
|
||||
add_custom_command(TARGET ResInsight POST_BUILD
|
||||
@ -494,11 +474,11 @@ if (MSVC)
|
||||
)
|
||||
endforeach(qtlib)
|
||||
else()
|
||||
set (QTLIBLIST QtCore4 QtCored4 QtGui4 QtGuid4 QtOpenGl4 QtOpenGld4 QtNetwork4 QtNetworkd4 QtScript4 QtScriptd4 QtScriptTools4 QtScriptToolsd4)
|
||||
set (QTLIBLIST QtCore QtGui QtGui QtOpenGl QtNetwork QtScript QtScriptTools)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/${qtlib}.dll)
|
||||
list(APPEND RI_DLL_FILENAMES ${QT_BINARY_DIR}/$<IF:$<CONFIG:Debug>,${qtlib}d4.dll,${qtlib}4.dll>)
|
||||
endforeach( qtlib )
|
||||
endif()
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
# Odb Dlls
|
||||
if (RESINSIGHT_USE_ODB_API)
|
||||
# Find all the dlls
|
||||
@ -595,7 +575,7 @@ if (RESINSIGHT_PRIVATE_INSTALL)
|
||||
|
||||
set (RESINSIGHT_FILES ${RI_DLL_FILENAMES})
|
||||
|
||||
if(Qt5_FOUND AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
||||
if(RESINSIGHT_BUILD_WITH_QT5 AND WIN32 AND TARGET Qt5::qmake AND NOT TARGET Qt5::windeployqt)
|
||||
get_target_property(_qt5_qmake_location Qt5::qmake IMPORTED_LOCATION)
|
||||
|
||||
execute_process(
|
||||
|
@ -2,35 +2,20 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (WellPathImportSsihub)
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS Core QUIET)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
find_package(Qt5 CONFIG REQUIRED Core Network)
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtNetwork REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
endif(Qt5Core_FOUND)
|
||||
|
||||
# These headers need to go through Qt's MOC compiler
|
||||
set( QT_MOC_HEADERS
|
||||
set( MOC_HEADER_FILES
|
||||
RiuWellImportWizard.h
|
||||
)
|
||||
|
||||
|
||||
set( QT_UI_FILES
|
||||
)
|
||||
|
||||
if ( NOT CMAKE_AUTOMOC )
|
||||
if (Qt5Core_FOUND)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt5_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
else()
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${QT_MOC_HEADERS} )
|
||||
qt4_wrap_ui( FORM_FILES_CPP ${QT_UI_FILES} )
|
||||
endif()
|
||||
endif()
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Network)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Network)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtNetwork REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
@ -38,7 +23,6 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../FileInterface
|
||||
)
|
||||
|
||||
|
||||
add_library( ${PROJECT_NAME}
|
||||
RimWellPathImport.h
|
||||
RimWellPathImport.cpp
|
||||
@ -58,10 +42,6 @@ add_library( ${PROJECT_NAME}
|
||||
${HEADER_FILES}
|
||||
)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Network)
|
||||
endif()
|
||||
|
||||
target_link_libraries ( ${PROJECT_NAME}
|
||||
cafUserInterface cafPdmCvf CommonCode ${QT_LIBRARIES}
|
||||
)
|
||||
|
@ -253,27 +253,13 @@ list(APPEND THIRD_PARTY_LIBRARIES
|
||||
################################################################################
|
||||
# Qt
|
||||
################################################################################
|
||||
option(RESINSIGHT_BUILD_WITH_QT5 "Use Qt5 folder" OFF)
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
message(STATUS "Attempting to build with Qt5")
|
||||
find_package(Qt5 COMPONENTS Core QUIET)
|
||||
else()
|
||||
message(STATUS "Attempting to build with Qt4")
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
option(RESINSIGHT_BUILD_WITH_QT5 "Use Qt5" OFF)
|
||||
|
||||
if (Qt5Core_FOUND)
|
||||
message(STATUS "Found Qt5")
|
||||
find_package (Qt5 CONFIG REQUIRED Core Widgets OpenGL Network Script ScriptTools)
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Gui OpenGL Network Script ScriptTools Widgets)
|
||||
else()
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
message(WARNING "Could not find Qt5. Trying with Qt4")
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtMain REQUIRED)
|
||||
if (QT_VERSION_MINOR LESS 6)
|
||||
message(FATAL_ERROR "Qt 4.6 is required, please specify qmake for variable QT_QMAKE_EXECUTABLE")
|
||||
endif()
|
||||
include(${QT_USE_FILE})
|
||||
endif(Qt5Core_FOUND)
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl QtNetwork QtScript QtScriptTools REQUIRED)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
# Open GL
|
||||
find_package( OpenGL )
|
||||
|
23
ThirdParty/Qwt/src/CMakeLists.txt
vendored
23
ThirdParty/Qwt/src/CMakeLists.txt
vendored
@ -7,13 +7,6 @@ if (MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
|
||||
endif()
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS Concurrent Core OpenGL PrintSupport Widgets REQUIRED)
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL qtmain REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
# Adapted from src.pri file in Qwt's source catalog for Qwt 6.1.0
|
||||
# Compiles static library
|
||||
# Some bits removed (at least SVG)
|
||||
@ -275,16 +268,16 @@ qwt_thermo.h
|
||||
qwt_wheel.h
|
||||
)
|
||||
|
||||
|
||||
|
||||
set(MOC_SOURCE_FILES)
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
|
||||
find_package(Qt5 COMPONENTS REQUIRED Concurrent Core Gui OpenGL PrintSupport Widgets)
|
||||
set(QT_LIBRARIES Qt5::Concurrent Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::PrintSupport Qt5::Widgets)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
|
||||
else()
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
|
||||
add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES} ${MOC_SOURCE_FILES})
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
@ -292,9 +285,7 @@ target_include_directories(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Concurrent Qt5::Core Qt5::OpenGL Qt5::PrintSupport Qt5::Widgets)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES})
|
||||
|
||||
if (COMMAND caf_apply_cotire)
|
||||
caf_apply_cotire("${PROJECT_NAME}")
|
||||
|
10
ThirdParty/expressionparser/CMakeLists.txt
vendored
10
ThirdParty/expressionparser/CMakeLists.txt
vendored
@ -7,10 +7,12 @@ if(MSVC)
|
||||
message(STATUS "MSVC: Enabled increased number of sections in object files")
|
||||
endif()
|
||||
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core)
|
||||
set(QT_LIBRARIES Qt5::Core)
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore REQUIRED)
|
||||
find_package(Qt4 COMPONENTS QtCore REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
@ -35,8 +37,6 @@ if(MSVC)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES})
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
11
ThirdParty/nightcharts/CMakeLists.txt
vendored
11
ThirdParty/nightcharts/CMakeLists.txt
vendored
@ -3,10 +3,13 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
project (nightcharts)
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Widgets)
|
||||
set(QT_LIBRARIES Qt5::Core Qt5::Widgets)
|
||||
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
|
||||
else()
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
|
||||
find_package(Qt4 COMPONENTS QtCore QtWidgets)
|
||||
include(${QT_USE_FILE})
|
||||
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
@ -26,8 +29,6 @@ target_include_directories(${PROJECT_NAME}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if (RESINSIGHT_BUILD_WITH_QT5)
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets)
|
||||
endif(RESINSIGHT_BUILD_WITH_QT5)
|
||||
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES})
|
||||
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
Loading…
Reference in New Issue
Block a user