yams/CMakeLists.txt
Trevon 577adf1e0f
build: standardize the Debug build dir on build/debug (#248)
* build: standardize the Debug build dir on build/debug

`docs/BUILD.md` and `AGENTS.md` document `./setup.sh Debug` producing
`build/debug`, but `setup.sh`/`setup.ps1` created `builddir` and `.clangd`
pointed there too, so the documented layout and the actual tree disagreed.

Align the Debug mapping with the documented layout:
- setup.sh / setup.ps1: Debug -> `build/debug`
- CMakeLists.txt: Debug `_meson_build_dir` -> `build/debug`
- .clangd: CompilationDatabase -> `build/debug`
- plugin test fallbacks, S3 smoke default, quality-gate candidate list, and
  doc examples -> `build/debug`

Legacy `builddir` trees stay readable: the quality gate and local-ci scripts
still probe `builddir` as a fallback, and `plugin_trust` already treats
`/build/` paths as build artifacts.

* build: migrate remaining Debug consumers off builddir

Follow-up to the Debug build-dir standardization: tracked consumers still
hardcoded `builddir` and would break or silently skip against a fresh
`build/debug` tree. Migrate them, keeping tolerant fallbacks where a legacy
tree may still exist.

- CI: `.github/workflows/tests.yml` runs `./setup.sh Debug` and then compiled
  `-C builddir`; switch BUILD_DIR/COMPILE_DB_DIR/compile paths to `build/debug`.
  Same for windows-test-diagnose.yml.
- IDE: `.vscode/tasks.json` build/test/bench tasks target `build/debug`.
- Runtime: `object_storage_plugin_loader` also probes `build/debug/plugins`
  (and the flat `build/debug`), retaining the `builddir` fallbacks.
- Tests/docs: ONNX tuning integration plugin dir, benchmarks, and plugin
  READMEs/examples use `build/debug`.

`./build/*` is already excluded from the quality-gate find and `.dockerignore`,
so no exclusion lists change.
2026-10-01 08:45:20 -06:00

74 lines
2.2 KiB
CMake

cmake_minimum_required(VERSION 3.20)
project(yams-bootstrap LANGUAGES NONE)
set(YAMS_PROFILE "Release" CACHE STRING "Build profile forwarded to setup script")
set_property(CACHE YAMS_PROFILE PROPERTY STRINGS Debug Release Profiling Fuzzing)
set(YAMS_BUILD_DIR "" CACHE PATH "Optional YAMS build directory override")
option(YAMS_OFFLINE "Disable network dependency resolution" OFF)
option(YAMS_USE_SYSTEM_DEPS "Skip Conan and use system dependencies" OFF)
find_program(MESON_EXECUTABLE meson REQUIRED)
if(WIN32)
find_program(YAMS_POWERSHELL_EXECUTABLE NAMES pwsh powershell REQUIRED)
set(_setup_cmd
"${YAMS_POWERSHELL_EXECUTABLE}" -NoProfile -ExecutionPolicy Bypass
-File "${CMAKE_SOURCE_DIR}/setup.ps1"
-BuildType "${YAMS_PROFILE}")
if(YAMS_OFFLINE)
list(APPEND _setup_cmd -Offline)
endif()
if(YAMS_USE_SYSTEM_DEPS)
list(APPEND _setup_cmd -SystemDeps)
endif()
else()
find_program(YAMS_BASH_EXECUTABLE bash REQUIRED)
set(_setup_cmd "${YAMS_BASH_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/setup.sh" "${YAMS_PROFILE}")
if(YAMS_OFFLINE)
list(APPEND _setup_cmd --offline)
endif()
if(YAMS_USE_SYSTEM_DEPS)
list(APPEND _setup_cmd --system-deps)
endif()
endif()
if(YAMS_BUILD_DIR)
set(_meson_build_dir "${YAMS_BUILD_DIR}")
else()
if(YAMS_PROFILE STREQUAL "Debug")
set(_meson_build_dir "build/debug")
else()
string(TOLOWER "${YAMS_PROFILE}" _profile_lower)
set(_meson_build_dir "build/${_profile_lower}")
endif()
endif()
set(_env_cmd "${CMAKE_COMMAND}" -E env)
if(YAMS_BUILD_DIR)
list(APPEND _env_cmd "YAMS_BUILD_DIR=${YAMS_BUILD_DIR}")
endif()
add_custom_target(yams-configure
COMMAND ${_env_cmd} ${_setup_cmd}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
USES_TERMINAL
COMMENT "Configuring YAMS via setup script"
)
add_custom_target(yams ALL
COMMAND "${MESON_EXECUTABLE}" compile -C "${_meson_build_dir}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
DEPENDS yams-configure
USES_TERMINAL
COMMENT "Building YAMS via Meson"
)
add_custom_target(yams-install
COMMAND "${MESON_EXECUTABLE}" install -C "${_meson_build_dir}"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
DEPENDS yams
USES_TERMINAL
COMMENT "Installing YAMS via Meson"
)