onnxruntime
c6d9a020 - Fix Clang + libc++ compilation and portability issues (#28049)

Commit
118 days ago
Fix Clang + libc++ compilation and portability issues (#28049) ## Description Fixes compilation of ONNX Runtime with Clang/libc++ toolchains (e.g. Chromium's build system) and clang-cl on ARM64 Windows. ### Portability fixes - Add `math_constants.h` with M_PI, M_SQRT2, M_SQRT1_2 for libc++ (which does not define these by default) - Use `__attribute__((visibility(default)))` for `ORT_EXPORT` on GCC/Clang - Move `TargetConditionals.h` include outside namespace for Clang modules - Out-of-line `Node`/`Model` destructors for libc++ `unique_ptr` with incomplete types - Add `gsl::narrow` alias for `onnxruntime::narrow` in `narrow.h` - Add `[[maybe_unused]]` on catch variables for `-Wunused-variable` - Fix `reverse` attribute validation in `cumsum.cc` (string literal as condition) - Use M_PI/M_SQRT2/M_SQRT1_2 from `math_constants.h` in all signal/optimizer/contrib files ### ARM64 MLAS fixes (clang-cl on Windows) - Guard MSVC-specific NEON builtins (`neon_fmaxv`, `neon_fminv`) with `!defined(__clang__)` in `mlasi.h` - Include clang in portable NEON `_ex` fallbacks in `qladd.h` - Guard `vcleq_z_f32_ex` with `!defined(__clang__)` in `activate.cpp` - Add `_WIN32` case in `asmmacro.h` to skip ELF `.type` directive on COFF ## Motivation These changes enable building ORT from source with Chromium's Clang/libc++ toolchain on all platforms (Windows x64/ARM64, Linux x64, Mac x64/ARM64).
Author
Parents
Loading