Compare commits

..

No commits in common. "43c8fb2cce798bfd17aa713bec61c59123f0d8c8" and "8a6e916876428953c15b971a05439def3c7ca2a4" have entirely different histories.

8 changed files with 30 additions and 112 deletions

View file

@ -7,6 +7,7 @@ CMakeCache.txt
CMakeFiles/ CMakeFiles/
CMakeScripts/ CMakeScripts/
cmake_install.cmake cmake_install.cmake
Makefile
*.cmake *.cmake
!CMakeLists.txt !CMakeLists.txt

View file

@ -1,59 +0,0 @@
# Simple Makefile wrapper to configure, build and run the CMake project.
# Usage:
# make # builds (default)
# make build # configure + build
# make run # build (if needed) and run the executable
# make clean # run CMake clean (or remove build files)
# make distclean # remove build dir and generated targets
CMAKE ?= cmake
BUILD_DIR := build
CMAKE_BUILD_TYPE ?= Release
TARGET := target/bin/simulator_exec
GUI_TARGET := target/bin/simulator_qt
.PHONY: all configure build run clean distclean
all: build
configure:
@echo "Configuring (build dir: $(BUILD_DIR), type: $(CMAKE_BUILD_TYPE))"
$(CMAKE) -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
build: configure
@echo "Building..."
$(CMAKE) --build $(BUILD_DIR) -j$(shell nproc)
run: build
@echo "Running primary target..."
# Prefer GUI if available, otherwise fall back to console executable
@if [ -x "$(GUI_TARGET)" ]; then \
echo "Launching GUI: $(GUI_TARGET)"; \
sh -c 'nohup env QT_QPA_PLATFORM=xcb ./$(GUI_TARGET) >/dev/null 2>&1 & echo $! > "$(BUILD_DIR)/simulator_qt.pid"'; \
elif [ -x "$(TARGET)" ]; then \
@./$(TARGET); \
else \
echo "No runnable target found (tried $(GUI_TARGET) and $(TARGET))."; exit 1; \
fi
.PHONY: run-gui
run-gui: build
@echo "Running GUI target ($(GUI_TARGET))"
@if [ -x "$(GUI_TARGET)" ]; then \
echo "Starting GUI..."; ./$(GUI_TARGET) -platform xcb; \
else \
echo "GUI executable not found: $(GUI_TARGET)"; exit 1; \
fi
.PHONY: build-gui
build-gui: configure
@echo "Building GUI (and core)..."
$(CMAKE) --build $(BUILD_DIR) -j$(shell nproc) --target simulator_qt || true
clean:
@echo "Cleaning build (CMake clean)..."
-$(CMAKE) --build $(BUILD_DIR) --target clean || true
distclean:
@echo "Removing build artifacts and generated files..."
-rm -rf $(BUILD_DIR) CMakeFiles CMakeCache.txt cmake_install.cmake target/bin/*

View file

@ -30,20 +30,19 @@ endif()
set(GUI_SRCS set(GUI_SRCS
main.cpp main.cpp
mainwindow.cpp MainWindow.cpp
MachineController.cpp MachineController.cpp
) )
set(GUI_HDRS set(GUI_HDRS
mainwindow.h MainWindow.h
MachineController.h MachineController.h
) )
add_executable(simulator_qt ${GUI_SRCS} ${GUI_HDRS}) add_executable(simulator_qt ${GUI_SRCS} ${GUI_HDRS})
# Allow the generated UI headers (from AUTOUIC) to be found in the build dir # Use top-level include folder (works when added with add_subdirectory)
# and also include the top-level include folder (works when added with add_subdirectory) target_include_directories(simulator_qt PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_include_directories(simulator_qt PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include)
# Link to core library target (must be defined by top-level CMake) # Link to core library target (must be defined by top-level CMake)
target_link_libraries(simulator_qt PRIVATE simulator_lib ${QT_LIB}) target_link_libraries(simulator_qt PRIVATE simulator_lib ${QT_LIB})

View file

@ -0,0 +1,20 @@
#include "MainWindow.h"
#include "MachineController.h"
#include <QLabel>
#include <QVBoxLayout>
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;

View file

@ -3,20 +3,16 @@
#include <QMainWindow> #include <QMainWindow>
namespace Ui { class MachineController;
class MainWindow;
}
class MainWindow : public QMainWindow class MainWindow : public QMainWindow {
{
Q_OBJECT Q_OBJECT
public: public:
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow() override;
private: private:
Ui::MainWindow *ui; MachineController *m_controller = nullptr;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View file

@ -1,5 +1,5 @@
#include <QApplication> #include <QApplication>
#include "mainwindow.h" #include "MainWindow.h"
int main(int argc, char **argv) { int main(int argc, char **argv) {
QApplication app(argc, argv); QApplication app(argc, argv);

View file

@ -1,14 +0,0 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}

View file

@ -1,25 +0,0 @@
<?xml version='1.0'?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>MainWindow</class>
<widget name="MainWindow" class="QMainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget name="menubar" class="QMenuBar"/>
<widget name="centralwidget" class="QWidget"/>
<widget name="statusbar" class="QStatusBar"/>
</widget>
<pixmapfunction/>
<connections/>
</ui>