connected to gui

This commit is contained in:
zanostro 2025-11-12 19:05:16 +01:00
parent 42e884aced
commit 8a6e916876
7 changed files with 165 additions and 3 deletions

View file

@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.16)
project(simulator_qt LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# Prefer Qt6, fall back to Qt5
find_package(Qt6 COMPONENTS Widgets QUIET)
if(NOT Qt6_FOUND)
# Try explicitly the system Qt6 cmake prefix on Debian/Ubuntu
find_package(Qt6 COMPONENTS Widgets QUIET PATHS /usr/lib/x86_64-linux-gnu)
endif()
if(NOT Qt6_FOUND)
# Fallback: try Qt5 if Qt6 is unavailable
find_package(Qt5 COMPONENTS Widgets QUIET)
endif()
if(Qt6_FOUND)
set(QT_LIB Qt6::Widgets)
elseif(Qt5_FOUND)
set(QT_LIB Qt5::Widgets)
else()
message(FATAL_ERROR "Qt6 or Qt5 not found. Install Qt development packages or set CMAKE_PREFIX_PATH to your Qt installation.")
endif()
set(GUI_SRCS
main.cpp
MainWindow.cpp
MachineController.cpp
)
set(GUI_HDRS
MainWindow.h
MachineController.h
)
add_executable(simulator_qt ${GUI_SRCS} ${GUI_HDRS})
# Use top-level include folder (works when added with add_subdirectory)
target_include_directories(simulator_qt PRIVATE ${CMAKE_SOURCE_DIR}/include)
# Link to core library target (must be defined by top-level CMake)
target_link_libraries(simulator_qt PRIVATE simulator_lib ${QT_LIB})
# Place runtime binary under repo/target/bin to match project layout
set_target_properties(simulator_qt PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/target/bin
)