Skip to content

Commit 7812e6c

Browse files
committed
GPU Display Qt GUI: Avoid Qt CMake AUTOMOC
1 parent 461c0cc commit 7812e6c

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎GPU/GPUTracking/display/CMakeLists.txt‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,18 @@ if(Vulkan_FOUND)
8484
endif()
8585
if(Freetype_FOUND)
8686
set(GPUCA_EVENT_DISPLAY_FREETYPE ON)
87+
if(Fontconfig_FOUND)
88+
set(GPUCA_EVENT_DISPLAY_FONTCONFIG ON)
89+
endif()
8790
endif()
8891
if(Qt6_FOUND)
8992
set(GPUCA_EVENT_DISPLAY_QT ON)
9093
endif()
94+
foreach(feature OPENGL VULKAN WAYLAND FREETYPE FONTCONFIG QT)
95+
if(NOT GPUCA_EVENT_DISPLAY_${feature})
96+
set(GPUCA_EVENT_DISPLAY_${feature} OFF)
97+
endif()
98+
endforeach()
9199

92100
set(SRCS ../utils/qsem.cxx
93101
GPUDisplay.cxx
@@ -161,12 +169,11 @@ if(GLFW_FOUND)
161169
endif()
162170

163171
if(GPUCA_EVENT_DISPLAY_QT)
164-
set(CMAKE_AUTOMOC ON)
165-
set(CMAKE_AUTORCC ON)
166-
set(CMAKE_AUTOUIC ON)
172+
qt_wrap_cpp(GPUCA_QT_MOC_SRCS frontend/GPUDisplayGUI.h) # Explicit moc / uic instead of AUTOMOC / AUTOUIC: rerun only if these files change; add new Q_OBJECT headers / .ui files here
173+
qt_wrap_ui(GPUCA_QT_UI_HDRS frontend/GPUDisplayGUI.ui)
167174

168175
set(SRCS ${SRCS} frontend/GPUDisplayGUI.cxx frontend/GPUDisplayGUIWrapper.cxx)
169-
set(SRCS_NO_H ${SRCS_NO_H} frontend/GPUDisplayGUI.ui)
176+
set(SRCS_NO_H ${SRCS_NO_H} ${GPUCA_QT_MOC_SRCS} ${GPUCA_QT_UI_HDRS})
170177
endif()
171178

172179
string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
@@ -203,7 +210,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/setinclude.sh PERMISSIONS OWNER_READ O
203210

204211
target_compile_definitions(${targetName} PRIVATE $<TARGET_PROPERTY:O2::GPUTracking,COMPILE_DEFINITIONS>)
205212

206-
message(STATUS "Building GPU Event Display (OpenGL ${GPUCA_EVENT_DISPLAY_OPENGL}, Vulkan ${GPUCA_EVENT_DISPLAY_VULKAN} ${Vulkan_VERSION}, Wayland ${GPUCA_EVENT_DISPLAY_WAYLAND}, Freetype ${GPUCA_EVENT_DISPLAY_FREETYPE}, Fontconfig ${Fontconfig_FOUND}, Qt ${GPUCA_EVENT_DISPLAY_QT})")
213+
message(STATUS "Building GPU Event Display (OpenGL ${GPUCA_EVENT_DISPLAY_OPENGL}, Vulkan ${GPUCA_EVENT_DISPLAY_VULKAN} ${Vulkan_VERSION}, Wayland ${GPUCA_EVENT_DISPLAY_WAYLAND}, Freetype ${GPUCA_EVENT_DISPLAY_FREETYPE}, Fontconfig ${GPUCA_EVENT_DISPLAY_FONTCONFIG}, Qt ${GPUCA_EVENT_DISPLAY_QT})")
207214
target_include_directories(${targetName} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
208215

209216
if(X11_FOUND)
@@ -275,7 +282,7 @@ endif()
275282
if(GPUCA_EVENT_DISPLAY_FREETYPE)
276283
target_compile_definitions(${targetName} PRIVATE GPUCA_BUILD_EVENT_DISPLAY_FREETYPE)
277284
target_link_libraries(${targetName} PRIVATE Freetype::Freetype)
278-
if(Fontconfig_FOUND)
285+
if(GPUCA_EVENT_DISPLAY_FONTCONFIG)
279286
target_compile_definitions(${targetName} PRIVATE GPUCA_BUILD_EVENT_DISPLAY_FONTCONFIG)
280287
target_link_libraries(${targetName} PRIVATE Fontconfig::Fontconfig)
281288
endif()
@@ -284,6 +291,7 @@ endif()
284291
if(GPUCA_EVENT_DISPLAY_QT)
285292
target_compile_definitions(${targetName} PRIVATE GPUCA_BUILD_EVENT_DISPLAY_QT)
286293
target_link_libraries(${targetName} PRIVATE Qt6::Widgets)
294+
target_include_directories(${targetName} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) # ui_*.h
287295
endif()
288296

289297
target_link_libraries(${targetName} PRIVATE TBB::tbb)

‎GPU/GPUTracking/display/frontend/GPUDisplayGUI.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "GPUDisplayGUI.h"
1616
#include "GPUDisplayGUIWrapper.h"
17-
#include "./ui_GPUDisplayGUI.h"
17+
#include "ui_GPUDisplayGUI.h"
1818

1919
using namespace o2::gpu;
2020

0 commit comments

Comments
 (0)