Building PBXA64 from Source

Prerequisites

ToolMinimum VersionRequired
CMake3.20+Yes
MinGW-w64 (GCC)14.2+Yes
MinGW Make or NinjaRecentYes (one of)

Build Commands

Standard Build (CMake Presets)

# Debug build with tests
cmake --preset debug
cmake --build --preset debug -j2

# Run tests
ctest --test-dir build/debug --output-on-failure

Release Build

cmake --preset release
cmake --build --preset release -j2

Sanitizer Build (ASAN + UBSAN)

cmake --preset asan-ubsan
cmake --build --preset asan-ubsan -j2
ctest --test-dir build/asan-ubsan --output-on-failure

Using MinGW Makefiles Directly

cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j2

Build Outputs

FileDescription
build/debug/pbxa64.exeMain PBXA64 compiler (PB/MGC/PILOT frontend)
build/debug/mgc64.exeMGC-only compiler (shares core library)
build/debug/libmgc64_core.aStatic core library (59 source files)

Test Suite

The full test suite contains 28 tests covering:

CategoryTestsDescription
Unit tests9Lexer, parser, codegen, ASM encoder, PE layout, PILOT, string/wstring runtime
E2E: MGC4Assembly emission, PE linking, CFG lowering
E2E: PowerBASIC15Compile/link smoke, includes, strings/arrays, WinAPI, regression tests, PILOT features

Project Structure

src/
  common/       Shared support types (status, memory, string, vector, map, file, diagnostic)
  frontend/     Lexer, parser, AST, types, semantic (MGC, PB, PILOT)
  middle/       IR, CFG, SSA, IR builder, optimization passes
  backend/      x64 target, ABI, MIR, frame, register allocation, ISEL, encoding, codegen
  assembler/    ASM tokenizer/parser, encoder, COFF writer
  linker/       Object aggregation, symbol resolution, relocation, import table, PE writer
  runtime/      CRT entry, builtins, string/wstring runtime
  driver/       CLI, pipeline, compiler orchestration, main entry
include/
  compiler/     All public headers (mirrors src/ structure)
tests/
  frontend/     Lexer, parser, codegen, PILOT unit tests
  linker/       PE section layout tests
  runtime/      String/wstring runtime tests
  e2e/          End-to-end compilation tests
examples/
  pb/           PowerBASIC sample programs
  pilot/        PILOT sample programs
  mgc/          MGC sample programs
Compiler flags: The build uses C11 (-std=c11) with -Wall -Wextra -Wpedantic -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Werror=implicit-function-declaration.