Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions .github/workflows/parser-sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# lane needs no runtime and no `ost`: it configures libs/mmdPmx and
# libs/motionVmd on their own, as `ost library build` does, installs each
# library instrumented, and configures the ones that depend on them against
# that prefix, each with the sanitizer options its CMakeLists.txt declares. `ost ci generate` has no
# that prefix, each with the USDMMD_SANITIZERS option
# cmake/UsdMmdSanitizers.cmake declares. `ost ci generate` has no
# way to express a sanitizer build, which is why this workflow exists beside
# the generated one rather than inside it.
name: parser-sanitizers
Expand All @@ -23,7 +24,11 @@ on:
- "libs/mmdControl/**"
- "tests/fixtures/generate_fixtures.py"
- "tests/fixtures/generate_vmd_fixtures.py"
- "cmake/UsdMmdProject.cmake"
- "cmake/UsdMmdTargets.cmake"
- "cmake/UsdMmdSanitizers.cmake"
- "cmake/UsdMmdPackage.cmake"
- "cmake/UsdMmdTesting.cmake"
- "scripts/check_library_boundaries.py"
- ".github/workflows/parser-sanitizers.yml"
push:
Expand All @@ -36,7 +41,11 @@ on:
- "libs/mmdControl/**"
- "tests/fixtures/generate_fixtures.py"
- "tests/fixtures/generate_vmd_fixtures.py"
- "cmake/UsdMmdProject.cmake"
- "cmake/UsdMmdTargets.cmake"
- "cmake/UsdMmdSanitizers.cmake"
- "cmake/UsdMmdPackage.cmake"
- "cmake/UsdMmdTesting.cmake"
- "scripts/check_library_boundaries.py"
- ".github/workflows/parser-sanitizers.yml"
workflow_dispatch:
Expand Down Expand Up @@ -71,8 +80,8 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++-18
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DMMDPMX_BUILD_TESTS=ON
-DMMDPMX_SANITIZERS="address;undefined"
-DMMDPMX_BUILD_FUZZER=ON
-DUSDMMD_SANITIZERS="address;undefined"
-DUSDMMD_BUILD_FUZZERS=ON

- name: Build
run: cmake --build build/sanitize
Expand All @@ -89,7 +98,7 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMMDPMX_BUILD_TESTS=OFF \
-DMMDPMX_SANITIZERS="address;undefined"
-DUSDMMD_SANITIZERS="address;undefined"
cmake --build build/sanitize-pmx
cmake --install build/sanitize-pmx --prefix build/sanitize-prefix

Expand All @@ -100,7 +109,7 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="$PWD/build/sanitize-prefix" \
-DMMDMODEL_BUILD_TESTS=ON \
-DMMDMODEL_SANITIZERS="address;undefined"
-DUSDMMD_SANITIZERS="address;undefined"
cmake --build build/sanitize-model

- name: mmdModel unit, robustness and boundary tests under the sanitizers
Expand All @@ -112,8 +121,8 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++-18
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DMOTIONVMD_BUILD_TESTS=ON
-DMOTIONVMD_SANITIZERS="address;undefined"
-DMOTIONVMD_BUILD_FUZZER=ON
-DUSDMMD_SANITIZERS="address;undefined"
-DUSDMMD_BUILD_FUZZERS=ON

- name: Build motionVmd
run: cmake --build build/sanitize-vmd
Expand All @@ -129,7 +138,7 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++-18 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMOTIONVMD_BUILD_TESTS=OFF \
-DMOTIONVMD_SANITIZERS="address;undefined"
-DUSDMMD_SANITIZERS="address;undefined"
cmake --build build/sanitize-vmd-lib
cmake --install build/sanitize-vmd-lib --prefix build/sanitize-prefix
cmake --install build/sanitize-model --prefix build/sanitize-prefix
Expand All @@ -141,7 +150,7 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="$PWD/build/sanitize-prefix" \
-DMMDMOTIONBINDING_BUILD_TESTS=ON \
-DMMDMOTIONBINDING_SANITIZERS="address;undefined"
-DUSDMMD_SANITIZERS="address;undefined"
cmake --build build/sanitize-binding

- name: mmdMotionBinding unit and boundary tests under the sanitizers
Expand All @@ -159,7 +168,7 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH="$PWD/build/sanitize-prefix" \
-DMMDCONTROL_BUILD_TESTS=ON \
-DMMDCONTROL_SANITIZERS="address;undefined"
-DUSDMMD_SANITIZERS="address;undefined"
cmake --build build/sanitize-control

- name: mmdControl unit, robustness and boundary tests under the sanitizers
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ Stage-contract version: **1**, authored since the Phase 0 importer.

### Changed

