# Build-time project options for lime-parser.

option('lime_pgo',
  type        : 'combo',
  choices     : ['off', 'generate', 'use'],
  value       : 'off',
  description : 'Profile-guided optimisation control.  ' +
                'off (default): no PGO instrumentation. ' +
                'generate: instrument with -fprofile-generate; run ' +
                'lime + benchmarks to populate the profile. ' +
                'use: feed -fprofile-use=<path> back into the build for ' +
                'optimised codegen.  Use with -Dbuildtype=release ' +
                '+ -Db_lto=true for production binaries.  See ' +
                'docs/PERFORMANCE.md for the workflow.',
)

option('llvm',
  type        : 'feature',
  value       : 'auto',
  description : 'LLVM JIT compilation support. ' +
                'auto: enable if llvm-config is found; ' +
                'enabled: require LLVM (hard error if absent); ' +
                'disabled: build stubs only (-DLIME_NO_JIT).',
)

option('llvm-static',
  type        : 'boolean',
  value       : false,
  description : 'Link LLVM statically (llvm-config --link-static). ' +
                'Produces a self-contained binary with no runtime ' +
                'libLLVM.so dependency at the cost of a larger binary ' +
                '(50-80 MB typical) and slower link. ' +
                'Only effective when LLVM is enabled.',
)

option('pg_grammar',
  type        : 'boolean',
  value       : false,
  description : 'Build the PostgreSQL-grammar regression test ' +
                '(tests/test_pg_grammar). Off by default because ' +
                'regenerating examples/pg/gram_snapshot.c via lime -n ' +
                'takes ~3.8 s -- only enable for stress runs / CI ' +
                'sweeps. The 3,842-state PG grammar is the largest ' +
                'LR(1) machine Lime is asked to host, and the test ' +
                'guards against int16/int32 overflow and JIT codegen ' +
                'scaling regressions.',
)