chore(cpn): cmake use automoc and autouic (#4258)

This commit is contained in:
Neil Horne
2023-10-28 20:03:29 +10:00
committed by GitHub
parent e8d555da11
commit 9dd4a1e95c
11 changed files with 383 additions and 431 deletions
+39 -58
View File
@@ -1,68 +1,49 @@
include_directories(
${CMAKE_SOURCE_DIR}
${COMPANION_SRC_DIRECTORY}
${CMAKE_CURRENT_BINARY_DIR}
${maxLibQt_SOURCE_DIR}/widgets
)
set(modeledit_NAMES
modeledit
setup
heli
telemetry
expodialog
mixerdialog
project(modeledit)
set(${PROJECT_NAME}_NAMES
channels
checklistdialog
colorcustomscreens
curves
customfunctions
expodialog
flightmodes
inputs
heli
logicalswitches
mixerdialog
mixes
mixerslistwidget
modeledit
modeloptions
setup
telemetry
telemetry_customscreens
)
set(modeledit_SRCS
flightmodes.cpp
inputs.cpp
mixes.cpp
channels.cpp
logicalswitches.cpp
customfunctions.cpp
mixerslistwidget.cpp
# node.cpp ## node and edge are built in common lib because also used by simulator
# edge.cpp ## commenting them here avoids a "duplicate target" warning eg. from ninja
colorcustomscreens.cpp
telemetry_customscreens.cpp
curves.cpp
modeloptions.cpp
AddHeadersSources()
# AUTOMOC does not detect so manually process
qt5_wrap_cpp(${PROJECT_NAME}_SRCS
${${PROJECT_NAME}_HDRS}
)
set(modeledit_HDRS
flightmodes.h
inputs.h
mixes.h
channels.h
logicalswitches.h
customfunctions.h
mixerslistwidget.h
# node.h
colorcustomscreens.h
telemetry_customscreens.h
curves.h
modeloptions.h
add_library(${PROJECT_NAME}
${${PROJECT_NAME}_SRCS}
)
set(modeledit_UIS
setup_timer.ui
setup_module.ui
setup_function_switches.ui
flightmode.ui
telemetry_customscreen.ui
telemetry_sensor.ui
target_link_libraries(${PROJECT_NAME}
PRIVATE
${CPN_COMMON_LIB}
Qt5::Multimedia
)
foreach(name ${modeledit_NAMES})
set(modeledit_SRCS ${modeledit_SRCS} ${name}.cpp)
set(modeledit_HDRS ${modeledit_HDRS} ${name}.h)
set(modeledit_UIS ${modeledit_UIS} ${name}.ui)
endforeach()
qt5_wrap_ui(modeledit_SRCS ${modeledit_UIS})
qt5_wrap_cpp(modeledit_SRCS ${modeledit_HDRS})
add_library(modeledit ${modeledit_SRCS})
target_link_libraries(modeledit PRIVATE datamodels ${CPN_COMMON_LIB} Qt5::Multimedia)
target_include_directories(${PROJECT_NAME}
PRIVATE
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
"${maxLibQt_SOURCE_DIR}/widgets"
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}"
)