- **One CMake dependency contract for plain CMake, a single component and
`ost`.** Inside the repository an edge is the in-tree target when it
exists and the installed package otherwise; outside it, always an
installed package found by the component that links it — the adapters now
find `motionRetarget` and `motionCore` themselves, and the root lists no
external package but OpenUSD. `CMakePresets.json` no longer reads
`USD_INSTALL_ROOT`: the caller passes the dependency prefix as
`CMAKE_PREFIX_PATH`. The shared CMake is one module per concern
(`UsdMmdProject`, `UsdMmdTargets`, `UsdMmdSanitizers`, `UsdMmdPackage`,
`UsdMmdTesting`, `UsdMmdOpenUsd`): every library installs through
`usdmmd_install_library()`, OpenUSD resolves through
`usdmmd_find_openusd()` only where its targets are not yet visible, and
build settings are per target. The per-component sanitizer options became
`USDMMD_SANITIZERS` and `USDMMD_BUILD_FUZZERS`. The adapters' tests put
OpenUSD on `PATH` themselves, so they pass outside an `ost` session.
Staging the plugin and tools out of the source tree waits on OpenStrata
(`WORKSPACE.md` §5; ost report 01).

- **The `ost` pin is 0.23.3.** 0.23.3 adds a tool's own library edges to
`ost library pull`, the root build and the graph check, and discards a
build tree whose cache was configured against another runtime
Expand Down
83 changes: 34 additions & 49 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,59 +1,47 @@
# SPDX-License-Identifier: Apache-2.0
#
# Top-level project for usd-mmd-plugins.
# Top-level project for usd-mmd-plugins: the dependency graph of the
# workspace, and nothing else. Each component declares its own dependencies
# and its own install; this file says in which order they are composed, and
# where OpenUSD enters.
#
# The workspace builds two ways, and both are kept working
# (docs/architecture/WORKSPACE.md §5):
# * OpenStrata: `ost plugin build|test plugins/usdMmdFileFormat` drives the
# bundle's own CMakeLists.txt against the activated runtime's toolchain, and
# `ost plugin test --workspace` configures this file.
# * Plain CMake: configure this file with CMAKE_PREFIX_PATH pointing at an
# OpenUSD 26.08 install, or use CMakePresets.json:
# cmake -S . -B build -DCMAKE_PREFIX_PATH=<usd-install>
# One CMake contract, three ways to drive it (docs/architecture/WORKSPACE.md
# §5):
# * Plain CMake, this file: CMAKE_PREFIX_PATH names the dependency prefix --
# OpenUSD 26.08 and usd-motion-plugins' packages, installed:
# cmake -S . -B build -DCMAKE_PREFIX_PATH=<dependency-prefix>
# cmake --build build --config Release
# ctest --test-dir build -C Release
# * Plain CMake, one component: `cmake -S libs/<component>` against the same
# prefix plus the installed packages of its in-repository edges.
# * OpenStrata: `ost build`, `ost plugin build plugins/usdMmdFileFormat`,
# `ost library build libs/<component>` compose that prefix and configure
# these same files; nothing here knows it.
#
# Every component is a self-contained CMake project (so `ost` can build it
# standalone) that is also add_subdirectory()-able from here.
# Inside this repository an edge is the in-tree target when it exists and the
# installed package otherwise (`if(NOT TARGET ...) find_package(...)`);
# outside it, always an installed package. No sibling checkout is ever
# add_subdirectory()'d.
cmake_minimum_required(VERSION 3.22)

# The single product version: the repository-root VERSION file. CHANGELOG.md,
# the git tag and every manifest mirror it; nothing restates the number here.
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" _mmd_project_version LIMIT_COUNT 1)
string(STRIP "${_mmd_project_version}" _mmd_project_version)

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/UsdMmdProject.cmake")
project(UsdMmdPlugins
VERSION ${_mmd_project_version}
VERSION ${USDMMD_VERSION}
DESCRIPTION "OpenUSD plugins for MikuMikuDance assets"
LANGUAGES CXX)

# C++20: the parser's public API takes std::span (DEPENDENCIES.md §2).
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Single-config generators (Ninja) default to an empty build type. The OpenUSD
# installs this builds against are Release-only, so default to Release rather
# than pull debug-only imported dependencies.
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()

option(USDMMD_BUILD_TESTS "Build usd-mmd-plugins tests" ${PROJECT_IS_TOP_LEVEL})
usdmmd_component(TESTS_OPTION USDMMD_BUILD_TESTS)

if(USDMMD_BUILD_TESTS)
# At the top level, so tests registered by components are discoverable by
# `ctest` from this build tree.
enable_testing()
endif()

# The PMX syntax parser, the canonical model, the VMD reader and the tools that
# report on a PMX and a VMD link no OpenUSD (WORKSPACE.md §2), so they are
# added before the one workspace-wide OpenUSD resolution below. Their position
# is the statement: nothing they configure can see pxr.
# Pure MMD libraries: the PMX syntax parser, the canonical model, the VMD
# reader, motion binding and control evaluation, and the tools that report on
# a PMX and a VMD. They link no OpenUSD and nothing outside this repository
# (WORKSPACE.md §2), so they are added before OpenUSD is resolved. Their
# position is the statement: nothing they configure can see pxr.
add_subdirectory("libs/mmdPmx")
add_subdirectory("libs/mmdModel")
add_subdirectory("libs/motionVmd")
Expand All @@ -62,18 +50,9 @@ add_subdirectory("libs/mmdControl")
add_subdirectory("tools/mmdInspect")
add_subdirectory("tools/vmdInspect")

