Skip to content

🔨 BUILD INSTRUCTIONS - 05_14_PRESET_SYSTEM

PREREQUISITOS

Windows (Actual Sistema):

# Verificar CMake
cmake --version  # Debe ser >= 3.20

# Verificar compilador C++20
# Visual Studio 2019 o posterior
# O MinGW-w64 con GCC 10+

Dependencies:

Todas las dependencies se descargan automáticamente vía CMake FetchContent: - nlohmann/json (v3.11.3) - Header-only, auto-download - Catch2 (v3.5.0) - Auto-download para tests - OpenSSL - Debe estar instalado en el sistema

Instalar OpenSSL en Windows:

Opción 1: vcpkg (Recomendado)

# Si tienes vcpkg instalado
vcpkg install openssl:x64-windows

Opción 2: Chocolatey

choco install openssl

Opción 3: Manual - Descargar desde: https://slproweb.com/products/Win32OpenSSL.html - Instalar Win64 OpenSSL v3.0+ - Agregar a PATH: C:\Program Files\OpenSSL-Win64\bin


BUILD STEPS

1. Navigate to preset_schemas

cd "c:\AudioDev\audio-lab\3 - COMPONENTS\05_MODULES\05_14_PRESET_SYSTEM\05_14_00_preset_schemas"

2. Create build directory

mkdir build
cd build

3. Configure CMake

Con Visual Studio (Recomendado para Windows):

cmake .. -G "Visual Studio 17 2022" -A x64

Con MinGW:

cmake .. -G "MinGW Makefiles"

Con Ninja (Más rápido):

cmake .. -G "Ninja"

Con vcpkg (si tienes OpenSSL ahí):

cmake .. -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake

4. Build

cmake --build . --config Release

O para Debug:

cmake --build . --config Debug

5. Run Tests

ctest --output-on-failure -C Release

O manualmente:

# Windows
.\Release\test_schema_validation.exe

# O con verbose output
.\Release\test_schema_validation.exe -s

6. Run Examples

# Create preset example
.\Release\example_create_preset.exe

# Validate preset example
.\Release\example_validate_preset.exe ..\examples\example_l1_preset.json

TROUBLESHOOTING

Error: "OpenSSL not found"

Solución 1: Instalar OpenSSL con vcpkg

vcpkg install openssl:x64-windows
cmake .. -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake

Solución 2: Especificar OpenSSL path manualmente

cmake .. -DOPENSSL_ROOT_DIR="C:/Program Files/OpenSSL-Win64"

Solución 3: Usar pre-built OpenSSL

# Descargar desde slproweb.com
# Instalar en C:\OpenSSL-Win64
cmake .. -DOPENSSL_ROOT_DIR="C:/OpenSSL-Win64"

Error: "nlohmann/json not found"

Solución: FetchContent lo descarga automáticamente, pero si falla:

# Instalar con vcpkg
vcpkg install nlohmann-json:x64-windows

# O clonar manualmente
git clone https://github.com/nlohmann/json.git
cmake .. -Dnlohmann_json_DIR=path/to/json

Error: "Catch2 not found"

Solución: Deshabilitar tests temporalmente

cmake .. -DBUILD_TESTS=OFF

O instalar Catch2:

vcpkg install catch2:x64-windows

Error: Compilation warnings

Solución: Build con warnings menos estrictos temporalmente

# Editar CMakeLists.txt, comentar línea:
# target_compile_options(preset_schemas PRIVATE ... /WX ...)

Error: "C++20 not supported"

Solución: Actualizar compilador - Visual Studio 2019 (v16.8+) o posterior - GCC 10+ o Clang 10+


VERIFICACIÓN

1. Verificar que compiló correctamente:

# Debe existir:
ls Release/preset_schemas.lib      # (o .a en MinGW)
ls Release/test_schema_validation.exe
ls Release/example_create_preset.exe
ls Release/example_validate_preset.exe

2. Ejecutar tests:

ctest --output-on-failure -C Release

Output esperado:

Test project C:/AudioDev/.../build
    Start 1: All tests
1/1 Test #1: All tests ........................   Passed    0.15 sec

100% tests passed, 0 tests failed out of 1

3. Ejecutar example:

.\Release\example_create_preset.exe

Output esperado:

=== AudioLab Preset Creation Example ===

