Commit 05dc6051 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Adapt build system for building against qt6

parent 4916dd0f
Pipeline #198091 passed with stage
in 6 minutes and 22 seconds
......@@ -2,7 +2,7 @@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Core @QT_REQUIRED_VERSION@)
find_dependency(Qt@QT_REQUIRED_VERSION@Core @QT_REQUIRED_VERSION@)
find_dependency(Qt5Xml @QT_REQUIRED_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/Analitza5Targets.cmake")
project(Analitza)
cmake_minimum_required(VERSION 3.16)
set(ANALITZA_VERSION "8.0.0")
project(Analitza VERSION ${ANALITZA_VERSION})
cmake_minimum_required(VERSION 3.5)
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.90.0")
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
find_package(ECM 1.7.0 REQUIRED NO_MODULE)
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
#Checking whether we can compile calgebra
set(QT_REQUIRED_VERSION 5.6)
find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Xml Svg Test Qml Quick PrintSupport)
include(CMakePackageConfigHelpers)
include(FeatureSummary)
include(ECMAddAppIcon)
include(ECMSetupVersion)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMAddTests)
include(KDEInstallDirs)
include(KDECMakeSettings)
......@@ -22,6 +24,10 @@ include(GenerateExportHeader)
include(CheckIncludeFiles)
include(CheckLibraryExists) #FindCurses seems to need that on the CI
include(ECMPoQmTools)
find_package(Qt${QT_MAJOR_VERSION} ${QT_REQUIRED_VERSION} REQUIRED NO_MODULE COMPONENTS Widgets Xml Svg Test Qml Quick PrintSupport)
if (QT_MAJOR_VERSION STREQUAL "6")
find_package(Qt6Core5Compat)
endif()
set(ANALITZA_INCLUDE_INSTALL_DIR "${KDE_INSTALL_INCLUDEDIR}/Analitza5")
ecm_setup_version(8.0.0 VARIABLE_PREFIX ANALITZA
......@@ -50,7 +56,7 @@ configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/Analitza5Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Analitza5Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
PATH_VARS KDE_INSTALL_INCLUDEDIR CMAKE_INSTALL_PREFIX
)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config-analitza.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-analitza.h)
......
......@@ -52,10 +52,15 @@ set(analitza_SRCS
ecm_create_qm_loader(analitza_SRCS analitza_qt)
add_library(Analitza ${analitza_SRCS})
target_link_libraries(Analitza PUBLIC Qt5::Core PRIVATE Qt5::Xml)
target_link_libraries(Analitza PUBLIC Qt::Core PRIVATE Qt::Xml)
if (QT_MAJOR_VERSION STREQUAL "6")
target_link_libraries(Analitza PRIVATE Qt6::Core5Compat)
endif()
target_include_directories(Analitza INTERFACE "$<INSTALL_INTERFACE:${ANALITZA_INCLUDE_INSTALL_DIR}>")
set_target_properties(Analitza PROPERTIES VERSION ${ANALITZA_VERSION_STRING} SOVERSION ${ANALITZA_SOVERSION} )
set_target_properties(Analitza PROPERTIES VERSION ${ANALITZA_VERSION} SOVERSION ${ANALITZA_SOVERSION} )
if(EIGEN3_FOUND)
target_sources(Analitza PRIVATE commands/eigencommands.cpp)
......
set(testLibs Qt5::Core Qt5::Xml Qt5::Test Analitza)
set(testLibs Qt::Core Qt::Xml Qt::Test Analitza)
ecm_add_tests(
analitzatest.cpp
......
add_subdirectory(tests)
add_library(AnalitzaGui operatorsmodel.cpp algebrahighlighter.cpp variablesmodel.cpp)
target_link_libraries(AnalitzaGui Qt5::Core Qt5::Gui Analitza)
target_link_libraries(AnalitzaGui Qt::Core Qt::Gui Analitza)
set_target_properties(AnalitzaGui PROPERTIES VERSION ${ANALITZA_VERSION_STRING} SOVERSION ${ANALITZA_SOVERSION} )
set_target_properties(AnalitzaGui PROPERTIES VERSION ${ANALITZA_VERSION} SOVERSION ${ANALITZA_SOVERSION} )
generate_export_header(AnalitzaGui EXPORT_FILE_NAME analitzaguiexport.h)
......
ecm_add_tests(
operatorsmodeltest.cpp
LINK_LIBRARIES Qt5::Xml Qt5::Test Qt5::Gui Analitza AnalitzaGui
LINK_LIBRARIES Qt::Xml Qt::Test Qt::Gui Analitza AnalitzaGui
)
......@@ -59,11 +59,11 @@ add_library( AnalitzaPlot ${analitzaplot_SRCS} )
target_link_libraries ( AnalitzaPlot
PUBLIC
Analitza
Qt5::Core
Qt5::Gui
Qt::Core
Qt::Gui
PRIVATE
Qt5::PrintSupport # this pulls widgets
Qt::PrintSupport # this pulls widgets
)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
......@@ -72,7 +72,7 @@ elseif(WIN32)
target_link_libraries(AnalitzaPlot PRIVATE ${GLEW_LIBRARIES})
endif()
set_target_properties(AnalitzaPlot PROPERTIES VERSION ${ANALITZA_VERSION_STRING} SOVERSION ${ANALITZA_SOVERSION} )
set_target_properties(AnalitzaPlot PROPERTIES VERSION ${ANALITZA_VERSION} SOVERSION ${ANALITZA_SOVERSION} )
generate_export_header(AnalitzaPlot EXPORT_FILE_NAME analitzaplotexport.h)
......
......@@ -13,5 +13,5 @@ target_link_libraries(export3dplotdemo AnalitzaWidgets)
find_library(SNDFILE sndfile)
if (SNDFILE_FOUND)
add_executable(audioplots audioplots.cpp)
target_link_libraries(audioplots Qt5::Core AnalitzaPlot sndfile)
target_link_libraries(audioplots Qt::Core AnalitzaPlot sndfile)
endif()
......@@ -5,7 +5,7 @@ ecm_add_tests(
plotsmodeltest.cpp
plotsdictionarymodeltest.cpp
LINK_LIBRARIES Qt5::Xml Qt5::Test Qt5::Gui Analitza AnalitzaPlot AnalitzaGui
LINK_LIBRARIES Qt::Xml Qt::Test Qt::Gui Analitza AnalitzaPlot AnalitzaGui
)
function(test_export name expression)
......
......@@ -11,11 +11,11 @@ set(analitzaplot_SRCS
)
add_library(AnalitzaWidgets ${analitzaplot_SRCS})
target_link_libraries(AnalitzaWidgets PUBLIC Qt5::Widgets Analitza AnalitzaPlot AnalitzaGui
PRIVATE Qt5::Svg
target_link_libraries(AnalitzaWidgets PUBLIC Qt::Widgets Analitza AnalitzaPlot AnalitzaGui
PRIVATE Qt::Svg
)
set_target_properties(AnalitzaWidgets PROPERTIES VERSION ${ANALITZA_VERSION_STRING} SOVERSION ${ANALITZA_SOVERSION} )
set_target_properties(AnalitzaWidgets PROPERTIES VERSION ${ANALITZA_VERSION} SOVERSION ${ANALITZA_SOVERSION} )
generate_export_header(AnalitzaWidgets)
......
......@@ -6,7 +6,7 @@ add_library(analitzadeclarativeplugin SHARED
)
target_link_libraries(analitzadeclarativeplugin
Qt5::Core Qt5::Gui Qt5::Qml Qt5::Quick
Qt::Core Qt::Gui Qt::Qml Qt::Quick
Analitza AnalitzaGui AnalitzaPlot)
install(TARGETS analitzadeclarativeplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/analitza)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment