Build and Simulation
This document describes how to build and run HoneyGUI Visual Designer projects, including development environment setup, build process, and simulation testing.
Overview
HoneyGUI Visual Designer supports simulation on PC, allowing rapid GUI application development and testing without embedded hardware. Projects use the SCons build system and support Windows, Linux, and WSL environments.
Development Environment Requirements
Windows
Required software:
-
MinGW-w64: C/C++ compiler
Recommended version: 8.1.0 or higher
Installation path:
C:\mingw64(default)
-
Python: 3.9.7 or higher
Download: https://www.python.org/downloads/
-
SCons: Build tool
pip install scons==4.4.0
-
kconfiglib: Configuration tool
pip install kconfiglib
-
VSCode: Code editor
Download: https://code.visualstudio.com/
Install HoneyGUI Visual Designer plugin
Optional software:
-
CMake: 3.31.2 or higher (if using CMake build)
pip install cmake
Linux/WSL
Required software:
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install build-essential python3 python3-pip libsdl2-dev
# Install Python tools
pip3 install scons==4.4.0 kconfiglib
Environment Variable Configuration
Windows:
Ensure MinGW-w64 bin directory is in PATH:
# Check compiler
gcc --version
g++ --version
# If not found, add to PATH
set PATH=C:\mingw64\bin;%PATH%
Linux/WSL:
# Check compiler
gcc --version
# Check SDL2
pkg-config --libs sdl2
Project Structure
Standard HoneyGUI Visual Designer project structure:
my_project/
├── project.json # Project configuration file
├── ui/ # HML design files
│ ├── main/
│ │ └── main.hml
│ └── settings/
│ └── settings.hml
├── assets/ # Resource files
│ ├── images/ # Image resources
│ ├── fonts/ # Font resources
│ └── models/ # 3D models
├── src/ # Generated C code
│ ├── {ProjectName}Entry.c
│ ├── SConscript
│ ├── ui/ # UI code
│ ├── callbacks/ # Callback code
│ └── user/ # User code
└── win32_sim/ # Simulator directory (after build)
Project Configuration File
project.json defines basic project information:
{
"name": "MyWatchApp",
"version": "1.0.0",
"description": "My smart watch application",
"resolution": "410x502",
"author": "Your Name",
"license": "MIT"
}
Supported resolutions:
240x240- Small round watch410x502- Standard smartwatch466x466- Large screen watch480x272- Landscape device800x480- Tablet/car display
Build Process
Build Using VSCode Plugin
Open Project: Open HoneyGUI Visual Designer project folder in VSCode
-
Generate Code:
Click the Generate Code button in toolbar
Or use command palette:
Ctrl+Shift+P->HoneyGUI: Generate Code
-
Configure Application:
Use command:
HoneyGUI: Configure ApplicationSelect application to run
-
Build Project:
Use command:
HoneyGUI: Build Project-
Or execute in terminal:
cd win32_sim scons
-
Run Simulator:
Use command:
HoneyGUI: Run Simulator-
Or execute manually:
# Windows ./win32_sim/gui.exe # Linux/WSL ./win32_sim/gui
Build Using Command Line
Complete build workflow:
# 1. Enter simulator directory
cd win32_sim
# 2. Configure application (optional)
menuconfig ../Kconfig.gui
# 3. Build project
scons
# 4. Run
cd ..
./win32_sim/gui.exe # Windows
./win32_sim/gui # Linux/WSL
Clean build:
cd win32_sim
scons -c
Debug mode:
# Skip strict checks for development debugging
set DEBUG_MODE=1 # Windows
export DEBUG_MODE=1 # Linux/WSL
scons
Build Configuration
Compiler Flags
Default compiler flags (strict mode):
-Wall: Enable all warnings-Werror: Treat warnings as errors-O2: Optimization level 2
Debug mode flags (DEBUG_MODE=1):
-g: Generate debug information-O0: No optimization, easier debuggingDon't use
-Werror
Build with CMake (Optional)
HoneyGUI also supports CMake build system:
cd win32_sim
mkdir build
cd build
# Windows (MinGW)
cmake -G "MinGW Makefiles" ..
mingw32-make -j 32
# Linux
cmake ..
make -j 8
# Run
cd ../..
./win32_sim/build/gui.exe # Windows
./win32_sim/build/gui # Linux
Running the Simulator
Start Simulator
# Windows
./win32_sim/gui.exe
# Linux/WSL
./win32_sim/gui
The simulator window will display your designed GUI interface.
Interaction Methods
Mouse Left Click: Simulate touch tap
Mouse Drag: Simulate swipe gesture
Mouse Long Press: Simulate long press
Keyboard ESC: Exit simulator
Window Close: Exit simulator
Debugging Tips
View Logs: Simulator outputs debug information to console
-
Use GDB Debugging (Linux):
gdb ./win32_sim/gui (gdb) run (gdb) break main (gdb) continue
-
Visual Studio Code Debugging (Windows):
Configure
launch.json:{ "version": "0.2.0", "configurations": [ { "name": "Debug HoneyGUI", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/win32_sim/gui.exe", "cwd": "${workspaceFolder}", "MIMode": "gdb", "miDebuggerPath": "C:/mingw64/bin/gdb.exe" } ] }
Common Issues
Build Errors
Error: gcc not found
'gcc' is not recognized as an internal or external command
Solutions:
Confirm MinGW-w64 is installed
Check PATH environment variable
Restart terminal/VSCode
Error: SDL2 library missing
fatal error: SDL2/SDL.h: No such file or directory
Solution (Linux):
sudo apt-get install libsdl2-dev
Error: Python module missing
ModuleNotFoundError: No module named 'SCons'
Solution:
pip install scons==4.4.0 kconfiglib
Runtime Errors
Error: Cannot start simulator
Failed to initialize SDL
Solutions:
Windows: Confirm system supports OpenGL
Linux: Check SDL2 library installation
WSL: Need to configure X Server (e.g., VcXsrv)
Error: Resource file not found
Error loading image: assets/logo.bin
Solutions:
Confirm resource files have been converted to
.binformatCheck file path is correct
Rebuild project
Performance Optimization
Build Speed Optimization
-
Parallel Compilation:
# SCons scons -j 8 # Use 8 threads # CMake make -j 8
Incremental Build: Build system automatically recompiles only changed files after partial modifications
-
Use ccache (Linux):
sudo apt-get install ccache export CC="ccache gcc" export CXX="ccache g++"
Runtime Performance Optimization
Resource Optimization: Use appropriate image formats and resolutions
Code Optimization: Avoid time-consuming operations in frequently called callbacks
Compilation Optimization: Use
-O2or-O3optimization level for release builds
Continuous Integration
Build HoneyGUI projects in CI/CD pipelines:
# GitHub Actions example
name: Build HoneyGUI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libsdl2-dev python3-pip
pip3 install scons==4.4.0 kconfiglib
- name: Build project
run: |
cd win32_sim
scons
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: gui-binary
path: win32_sim/gui
Next Steps
Learn Code Generation to understand code generation process
See Event System to implement interaction logic
Refer to Resource Management to manage project resources
Read Embedded Deployment for embedded deployment solutions