# Resolve OpenUSD once for the whole project; bundles reuse the result.
find_package(pxr REQUIRED CONFIG)
# OpenUSD, resolved once for everything below and held to the pin.
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/UsdMmdOpenUsd.cmake")

# The two Phase 9 adapters are the only libraries that cross into the shared
# motion packages. Resolve them after OpenUSD so motionCore/motionRetarget can
# reuse the already-defined foundation targets, then add the adapters in their
# dependency order.
find_package(motionCore 0.5 CONFIG REQUIRED)
find_package(motionRetarget 0.5 CONFIG REQUIRED)
add_subdirectory("libs/mmdSkeletonAdapter")
add_subdirectory("libs/mmdMotionAdapter")
usdmmd_find_openusd()

# The interpreter the integration tests import OpenUSD's Python bindings into.
# It must be the Python OpenUSD was built against, and pxrConfig.cmake names
Expand All @@ -88,6 +67,12 @@ if(USDMMD_BUILD_TESTS)
endif()
endif()

# Ecosystem adapters: the only libraries that cross into usd-motion-plugins
# (WORKSPACE.md §2.4). Each finds its motion package itself; they follow
# OpenUSD so those packages reuse the foundation targets resolved above.
add_subdirectory("libs/mmdSkeletonAdapter")
add_subdirectory("libs/mmdMotionAdapter")

# Every plugin bundle: an immediate plugins/<name>/ carrying both an
# openstrata.plugin.yaml and a CMakeLists.txt. Named rather than globbed, so
# adding a bundle is a visible edit here, in openstrata.toml, and in
Expand Down
9 changes: 4 additions & 5 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
"installDir": "${sourceDir}/build/${presetName}-install",
"cacheVariables": {
"CMAKE_CXX_STANDARD": "20",
"USDMMD_BUILD_TESTS": "ON",
"CMAKE_PREFIX_PATH": "$env{USD_INSTALL_ROOT}"
"USDMMD_BUILD_TESTS": "ON"
}
},
{
"name": "windows-msvc",
"displayName": "Windows / Visual Studio (plain CMake)",
"description": "Set USD_INSTALL_ROOT to an OpenUSD 26.08 install. No generator is named, so CMake picks the newest Visual Studio installed.",
"description": "Pass the dependency prefix -- OpenUSD 26.08, and usd-motion-plugins' motionCore, motionRetarget and motionUsd 0.5 -- with -DCMAKE_PREFIX_PATH or the CMAKE_PREFIX_PATH environment variable. No generator is named, so CMake picks the newest Visual Studio installed.",
"inherits": "base",
"architecture": {
"value": "x64",
Expand All @@ -35,7 +34,7 @@
{
"name": "macos-ninja",
"displayName": "macOS / Ninja (plain CMake)",
"description": "Set USD_INSTALL_ROOT to an OpenUSD 26.08 install.",
"description": "Pass the dependency prefix -- OpenUSD 26.08, and usd-motion-plugins' motionCore, motionRetarget and motionUsd 0.5 -- with -DCMAKE_PREFIX_PATH or the CMAKE_PREFIX_PATH environment variable.",
"inherits": "base",
"generator": "Ninja Multi-Config",
"condition": {
Expand All @@ -47,7 +46,7 @@
{
"name": "linux-ninja",
"displayName": "Linux / Ninja (plain CMake)",
"description": "Set USD_INSTALL_ROOT to an OpenUSD 26.08 install.",
"description": "Pass the dependency prefix -- OpenUSD 26.08, and usd-motion-plugins' motionCore, motionRetarget and motionUsd 0.5 -- with -DCMAKE_PREFIX_PATH or the CMAKE_PREFIX_PATH environment variable.",
"inherits": "base",
"generator": "Ninja Multi-Config",
"condition": {
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,19 @@ paths, and Japanese texture filenames resolve. The full contract is

The workspace builds both with
[OpenStrata](https://github.com/animu-sphere/open-strata) (`ost`) and with
plain CMake, against OpenUSD 26.08 exactly
plain CMake, against OpenUSD 26.08 exactly and `usd-motion-plugins`' released
packages, all found as installed packages on `CMAKE_PREFIX_PATH`
([WORKSPACE.md §5](docs/architecture/WORKSPACE.md#5-build-modes)):

```powershell
$env:USD_INSTALL_ROOT = "<OpenUSD 26.08 install>"
$env:CMAKE_PREFIX_PATH = "<OpenUSD 26.08>;<motionCore>;<motionRetarget>;<motionUsd>"
cmake --preset windows-msvc
cmake --build --preset windows-release
ctest --preset windows-release
```

or `ost build` and `ost test`. [docs/guides/building.md](docs/guides/building.md)
has the full set — the bundle on its own, packaging, and the
has the full set — one component on its own, packaging, and the
installed-consumer lane — every command in it run.

## Documentation
Expand Down
Loading
Loading