connected to gui
This commit is contained in:
parent
8a6e916876
commit
d77a32e6e6
8 changed files with 126 additions and 26 deletions
59
simulator_SIC_XE/Makefile
Normal file
59
simulator_SIC_XE/Makefile
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# 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/*
|
||||
Loading…
Add table
Add a link
Reference in a new issue