✓ Created preset: Warm Lowpass Filter
  Author: AudioLab Team
  Category: Filters/Lowpass
  Tags: filter lowpass warm analog bass

Validating preset...
✓ Preset is valid!

Checksum: 1234567890abcdef...

Saving to: warm_lowpass_filter.preset
✓ Saved successfully!

Loading preset back...
✓ Loaded successfully!
  Name: Warm Lowpass Filter
  Cutoff: 1000 Hz
  Resonance: 0.7

=== Example Complete ===

4. Verificar preset creado:

cat warm_lowpass_filter.preset
# Debe mostrar JSON bien formado

5. Validar preset de ejemplo:

.\Release\example_validate_preset.exe ..\examples\example_l1_preset.json

Output esperado:

=== AudioLab Preset Validator Example ===

Validating file: ..\examples\example_l1_preset.json

✓ File loaded successfully

=== Preset Information ===
  Name:     Warm Lowpass Filter
  Author:   AudioLab Team
  Category: Filters/Lowpass
  Version:  1.0.0
  Type:     L1
  Tags:     filter, lowpass, warm, analog, bass

=== Level 1: Structure Validation ===
✓ Validation PASSED
  Level reached: Structure

...

=== Full Validation (All Levels) ===
✓ Validation PASSED
  Level reached: Integrity

=== Summary ===
✓ Preset is fully valid and ready to use!
  Checksum: a1b2c3d4e5f6g7h8...
  ✓ Checksum verified

=== Example Complete ===


BUILD OPTIONS

Configuración personalizada:

# Sin tests
cmake .. -DBUILD_TESTS=OFF

# Sin examples
cmake .. -DBUILD_EXAMPLES=OFF

# Release con debug info
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo

# Debug puro
cmake .. -DCMAKE_BUILD_TYPE=Debug

# Custom install prefix
cmake .. -DCMAKE_INSTALL_PREFIX=/custom/path

INSTALLATION

Instalar librería y headers:

cmake --build . --target install

Instala en: - Headers: ${CMAKE_INSTALL_PREFIX}/include/ - Library: ${CMAKE_INSTALL_PREFIX}/lib/ - CMake config: ${CMAKE_INSTALL_PREFIX}/lib/cmake/preset_schemas/

Usar desde otro proyecto:

find_package(preset_schemas REQUIRED)
target_link_libraries(my_app PRIVATE audiolab::preset_schemas)

PERFORMANCE BENCHMARKS

Ejecutar benchmarks (cuando estén implementados):

.\Release\benchmark_preset_schemas.exe

Métricas esperadas: - Load time: <50ms para preset típico - Validation: <10ms por preset - Checksum: <5ms para preset típico - Serialization: <20ms


TESTING COVERAGE

Generar coverage report (con gcov/lcov):

# Build con coverage
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage"
cmake --build .

# Run tests
ctest

# Generate report
lcov --capture --directory . --output-file coverage.info
genhtml coverage.info --output-directory coverage_html

# Open in browser
start coverage_html/index.html

Target: >90% coverage


CONTINUOUS INTEGRATION

GitHub Actions (futuro):

name: Build and Test

on: [push, pull_request]

jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install OpenSSL
        run: vcpkg install openssl:x64-windows
      - name: Configure
        run: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=...
      - name: Build
        run: cmake --build build --config Release
      - name: Test
        run: cd build && ctest -C Release

NEXT STEPS

Después de verificar que todo compila y tests pasan:

  1. ✅ Confirmar que ctest pasa todos los tests
  2. ✅ Confirmar que examples se ejecutan sin errores
  3. ✅ Confirmar que presets se crean y validan correctamente
  4. ⏳ Iniciar TAREA 2: Serialization Engine
  5. ⏳ Implementar Binary serializer
  6. ⏳ Implementar compression

SUPPORT

Si encuentras problemas:

  1. Verifica prerequisites (CMake, OpenSSL, C++20 compiler)
  2. Lee la sección TROUBLESHOOTING arriba
  3. Revisa QUICKSTART.md para más detalles
  4. Revisa logs de CMake: build/CMakeFiles/CMakeOutput.log

Para reportar bugs: - Incluye versión de CMake - Incluye versión de compilador - Incluye output completo de error - Incluye CMakeCache.txt si es error de configuración


Última actualización: 2025-01-14 Status: ✅ Ready to Build Tested on: Windows 11, Visual Studio 2022, CMake 3.28