chore: auto-commit (97 archivos)
- .claude/CLAUDE.md - .claude/agents/fn-recopilador/SKILL.md - .claude/rules/INDEX.md - .claude/rules/cpp_apps.md - bash/functions/infra/build_cpp_windows.sh - cpp/CMakeLists.txt - cpp/PATTERNS.md - cpp/framework/app_base.cpp - cpp/framework/app_base.h - dev/issues/README.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,34 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# build_cpp_windows — Cross-compila apps C++ del registry para Windows con
|
||||
# mingw-w64. Configura el build dir cpp/build/windows/ con la toolchain la
|
||||
# primera vez y construye el target indicado (o todos).
|
||||
#
|
||||
# Uso (funcion via source):
|
||||
# source bash/functions/infra/build_cpp_windows.sh
|
||||
# build_cpp_windows my_app # construye target especifico
|
||||
# build_cpp_windows # construye todos
|
||||
#
|
||||
# Uso (script directo):
|
||||
# bash bash/functions/infra/build_cpp_windows.sh my_app
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REGISTRY_ROOT="${FN_REGISTRY_ROOT:-$(cd "$(dirname "$0")/../../.." && pwd)}"
|
||||
CPP_ROOT="$REGISTRY_ROOT/cpp"
|
||||
BUILD_DIR="$CPP_ROOT/build/windows"
|
||||
TOOLCHAIN="$CPP_ROOT/toolchains/mingw-w64.cmake"
|
||||
TARGET="${1:-}"
|
||||
build_cpp_windows() {
|
||||
local target="${1:-}"
|
||||
local registry_root="${FN_REGISTRY_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}"
|
||||
local cpp_root="$registry_root/cpp"
|
||||
local build_dir="${BUILD_WIN:-$cpp_root/build/windows}"
|
||||
local toolchain="$cpp_root/toolchains/mingw-w64.cmake"
|
||||
|
||||
# Check mingw is available
|
||||
if ! command -v x86_64-w64-mingw32-g++ &>/dev/null; then
|
||||
echo "[build_cpp_windows] Error: mingw-w64 not found. Install with: sudo apt install mingw-w64"
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v x86_64-w64-mingw32-g++ &>/dev/null; then
|
||||
echo "[build_cpp_windows] Error: mingw-w64 not found. Install with: sudo apt install mingw-w64" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Configure if needed
|
||||
if [ ! -f "$BUILD_DIR/CMakeCache.txt" ]; then
|
||||
echo "[build_cpp_windows] Configuring cmake with mingw-w64 toolchain..."
|
||||
cmake -B "$BUILD_DIR" -S "$CPP_ROOT" -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN"
|
||||
fi
|
||||
if [ ! -f "$build_dir/CMakeCache.txt" ]; then
|
||||
echo "[build_cpp_windows] Configuring cmake with mingw-w64 toolchain..." >&2
|
||||
cmake -B "$build_dir" -S "$cpp_root" -DCMAKE_TOOLCHAIN_FILE="$toolchain"
|
||||
else
|
||||
# Re-run cmake to pick up new add_subdirectory entries cuando se anade
|
||||
# una app nueva al CMakeLists.txt (no rompe builds incrementales).
|
||||
cmake "$build_dir" >/dev/null
|
||||
fi
|
||||
|
||||
# Build
|
||||
if [ -n "$TARGET" ]; then
|
||||
echo "[build_cpp_windows] Cross-compiling target: $TARGET"
|
||||
cmake --build "$BUILD_DIR" --target "$TARGET" -- -j"$(nproc)"
|
||||
else
|
||||
echo "[build_cpp_windows] Cross-compiling all targets..."
|
||||
cmake --build "$BUILD_DIR" -- -j"$(nproc)"
|
||||
fi
|
||||
if [ -n "$target" ]; then
|
||||
echo "[build_cpp_windows] Cross-compiling target: $target" >&2
|
||||
cmake --build "$build_dir" --target "$target" -- -j"$(nproc)"
|
||||
else
|
||||
echo "[build_cpp_windows] Cross-compiling all targets..." >&2
|
||||
cmake --build "$build_dir" -- -j"$(nproc)"
|
||||
fi
|
||||
|
||||
echo "[build_cpp_windows] Done. Windows binaries in $BUILD_DIR"
|
||||
if [ -n "$TARGET" ]; then
|
||||
file "$BUILD_DIR"/**/"$TARGET".exe 2>/dev/null || file "$BUILD_DIR/$TARGET".exe 2>/dev/null || true
|
||||
echo "[build_cpp_windows] Done. Windows binaries in $build_dir" >&2
|
||||
}
|
||||
|
||||
# Invocacion directa como script (compatibilidad).
|
||||
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
||||
build_cpp_windows "$@"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user