diff --git a/simulator_SIC_XE/.gitignore b/simulator_SIC_XE/.gitignore index 70b91f4..6b70294 100644 --- a/simulator_SIC_XE/.gitignore +++ b/simulator_SIC_XE/.gitignore @@ -71,7 +71,6 @@ xcuserdata/ *.moc.cpp *.qm *.prl -CMakeLists.txt.user # OS generated files .DS_Store diff --git a/simulator_SIC_XE/CMakeLists.txt b/simulator_SIC_XE/CMakeLists.txt index fe0a86a..242ebd3 100644 --- a/simulator_SIC_XE/CMakeLists.txt +++ b/simulator_SIC_XE/CMakeLists.txt @@ -4,7 +4,7 @@ project(simulator_SIC_XE VERSION 1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# Put all build outputs under target/bin +# Put all build outputs under target/bin as requested set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/target/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIR}) @@ -28,7 +28,8 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/src/main.cpp") target_link_libraries(simulator_exec PRIVATE simulator_lib) endif() - +# Convenience target: `cmake --build build --target run` +# This target will build `simulator_exec` (if present) and then execute it. if(TARGET simulator_exec) add_custom_target(run DEPENDS simulator_exec @@ -42,7 +43,3 @@ endif() message(STATUS "Project: ${PROJECT_NAME}") message(STATUS "Sources found: ${SOURCES}") message(STATUS "Output directory: ${OUTPUT_DIR}") - -if(EXISTS "${CMAKE_SOURCE_DIR}/gui/qt/CMakeLists.txt") - add_subdirectory(gui/qt) -endif() diff --git a/simulator_SIC_XE/gui/qt/CMakeLists.txt b/simulator_SIC_XE/gui/qt/CMakeLists.txt deleted file mode 100644 index 0b42058..0000000 --- a/simulator_SIC_XE/gui/qt/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -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 -) \ No newline at end of file diff --git a/simulator_SIC_XE/gui/qt/MachineController.cpp b/simulator_SIC_XE/gui/qt/MachineController.cpp deleted file mode 100644 index f066e23..0000000 --- a/simulator_SIC_XE/gui/qt/MachineController.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "MachineController.h" -#include - -MachineController::MachineController(QObject *parent) - : QObject(parent) -{ -} - -MachineController::~MachineController() { - stop(); -} - -void MachineController::start() { - if (m_running.exchange(true)) return; - m_thread = std::thread([this]{ runLoop(); }); -} - -void MachineController::stop() { - if (!m_running.exchange(false)) return; - if (m_thread.joinable()) m_thread.join(); -} - -void MachineController::step() { - emit tick(); -} - -void MachineController::runLoop() { - while (m_running.load()) { - emit tick(); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } -} diff --git a/simulator_SIC_XE/gui/qt/MachineController.h b/simulator_SIC_XE/gui/qt/MachineController.h deleted file mode 100644 index bc29329..0000000 --- a/simulator_SIC_XE/gui/qt/MachineController.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef MACHINECONTROLLER_H -#define MACHINECONTROLLER_H - -#include -#include -#include - -class MachineController : public QObject { - Q_OBJECT -public: - explicit MachineController(QObject *parent = nullptr); - ~MachineController() override; - - void start(); - void stop(); - void step(); - -signals: - void tick(); - -private: - void runLoop(); - std::atomic m_running{false}; - std::thread m_thread; -}; - -#endif // MACHINECONTROLLER_H diff --git a/simulator_SIC_XE/gui/qt/MainWindow.cpp b/simulator_SIC_XE/gui/qt/MainWindow.cpp deleted file mode 100644 index 09a31c2..0000000 --- a/simulator_SIC_XE/gui/qt/MainWindow.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "MainWindow.h" -#include "MachineController.h" -#include -#include - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) -{ - QWidget *central = new QWidget(this); - auto *layout = new QVBoxLayout(central); - auto *label = new QLabel("SIC/XE Simulator — GUI stub", central); - label->setAlignment(Qt::AlignCenter); - layout->addWidget(label); - setCentralWidget(central); - - m_controller = new MachineController(this); - setWindowTitle("SIC/XE Simulator"); -} - -MainWindow::~MainWindow() = default; diff --git a/simulator_SIC_XE/gui/qt/MainWindow.h b/simulator_SIC_XE/gui/qt/MainWindow.h deleted file mode 100644 index a67c8d1..0000000 --- a/simulator_SIC_XE/gui/qt/MainWindow.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class MachineController; - -class MainWindow : public QMainWindow { - Q_OBJECT -public: - explicit MainWindow(QWidget *parent = nullptr); - ~MainWindow() override; - -private: - MachineController *m_controller = nullptr; -}; - -#endif // MAINWINDOW_H diff --git a/simulator_SIC_XE/gui/qt/main.cpp b/simulator_SIC_XE/gui/qt/main.cpp deleted file mode 100644 index 74143ee..0000000 --- a/simulator_SIC_XE/gui/qt/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "MainWindow.h" - -int main(int argc, char **argv) { - QApplication app(argc, argv); - MainWindow w; - w.show(); - return app.exec(); -} \ No newline at end of file