Skip to content

Commit

Permalink
Use Qt versionless
Browse files Browse the repository at this point in the history
  • Loading branch information
dantti committed Jan 12, 2024
1 parent 2b3d692 commit 1c9dbc0
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 43 deletions.
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-examples.h.cmake ${CMAKE_CURRE

add_subdirectory(layoutexport)
add_subdirectory(export)
if(Qt${Qt_VERSION_MAJOR}RemoteObjects_FOUND)
if(TARGET Qt::RemoteObjects)
add_subdirectory(qsmdebugger)
if(Qt${Qt_VERSION_MAJOR}Scxml_FOUND)
if(TARGET Qt::Scxml)
add_subdirectory(qscxmldebugger)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion examples/layoutexport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
#

add_executable(layoutexport main.cpp)
target_link_libraries(layoutexport KDSME::Core Qt${Qt_VERSION_MAJOR}::Gui)
target_link_libraries(layoutexport KDSME::Core Qt::Gui)
14 changes: 7 additions & 7 deletions examples/qscxmldebugger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@
add_executable(qscxmldebugger trafficlight.cpp main.cpp trafficlight-widgets-static.qrc)
# Copy the .rep file to your project
if(NOT BUILD_QT6)
qt5_generate_repc(REPC_SRCS ../../src/debuginterface/debuginterface.rep REPLICA)
qt_generate_repc(REPC_SRCS ../../src/debuginterface/debuginterface.rep REPLICA)

qt5_add_statecharts(STATECHART_SRCS statemachine.scxml)
qt_add_statecharts(STATECHART_SRCS statemachine.scxml)
# Work-around QTBUG-84387
# Needed in Qt5, otherwise we'll run into duplicate symbol issues like this:
# ld: error: duplicate symbol: TrafficLightStateMachine::qt_metacall(QMetaObject::Call, int, void**)
set_source_files_properties(${STATECHART_SRCS} PROPERTIES GENERATED TRUE SKIP_AUTOGEN ON)
target_sources(qscxmldebugger PRIVATE ${REPC_SRCS} ${STATECHART_SRCS})
endif()
if(BUILD_QT6)
qt6_add_repc_replicas(qscxmldebugger ../../src/debuginterface/debuginterface.rep)
qt6_add_statecharts(qscxmldebugger statemachine.scxml)
qt_add_repc_replicas(qscxmldebugger ../../src/debuginterface/debuginterface.rep)
qt_add_statecharts(qscxmldebugger statemachine.scxml)
endif()
target_link_libraries(
qscxmldebugger
KDSME::Core
KDSME::View
KDSME::DebugInterfaceClient
KDSME::DebugInterfaceSource
Qt${Qt_VERSION_MAJOR}::Widgets
Qt${Qt_VERSION_MAJOR}::RemoteObjects
Qt${Qt_VERSION_MAJOR}::Scxml
Qt::Widgets
Qt::RemoteObjects
Qt::Scxml
)
2 changes: 1 addition & 1 deletion examples/scxmlimport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
#

add_executable(scxmlimport main.cpp)
target_link_libraries(scxmlimport KDSME::Core KDSME::View Qt${Qt_VERSION_MAJOR}::Gui)
target_link_libraries(scxmlimport KDSME::Core KDSME::View Qt::Gui)
2 changes: 1 addition & 1 deletion examples/simplestatemachine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
#

add_executable(simplestatemachine main.cpp)
target_link_libraries(simplestatemachine KDSME::Core KDSME::View Qt${Qt_VERSION_MAJOR}::Gui)
target_link_libraries(simplestatemachine KDSME::Core KDSME::View Qt::Gui)
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(core)
add_subdirectory(view)

if(Qt${Qt_VERSION_MAJOR}RemoteObjects_FOUND)
if(TARGET Qt${Qt_VERSION_MAJOR}::RemoteObjects)
add_subdirectory(debuginterface)
endif()

Expand Down
6 changes: 3 additions & 3 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

set(KDSME_APPBIN ${CMAKE_PROJECT_NAME})

set(BIN_SRCS mainwindow.cpp main.cpp)
set(BIN_SRCS mainwindow.cpp mainwindow.h main.cpp)
set(BIN_UIS mainwindow.ui)

add_executable(${KDSME_APPBIN} WIN32 ${BIN_SRCS} ${BIN_UIS})
target_link_libraries(
${KDSME_APPBIN} Qt${Qt_VERSION_MAJOR}::QuickWidgets kdstatemachineeditor_core kdstatemachineeditor_view
kdsme_testhelper
${KDSME_APPBIN} PUBLIC Qt${Qt_VERSION_MAJOR}::QuickWidgets kdstatemachineeditor_core kdstatemachineeditor_view
kdsme_testhelper
)
41 changes: 36 additions & 5 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,64 @@
#

set(LIB_SRCS
debug.cpp
debug.h
export/abstractexporter.cpp
export/abstractexporter.h
export/qmlexporter.cpp
export/qmlexporter.h
export/scxmlexporter.cpp
export/scxmlexporter.h
export/svgexporter.cpp
export/svgexporter.h
import/abstractimporter.cpp
import/abstractimporter.h
import/scxmlimporter.cpp
import/scxmlimporter.h
layout/layerwiselayouter.cpp
layout/layerwiselayouter.h
layout/layouter.cpp
layout/layouter.h
layout/layoutimportexport.cpp
layout/layoutimportexport.h
layout/layoutproperties.cpp
layout/layoutproperties.h
layout/layoututils.cpp
layout/layoututils.h
model/element.cpp
model/element.h
model/elementfactory.cpp
model/elementfactory.h
model/elementmodel.cpp
model/elementmodel.h
model/elementutil.cpp
model/elementutil.h
model/runtimecontroller.cpp
model/runtimecontroller.h
model/state.cpp
model/state.h
model/transition.cpp
import/abstractimporter.cpp
import/scxmlimporter.cpp
model/transition.h
util/depthchecker.cpp
util/depthchecker.h
util/objecthelper.cpp
util/objecthelper.h
util/objecttreemodel.cpp
debug.cpp
util/objecttreemodel.h
)

if(GRAPHVIZ_FOUND)
list(APPEND LIB_SRCS layout/graphvizlayout/gvutils.cpp layout/graphvizlayout/graphvizlayerlayouter.cpp
layout/graphvizlayout/graphvizlayouter.cpp layout/graphvizlayout/graphvizlayouterbackend.cpp
list(
APPEND
LIB_SRCS
layout/graphvizlayout/graphvizlayerlayouter.cpp
layout/graphvizlayout/graphvizlayerlayouter.h
layout/graphvizlayout/graphvizlayouter.cpp
layout/graphvizlayout/graphvizlayouter.h
layout/graphvizlayout/graphvizlayouterbackend.cpp
layout/graphvizlayout/graphvizlayouterbackend_p.h
layout/graphvizlayout/gvutils.cpp
layout/graphvizlayout/gvutils.h
)
if(WITH_STATIC_GRAPHVIZ)
list(APPEND LIB_SRCS layout/graphvizlayout/graphviz_staticbuild.c)
Expand Down
32 changes: 12 additions & 20 deletions src/core/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,62 +22,54 @@ if(TARGET Qt5::XmlPatterns_FOUND AND NOT APPLE)
endif()

add_library(kdsme_testhelper STATIC parsehelper.cpp util.cpp)
target_link_libraries(kdsme_testhelper Qt${Qt_VERSION_MAJOR}::Test kdstatemachineeditor_core)
target_link_libraries(kdsme_testhelper Qt::Test kdstatemachineeditor_core)

if(GRAPHVIZ_FOUND)
ecm_add_test(test_layouter.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Gui kdsme_testhelper)
ecm_add_test(test_layouter.cpp LINK_LIBRARIES Qt::Gui kdsme_testhelper)
endif()

ecm_add_test(test_layoutitem.cpp LINK_LIBRARIES kdsme_testhelper)

ecm_add_test(
test_models.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Gui Qt${Qt_VERSION_MAJOR}::Test kdstatemachineeditor_core
)
ecm_add_test(test_models.cpp LINK_LIBRARIES Qt::Gui Qt::Test kdstatemachineeditor_core)

ecm_add_test(test_qmlexport.cpp LINK_LIBRARIES kdsme_testhelper)

if(Qt${Qt_VERSION_MAJOR}RemoteObjects_FOUND)
if(TARGET Qt::RemoteObjects)
set(SRCS test_qsmintegration.cpp)
if(NOT BUILD_QT6)
qt5_generate_repc(SRCS ../../debuginterface/debuginterface.rep REPLICA)
qt_generate_repc(SRCS ../../debuginterface/debuginterface.rep REPLICA)
endif()
ecm_add_test(
${SRCS}
TEST_NAME
test_qsmintegration
LINK_LIBRARIES
Qt${Qt_VERSION_MAJOR}::RemoteObjects
Qt${Qt_VERSION_MAJOR}::Test
Qt::RemoteObjects
Qt::Test
kdstatemachineeditor_debuginterfaceclient
kdstatemachineeditor_debuginterfacesource
kdsme_testhelper
)
if(BUILD_QT6)
target_link_libraries(test_qsmintegration Qt6::StateMachine)
qt6_add_repc_replicas(test_qsmintegration ../../debuginterface/debuginterface.rep)
qt_add_repc_replicas(test_qsmintegration ../../debuginterface/debuginterface.rep)
endif()
endif()

ecm_add_test(test_scxmlimport.cpp LINK_LIBRARIES kdsme_testhelper)

if(DEFINED KDSME_TESTHELPER_EXTRA_LIBS)
ecm_add_test(
test_scxmlexport.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Test ${KDSME_TESTHELPER_EXTRA_LIBS}
kdstatemachineeditor_core
)
ecm_add_test(test_scxmlexport.cpp LINK_LIBRARIES Qt::Test ${KDSME_TESTHELPER_EXTRA_LIBS} kdstatemachineeditor_core)
else()
ecm_add_test(test_scxmlexport.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Test kdstatemachineeditor_core)
ecm_add_test(test_scxmlexport.cpp LINK_LIBRARIES Qt::Test kdstatemachineeditor_core)
endif()

ecm_add_test(test_statemachine.cpp LINK_LIBRARIES kdsme_testhelper)

ecm_add_test(test_util.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Gui kdsme_testhelper)
ecm_add_test(test_util.cpp LINK_LIBRARIES Qt::Gui kdsme_testhelper)

if(NOT BUILD_QT6 OR Qt6Core5Compat_FOUND)
ecm_add_test(
test_layoutinformation.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Gui Qt${Qt_VERSION_MAJOR}::Test
kdstatemachineeditor_core
)
ecm_add_test(test_layoutinformation.cpp LINK_LIBRARIES Qt::Gui Qt::Test kdstatemachineeditor_core)
if(BUILD_QT6)
target_link_libraries(test_layoutinformation Qt6::Core5Compat)
endif()
Expand Down
4 changes: 2 additions & 2 deletions src/view/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
# Contact [email protected] if any conditions of this licensing are not clear to you.
#

ecm_add_test(test_commands.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Test kdstatemachineeditor_view)
ecm_add_test(test_commands.cpp LINK_LIBRARIES Qt::Test kdstatemachineeditor_view)

ecm_add_test(test_statemachineview.cpp LINK_LIBRARIES Qt${Qt_VERSION_MAJOR}::Test kdstatemachineeditor_view)
ecm_add_test(test_statemachineview.cpp LINK_LIBRARIES Qt::Test kdstatemachineeditor_view)

0 comments on commit 1c9dbc0

Please sign in to comment.