182 lines
7.2 KiB
TOML
182 lines
7.2 KiB
TOML
# ================================================================================================
|
|
# FastLED Example Build Flags Configuration
|
|
# ================================================================================================
|
|
#
|
|
# This file centralizes ALL compilation flags used by example compilation to ensure
|
|
# they remain synchronized and compatible across the entire build system.
|
|
#
|
|
# Examples use the STUB platform for Arduino-compatible functionality without hardware
|
|
# dependencies, but do NOT need unit test specific flags like FASTLED_FORCE_NAMESPACE.
|
|
|
|
[tools]
|
|
# Build tool configuration - Full compiler command with arguments
|
|
# CRITICAL: Must use 'uv run python' for subprocess execution (subprocess doesn't inherit uv environment)
|
|
cpp_compiler = ["uv", "run", "python", "-m", "ziglang", "c++"]
|
|
linker = ["uv", "run", "python", "-m", "ziglang", "c++"] # Separate linker config for consistency
|
|
archiver = ["uv", "run", "python", "-m", "ziglang", "ar"] # Ziglang archiver for unified toolchain
|
|
c_compiler = ["uv", "run", "python", "-m", "ziglang", "cc"]
|
|
objcopy = ["uv", "run", "python", "-m", "ziglang", "objcopy"]
|
|
nm = ["uv", "run", "python", "-m", "ziglang", "nm"]
|
|
strip = ["uv", "run", "python", "-m", "ziglang", "strip"]
|
|
ranlib = ["uv", "run", "python", "-m", "ziglang", "ranlib"]
|
|
|
|
[all]
|
|
# Universal compilation flags (compiler command handled separately)
|
|
compiler_flags = [
|
|
"-std=gnu++17",
|
|
"-fpermissive",
|
|
"-Wall",
|
|
"-Wextra",
|
|
"-Wno-deprecated-register", # Suppress 'register' keyword warnings for C++17 compatibility
|
|
"-Wno-backslash-newline-escape", # Suppress backslash newline escape warnings
|
|
"-fno-exceptions",
|
|
"-fno-rtti",
|
|
]
|
|
|
|
defines = [
|
|
"STUB_PLATFORM",
|
|
# NOTE: Examples do NOT get FASTLED_FORCE_NAMESPACE=1 - they use global namespace
|
|
]
|
|
|
|
include_flags = [
|
|
"-I.",
|
|
"-Isrc",
|
|
]
|
|
|
|
[windows]
|
|
# ================================================================================================
|
|
# WINDOWS-SPECIFIC BUILD FLAGS
|
|
# ================================================================================================
|
|
# Comprehensive Windows build configuration using Zig's bundled Clang with GNU target
|
|
|
|
# C compiler flags for Windows
|
|
cc_flags = [
|
|
"--target=x86_64-windows-gnu", # Explicit target for MSYS2/MinGW compatibility
|
|
"-fuse-ld=lld", # Use Zig's bundled LLD linker
|
|
"-std=c17", # C17 standard
|
|
"-Wall",
|
|
"-Wextra",
|
|
]
|
|
|
|
# C++ compiler flags for Windows
|
|
cpp_flags = [
|
|
"--target=x86_64-windows-gnu", # Explicit target for MSYS2/MinGW compatibility
|
|
"-fuse-ld=lld-link", # Use lld-link (Windows MSVC-compatible linker)
|
|
"-std=c++17", # C++17 standard
|
|
"-Wall",
|
|
"-Wextra",
|
|
"-fno-exceptions",
|
|
"-fno-rtti",
|
|
|
|
# Fix Arduino INPUT macro conflict with Windows headers
|
|
"-DNOMINMAX", # Prevent Windows min/max macros
|
|
"-DWIN32_LEAN_AND_MEAN", # Reduce Windows header conflicts
|
|
]
|
|
|
|
# Linker flags for Windows
|
|
link_flags = [
|
|
"-mconsole", # Console application
|
|
|
|
# Prevent automatic library inclusion to avoid CRT collisions
|
|
"-nodefaultlibs", # Don't automatically include default libraries
|
|
|
|
# Fix CRT collision between Zig/Clang and MSYS2/MinGW runtimes
|
|
# This prevents "atexit was replaced" errors from conflicting CRT implementations
|
|
# "-rtlib=compiler-rt", # Removed - was causing conflicts
|
|
"-unwindlib=libunwind", # Use Clang's libunwind (avoid MinGW unwind)
|
|
"-nostdlib++", # Don't auto-link standard C++ library
|
|
"-lc++", # Manually link libc++ (Clang's C++ standard library)
|
|
|
|
"-lkernel32", # Windows kernel functions
|
|
"-luser32", # Windows user interface
|
|
"-lgdi32", # Graphics device interface
|
|
"-ladvapi32", # Advanced Windows API
|
|
]
|
|
|
|
[linking.base]
|
|
# Base linking flags (Unix-like systems)
|
|
flags = [
|
|
"-pthread", # POSIX threads (not used on Windows)
|
|
]
|
|
|
|
[build_modes.quick]
|
|
flags = [
|
|
"-O1",
|
|
"-g0",
|
|
"-fno-inline-functions",
|
|
"-fno-vectorize",
|
|
"-fno-unroll-loops",
|
|
"-fno-strict-aliasing",
|
|
]
|
|
|
|
link_flags = []
|
|
|
|
[strict_mode]
|
|
flags = [
|
|
"-Werror",
|
|
"-Wextra",
|
|
"-Wconversion",
|
|
"-Wsign-conversion",
|
|
"-Werror=unused-variable", # Force error on unused variables
|
|
"-Werror=unused-parameter", # Force error on unused parameters
|
|
"-Werror=unused-function", # Force error on unused functions
|
|
"-Werror=unused-but-set-variable", # Force error on variables that are set but never used
|
|
"-Wuninitialized",
|
|
"-Wdouble-promotion",
|
|
"-Wformat=2",
|
|
"-Wcast-align",
|
|
"-Wcast-qual",
|
|
"-Werror=return-type",
|
|
]
|
|
|
|
[stub_platform]
|
|
# ================================================================================================
|
|
# STUB PLATFORM DEFINES FOR EXAMPLE COMPILATION
|
|
# ================================================================================================
|
|
# These defines are used for compiling examples on the STUB platform
|
|
# which provides Arduino-compatible functionality without hardware dependencies.
|
|
|
|
defines = [
|
|
"STUB_PLATFORM", # Enable STUB platform
|
|
"ARDUINO=10808", # Arduino version compatibility
|
|
"FASTLED_USE_STUB_ARDUINO", # Use stub Arduino implementation
|
|
"FASTLED_STUB_IMPL", # Enable STUB platform Arduino function implementations
|
|
"SKETCH_HAS_LOTS_OF_MEMORY=1", # Enable memory-intensive features for STUB platform
|
|
"FASTLED_HAS_ENGINE_EVENTS=1", # Enable EngineEvents for UI components
|
|
]
|
|
|
|
# Include paths required for stub platform compilation
|
|
include_paths = [
|
|
"src/platforms/stub", # Arduino.h stub for examples
|
|
]
|
|
|
|
# Additional compiler arguments for stub platform
|
|
compiler_args = [
|
|
# No additional args currently needed - all flags come from [all] and [build_modes.quick] sections
|
|
]
|
|
|
|
[archive]
|
|
# ================================================================================================
|
|
# ARCHIVE CREATION FLAGS
|
|
# ================================================================================================
|
|
# Flags for creating static libraries (.a files) with deterministic builds.
|
|
# Using Zig's unified toolchain (ziglang ar) which supports deterministic builds on all platforms.
|
|
|
|
flags = "rcsD" # r=insert, c=create if needed, s=write symbol table, D=deterministic (zero timestamps)
|
|
|
|
[linking.unix]
|
|
# ================================================================================================
|
|
# UNIX-SPECIFIC LINKING FLAGS
|
|
# ================================================================================================
|
|
# Linking flags specific to Unix-like systems (Linux, macOS).
|
|
|
|
flags = [
|
|
# Core Libraries
|
|
"-pthread", # POSIX threads support
|
|
"-lm", # Math library
|
|
"-ldl", # Dynamic loading library
|
|
|
|
# Platform-specific libraries (added as needed)
|
|
# Note: Additional platform-specific flags can be added here
|
|
]
|