Files
oak-editor/crates/oakengine/build.rs
T
Mike-Solar c5f1d0d76c refactor(engine): pure cdylib + undo-stack test race fix (M14 R4)
- oakengine is now cdylib-only (no rlib/staticlib consumers anywhere;
  cargo tree verified) — the plugin/external C ABI layer; README and
  docs updated
- cd.yml drops the dylib embedding/re-sign steps (the app no longer
  links it)
- test race root-caused and fixed for good: the global undo stack lock
  is now a re-entrant mutex (parking_lot) shared by every test that
  drives the stack, including the previously unlocked node/render
  families; the render-manager serial-ordering bug (an earlier repro
  test initialized the global manager before the not-initialized test)
  is fixed with a shared SERIAL guard and a manager shutdown
- 5 consecutive parallel runs clean; serial 209/209
2026-08-17 00:51:36 +08:00

61 lines
2.8 KiB
Rust

// Oak Video Editor - Non-Linear Video Editor
// Copyright (C) 2026 Oak Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//! Build-time link configuration for the `liboakengine` cdylib.
//!
//! The dylib carries the module crates themselves (their direct-Rust
//! code, kept in the link by `src/linkage.rs` — see Cargo.toml). The
//! `oakcore_audioparams_*` accessors the audio
//! paths read through used to be host-provided C++ liboakcore symbols,
//! left as runtime lookups via `-undefined,dynamic_lookup`; M12 P5
//! implemented them inside the dylib (src/stubs.rs, module `audio`), so
//! no undefined imports remain except system frameworks/libc++, and the
//! cdylib links on every platform (Windows DLLs reject undefined symbols,
//! which was the blocker).
fn main() {
let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
if os == "macos" {
// The static FFmpeg's transitive system deps (libz etc.) are
// recorded as `@rpath/libz.1.dylib`; the dylib itself carries the
// rpath so standalone binaries (and the packaged app) resolve
// them without extra host rpaths.
println!("cargo:rustc-cdylib-link-arg=-Wl,-rpath,/usr/lib");
}
if os == "macos" || os == "linux" {
// The dlsym codec bridge (M12 P0) resolves `oakcodec_*` from the
// process-global scope; the engine's unit-test binary (the former
// integration tests live in src/test_support/) statically links the
// module crates, so their symbols must be exported from the test
// executable. `cargo:rustc-link-arg-tests` is NOT usable: the facade
// is cdylib-only, so cargo reports "does not have a test target" for
// that directive — use the generic `rustc-link-arg` (a no-op for the
// cdylib link itself, and not emitted on Windows where the flag is
// meaningless and would break the DLL link).
println!("cargo:rustc-link-arg=-Wl,-export_dynamic");
}
if os == "macos" {
// The bundled OpenColorIO's macOS system monitor references
// IOKit / ColorSync / CoreGraphics display APIs; link them for
// the cdylib link and the unit-test binary (which statically
// pulls the same OCIO rlib).
for fw in ["IOKit", "ColorSync", "CoreGraphics"] {
println!("cargo:rustc-link-arg=-framework");
println!("cargo:rustc-link-arg={fw}");
}
}
}