Skip to content

Commit

Permalink
Upgrade from Qt5 to Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
franziska-wegner committed Dec 2, 2023
1 parent 0ac84fd commit 9f6c1eb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ message ( STATUS "")
message ( STATUS "Other important targets:")

# QT5 found
if ( Qt5_FOUND )
message ( STATUS "${MY_SPACE}qt5:\t\t\t\tadd libraries of QT5" )
target_compile_definitions ( EGOA PUBLIC QT5_AVAILABLE )
endif ( Qt5_FOUND )
if ( Qt6_FOUND )
message ( STATUS "${MY_SPACE}qt6:\t\t\t\tadd libraries of QT6" )
target_compile_definitions ( EGOA PUBLIC QT6_AVAILABLE )
endif ( Qt6_FOUND )

# OpenMP found
if ( OPENMP_FOUND )
Expand Down Expand Up @@ -270,12 +270,12 @@ endif ( BONMIN_FOUND )
if ( EGOA_ENABLE_EXCEPTION_HANDLING )
message(STATUS "${MY_SPACE}EGOA Exceptions:\t\t${EGOA_ENABLE_EXCEPTION_HANDLING}")
target_compile_definitions(EGOA PUBLIC EGOA_ENABLE_EXCEPTION_HANDLING)
endif()
endif ( EGOA_ENABLE_EXCEPTION_HANDLING )

if ( EGOA_ENABLE_ASSERTION AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
message(STATUS "${MY_SPACE}EGOA Assertions:\t\t${EGOA_ENABLE_ASSERTION}")
target_compile_definitions(EGOA PUBLIC EGOA_ENABLE_ASSERTION)
endif( )
endif ( )

# Define a macro to get number of configured threads
target_compile_definitions ( EGOA PUBLIC EGOA_USER_DEFINED_THREAD_LIMIT=$ENV{OMP_NUM_THREADS} )
Expand Down
36 changes: 18 additions & 18 deletions cmake/QtConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# Created on: Jan 30, 2019
# Author: Franziska Wegner
#
# Find QT5 include directory and libraries for linking and its required modules.
# Find QT6 include directory and libraries for linking and its required modules.
#
# * Once done this will define
# * Qt5_FOUND - system has Qt5
# * QT5_LIBRARIES - the libraries needed to use Qt5
# * QTCORE_LOCATION - location of the module Qt5::Core
# * QTQUICK_LOCATION - location of the module Qt5::Quick
# * Qt6_FOUND - system has Qt6
# * QT6_LIBRARIES - the libraries needed to use Qt6
# * QTCORE_LOCATION - location of the module Qt6::Core
# * QTQUICK_LOCATION - location of the module Qt6::Quick

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
Expand All @@ -25,27 +25,27 @@ set(CMAKE_AUTOUIC ON)
####################################################################
# Find QT5 #########################################################
####################################################################
message(STATUS "Looking for Qt5")
FIND_PACKAGE(Qt5 COMPONENTS Core Quick Widgets Concurrent REQUIRED) #
get_target_property(QTCORE_LOCATION Qt5::Core LOCATION)
get_target_property(QTQUICK_LOCATION Qt5::Quick LOCATION) # LOCATION_Release
get_target_property(QTWIDGETS_LOCATION Qt5::Widgets LOCATION) # LOCATION_Release
get_target_property(QTConcurrent_LOCATION Qt5::Concurrent LOCATION) # LOCATION_Release
message(STATUS "Looking for Qt6")
find_package(Qt6 REQUIRED COMPONENTS Core Quick Widgets Concurrent)
get_target_property(QTCORE_LOCATION Qt6::Core LOCATION)
get_target_property(QTQUICK_LOCATION Qt6::Quick LOCATION) # LOCATION_Release
get_target_property(QTWIDGETS_LOCATION Qt6::Widgets LOCATION) # LOCATION_Release
get_target_property(QTConcurrent_LOCATION Qt6::Concurrent LOCATION) # LOCATION_Release
add_definitions( ${QT_DEFINITIONS} )

####################################################################
# Output Message ###################################################
####################################################################
if(Qt5_FOUND)
message( STATUS "${MY_SPACE}Found Qt5 Core module in \"${QTCORE_LOCATION}\" " )
message( STATUS "${MY_SPACE}Found Qt5 Quick module in \"${QTQUICK_LOCATION}\" " )
message( STATUS "${MY_SPACE}Found Qt5 Widgets module in \"${QTWIDGETS_LOCATION}\" " )
message( STATUS "${MY_SPACE}Found Qt5 Concurrent module in \"${QTConcurrent_LOCATION}\" " )
if(Qt6_FOUND)
message( STATUS "${MY_SPACE}Found Qt6 Core module in \"${QTCORE_LOCATION}\" " )
message( STATUS "${MY_SPACE}Found Qt6 Quick module in \"${QTQUICK_LOCATION}\" " )
message( STATUS "${MY_SPACE}Found Qt6 Widgets module in \"${QTWIDGETS_LOCATION}\" " )
message( STATUS "${MY_SPACE}Found Qt6 Concurrent module in \"${QTConcurrent_LOCATION}\" " )
endif()

####################################################################
# Check if QT is available #########################################
####################################################################
set ( QT5_LIBRARIES Qt5::Core Qt5::Quick Qt5::Widgets )
set ( QT6_LIBRARIES Qt6::Core Qt6::Quick Qt6::Widgets )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QT5 DEFAULT_MSG QT5_LIBRARIES)
find_package_handle_standard_args(QT6 DEFAULT_MSG QT6_LIBRARIES)

0 comments on commit 9f6c1eb

Please sign in to comment.