Init add tinyusdz repo
|
@ -0,0 +1,30 @@
|
|||
build_and_store_wheels: &BUILD_AND_STORE_WHEELS
|
||||
install_cibuildwheel_script:
|
||||
- python -m pip install cibuildwheel==2.12.3
|
||||
run_cibuildwheel_script:
|
||||
- cibuildwheel
|
||||
wheels_artifacts:
|
||||
path: "wheelhouse/*"
|
||||
|
||||
# Upload only for tagged commit
|
||||
only_if: $CIRRUS_TAG != ''
|
||||
publish_script:
|
||||
- python -m pip install twine
|
||||
- python -m twine upload --repository-url https://upload.pypi.org/legacy/ --username __token__ wheelhouse/*.whl
|
||||
|
||||
|
||||
linux_aarch64_task:
|
||||
name: Build Linux aarch64 wheels.
|
||||
compute_engine_instance:
|
||||
image_project: cirrus-images
|
||||
image: family/docker-builder-arm64
|
||||
architecture: arm64
|
||||
platform: linux
|
||||
cpu: 4
|
||||
memory: 4G
|
||||
environment:
|
||||
TWINE_PASSWORD: ENCRYPTED[7a87c65110c7601f14459f31565caa3871c7d182e2da2a5c238c5b3e2d4dccf5c8ecb4517c407ff16d5089e1a2cffc12]
|
||||
|
||||
install_pre_requirements_script:
|
||||
- apt install -y python3-venv python-is-python3
|
||||
<<: *BUILD_AND_STORE_WHEELS
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 2
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
BreakBeforeBraces: Attach
|
||||
Standard: Cpp11
|
|
@ -0,0 +1,5 @@
|
|||
FROM gcr.io/oss-fuzz-base/base-builder:v1
|
||||
RUN apt-get update && apt-get install -y make autoconf automake libtool meson ninja-build
|
||||
COPY . $SRC/tinyusdz
|
||||
WORKDIR $SRC/tinyusdz
|
||||
COPY .clusterfuzzlite/build.sh $SRC/
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash -eu
|
||||
|
||||
# build project
|
||||
# e.g.
|
||||
# ./autogen.sh
|
||||
# ./configure
|
||||
# make -j$(nproc) all
|
||||
|
||||
# build fuzzers
|
||||
# e.g.
|
||||
# $CXX $CXXFLAGS -std=c++11 -Iinclude \
|
||||
# /path/to/name_of_fuzzer.cc -o $OUT/name_of_fuzzer \
|
||||
# $LIB_FUZZING_ENGINE /path/to/library.a
|
||||
|
||||
|
||||
cd tests/fuzzer
|
||||
|
||||
rm -rf build
|
||||
CXX=clang++ CC=clang meson -Dprefix=$OUT build
|
||||
cd build
|
||||
ninja && cp fuzz_intcoding fuzz_tinyusdz fuzz_usdaparser $OUT/
|
|
@ -0,0 +1 @@
|
|||
language: c++
|
|
@ -0,0 +1,13 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: syoyo # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@ -0,0 +1,10 @@
|
|||
name: "TinyUSDZ CodeQL config"
|
||||
|
||||
paths:
|
||||
- src
|
||||
paths-ignore:
|
||||
- src/external
|
||||
- src/osd
|
||||
- src/lz4
|
||||
- src/blender
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
name: ClusterFuzzLite continuous builds
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev # Use your actual default branch here.
|
||||
permissions: read-all
|
||||
jobs:
|
||||
Build:
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ matrix.sanitizer }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sanitizer:
|
||||
- address
|
||||
# Override this with the sanitizers you want.
|
||||
# - undefined
|
||||
# - memory
|
||||
steps:
|
||||
- name: Build Fuzzers (${{ matrix.sanitizer }})
|
||||
id: build
|
||||
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
|
||||
with:
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
upload-build: true
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
name: ClusterFuzzLite PR fuzzing
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '**'
|
||||
permissions: read-all
|
||||
jobs:
|
||||
PR:
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ matrix.sanitizer }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sanitizer:
|
||||
- address
|
||||
# Override this with the sanitizers you want.
|
||||
# - undefined
|
||||
# - memory
|
||||
steps:
|
||||
- name: Build Fuzzers (${{ matrix.sanitizer }})
|
||||
id: build
|
||||
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
# Optional but recommended: used to only run fuzzers that are affected
|
||||
# by the PR.
|
||||
# See later section on "Git repo for storage".
|
||||
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
|
||||
# storage-repo-branch: main # Optional. Defaults to "main"
|
||||
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
|
||||
- name: Run Fuzzers (${{ matrix.sanitizer }})
|
||||
id: run
|
||||
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fuzz-seconds: 600
|
||||
mode: 'code-change'
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
# Optional but recommended: used to download the corpus produced by
|
||||
# batch fuzzing.
|
||||
# See later section on "Git repo for storage".
|
||||
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
|
||||
# storage-repo-branch: main # Optional. Defaults to "main"
|
||||
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
name: Android
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
# Android(aarch64) build
|
||||
build-android:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
name: Build for Android(arm64v8a)
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Show android sdk root
|
||||
run: |
|
||||
env | grep ANDROID
|
||||
echo $ANDROID_SDK_ROOT
|
||||
- name: Setup
|
||||
run: |
|
||||
sudo apt-get install -y ninja-build tree
|
||||
- name: Show android sdk details
|
||||
run: |
|
||||
tree $ANDROID_SDK_ROOT
|
||||
- name: CmakeAndBuild
|
||||
run: |
|
||||
./scripts/bootstrap-android-cmake-linux.sh
|
||||
cd build-android
|
||||
ninja -v
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev" ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "dev" ]
|
||||
schedule:
|
||||
- cron: '35 18 * * 6'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp', 'python' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# đź“š See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
|
@ -0,0 +1,29 @@
|
|||
name: iOS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
|
||||
# iOS build
|
||||
build-ios:
|
||||
|
||||
runs-on: macos-latest
|
||||
name: Build for iOS
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: List up iPhone platform
|
||||
run: |
|
||||
ls -la /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
|
||||
- name: CmakeAndBuild
|
||||
run: |
|
||||
./scripts/bootstrap-aarch64-ios.sh
|
||||
cd build-aarch64-cross
|
||||
make VERBOSE=1
|
||||
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
name: Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
|
||||
# Disable gcc4.9 and gcc5 since its too obsolete and failed to do apt-get
|
||||
## compile with oldest gcc4.9 which supports (most of)C++14
|
||||
#build-gcc49:
|
||||
|
||||
# runs-on: ubuntu-latest
|
||||
# name: Build with gcc 4.9
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v1
|
||||
# - name: CmakeAndBuild
|
||||
# run: |
|
||||
# sudo apt-add-repository -y 'deb http://dk.archive.ubuntu.com/ubuntu/ xenial main'
|
||||
# sudo apt-add-repository -y 'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y build-essential
|
||||
# sudo apt-get install -y gcc-4.9 g++-4.9 gcc-4.9-multilib
|
||||
# ./scripts/bootstrap-gcc-49.sh
|
||||
# cd build-gcc49
|
||||
# make VERBOSE=1
|
||||
|
||||
## compile with older gcc5
|
||||
#build-gcc5:
|
||||
|
||||
# runs-on: ubuntu-latest
|
||||
# name: Build with gcc 5
|
||||
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@v1
|
||||
# - name: CmakeAndBuild
|
||||
# run: |
|
||||
# sudo apt-add-repository -y 'deb http://dk.archive.ubuntu.com/ubuntu/ xenial main'
|
||||
# sudo apt-add-repository -y 'deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe'
|
||||
# sudo apt-get update
|
||||
# sudo apt-get install -y build-essential
|
||||
# sudo apt-get install -y gcc-5 g++-5
|
||||
# ./scripts/bootstrap-gcc-5.sh
|
||||
# cd build-gcc5
|
||||
# make VERBOSE=1
|
||||
|
||||
# Cross-compile for aarch64 linux target
|
||||
build-cross-aarch64:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
name: Build on cross aarch64
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: CmakeAndBuild
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
||||
./scripts/bootstrap-gcc-aarch64-cross-ci.sh
|
||||
cd build-cross
|
||||
make VERBOSE=1
|
||||
|
||||
# Build with OpenSubdiv
|
||||
build-osd:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: configure
|
||||
run: ./scripts/bootstrap-cmake-linux-with-osd.sh
|
||||
- name: make
|
||||
run: cd build && make
|
||||
- name: test
|
||||
run: cd build && ctest --output-on-failure
|
||||
|
||||
# 32bit build(Linux only)
|
||||
build-32bit:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: setup
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt-get install -y gcc-multilib g++-multilib
|
||||
- name: configure
|
||||
run: ./scripts/bootstrap-cmake-linux-32bit.sh
|
||||
- name: make
|
||||
run: cd build_m32 && make
|
||||
- name: test
|
||||
run: cd build_m32 && ctest --output-on-failure
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# ubuntu-latest(Ubuntu 22.04 as of 2024/01/03) has clang installed,
|
||||
# so use clang
|
||||
# TODO: Use libc++ for STL?
|
||||
- name: configure
|
||||
run: CXX=clang++ CC=clang ./scripts/bootstrap-cmake-linux.sh
|
||||
- name: make
|
||||
run: cd build && make
|
||||
- name: tests
|
||||
run: cd build && ctest --output-on-failure
|
|
@ -0,0 +1,29 @@
|
|||
name: macOS
|
||||
|
||||
# TODO: Build with Python.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
|
||||
build-macos:
|
||||
|
||||
runs-on: macos-latest
|
||||
name: Build for macOS
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: CmakeAndBuild
|
||||
run: |
|
||||
./scripts/bootstrap-cmake-macos.sh
|
||||
cd build
|
||||
make VERBOSE=1
|
||||
- name: Ctest
|
||||
run: |
|
||||
cd build
|
||||
ctest --output-on-failure
|
|
@ -0,0 +1,101 @@
|
|||
name: Build and upload to PyPI
|
||||
|
||||
# Build on every branch push, tag push, and pull request change:
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
build_wheels:
|
||||
name: Build wheels on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@v2.16.5
|
||||
# to supply options, put them in 'env', like:
|
||||
# env:
|
||||
# CIBW_SOME_OPTION: value
|
||||
# Disable building PyPy wheels on all platforms
|
||||
env:
|
||||
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
|
||||
CIBW_ARCHS_WINDOWS: "AMD64 x86"
|
||||
# aarch64 build takes too much time, so aarch64 build is delegated to Cirrus CI.
|
||||
CIBW_ARCHS_LINUX: "x86_64 i686"
|
||||
CIBW_SKIP: pp*
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
||||
path: ./wheelhouse/*.whl
|
||||
|
||||
# It looks cibuildwheels did not clean build folder(CMake), and it results to Windows arm64 build failure(trying to reuse x86 build of .obj)
|
||||
# So supply separated build job for Windows ARM64 build
|
||||
# TODO: clean build folder using CIBW_BEFORE_ALL?
|
||||
build_win_arm64_wheels:
|
||||
name: Build ARM64 wheels on Windows.
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@v2.16.5
|
||||
# to supply options, put them in 'env', like:
|
||||
# env:
|
||||
# CIBW_SOME_OPTION: value
|
||||
# Disable building PyPy wheels on all platforms
|
||||
env:
|
||||
CIBW_ARCHS_WINDOWS: "ARM64"
|
||||
CIBW_SKIP: pp*
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
||||
path: ./wheelhouse/*.whl
|
||||
|
||||
make_sdist:
|
||||
name: Make SDist
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Optional, use if you use setuptools_scm
|
||||
submodules: true # Optional, use if you have submodules
|
||||
|
||||
- name: Build SDist
|
||||
run: pipx run build --sdist
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cibw-sdist
|
||||
path: dist/*.tar.gz
|
||||
|
||||
upload_all:
|
||||
needs: [build_wheels, build_wheels, make_sdist]
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
permissions:
|
||||
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||
id-token: write
|
||||
# # upload to PyPI on every tag starting with 'v'
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
# alternatively, to publish when a GitHub Release is created, use the following rule:
|
||||
# if: github.event_name == 'push' && github.event.action == 'published'
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: cibw-*
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
# Use Trusted Publishing so no use of PYPI_API_TOKEN
|
||||
# user: __token__
|
||||
# password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
skip-existing: true
|
||||
verbose: true
|
|
@ -0,0 +1,48 @@
|
|||
name: Windows ARM
|
||||
|
||||
# TODO: Run unittest on Native ARM64 Windows11
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
|
||||
# Windows(ARM64) + Visual Studio 2022 build
|
||||
build-windows-arm64-msvc:
|
||||
|
||||
runs-on: windows-latest
|
||||
name: Build for Windows(ARM64, MSVC)
|
||||
|
||||
# Use system installed cmake
|
||||
# https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir build_arm64
|
||||
cmake -G "Visual Studio 17 2022" -A ARM64 -Bbuild_arm64 -DTINYUSDZ_WITH_EXR=1 -DTINYUSDZ_WITH_TIFF=1 -S.
|
||||
- name: Build
|
||||
run: cmake --build build_arm64 --config Release
|
||||
|
||||
# Windows(ARM32) + Visual Studio 2022 build
|
||||
build-windows-arm32-msvc:
|
||||
|
||||
runs-on: windows-latest
|
||||
name: Build for Windows(ARM32, MSVC)
|
||||
|
||||
# Use system installed cmake
|
||||
# https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir build_arm32
|
||||
cmake -G "Visual Studio 17 2022" -A ARM -Bbuild_arm32 -DTINYUSDZ_WITH_EXR=1 -DTINYUSDZ_WITH_TIFF=1 -S.
|
||||
- name: Build
|
||||
run: cmake --build build_arm32 --config Release
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
name: Windows
|
||||
|
||||
# TODO: MinGW(gcc) build
|
||||
# TODO: llvm-mingw(clang) build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ dev ]
|
||||
pull_request:
|
||||
branches: [ dev ]
|
||||
|
||||
jobs:
|
||||
|
||||
# Windows(x64) + Visual Studio 2019 build
|
||||
build-windows-msvc:
|
||||
|
||||
runs-on: windows-latest
|
||||
name: Build for Windows(x64, MSVC)
|
||||
|
||||
# Use system installed cmake
|
||||
# https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Configure
|
||||
run: .\vcsetup.bat
|
||||
- name: Build
|
||||
run: cmake --build build --config Release
|
||||
- name: Test
|
||||
run: ctest --test-dir build -C Release --output-on-failure
|
||||
|
||||
# Windows(32bit) + Visual Studio 2019 build
|
||||
build-windows-msvc-win32:
|
||||
|
||||
runs-on: windows-latest
|
||||
name: Build for Windows(Win32, MSVC)
|
||||
|
||||
# Use system installed cmake
|
||||
# https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Configure
|
||||
run: .\vcsetup-32bit.bat
|
||||
- name: Build
|
||||
run: cmake --build build_win32 --config Release
|
||||
- name: Test
|
||||
run: ctest --test-dir build_win32 -C Release --output-on-failure
|
||||
|
|
@ -0,0 +1,357 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# App-specific
|
||||
build/
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
compile_commands.json
|
||||
|
||||
# Cmake
|
||||
CMakeUserPresets.json
|
|
@ -0,0 +1,203 @@
|
|||
{
|
||||
"version": 2,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default_debug",
|
||||
"displayName": "Default Debug Config",
|
||||
"description": "Default Debug build using Ninja generator",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/default_debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_debug",
|
||||
"displayName": "Default MSVC x64 Debug Config(VS2022)",
|
||||
"description": "Default MSVC x64 Debug build",
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/Debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_release",
|
||||
"displayName": "Default MSVC x64 Release Config(VS2022)",
|
||||
"description": "Default MSVC x64 Release build",
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/Release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_relwithdebinfo",
|
||||
"displayName": "Default MSVC x64 RelWithDebInfo Config(VS2022)",
|
||||
"description": "Default MSVC x64 RelWithDebInfo build",
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/RelWithDebInfo",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_minsizerel",
|
||||
"displayName": "Default MSVC x64 MinSizeRel Config(VS2022)",
|
||||
"description": "Default MSVC x64 MinSizeRel build",
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/MinSizeRel",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "MinSizeRel",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_debug",
|
||||
"displayName": "Default MSVC x64 Debug Config(VS2019)",
|
||||
"description": "Default MSVC x64 Debug build",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/Debug",
|
||||
"configurationType": "Debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_release",
|
||||
"displayName": "Default MSVC x64 Release Config(VS2019)",
|
||||
"description": "Default MSVC x64 Release build",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/Release",
|
||||
"configurationType": "Release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_relwithdebinfo",
|
||||
"displayName": "Default MSVC x64 RelWithDebInfo Config(VS2019)",
|
||||
"description": "Default MSVC x64 RelWithDebInfo build",
|
||||
"generator": "Visual Studio 17 2019",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/RelWithDebInfo",
|
||||
"configurationType": "RelWithDebInfo",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_minsizerel",
|
||||
"displayName": "Default MSVC x64 MinSizeRel Config(VS2019)",
|
||||
"description": "Default MSVC x64 MinSizeRel build",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"architecture": { "value": "x64" },
|
||||
"binaryDir": "${sourceDir}/build/MinSizeRel",
|
||||
"configurationType": "MinSizeRel",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "MinSizeRel",
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ninja-multi",
|
||||
"inherits": "default_debug",
|
||||
"displayName": "Ninja Multi-Config",
|
||||
"description": "Default build using Ninja Multi-Config generator",
|
||||
"generator": "Ninja Multi-Config"
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "default_debug",
|
||||
"configurePreset": "default_debug",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_debug",
|
||||
"displayName": "Debug",
|
||||
"configurePreset": "msvc_2022_debug",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_release",
|
||||
"displayName": "Release",
|
||||
"configurePreset": "msvc_2022_release",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_relwithdebinfo",
|
||||
"displayName": "RelWithDebInfo",
|
||||
"configurePreset": "msvc_2022_relwithdebinfo",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2022_minsizerel",
|
||||
"displayName": "MinSizeRel",
|
||||
"configurePreset": "msvc_2022_minsizerel",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_debug",
|
||||
"displayName": "Debug",
|
||||
"configurePreset": "msvc_2019_debug",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_release",
|
||||
"displayName": "Release",
|
||||
"configurePreset": "msvc_2019_release",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_relwithdebinfo",
|
||||
"displayName": "RelWithDebInfo",
|
||||
"configurePreset": "msvc_2019_relwithdebinfo",
|
||||
"jobs": 8
|
||||
},
|
||||
{
|
||||
"name": "msvc_2019_minsizerel",
|
||||
"displayName": "MinSizeRel",
|
||||
"configurePreset": "msvc_2019_minsizerel",
|
||||
"jobs": 8
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "default_debug",
|
||||
"configurePreset": "default_debug",
|
||||
"output": {
|
||||
"outputOnFailure": true
|
||||
},
|
||||
"execution": {
|
||||
"noTestsAction": "error",
|
||||
"stopOnFailure": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
Apache 2.0 License
|
||||
|
||||
Copyright (c) 2020-2023 Syoyo Fujita
|
||||
Copyright (c) 2024-Present Light Transport Entertainment Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,547 @@
|
|||
include CMakeLists.txt
|
||||
include CMakeSettings.json
|
||||
include LICENSE
|
||||
include README.md
|
||||
include cmake/ClangClCMakeCompileRules.cmake
|
||||
include cmake/aarch64-linux-gnu.toolchain
|
||||
include cmake/clang-cl-msvc-windows.cmake
|
||||
include cmake/clang-cl-msvc-wsl.cmake
|
||||
include cmake/ios.toolchain.cmake
|
||||
include cmake/llvm-mingw-cross.cmake
|
||||
include cmake/llvm-mingw-win64.cmake
|
||||
include cmake/mingw64-cross.cmake
|
||||
include cmake/sanitizers/FindASan.cmake
|
||||
include cmake/sanitizers/FindMSan.cmake
|
||||
include cmake/sanitizers/FindSanitizers.cmake
|
||||
include cmake/sanitizers/FindTSan.cmake
|
||||
include cmake/sanitizers/FindUBSan.cmake
|
||||
include cmake/sanitizers/asan-wrapper
|
||||
include cmake/sanitizers/sanitize-helpers.cmake
|
||||
include doc/README.md
|
||||
include doc/TODO.md
|
||||
include doc/composition.md
|
||||
include doc/docs/index.md
|
||||
include doc/macros.tex
|
||||
include doc/mkdocs.yml
|
||||
include doc/preview_surface.md
|
||||
include doc/prim_format.md
|
||||
include doc/usdObj.md
|
||||
include doc/usd_sourcecode_tour.md
|
||||
include doc/usdc_format.md
|
||||
include doc/usdz_note.md
|
||||
include pyproject.toml
|
||||
graft python
|
||||
include setup.py
|
||||
include src/asset-resolution.cc
|
||||
include src/asset-resolution.hh
|
||||
include src/ascii-parser.cc
|
||||
include src/ascii-parser.hh
|
||||
include src/ascii-parser-basetype.cc
|
||||
include src/ascii-parser-timesamples.cc
|
||||
include src/ascii-parser-timesamples-array.cc
|
||||
include src/c-tinyusd.cc
|
||||
include src/c-tinyusd.h
|
||||
include src/common-macros.inc
|
||||
include src/composition.hh
|
||||
include src/crate-format.cc
|
||||
include src/crate-format.hh
|
||||
include src/crate-pprint.cc
|
||||
include src/crate-pprint.hh
|
||||
include src/crate-reader.cc
|
||||
include src/crate-reader.hh
|
||||
include src/crate-writer.cc
|
||||
include src/crate-writer.hh
|
||||
include src/define-type-trait.inc
|
||||
include src/external/filesystem/LICENSE
|
||||
include src/external/filesystem/README.md
|
||||
include src/external/filesystem/include/ghc/filesystem.hpp
|
||||
include src/external/filesystem/include/ghc/fs_fwd.hpp
|
||||
include src/external/filesystem/include/ghc/fs_impl.hpp
|
||||
include src/external/filesystem/include/ghc/fs_std_fwd.hpp
|
||||
include src/external/filesystem/include/ghc/fs_std.hpp
|
||||
include src/external/glob/include/glob/glob.h
|
||||
include src/external/glob/LICENSE
|
||||
include src/external/glob/README.md
|
||||
include src/external/glob/single_include/glob/glob.hpp
|
||||
include src/external/glob/source/glob.cpp
|
||||
include src/external/filesystem/include/ghc/fs_std_impl.hpp
|
||||
include src/external/LICENSE.miniz
|
||||
include src/external/LICENSE.ogt_vox.md
|
||||
include src/external/README.fpng.md
|
||||
include src/external/dtoa_milo.h
|
||||
include src/external/dtoa_milo.LICENSE
|
||||
include src/external/dr_mp3.h
|
||||
include src/external/dr_wav.h
|
||||
include src/external/fast_float/LICENSE-APACHE
|
||||
include src/external/fast_float/LICENSE-MIT
|
||||
include src/external/fast_float/README.md
|
||||
include src/external/fast_float/include/fast_float/*.h
|
||||
include src/external/fpng.cpp
|
||||
include src/external/fpng.h
|
||||
include src/external/jsonhpp/LICENSE.MIT
|
||||
include src/external/jsonhpp/nlohmann/json.hpp
|
||||
include src/external/jsonhpp/nlohmann/json_fwd.hpp
|
||||
include src/external/jsteemann/LICENSE
|
||||
include src/external/jsteemann/README.md
|
||||
include src/external/jsteemann/atoi.h
|
||||
include src/external/jsteemann/modification.md
|
||||
include src/external/linalg.README
|
||||
include src/external/linalg.UNLICENSE
|
||||
include src/external/linalg.h
|
||||
include src/external/miniz.c
|
||||
include src/external/miniz.h
|
||||
include src/external/mapbox/eternal/LICENSE.md
|
||||
include src/external/mapbox/eternal/README.md
|
||||
include src/external/mapbox/eternal/include/mapbox/eternal.hpp
|
||||
include src/external/mapbox/earcut/CHANGELOG.md
|
||||
include src/external/mapbox/earcut/earcut.hpp
|
||||
include src/external/mapbox/earcut/LICENSE
|
||||
include src/external/mapbox/earcut/README.md
|
||||
#include src/external/nanobind/CMakeLists.txt
|
||||
#include src/external/nanobind/LICENSE
|
||||
#include src/external/nanobind/README.md
|
||||
#include src/external/nanobind/cmake/nanobind-config.cmake
|
||||
#include src/external/nanobind/ext/robin_map/CMakeLists.txt
|
||||
#include src/external/nanobind/ext/robin_map/LICENSE
|
||||
#include src/external/nanobind/ext/robin_map/README.md
|
||||
#include src/external/nanobind/ext/robin_map/cmake/tsl-robin-mapConfig.cmake.in
|
||||
#include src/external/nanobind/ext/robin_map/include/tsl/robin_growth_policy.h
|
||||
#include src/external/nanobind/ext/robin_map/include/tsl/robin_hash.h
|
||||
#include src/external/nanobind/ext/robin_map/include/tsl/robin_map.h
|
||||
#include src/external/nanobind/ext/robin_map/include/tsl/robin_set.h
|
||||
#include src/external/nanobind/ext/robin_map/tests/CMakeLists.txt
|
||||
#include src/external/nanobind/ext/robin_map/tests/custom_allocator_tests.cpp
|
||||
#include src/external/nanobind/ext/robin_map/tests/main.cpp
|
||||
#include src/external/nanobind/ext/robin_map/tests/policy_tests.cpp
|
||||
#include src/external/nanobind/ext/robin_map/tests/robin_map_tests.cpp
|
||||
#include src/external/nanobind/ext/robin_map/tests/robin_set_tests.cpp
|
||||
#include src/external/nanobind/ext/robin_map/tests/utils.h
|
||||
#include src/external/nanobind/ext/robin_map/tsl-robin-map.natvis
|
||||
#include src/external/nanobind/include/nanobind/nanobind.h
|
||||
#include src/external/nanobind/include/nanobind/nb_accessor.h
|
||||
#include src/external/nanobind/include/nanobind/nb_attr.h
|
||||
#include src/external/nanobind/include/nanobind/nb_call.h
|
||||
#include src/external/nanobind/include/nanobind/nb_cast.h
|
||||
#include src/external/nanobind/include/nanobind/nb_class.h
|
||||
#include src/external/nanobind/include/nanobind/nb_defs.h
|
||||
#include src/external/nanobind/include/nanobind/nb_descr.h
|
||||
#include src/external/nanobind/include/nanobind/nb_enums.h
|
||||
#include src/external/nanobind/include/nanobind/nb_error.h
|
||||
#include src/external/nanobind/include/nanobind/nb_func.h
|
||||
#include src/external/nanobind/include/nanobind/nb_lib.h
|
||||
#include src/external/nanobind/include/nanobind/nb_misc.h
|
||||
#include src/external/nanobind/include/nanobind/nb_python.h
|
||||
#include src/external/nanobind/include/nanobind/nb_traits.h
|
||||
#include src/external/nanobind/include/nanobind/nb_tuple.h
|
||||
#include src/external/nanobind/include/nanobind/nb_types.h
|
||||
#include src/external/nanobind/include/nanobind/operators.h
|
||||
#include src/external/nanobind/include/nanobind/stl/detail/nb_list.h
|
||||
#include src/external/nanobind/include/nanobind/stl/function.h
|
||||
#include src/external/nanobind/include/nanobind/stl/list.h
|
||||
#include src/external/nanobind/include/nanobind/stl/pair.h
|
||||
#include src/external/nanobind/include/nanobind/stl/shared_ptr.h
|
||||
#include src/external/nanobind/include/nanobind/stl/string.h
|
||||
#include src/external/nanobind/include/nanobind/stl/tuple.h
|
||||
#include src/external/nanobind/include/nanobind/stl/unique_ptr.h
|
||||
#include src/external/nanobind/include/nanobind/stl/vector.h
|
||||
#include src/external/nanobind/include/nanobind/tensor.h
|
||||
#include src/external/nanobind/include/nanobind/trampoline.h
|
||||
#include src/external/nanobind/src/buffer.h
|
||||
#include src/external/nanobind/src/common.cpp
|
||||
#include src/external/nanobind/src/error.cpp
|
||||
#include src/external/nanobind/src/implicit.cpp
|
||||
#include src/external/nanobind/src/nanobind/__init__.py
|
||||
#include src/external/nanobind/src/nb_enum.cpp
|
||||
#include src/external/nanobind/src/nb_func.cpp
|
||||
#include src/external/nanobind/src/nb_internals.cpp
|
||||
#include src/external/nanobind/src/nb_internals.h
|
||||
#include src/external/nanobind/src/nb_type.cpp
|
||||
#include src/external/nanobind/src/tensor.cpp
|
||||
#include src/external/nanobind/src/trampoline.cpp
|
||||
include src/external/ogt_vox.h
|
||||
include src/external/pugiconfig.hpp
|
||||
include src/external/pugixml.LICENSE
|
||||
include src/external/pugixml.cpp
|
||||
include src/external/pugixml.hpp
|
||||
include src/external/pystring.cpp
|
||||
include src/external/pystring.h
|
||||
include src/external/pystring.LICENSE
|
||||
include src/external/simple_match/LICENSE_1_0.txt
|
||||
include src/external/simple_match/README.md
|
||||
include src/external/simple_match/include/simple_match/implementation/some_none.hpp
|
||||
include src/external/simple_match/include/simple_match/simple_match.hpp
|
||||
include src/external/simple_match/include/simple_match/utility.hpp
|
||||
include src/external/stb_image.h
|
||||
include src/external/stb_image_resize.h
|
||||
include src/external/stb_image_write.h
|
||||
include src/external/stb_truetype.h
|
||||
include src/external/string_id/LICENSE
|
||||
include src/external/string_id/README.md
|
||||
include src/external/string_id/README.mod.txt
|
||||
include src/external/string_id/basic_database.hpp
|
||||
include src/external/string_id/config.hpp
|
||||
include src/external/string_id/config.hpp.in
|
||||
include src/external/string_id/config_impl.hpp
|
||||
include src/external/string_id/database.cpp
|
||||
include src/external/string_id/database.hpp
|
||||
include src/external/string_id/error.cpp
|
||||
include src/external/string_id/error.hpp
|
||||
include src/external/string_id/generator.cpp
|
||||
include src/external/string_id/generator.hpp
|
||||
include src/external/string_id/hash.hpp
|
||||
include src/external/string_id/string_id.cpp
|
||||
include src/external/string_id/string_id.hpp
|
||||
include src/external/tiny-color-io.h
|
||||
include src/external/tinycolorio.LICENSE
|
||||
include src/external/tiny_dng_loader.h
|
||||
include src/external/tiny_dng_writer.h
|
||||
include src/external/tiny_gltf.cc
|
||||
include src/external/tiny_gltf.h
|
||||
include src/external/tiny_obj_loader.cc
|
||||
include src/external/tiny_obj_loader.h
|
||||
include src/external/tinyexr.cc
|
||||
include src/external/tinyexr.h
|
||||
include src/external/floaxie/README.md
|
||||
include src/external/floaxie/LICENSE
|
||||
include src/external/floaxie/floaxie/atof.h
|
||||
include src/external/floaxie/floaxie/bit_ops.h
|
||||
include src/external/floaxie/floaxie/cached_power.h
|
||||
include src/external/floaxie/floaxie/conversion_status.h
|
||||
include src/external/floaxie/floaxie/default_fallback.h
|
||||
include src/external/floaxie/floaxie/diy_fp.h
|
||||
include src/external/floaxie/floaxie/fraction.h
|
||||
include src/external/floaxie/floaxie/ftoa.h
|
||||
include src/external/floaxie/floaxie/grisu.h
|
||||
include src/external/floaxie/floaxie/huge_val.h
|
||||
include src/external/floaxie/floaxie/integer_of_size.h
|
||||
include src/external/floaxie/floaxie/k_comp.h
|
||||
include src/external/floaxie/floaxie/krosh.h
|
||||
include src/external/floaxie/floaxie/memwrap.h
|
||||
include src/external/floaxie/floaxie/powers_ten.h
|
||||
include src/external/floaxie/floaxie/powers_ten_double.h
|
||||
include src/external/floaxie/floaxie/powers_ten_single.h
|
||||
include src/external/floaxie/floaxie/prettify.h
|
||||
include src/external/floaxie/floaxie/print.h
|
||||
include src/external/floaxie/floaxie/static_pow.h
|
||||
include src/external/floaxie/floaxie/type_punning_cast.h
|
||||
include src/handle-allocator.hh
|
||||
include src/image-loader.cc
|
||||
include src/image-loader.hh
|
||||
include src/image-types.hh
|
||||
include src/image-util.cc
|
||||
include src/image-util.hh
|
||||
include src/image-writer.cc
|
||||
include src/image-writer.hh
|
||||
include src/integerCoding.cpp
|
||||
include src/integerCoding.h
|
||||
include src/io-util.cc
|
||||
include src/io-util.hh
|
||||
include src/linear-algebra.cc
|
||||
include src/linear-algebra.hh
|
||||
include src/lz4-compression.cc
|
||||
include src/lz4-compression.hh
|
||||
include src/math-util.inc
|
||||
include src/nonstd/expected.hpp
|
||||
include src/nonstd/optional.hpp
|
||||
include src/osd/CMakeLists.txt
|
||||
include src/osd/LICENSE.txt
|
||||
include src/osd/README.md
|
||||
include src/osd/opensubdiv/CMakeLists.txt
|
||||
include src/osd/opensubdiv/far/CMakeLists.txt
|
||||
include src/osd/opensubdiv/far/bilinearPatchBuilder.cpp
|
||||
include src/osd/opensubdiv/far/bilinearPatchBuilder.h
|
||||
include src/osd/opensubdiv/far/catmarkPatchBuilder.cpp
|
||||
include src/osd/opensubdiv/far/catmarkPatchBuilder.h
|
||||
include src/osd/opensubdiv/far/error.cpp
|
||||
include src/osd/opensubdiv/far/error.h
|
||||
include src/osd/opensubdiv/far/loopPatchBuilder.cpp
|
||||
include src/osd/opensubdiv/far/loopPatchBuilder.h
|
||||
include src/osd/opensubdiv/far/patchBasis.cpp
|
||||
include src/osd/opensubdiv/far/patchBasis.h
|
||||
include src/osd/opensubdiv/far/patchBuilder.cpp
|
||||
include src/osd/opensubdiv/far/patchBuilder.h
|
||||
include src/osd/opensubdiv/far/patchDescriptor.cpp
|
||||
include src/osd/opensubdiv/far/patchDescriptor.h
|
||||
include src/osd/opensubdiv/far/patchMap.cpp
|
||||
include src/osd/opensubdiv/far/patchMap.h
|
||||
include src/osd/opensubdiv/far/patchParam.h
|
||||
include src/osd/opensubdiv/far/patchTable.cpp
|
||||
include src/osd/opensubdiv/far/patchTable.h
|
||||
include src/osd/opensubdiv/far/patchTableFactory.cpp
|
||||
include src/osd/opensubdiv/far/patchTableFactory.h
|
||||
include src/osd/opensubdiv/far/primvarRefiner.h
|
||||
include src/osd/opensubdiv/far/ptexIndices.cpp
|
||||
include src/osd/opensubdiv/far/ptexIndices.h
|
||||
include src/osd/opensubdiv/far/sparseMatrix.h
|
||||
include src/osd/opensubdiv/far/stencilBuilder.cpp
|
||||
include src/osd/opensubdiv/far/stencilBuilder.h
|
||||
include src/osd/opensubdiv/far/stencilTable.cpp
|
||||
include src/osd/opensubdiv/far/stencilTable.h
|
||||
include src/osd/opensubdiv/far/stencilTableFactory.cpp
|
||||
include src/osd/opensubdiv/far/stencilTableFactory.h
|
||||
include src/osd/opensubdiv/far/topologyDescriptor.cpp
|
||||
include src/osd/opensubdiv/far/topologyDescriptor.h
|
||||
include src/osd/opensubdiv/far/topologyLevel.h
|
||||
include src/osd/opensubdiv/far/topologyRefiner.cpp
|
||||
include src/osd/opensubdiv/far/topologyRefiner.h
|
||||
include src/osd/opensubdiv/far/topologyRefinerFactory.cpp
|
||||
include src/osd/opensubdiv/far/topologyRefinerFactory.h
|
||||
include src/osd/opensubdiv/far/types.h
|
||||
include src/osd/opensubdiv/hbr/CMakeLists.txt
|
||||
include src/osd/opensubdiv/hbr/allocator.h
|
||||
include src/osd/opensubdiv/hbr/bilinear.h
|
||||
include src/osd/opensubdiv/hbr/catmark.h
|
||||
include src/osd/opensubdiv/hbr/cornerEdit.h
|
||||
include src/osd/opensubdiv/hbr/creaseEdit.h
|
||||
include src/osd/opensubdiv/hbr/face.h
|
||||
include src/osd/opensubdiv/hbr/faceEdit.h
|
||||
include src/osd/opensubdiv/hbr/fvarData.h
|
||||
include src/osd/opensubdiv/hbr/fvarEdit.h
|
||||
include src/osd/opensubdiv/hbr/halfedge.h
|
||||
include src/osd/opensubdiv/hbr/hierarchicalEdit.h
|
||||
include src/osd/opensubdiv/hbr/holeEdit.h
|
||||
include src/osd/opensubdiv/hbr/loop.h
|
||||
include src/osd/opensubdiv/hbr/mesh.h
|
||||
include src/osd/opensubdiv/hbr/subdivision.h
|
||||
include src/osd/opensubdiv/hbr/vertex.h
|
||||
include src/osd/opensubdiv/hbr/vertexEdit.h
|
||||
include src/osd/opensubdiv/osd/Android.mk
|
||||
include src/osd/opensubdiv/osd/CMakeLists.txt
|
||||
include src/osd/opensubdiv/osd/bufferDescriptor.h
|
||||
include src/osd/opensubdiv/osd/clD3D11VertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/clD3D11VertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/clEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/clEvaluator.h
|
||||
include src/osd/opensubdiv/osd/clGLVertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/clGLVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/clKernel.cl
|
||||
include src/osd/opensubdiv/osd/clPatchTable.cpp
|
||||
include src/osd/opensubdiv/osd/clPatchTable.h
|
||||
include src/osd/opensubdiv/osd/clVertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/clVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/cpuD3D11VertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/cpuD3D11VertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/cpuEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/cpuEvaluator.h
|
||||
include src/osd/opensubdiv/osd/cpuGLVertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/cpuGLVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/cpuKernel.cpp
|
||||
include src/osd/opensubdiv/osd/cpuKernel.h
|
||||
include src/osd/opensubdiv/osd/cpuPatchTable.cpp
|
||||
include src/osd/opensubdiv/osd/cpuPatchTable.h
|
||||
include src/osd/opensubdiv/osd/cpuVertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/cpuVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/cudaD3D11VertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/cudaD3D11VertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/cudaEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/cudaEvaluator.h
|
||||
include src/osd/opensubdiv/osd/cudaGLVertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/cudaGLVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/cudaKernel.cu
|
||||
include src/osd/opensubdiv/osd/cudaPatchTable.cpp
|
||||
include src/osd/opensubdiv/osd/cudaPatchTable.h
|
||||
include src/osd/opensubdiv/osd/cudaVertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/cudaVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/d3d11ComputeEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/d3d11ComputeEvaluator.h
|
||||
include src/osd/opensubdiv/osd/d3d11LegacyGregoryPatchTable.cpp
|
||||
include src/osd/opensubdiv/osd/d3d11LegacyGregoryPatchTable.h
|
||||
include src/osd/opensubdiv/osd/d3d11Mesh.h
|
||||
include src/osd/opensubdiv/osd/d3d11PatchTable.cpp
|
||||
include src/osd/opensubdiv/osd/d3d11PatchTable.h
|
||||
include src/osd/opensubdiv/osd/d3d11VertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/d3d11VertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/glComputeEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/glComputeEvaluator.h
|
||||
include src/osd/opensubdiv/osd/glLegacyGregoryPatchTable.cpp
|
||||
include src/osd/opensubdiv/osd/glLegacyGregoryPatchTable.h
|
||||
include src/osd/opensubdiv/osd/glMesh.h
|
||||
include src/osd/opensubdiv/osd/glPatchTable.cpp
|
||||
include src/osd/opensubdiv/osd/glPatchTable.h
|
||||
include src/osd/opensubdiv/osd/glVertexBuffer.cpp
|
||||
include src/osd/opensubdiv/osd/glVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/glXFBEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/glXFBEvaluator.h
|
||||
include src/osd/opensubdiv/osd/glslComputeKernel.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchBSpline.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchBoxSplineTriangle.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchCommon.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchCommonTess.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchGregory.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchGregoryBasis.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchGregoryTriangle.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchLegacy.glsl
|
||||
include src/osd/opensubdiv/osd/glslPatchShaderSource.cpp
|
||||
include src/osd/opensubdiv/osd/glslPatchShaderSource.h
|
||||
include src/osd/opensubdiv/osd/glslXFBKernel.glsl
|
||||
include src/osd/opensubdiv/osd/hlslComputeKernel.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchBSpline.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchBoxSplineTriangle.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchCommon.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchCommonTess.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchGregory.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchGregoryBasis.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchGregoryTriangle.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchLegacy.hlsl
|
||||
include src/osd/opensubdiv/osd/hlslPatchShaderSource.cpp
|
||||
include src/osd/opensubdiv/osd/hlslPatchShaderSource.h
|
||||
include src/osd/opensubdiv/osd/mesh.h
|
||||
include src/osd/opensubdiv/osd/mtlCommon.h
|
||||
include src/osd/opensubdiv/osd/mtlComputeEvaluator.h
|
||||
include src/osd/opensubdiv/osd/mtlComputeEvaluator.mm
|
||||
include src/osd/opensubdiv/osd/mtlComputeKernel.metal
|
||||
include src/osd/opensubdiv/osd/mtlLegacyGregoryPatchTable.h
|
||||
include src/osd/opensubdiv/osd/mtlLegacyGregoryPatchTable.mm
|
||||
include src/osd/opensubdiv/osd/mtlMesh.h
|
||||
include src/osd/opensubdiv/osd/mtlMesh.mm
|
||||
include src/osd/opensubdiv/osd/mtlPatchBSpline.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchBoxSplineTriangle.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchCommon.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchCommonTess.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchGregory.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchGregoryBasis.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchGregoryTriangle.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchLegacy.metal
|
||||
include src/osd/opensubdiv/osd/mtlPatchShaderSource.h
|
||||
include src/osd/opensubdiv/osd/mtlPatchShaderSource.mm
|
||||
include src/osd/opensubdiv/osd/mtlPatchTable.h
|
||||
include src/osd/opensubdiv/osd/mtlPatchTable.mm
|
||||
include src/osd/opensubdiv/osd/mtlVertexBuffer.h
|
||||
include src/osd/opensubdiv/osd/mtlVertexBuffer.mm
|
||||
include src/osd/opensubdiv/osd/nonCopyable.h
|
||||
include src/osd/opensubdiv/osd/ompEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/ompEvaluator.h
|
||||
include src/osd/opensubdiv/osd/ompKernel.cpp
|
||||
include src/osd/opensubdiv/osd/ompKernel.h
|
||||
include src/osd/opensubdiv/osd/opencl.h
|
||||
include src/osd/opensubdiv/osd/opengl.h
|
||||
include src/osd/opensubdiv/osd/patchBasisCommon.h
|
||||
include src/osd/opensubdiv/osd/patchBasisCommonEval.h
|
||||
include src/osd/opensubdiv/osd/patchBasisCommonTypes.h
|
||||
include src/osd/opensubdiv/osd/tbbEvaluator.cpp
|
||||
include src/osd/opensubdiv/osd/tbbEvaluator.h
|
||||
include src/osd/opensubdiv/osd/tbbKernel.cpp
|
||||
include src/osd/opensubdiv/osd/tbbKernel.h
|
||||
include src/osd/opensubdiv/osd/types.h
|
||||
include src/osd/opensubdiv/sdc/CMakeLists.txt
|
||||
include src/osd/opensubdiv/sdc/bilinearScheme.h
|
||||
include src/osd/opensubdiv/sdc/catmarkScheme.h
|
||||
include src/osd/opensubdiv/sdc/crease.cpp
|
||||
include src/osd/opensubdiv/sdc/crease.h
|
||||
include src/osd/opensubdiv/sdc/loopScheme.h
|
||||
include src/osd/opensubdiv/sdc/options.h
|
||||
include src/osd/opensubdiv/sdc/scheme.h
|
||||
include src/osd/opensubdiv/sdc/typeTraits.cpp
|
||||
include src/osd/opensubdiv/sdc/types.h
|
||||
include src/osd/opensubdiv/tools/stringify/CMakeLists.txt
|
||||
include src/osd/opensubdiv/tools/stringify/main.cpp
|
||||
include src/osd/opensubdiv/version.cpp
|
||||
include src/osd/opensubdiv/version.h
|
||||
include src/osd/opensubdiv/vtr/CMakeLists.txt
|
||||
include src/osd/opensubdiv/vtr/array.h
|
||||
include src/osd/opensubdiv/vtr/componentInterfaces.h
|
||||
include src/osd/opensubdiv/vtr/fvarLevel.cpp
|
||||
include src/osd/opensubdiv/vtr/fvarLevel.h
|
||||
include src/osd/opensubdiv/vtr/fvarRefinement.cpp
|
||||
include src/osd/opensubdiv/vtr/fvarRefinement.h
|
||||
include src/osd/opensubdiv/vtr/level.cpp
|
||||
include src/osd/opensubdiv/vtr/level.h
|
||||
include src/osd/opensubdiv/vtr/quadRefinement.cpp
|
||||
include src/osd/opensubdiv/vtr/quadRefinement.h
|
||||
include src/osd/opensubdiv/vtr/refinement.cpp
|
||||
include src/osd/opensubdiv/vtr/refinement.h
|
||||
include src/osd/opensubdiv/vtr/sparseSelector.cpp
|
||||
include src/osd/opensubdiv/vtr/sparseSelector.h
|
||||
include src/osd/opensubdiv/vtr/stackBuffer.h
|
||||
include src/osd/opensubdiv/vtr/triRefinement.cpp
|
||||
include src/osd/opensubdiv/vtr/triRefinement.h
|
||||
include src/osd/opensubdiv/vtr/types.h
|
||||
include src/path-util.cc
|
||||
include src/path-util.hh
|
||||
include src/performance.cc
|
||||
include src/performance.hh
|
||||
include src/pprinter.cc
|
||||
include src/pprinter.hh
|
||||
include src/composition.cc
|
||||
include src/composition.hh
|
||||
include src/prim-pprint.hh
|
||||
include src/prim-reconstruct.cc
|
||||
include src/prim-reconstruct.hh
|
||||
include src/prim-types.cc
|
||||
include src/prim-types.hh
|
||||
include src/primvar.cc
|
||||
include src/primvar.hh
|
||||
include src/pxr-compat.cc
|
||||
include src/pxr-compat.hh
|
||||
include src/lz4/LICENSE
|
||||
include src/lz4/lz4.c
|
||||
include src/lz4/lz4.h
|
||||
include src/python-bindings.cc
|
||||
include src/str-util.hh
|
||||
include src/str-util.cc
|
||||
include src/stream-reader.hh
|
||||
include src/stream-writer.hh
|
||||
include src/subdiv.cc
|
||||
include src/subdiv.hh
|
||||
include src/stage.cc
|
||||
include src/stage.hh
|
||||
include src/texture-types.hh
|
||||
include src/tiny-any.inc
|
||||
include src/tiny-format.cc
|
||||
include src/tiny-format.hh
|
||||
include src/tinyusdz.cc
|
||||
include src/tinyusdz.hh
|
||||
include src/tiny-variant.hh
|
||||
include src/token-type.hh
|
||||
include src/tydra/README.md
|
||||
include src/tydra/prim-apply.cc
|
||||
include src/tydra/prim-apply.hh
|
||||
include src/tydra/render-data.cc
|
||||
include src/tydra/render-data.hh
|
||||
include src/tydra/scene-access.cc
|
||||
include src/tydra/scene-access.hh
|
||||
include src/tydra/shader-network.cc
|
||||
include src/tydra/shader-network.hh
|
||||
include src/tydra/facial.cc
|
||||
include src/tydra/facial.hh
|
||||
include src/usd-to-json.cc
|
||||
include src/usd-to-json.hh
|
||||
include src/usdGeom.cc
|
||||
include src/usdGeom.hh
|
||||
include src/usdLux.cc
|
||||
include src/usdLux.hh
|
||||
include src/usdMtlx.cc
|
||||
include src/usdMtlx.hh
|
||||
include src/usdObj.cc
|
||||
include src/usdObj.hh
|
||||
include src/usdShade.cc
|
||||
include src/usdShade.hh
|
||||
include src/usdSkel.cc
|
||||
include src/usdSkel.hh
|
||||
include src/usdVox.cc
|
||||
include src/usdVox.hh
|
||||
include src/usda-reader.cc
|
||||
include src/usda-reader.hh
|
||||
include src/usda-writer.cc
|
||||
include src/usda-writer.hh
|
||||
include src/usdc-reader.cc
|
||||
include src/usdc-reader.hh
|
||||
include src/usdc-writer.cc
|
||||
include src/usdc-writer.hh
|
||||
include src/value-eval-util.hh
|
||||
include src/value-pprint.cc
|
||||
include src/value-pprint.hh
|
||||
include src/value-types.cc
|
||||
include src/value-types.hh
|
||||
include src/value-type-macros.inc
|
||||
include src/xform.hh
|
||||
include src/xform.cc
|
||||
include src/audio-loader.cc
|
||||
include src/audio-loader.hh
|
||||
include src/external/OpenFBX/LICENSE
|
||||
include src/external/OpenFBX/README.md
|
||||
include src/external/OpenFBX/src/ofbx.cpp
|
||||
include src/external/OpenFBX/src/ofbx.h
|
||||
include src/usdFbx.cc
|
||||
include src/usdFbx.hh
|
||||
recursive-include src/external/pybind11 *
|
|
@ -0,0 +1,525 @@
|
|||
# Tiny USDZ/USDA/USDC library in C++14
|
||||
|
||||
`TinyUSDZ` is secure, portable and dependency-free(depends only on C++ STL. Other 3rd-party libraries included. Yes, you don't need pxrUSD/OpenUSD library!) USDZ/USDC/USDA library written in C++14.
|
||||
|
||||
## High priority
|
||||
|
||||
* Tydra: Handy data structure converter for rendering https://github.com/syoyo/tinyusdz/issues/31
|
||||
* Working on the branch: https://github.com/syoyo/tinyusdz/tree/rendermesh-refactor
|
||||
* [ ] USD to RenderScene(OpenGL/Vulkan) conversion https://github.com/syoyo/tinyusdz/issues/109
|
||||
* [ ] GeomSubset/Material Binding API support for shading/texturing https://github.com/syoyo/tinyusdz/issues/103
|
||||
|
||||
|
||||
## Mid-term todo
|
||||
|
||||
* Collection API
|
||||
* [ ] https://github.com/syoyo/tinyusdz/issues/108
|
||||
* Experimental composition support https://github.com/syoyo/tinyusdz/issues/25
|
||||
* [x] subLayers
|
||||
* [x] references
|
||||
* [x] payload(no delayed load)
|
||||
* [x] inherits
|
||||
* [x] variantSet
|
||||
* [ ] Validate composition is correctly operated.
|
||||
* Better usdLux support https://github.com/syoyo/tinyusdz/issues/101
|
||||
* Support reading & compose some production USD scenes
|
||||
* [ ] Moana island v2.1 https://github.com/syoyo/tinyusdz/issues/90
|
||||
* [ ] ALAB USD production scene https://github.com/syoyo/tinyusdz/issues/91
|
||||
|
||||
* MaterialX https://github.com/syoyo/tinyusdz/issues/86
|
||||
* USD + MateriralX + PBR rendering example using https://github.com/lighttransport/pbrlab
|
||||
* Improve interoperability with Blender USD export/import https://github.com/syoyo/tinyusdz/issues/98
|
||||
* Example viewer
|
||||
* [examples/openglviewer](examples/openglviewer) OpenGL viewer
|
||||
* [examples/sdlviewer](examples/sdlviewer) Software raytracing viewer
|
||||
|
||||
## "What if" Experimental feature
|
||||
|
||||
* Gaussian Splatting support? https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/
|
||||
|
||||
## Build status
|
||||
|
||||
| | Linux | Windows | macOS | iOS | Android |
|
||||
|:-------:|:---------------------------------------- |:------------------------------------- |:---------:|:------:|:-------:|
|
||||
| dev | [](https://github.com/syoyo/tinyusdz/actions/workflows/linux_ci.yml) | [](https://github.com/syoyo/tinyusdz/actions/workflows/windows_ci.yml) </br> [](https://github.com/syoyo/tinyusdz/actions/workflows/windows_arm_ci.yml) | [](https://github.com/syoyo/tinyusdz/actions/workflows/macos_ci.yml) | [](https://github.com/syoyo/tinyusdz/actions/workflows/ios_ci.yml) | [](https://github.com/syoyo/tinyusdz/actions/workflows/android_ci.yml) |
|
||||
|
||||
## Supported platforms
|
||||
|
||||
| | Linux | Windows | macOS | iOS | Android | WASM(WASI) | WASM(Emscripten) |
|
||||
|:-------:|:---------------------------------------- |:------------------------------------- |:---------:|:------:|:-------:|:------------------------------:|:-----------:|
|
||||
| dev | âś… 64bit </br> âś… 32bit </br> âś… aarch64 | âś… 64bit </br> âś… 32bit </br> âś… ARM64/ARM32 |âś… |âś… |âś… |âś… [sandbox/wasi](sandbox/wasi) | âś… [sandbox/emscripten](sandbox/emscripten) |
|
||||
|
||||
### Python binding(testing. currently not working)
|
||||
|
||||
https://pypi.org/project/tinyusdz/
|
||||
|
||||
Python binding is very early alpha testing stage. Not working at the moment.
|
||||
|
||||
You can install Python prebuilt wheel using
|
||||
|
||||
```
|
||||
$ python -m pip install tinyusdz
|
||||
```
|
||||
|
||||
| | Linux | Windows | macOS 11(Big Sur) or later | macos 10 |
|
||||
|:-------:|:---------------------------------------- |:------------------------------------- |:-----------------------------:|:---------:|
|
||||
| 3.6(⚠️) | ✅ 64bit </br> ✅ 32bit </br> ✅ aarch64 | ✅ 64bit </br> ✅ 32bit </br> ✅ ARM64 |🚫 | ✅ Intel |
|
||||
| 3.7 | âś… 64bit </br> âś… 32bit </br> âś… aarch64 | âś… 64bit </br> âś… 32bit </br> âś… ARM64 |âś… arm64 | đźš« universal2 </br> âś… Intel |
|
||||
| 3.8 | âś… 64bit </br> âś… 32bit </br> âś… aarch64 | âś… 64bit </br> âś… 32bit </br> âś… ARM64 |âś… arm64 | âś… universal2 </br> âś… Intel |
|
||||
| 3.9 | âś… 64bit </br> âś… 32bit </br> âś… aarch64 | âś… 64bit </br> âś… 32bit </br> âś… ARM64 |âś… arm64 | âś… universal2 </br> âś… Intel |
|
||||
| 3.10 | âś… 64bit </br> âś… 32bit </br> âś… aarch64 | âś… 64bit </br> âś… 32bit </br> âś… ARM64 |âś… arm64 | âś… universal2 </br> âś… Intel |
|
||||
| 3.11 | âś… 64bit </br> âś… 32bit </br> âś… aarch64 | âś… 64bit </br> âś… 32bit </br> âś… ARM64 |âś… arm64 | âś… universal2 </br> âś… Intel |
|
||||
|
||||
⚠️ Python 3.6 is EOL and not recommended to use it. 3.6 bwheels is provided as long as cibuildwheels provides the build for it.
|
||||
NOTE: Windows ARM64 binary is provided using cross-compiling. Its not well tested.
|
||||
|
||||
|
||||
## Status
|
||||
|
||||
TinyUSDZ is in v0.8.0 release candidate.
|
||||
Core loading feature(both USDA and USDC) is now working and production-grade(And no seg fault for corrupted USDA/USDC/USDZ input).
|
||||
|
||||
v0.8.0 is Flattened scene only(i.e, USDA/USDC generated by using pxrUSD's `usdcat --flatten` or USDZ scene).
|
||||
Composition features are work-in-progress(experimental Composition feature support in v0.8.0. Better composition feature in next major release v0.9.0(Q4/2023 expected) planned)
|
||||
|
||||
Remaining tasks for v0.8.0 release are writing examples, demos and utility functions(Tydra. Especially access to Material/Shader attributes).
|
||||
|
||||
* [x] USDZ/USDC(Crate) parser
|
||||
* USDC Crate version v0.8.0(most commonly used version as of 2022 Nov) or higher is supported.
|
||||
* [ ] USDZ/USDC(Crate) writer (Work-in-progress)
|
||||
* [x] USDA parser(Hand-written from a scratch. No Bison/Flex dependency!)
|
||||
* [x] USDA writer
|
||||
* [x] Support basic Primitives(Xform, Mesh, BasisCurves, etc.), basic Lights and Shaders(UsdPreviewSurface, UsdUVTexture, UsdPrimvarReader)
|
||||
* **Experimental** support of some Composition features https://github.com/syoyo/tinyusdz/issues/25
|
||||
* [x] subLayers
|
||||
* [x] references
|
||||
* [x] payload
|
||||
* [x] inherits
|
||||
* [x] variants
|
||||
* [ ] specializes
|
||||
|
||||
**Please see** [doc/status.md](doc/status.md) **for more details**
|
||||
|
||||
* [ ] Basic C API(`c-tinyusd`) for language bindings
|
||||
* [ ] [examples/c_api_example](examples/c_api_example)
|
||||
* [ ] Basic Python binding
|
||||
* [ ] Write simple SDL viewer example(2023 Winter expected)
|
||||
* [ ] Write iOS and Android example(2023 Winter expected)
|
||||
* [ ] Write Vision OS example?(2024 expected)
|
||||
* [ ] Vulkan or OptiX/HIP RT raytracing viewer example
|
||||
* [ ] USD <-> glTF converter example
|
||||
* There is an independent work of USD to glTF binary GLB converter: https://github.com/fynv/usd2glb
|
||||
* [ ] Web demo with Three.js?
|
||||
* [ ] Three.js started to support USDZ with Ascii format, but no USDC support yet: https://github.com/mrdoob/three.js/issues/14219
|
||||
|
||||
## Discussions
|
||||
|
||||
We've opened Github Discussions page! https://github.com/syoyo/tinyusdz/discussions
|
||||
|
||||
### Security and memory budget
|
||||
|
||||
TinyUSDZ has first priority of considering security and stability.
|
||||
|
||||
USDZ(USDC) is a binary format. To avoid out-of-bounds access, out-of-memory, and other security issues when loading malcious USDZ(e.g. USDZ file from unknown origin), TinyUSDZ has a memory budget feature to avoid out-of-memory issue.
|
||||
|
||||
To limit a memory usage when loading USDZ file, Please set a value `max_memory_limit_in_mb` in USDLoadOptions.
|
||||
|
||||
TinyUSDZ source codes(and some external third party codes) are also checked by Address Sanitizer, CodeQL and Fuzzer.
|
||||
|
||||
#### Fuzzer
|
||||
|
||||
See [tests/fuzzer](tests/fuzzer) .
|
||||
For building fuzzer tests, you'll need Meson and Ninja.
|
||||
|
||||
#### Web platform(WASM) and sandboxed environment(WASI)
|
||||
|
||||
If you need to deal with arbitrary USD files from unknown origin(e.g. from internet, NFT storage. Whose may contain malcious data), it is recommended to use TinyUSDZ in sandboxed environment(RunC, FlatPak, WASI(WASM)). Run in WASI is recommended at the moment.
|
||||
|
||||
TinyUSDZ does not use C++ exceptions and can be built without threads. TinyUSDZ supports WASM and WASI build. So TinyUSDZ should runs well on various Web platform(WebAssembly. No SharedArrayBuffer, Atomics and WebAssembly SIMD(which is not yet available on iOS Safari) required) and sandboxed environment(WASI. Users who need to read various USD file which possibly could contain malcious data from Internet, IPFS or blockchain storage).
|
||||
|
||||
See [sandbox/wasi/](sandbox/wasi) for Building TinyUSDZ with WASI toolchain.
|
||||
|
||||
### Tydra
|
||||
|
||||
USD itself is a generic container of 3D scene data.
|
||||
|
||||
Tydra is an interface to Renderers/Viewers and other DCCs.
|
||||
Tydra may be something like Tiny version of pxrUSD Hydra, but its API is completely different. See [src/tydra/README.md](src/tydra/README.md) for the background.
|
||||
|
||||
* Image color space
|
||||
* sRGB
|
||||
* Linear
|
||||
* Rec.709
|
||||
* [ ] Partial support of OCIO(OpenColor IO) through TinyColorIO https://github.com/syoyo/tinycolorio . Currently SPI3DLut only.
|
||||
* More details are T.B.W.
|
||||
|
||||
## Notice
|
||||
|
||||
TinyUSDZ does not support Reality Composer file format(`.reality`) since it uses proprietary file format and we cannot understand it(so no conversion support from/to Reality also).
|
||||
|
||||
## Commercial support
|
||||
|
||||
TinyUSDZ focuses on loading/writing USDA/USDC/USDZ functionalities.
|
||||
Example viewer is just for demo purpose.
|
||||
`syoyo` does not provide commercial support as an individual.
|
||||
|
||||
If you need commercial support, eco-system development(e.g. plug-ins, DCC tools on top of TinyUSDZ) or production-grade USDZ model viewer(e.g. embed TinyUSDZ to your AR app, 3D NFT Android mobile viewer capable of displaying (encrypted) USDZ model), please contact Light Transport Entertainment, Inc. : https://goo.gl/forms/1p6uGcOKWGpXPHkA2
|
||||
|
||||
We have a plan to manage TinyUSDZ project under Light Transport Entertainment Inc.
|
||||
(By relicensing to Apatch 2.0)
|
||||
|
||||
## Projects using TinyUSDZ
|
||||
|
||||
* usd2glb: USD to glTF 2.0 GLB converter https://github.com/fynv/usd2glb
|
||||
* webgpu-cpp-usdz: WebGPU C++/Wasm USDZ Renderer(NOTE: It doesn't support much yet!) https://github.com/Twinklebear/webgpu-cpp-usdz
|
||||
|
||||
### Other related projects
|
||||
|
||||
* UsdzSharpie: C# Simple implementation of Usdz file format ( https://github.com/UkooLabs/UsdzSharpie )
|
||||
* TinyGLTF: glTF 2.0 loader/saver ( https://github.com/syoyo/tinygltf )
|
||||
* BlenderUSDZ: It contains their own Python USDC parser/serializer. https://github.com/robmcrosby/BlenderUSDZ
|
||||
|
||||
## Supported platforms
|
||||
|
||||
* [x] Linux 64bit or later
|
||||
* [x] ARM AARCH64
|
||||
* [x] x86-64
|
||||
* [ ] RISC-V(Should work)
|
||||
* [ ] SPARC, POWER(Big endian machine). May work(theoretically)
|
||||
* [x] Android arm64v8a
|
||||
* [x] iOS
|
||||
* [x] macOS(Arm, x86-64)
|
||||
* [x] Windows 10 64bit or later
|
||||
* [x] Windows ARM
|
||||
* [x] clang-cl + MSVC SDK cross compile
|
||||
* [x] WebAssembly
|
||||
* Emscripten
|
||||
* See [examples/sdlviewer/](examples/sdlviewer) example.
|
||||
* [x] WASI(through WASI toolchain)
|
||||
* See [sandbox/wasi](sandbox/wasi)
|
||||
|
||||
## Requirements
|
||||
|
||||
* C++14 compiler
|
||||
* [x] gcc 4.9 or later
|
||||
* [x] Visual Studio 2019 or later(2017 may compiles)
|
||||
* VS2019 16.10 or later you can use `CMakePresets.json` for easier building.
|
||||
* [x] Can be compiled with standalone MSVC compilers(Build Tools for Visual Studio 2019)
|
||||
* [x] clang 3.4 or later https://clang.llvm.org/cxx_status.html
|
||||
* [x] llvm-mingw(clang) supported
|
||||
* [x] MinGW gcc supported, but not recommended(You may got compilation failure depending on your build configuration: https://github.com/syoyo/tinyusdz/issues/33 , and linking takes too much time if you use default bfd linker.). If you want to compile TinyUSDZ in MinGW environment, llvm-mingw(clang) is recommended to use.
|
||||
|
||||
|
||||
Compilation with C++17 is also supported.
|
||||
Compile on C++20 and C++23 could be possible, but not well tested, since C++20/C++23 compiler is not yet mature(as of 2024/01))
|
||||
|
||||
## Build
|
||||
|
||||
### Integrate to your app
|
||||
|
||||
If you are using CMake, just include tinyusdz repo with `add_subdirectory` and set include path to `<tinyusdz>/src`
|
||||
We recommend to use CMake 3.24 or later.
|
||||
(Mininum requirement is 3.16)
|
||||
|
||||
```cmake
|
||||
|
||||
...
|
||||
|
||||
# TinyUSDZ examples, tests and tools builds are disabled by default when
|
||||
# tinyusdz is being built as a library with `add_subdirectory`
|
||||
add_subdirectory(/path/to/tinyusdz tinyusdz)
|
||||
|
||||
target_include_directories(YOUR_APP PRIVATE "/path/to/tinyusdz/src")
|
||||
|
||||
# Namespaced static library target `tinyusdz::tinyusdz_static` is provided.
|
||||
# At the moment we recommend to use static build of TinyUSDZ.
|
||||
# You can use alias target `tinyusdz_static` also for legacy cmake version.
|
||||
target_link_libraries(YOUR_APP PRIVATE tinyusdz::tinyusdz_static)
|
||||
|
||||
# For TinyUSDZ DLL(shared) library target, you can use
|
||||
# `tinyusdz` library target
|
||||
```
|
||||
|
||||
Another way is simply copy `src` folder to your app, and add `*.cc` files to your app's build system.
|
||||
All include paths are set relative from `src` folder, so you can just add include directory to `src` folder.
|
||||
|
||||
See `<tinyusdz>/CMakeLists.txt` and [examples/sdlviewer/CMakeLists.txt](examples/sdlviewer/CMakeLists.txt) for details.
|
||||
|
||||
TinyUSDZ does not generate any header files and source files before the build and after the build(before the installation stage), so you don't need to take care of any pre-processing and post-processing of source tree. For example, USD Ascii parser uses hand-written C++ code so no Bison/flex/PEG processing involved.
|
||||
|
||||
It may not be recommend to use tinyusdz as a git submodule, since the repo contains lots of codes required to build TinyUSDZ examples but these are not required for your app.
|
||||
|
||||
### Compiler defines
|
||||
|
||||
Please see `CMake build options` and `CMakeLists.txt`. In most case same identifier is defined from cmake build options: For example if you specify `-DTINYUSDZ_PRODUCTION_BUILD=1` for cmake argument, `TINYUSDZ_PRODUCTION_BUILD` is defined.
|
||||
|
||||
### CMake
|
||||
|
||||
Cmake build is provided.
|
||||
|
||||
#### Linux and macOS
|
||||
|
||||
```
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ make
|
||||
```
|
||||
|
||||
Please take a look at `scripts/bootstrap-cmake-*.sh` for some build configuraions.
|
||||
|
||||
#### Visual Studio
|
||||
|
||||
Visual Studio 2019 and 2022 are supported.
|
||||
|
||||
`CMakePresets.json` is provided for easier build on Visual Studio 2019 and Visual Studio 2022, but has lot of limitations(and seems parallel build is not working well so build is slow).
|
||||
|
||||
If you want flexibility, ordinary cmake `.sln` generation approach by invoking `vcsetup.bat` recommended.
|
||||
(Edit VS version in `vcsetup.bat` as you with before the run)
|
||||
|
||||
#### LLVM-MinGW build
|
||||
|
||||
MinGW native and cross-compiling example using llvm-mingw(clang) is provided.
|
||||
See `scripts/bootstrap-cmake-mingw-win.sh` and `scripts/bootstrap-cmake-llvm-mingw-cross.sh` for details.
|
||||
|
||||
One of benefit to use llvm-mingw is address sanitizer support on Windows app.
|
||||
|
||||
To run app(`.exe`, you'll need `libunwind.dll` and `libc++.dll` on your working directory or search path)
|
||||
|
||||
For Windows native build, we assume `ninja.exe` is installed on your system(You can use it from Meson package)
|
||||
|
||||
#### CMake build options
|
||||
|
||||
* `TINYUSDZ_PRODUCTION_BUILD` : Production build. Do not output debugging logs.
|
||||
* `TINYUSDZ_BUILD_TESTS` : Build tests
|
||||
* `TINYUSDZ_BUILD_EXAMPLES` : Build examples(note that not all examples in `examples` folder are built)
|
||||
* `TINYUSDZ_WITH_OPENSUBDIV` : Use OpenSubviv to tessellate subdivision surface.
|
||||
* OpenSubdiv code is included in TinyUSDZ repo. If you want to use external OpenSubdiv repo, specity the path to OpenSubdiv using `osd_DIR` cmake environment variable.
|
||||
* `TINYUSDZ_WITH_AUDIO` : Support loading audio(mp3 and wav).
|
||||
* `TINYUSDZ_WITH_EXR` : Support loading EXR format HDR texture through TinyEXR.
|
||||
* `TINYUSDZ_WITH_PXR_COMPAT_API` : Build with pxrUSD compatible API.
|
||||
|
||||
#### clang-cl on Windows
|
||||
|
||||
Assume ninja.exe is installed and path to ninja.exe is added to your `%PATH%`
|
||||
|
||||
Edit path to MSVC SDK and Windows SDK in `bootstrap-clang-cl-win64.bat`, then
|
||||
|
||||
```
|
||||
> bootstrap-clang-cl-win64.bat
|
||||
> ninja.exe
|
||||
```
|
||||
|
||||
|
||||
### Tools and Examples
|
||||
|
||||
* [tusdcat](examples/tusdcat/) Parse USDZ/USDA/USDC and print it as Ascii(similar to `usdcat` in pxrUSD).
|
||||
* `tusdcat` also do USD composition(`flatten`) and contains TinyUSDZ Composition API usecase.
|
||||
* Deprecated. Use `tusdcat` [usda_parser](examples/usda_parser/) Parse USDA and print it as Ascii.
|
||||
* Deprecated. Use `tusdcat` [usdc_parser](examples/usdc_parser/) Parse USDC and print it as Ascii.
|
||||
* [Simple SDL viewer](examples/sdlviewer/)
|
||||
* Separated CMake build provided: See [Readme](examples/sdlviewer/README.md)
|
||||
* [api_tutorial](examples/api_tutorial/) Tutorial of TinyUSDZ Core API to construct a USD scene data.
|
||||
* [tydra_api](examples/tydra_api/) Tutorial of TinyUSDZ Tydra API to access/query/convert a USD scene data.
|
||||
* [asset_resolution](examples/asset_resolution/) Tutorial of using AssetResolutionResolver API to load USD from customized I/O(e.g. from Memory, Web, DB, ...)
|
||||
* [file_format](examples/file_format/) Tutorial of using custom FileFormat handler to load Prim data in custom fileformat.
|
||||
|
||||
See [examples](examples) directory for more examples, but may not actively maintained except for the above examples.
|
||||
|
||||
### USDZ Data format
|
||||
|
||||
See [prim_format.md](doc/prim_format.md) and [preview_surface.md](doc/preview_surface.md)
|
||||
|
||||
## Example
|
||||
|
||||
### Minimum example to load USDA/USDC/USDZ file.
|
||||
|
||||
```
|
||||
// TinyUSDZ is not a header-only library, so no TINYUSDZ_IMPLEMENTATIONS
|
||||
#include "tinyusdz.hh"
|
||||
|
||||
// Include pprinter.hh and value-pprint.hh if you want to print TinyUSDZ classes/structs/enums.
|
||||
// `tinyusdz::to_string()` and `std::operator<<` for TinyUSDZ classes/enums are provided separately for faster compilation
|
||||
#include <iostream>
|
||||
#include "pprinter.hh"
|
||||
#include "value-pprint.hh"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
std::string filename = "input.usd";
|
||||
|
||||
if (argc > 1) {
|
||||
filename = argv[1];
|
||||
}
|
||||
|
||||
tinyusdz::Stage stage; // Stage in USD terminology is nearly meant for Scene in generic 3D graphics terminology.
|
||||
std::string warn;
|
||||
std::string err;
|
||||
|
||||
// Auto detect USDA/USDC/USDZ
|
||||
bool ret = tinyusdz::LoadUSDFromFile(filename, &stage, &warn, &err);
|
||||
|
||||
if (warn.size()) {
|
||||
std::cout << "WARN : " << warn << "\n";
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
if (!err.empty()) {
|
||||
std::cerr << "ERR : " << warn << "\n";
|
||||
}
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Print Stage(Scene graph)
|
||||
std::cout << tinyusdz::to_string(stage) << "\n";
|
||||
|
||||
// You can also use ExportToString() as done in pxrUSD
|
||||
// std::cout << stage.ExportToString() << "\n";
|
||||
|
||||
// stage.metas() To get Scene metadatum,
|
||||
for (const Prim &root_prim : stage.root_prims()) {
|
||||
std::cout << root_prim.absolute_path() << "\n";
|
||||
// You can traverse Prim(scene graph object) using Prim::children()
|
||||
// See examples/api_tutorial and examples/tydra_api for details.
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
```
|
||||
|
||||
### With Core TinyUSDZ API
|
||||
|
||||
Please see [api_tutorial](examples/api_tutorial/)
|
||||
|
||||
### With Tydra API
|
||||
|
||||
Please see [tydra_api](examples/tydra_api/)
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
### Higher priority
|
||||
|
||||
* [ ] Built-in usdObj(wavefront .obj mesh) support.
|
||||
* via tinyobjloader.
|
||||
* [x] Support Crate(binary) version 0.8.0(USD v20.11 default)
|
||||
* [ ] usdSkel utilities
|
||||
* [ ] Joint hierachy reconstruction and compute skinning matrix(usdSkel)
|
||||
* [ ] Blend shapes
|
||||
* [x] Basic Blendshapes support
|
||||
* [ ] In-between blend shapes
|
||||
* [ ] Read USD data with bounded memory size. This feature is especially useful for mobile platform(e.g. in terms of security, memory consumption, etc)
|
||||
* [ ] USDC writer
|
||||
* [ ] Support Nested USDZ
|
||||
* [ ] UDIM texture support
|
||||
* [ ] MaterialX support
|
||||
* [ ] Parse XML file using tinyxml2
|
||||
|
||||
### Middle priority
|
||||
|
||||
* [ ] Composition arcs
|
||||
* [ ] Code refactoring, code optimization
|
||||
|
||||
### Lower priority
|
||||
|
||||
* [ ] iOS example?
|
||||
* [ ] Support AR related schema(Game-like feature added by Reality Composer?)
|
||||
* [ ] Audio play support
|
||||
* [ ] Play audio using SoLoud or miniaudio(or Oboe for Android)
|
||||
* [ ] wav(dr_wav)
|
||||
* [ ] mp3(dr_mp3)
|
||||
* [ ] m4a(ALAC?)
|
||||
* [ ] Viewer with Vulkan API.
|
||||
* [ ] Replace OpenSubdiv with our own subdiv library.
|
||||
* [ ] Write parser based on the schema definition.
|
||||
* [ ] Support big endian architecture.
|
||||
|
||||
## Python binding and prebuit packages
|
||||
|
||||
Python binding and prebuilt packages(uploadded on PyPI) are provided.
|
||||
|
||||
See [python/README.md](python/README.md) and [doc/python_binding.md](doc/python_binding.md) for details.
|
||||
|
||||
## CI build
|
||||
|
||||
CI build script is a build script trying to build TinyUSDZ in self-contained manner as much as possible(including custom Python build)
|
||||
|
||||
### Linux/macOS
|
||||
|
||||
T.B.W.
|
||||
|
||||
### Windows
|
||||
|
||||
Build custom Python,
|
||||
|
||||
```
|
||||
> ci-build-python-lib.bat
|
||||
```
|
||||
|
||||
then build TinyUSDZ by linking with this local Python build.
|
||||
|
||||
```
|
||||
> ci-build-vs2022.bat
|
||||
```
|
||||
|
||||
#### Cross compile with clang-cl + MSVC SDK on linux and run it on WINE(No Windows required at all solution!)
|
||||
|
||||
clang-cl(MSVC cl.exe) + MSVC SDK cross compile is also supported.
|
||||
|
||||
Please take a look at [doc/wine_cl.md](doc/wine_cl.md)
|
||||
|
||||
You can build pure Windows build of TinyUSDZ on Linux CI machine.
|
||||
|
||||
## License
|
||||
|
||||
TinyUSDZ is primarily licensed under Apache 2.0 license.
|
||||
Some helper code is licensed under MIT license.
|
||||
|
||||
### Third party licenses
|
||||
|
||||
* pxrUSD : Apache 2.0 license. https://github.com/PixarAnimationStudios/USD
|
||||
* OpenSubdiv : Apache 2.0 license. https://github.com/PixarAnimationStudios/OpenSubdiv
|
||||
* lz4 : BSD-2 license. http://www.lz4.org
|
||||
* cnpy(uncompressed ZIP decode/encode code) : MIT license https://github.com/rogersce/cnpy
|
||||
* tinyexr: BSD license.
|
||||
* tinyobjloader: MIT license.
|
||||
* tinygltf: MIT license.
|
||||
* tinycolorio: MIT license. https://github.com/syoyo/tinycolorio
|
||||
* stb_image, stb_image_resize, stb_image_write, stb_truetype: public domain.
|
||||
* dr_libs: public domain. https://github.com/mackron/dr_libs
|
||||
* miniaudio: public domain or MIT no attribution. https://github.com/dr-soft/miniaudio
|
||||
* SDL2 : zlib license. https://www.libsdl.org/index.php
|
||||
* optional-lite: BSL 1.0 license. https://github.com/martinmoene/optional-lite
|
||||
* expected-lite: BSL 1.0 license. https://github.com/martinmoene/expected-lite
|
||||
* mapbox/earcut.hpp: ISC license. https://github.com/mapbox/earcut.hpp
|
||||
* par_shapes.h generate parametric surfaces and other simple shapes: MIT license https://github.com/prideout/par
|
||||
* MaterialX: Apache 2.0 license. https://github.com/AcademySoftwareFoundation/MaterialX
|
||||
* string_id: zlib license. https://github.com/foonathan/string_id
|
||||
* cityhash: MIT license. https://github.com/google/cityhash
|
||||
* fast_float: Apache 2.0/MIT dual license. https://github.com/fastfloat/fast_float
|
||||
* jsteeman/atoi: Apache 2.0 license. https://github.com/jsteemann/atoi
|
||||
* formatxx: unlicense. https://github.com/seanmiddleditch/formatxx
|
||||
* ubench.h: Unlicense. https://github.com/sheredom/ubench.h
|
||||
* thelink2012/any : BSL-1.0 license. https://github.com/thelink2012/any
|
||||
* simple_match : BSL-1.0 license. https://github.com/jbandela/simple_match
|
||||
* nanobind : BSD-3 license. https://github.com/wjakob/nanobind
|
||||
* pybind11 : BSD-3 license. https://github.com/pybind/pybind11
|
||||
* pystring : BSD-3 license. https://github.com/imageworks/pystring
|
||||
* gulrak/filesytem : MIT license. https://github.com/gulrak/filesystem
|
||||
* p-ranav/glob : MIT license. https://github.com/p-ranav/glob
|
||||
* linalg.h : Unlicense. https://github.com/sgorsten/linalg
|
||||
* mapbox/eternal: ISC License. https://github.com/mapbox/eternal
|
||||
* bvh: MIT license. https://github.com/madmann91/bvh
|
||||
* dtoa_milo.h: MIT License. https://github.com/miloyip/dtoa-benchmark
|
||||
* jeaiii/itoa: MIT License. https://github.com/jeaiii/itoa
|
||||
* alac: Apache 2.0 License. https://macosforge.github.io/alac/
|
||||
* OpenFBX: MIT License. https://github.com/nem0/OpenFBX
|
||||
* floaxie: Apache 2.0 License. https://github.com/aclex/floaxie
|
||||
* boost math sin_pi/cos_pi: BSL 1.0 License. https://www.boost.org/
|
||||
* Vulkan: MIT License. https://github.com/SaschaWillems/Vulkan
|
||||
* Metal.cpp: Apache 2.0 License. https://github.com/bkaradzic/metal-cpp https://developer.apple.com/metal/cpp/
|
||||
* sRGB transform: MIT license. https://www.nayuki.io/page/srgb-transform-library
|
||||
* virtualGizmo3D: BSD-2 license. https://github.com/BrutPitt/virtualGizmo3D
|
||||
* nanozlib: Apache 2.0 license. https://github.com/lighttransport/nanozlib
|
||||
* lz4.py: MIT license. https://github.com/SE2Dev/PyCoD/blob/master/_lz4.py
|
||||
* pugixml: MIT license. https://github.com/zeux/pugixml
|
|
@ -0,0 +1,22 @@
|
|||
# Example project for Anroid Studio
|
||||
|
||||
arm64-v8a arch only.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Android 8.1(API 27) or later
|
||||
* Android 12.0 or later recommended.
|
||||
* Android Studio 2022 Framingo or later
|
||||
* CMake(You can install cmake through Android Studio)
|
||||
* NDK r25 or later
|
||||
|
||||
|
||||
## How to build
|
||||
|
||||
Open this folder in Android Studio and build it.
|
||||
|
||||
When you open the folder in the first time, it will take time(~20 mins) and many file downloads(e.g. gradle) will happen.
|
||||
|
||||
### Command line build
|
||||
|
||||
T.B.W.
|
|
@ -0,0 +1,39 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
defaultConfig {
|
||||
applicationId "com.example.hellotinyusdz"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
ndk {
|
||||
abiFilters "arm64-v8a"
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "src/main/cpp/CMakeLists.txt"
|
||||
//version "3.18.1"
|
||||
}
|
||||
}
|
||||
namespace 'com.example.hellotinyusdz'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /Users/gfan/dev/sdk_current/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name="android.colormode.WideColorModeActivity"
|
||||
android:colorMode="wideColorGamut" />
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,102 @@
|
|||
project(tinyusz_android)
|
||||
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
option(TINYUSDZ_USE_USDOBJ "Build with built-in .obj support" On)
|
||||
|
||||
set(TINYUSDZ_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tinyusdz.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/asset-resolution.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/composition.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/prim-types.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/ascii-parser.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/ascii-parser-basetype.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/ascii-parser-timesamples.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/ascii-parser-timesamples-array.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usda-reader.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdc-reader.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdc-writer.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/crate-reader.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/crate-format.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/crate-pprint.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/io-util.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/pprinter.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tiny-format.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/value-types.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/value-pprint.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/primvar.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/prim-reconstruct.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/prim-composition.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/image-loader.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usda-writer.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdGeom.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdSkel.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdShade.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdMtlx.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdLux.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/xform.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/stage.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/str-util.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/path-util.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/image-util.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/image-writer.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/linear-algebra.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/facial.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/scene-access.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/render-data.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/prim-apply.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/tydra/shader-network.cc
|
||||
)
|
||||
if (TINYUSDZ_USE_USDOBJ)
|
||||
list(APPEND TINYUSDZ_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/usdObj.cc)
|
||||
list(APPEND TINYUSDZ_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/external/tiny_obj_loader.cc)
|
||||
endif ()
|
||||
|
||||
set(TINYUSDZ_DEP_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/integerCoding.cpp
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/lz4-compression.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/lz4/lz4.c
|
||||
#${PROJECT_SOURCE_DIR}/../../../../../src/external/string_id/database.cpp
|
||||
#${PROJECT_SOURCE_DIR}/../../../../../src/external/string_id/string_id.cpp
|
||||
#${PROJECT_SOURCE_DIR}/../../../../../src/external/string_id/error.cpp
|
||||
${PROJECT_SOURCE_DIR}/../../../../../src/external/fpng.cpp
|
||||
#${PROJECT_SOURCE_DIR}/../../../../../src/external/staticstruct.cc
|
||||
#${PROJECT_SOURCE_DIR}/../../../../../src/external/tinyxml2/tinyxml2.cpp
|
||||
)
|
||||
|
||||
# Reuse files from sdlviewer
|
||||
set(USDVIEW_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/../../../../../examples/sdlviewer/simple-render.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../examples/common/matrix.cc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../examples/common/trackball.cc)
|
||||
|
||||
# Build the libhello-oboe library
|
||||
add_library(
|
||||
hello-tinyusdz SHARED jni-tinyusdz.cc render-ctx.cc ${TINYUSDZ_SOURCES}
|
||||
${TINYUSDZ_DEP_SOURCES} ${USDVIEW_SOURCES})
|
||||
|
||||
target_link_libraries(hello-tinyusdz jnigraphics android log)
|
||||
|
||||
target_include_directories(
|
||||
hello-tinyusdz
|
||||
PRIVATE ${PROJECT_SOURCE_DIR}/../../../../../src/
|
||||
# nanort, nanosg, etc
|
||||
${PROJECT_SOURCE_DIR}/../../../../../examples/common/
|
||||
# sdlviewer example
|
||||
${PROJECT_SOURCE_DIR}/../../../../../examples/sdlviewer/)
|
||||
|
||||
if (TINYUSDZ_USE_USDOBJ)
|
||||
target_compile_definitions(hello-tinyusdz PRIVATE "TINYUSDZ_USE_USDOBJ")
|
||||
endif ()
|
||||
|
||||
# Required to load .usd files from Android asset for demo purpose
|
||||
# When you embed TinyUSDZ to your own app, you are better to load .usd files from a memory and turn this define off.
|
||||
target_compile_definitions(hello-tinyusdz
|
||||
PRIVATE "TINYUSDZ_ANDROID_LOAD_FROM_ASSETS")
|
||||
|
||||
# Enable optimization flags: if having problems with source level debugging,
|
||||
# disable -Ofast ( and debug ), re-enable after done debugging.
|
||||
target_compile_options(hello-tinyusdz PRIVATE -Wall -Werror
|
||||
"$<$<CONFIG:RELEASE>:-Ofast>")
|
|
@ -0,0 +1,157 @@
|
|||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <android/bitmap.h>
|
||||
#include <android/asset_manager.h>
|
||||
#include <android/asset_manager_jni.h>
|
||||
|
||||
#include "tinyusdz.hh"
|
||||
#include "io-util.hh"
|
||||
|
||||
#include "render-ctx.hh"
|
||||
|
||||
#ifndef TINYUSDZ_ANDROID_LOAD_FROM_ASSETS
|
||||
#error "This demo requires to load .usd file from Android Assets"
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// https://stackoverflow.com/questions/41820039/jstringjni-to-stdstringc-with-utf8-characters
|
||||
std::string jstring2string(JNIEnv *env, jstring jStr) {
|
||||
if (!jStr)
|
||||
return "";
|
||||
|
||||
const jclass stringClass = env->GetObjectClass(jStr);
|
||||
const jmethodID getBytes = env->GetMethodID(stringClass, "getBytes", "(Ljava/lang/String;)[B");
|
||||
const jbyteArray stringJbytes = (jbyteArray) env->CallObjectMethod(jStr, getBytes, env->NewStringUTF("UTF-8"));
|
||||
|
||||
size_t length = (size_t) env->GetArrayLength(stringJbytes);
|
||||
jbyte* pBytes = env->GetByteArrayElements(stringJbytes, NULL);
|
||||
|
||||
std::string ret = std::string((char *)pBytes, length);
|
||||
env->ReleaseByteArrayElements(stringJbytes, pBytes, JNI_ABORT);
|
||||
|
||||
env->DeleteLocalRef(stringJbytes);
|
||||
env->DeleteLocalRef(stringClass);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_example_hellotinyusdz_MainActivity_touchMove(JNIEnv *env, jobject obj, jfloat dx, jfloat dy) {
|
||||
const float scale = 0.2f;
|
||||
|
||||
example::g_gui_ctx.yaw += scale * dy;
|
||||
example::g_gui_ctx.roll -= scale * dx;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_example_hellotinyusdz_MainActivity_grabImage(JNIEnv *env, jobject obj, jintArray _intarray, jint width, jint height) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "grabImage");
|
||||
|
||||
jint *ptr = env->GetIntArrayElements(_intarray, NULL);
|
||||
int length = env->GetArrayLength(_intarray);
|
||||
if (length != (width * height)) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "Buffer size mismatch");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (length != (example::g_gui_ctx.aov.width * example::g_gui_ctx.aov.height)) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "AOV size mismatch");
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t *dest_ptr = reinterpret_cast<uint32_t *>(ptr);
|
||||
|
||||
std::vector<uint32_t> src;
|
||||
example::GetRenderedImage(example::g_gui_ctx, &src);
|
||||
|
||||
if (src.size() != length) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "GetRenderedImage failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(dest_ptr, src.data(), sizeof(uint32_t) * length);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_example_hellotinyusdz_MainActivity_renderImage(
|
||||
JNIEnv *env,
|
||||
jobject obj,
|
||||
jint width, jint height)
|
||||
{
|
||||
example::g_gui_ctx.render_width = width;
|
||||
example::g_gui_ctx.render_height = height;
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "renderImage");
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "draw_meshes %d", (int)example::g_gui_ctx.render_scene.draw_meshes.size());
|
||||
bool ret = example::RenderScene(example::g_gui_ctx);
|
||||
|
||||
if (!ret) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "RenderScene failed.");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns: 0 - success
|
||||
* -1 - failed
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_example_hellotinyusdz_MainActivity_initScene(
|
||||
JNIEnv *env,
|
||||
jobject obj,
|
||||
jobject assetManager,
|
||||
jstring _filename) {
|
||||
|
||||
std::string filename = jstring2string(env, _filename);
|
||||
tinyusdz::io::asset_manager = AAssetManager_fromJava(env, assetManager);
|
||||
|
||||
tinyusdz::USDLoadOptions options;
|
||||
|
||||
// load from Android asset folder
|
||||
example::g_gui_ctx.stage = tinyusdz::Stage(); // reset
|
||||
|
||||
std::string warn, err;
|
||||
bool ret = LoadUSDCFromFile(filename, &example::g_gui_ctx.stage, &warn, &err, options);
|
||||
|
||||
if (warn.size()) {
|
||||
__android_log_print(ANDROID_LOG_WARN, "tinyusdz", "USD load warning: %s", warn.c_str());
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
if (err.size()) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "USD load error: %s", err.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
// TODO
|
||||
//__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "USD loaded. #of geom_meshes: %d", int(example::g_gui_ctx.stage.geom_meshes.size()));
|
||||
}
|
||||
|
||||
ret = example::SetupScene(example::g_gui_ctx);
|
||||
if (!ret) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "SetupScene failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// TODO
|
||||
//return int(example::g_gui_ctx.stage.geom_meshes.size()); // OK
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
#include <android/log.h>
|
||||
|
||||
#include "render-ctx.hh"
|
||||
|
||||
namespace example {
|
||||
|
||||
GUIContext g_gui_ctx;
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// TODO: Use pow table for faster conversion.
|
||||
inline float linearToSrgb(float x) {
|
||||
if (x <= 0.0f)
|
||||
return 0.0f;
|
||||
else if (x >= 1.0f)
|
||||
return 1.0f;
|
||||
else if (x < 0.0031308f)
|
||||
return x * 12.92f;
|
||||
else
|
||||
return std::pow(x, 1.0f / 2.4f) * 1.055f - 0.055f;
|
||||
}
|
||||
|
||||
inline uint8_t ftouc(float f) {
|
||||
int val = int(f * 255.0f);
|
||||
val = std::max(0, std::min(255, val));
|
||||
|
||||
return static_cast<uint8_t>(val);
|
||||
}
|
||||
|
||||
inline double radians(double degree) { return 3.141592653589 * degree / 180.0; }
|
||||
|
||||
// https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
|
||||
std::array<double, 4> ToQuaternion(double yaw, double pitch,
|
||||
double roll) // yaw (Z), pitch (Y), roll (X)
|
||||
{
|
||||
// Abbreviations for the various angular functions
|
||||
double cy = std::cos(yaw * 0.5);
|
||||
double sy = std::sin(yaw * 0.5);
|
||||
double cp = std::cos(pitch * 0.5);
|
||||
double sp = std::sin(pitch * 0.5);
|
||||
double cr = std::cos(roll * 0.5);
|
||||
double sr = std::sin(roll * 0.5);
|
||||
|
||||
std::array<double, 4> q;
|
||||
q[0] = cr * cp * cy + sr * sp * sy;
|
||||
q[1] = sr * cp * cy - cr * sp * sy;
|
||||
q[2] = cr * sp * cy + sr * cp * sy;
|
||||
q[3] = cr * cp * sy - sr * sp * cy;
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool SetupScene(GUIContext &ctx) {
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "SetupScene");
|
||||
#if 0 // TODO
|
||||
if (ctx.stage.root_nodes.empty()) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "No GeomMesh");
|
||||
// No GeomMesh in the scene
|
||||
return false;
|
||||
}
|
||||
|
||||
// Convert USD geom_mesh to renderable mesh.
|
||||
ctx.render_scene.draw_meshes.clear();
|
||||
#if 0 // TODO
|
||||
__android_log_print(ANDROID_LOG_INFO, "tinyusdz", "# of geom_meshes %d", (int)ctx.scene.geom_meshes.size());
|
||||
for (size_t i = 0; i < ctx.scene.geom_meshes.size(); i++) {
|
||||
example::DrawGeomMesh draw_mesh(&ctx.scene.geom_meshes[i]);
|
||||
ctx.render_scene.draw_meshes.push_back(draw_mesh);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Setup render mesh
|
||||
if (!ctx.render_scene.Setup()) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "tinyusdz", "Scene::Setup failed");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// init camera matrix
|
||||
{
|
||||
auto q = ToQuaternion(radians(ctx.yaw), radians(ctx.pitch),
|
||||
radians(ctx.roll));
|
||||
ctx.camera.quat[0] = q[0];
|
||||
ctx.camera.quat[1] = q[1];
|
||||
ctx.camera.quat[2] = q[2];
|
||||
ctx.camera.quat[3] = q[3];
|
||||
}
|
||||
|
||||
// HACK. camera position adjusted for `suzanne.usdc`
|
||||
ctx.camera.eye[2] = 3.5f;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenderScene(GUIContext &ctx)
|
||||
{
|
||||
|
||||
// init camera matrix
|
||||
{
|
||||
auto q = ToQuaternion(radians(ctx.yaw), radians(ctx.pitch),
|
||||
radians(ctx.roll));
|
||||
ctx.camera.quat[0] = q[0];
|
||||
ctx.camera.quat[1] = q[1];
|
||||
ctx.camera.quat[2] = q[2];
|
||||
ctx.camera.quat[3] = q[3];
|
||||
}
|
||||
|
||||
// Init AOV image
|
||||
ctx.aov.Resize(ctx.render_width, ctx.render_height);
|
||||
|
||||
example::Render(ctx.render_scene, ctx.camera, &ctx.aov);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GetRenderedImage(const GUIContext &ctx, std::vector<uint32_t> *argb) {
|
||||
if (!argb) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> buf;
|
||||
buf.resize(ctx.aov.width * ctx.aov.height);
|
||||
|
||||
for (size_t i = 0; i < ctx.aov.width * ctx.aov.height; i++) {
|
||||
uint8_t r = ftouc(linearToSrgb(ctx.aov.rgb[3 * i + 0]));
|
||||
uint8_t g = ftouc(linearToSrgb(ctx.aov.rgb[3 * i + 1]));
|
||||
uint8_t b = ftouc(linearToSrgb(ctx.aov.rgb[3 * i + 2]));
|
||||
uint8_t a = 255;
|
||||
|
||||
buf[i] = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
(*argb) = buf;
|
||||
}
|
||||
} // example
|
|
@ -0,0 +1,82 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
#pragma once
|
||||
|
||||
#include "simple-render.hh"
|
||||
|
||||
namespace example {
|
||||
|
||||
struct GUIContext {
|
||||
enum AOVMode {
|
||||
AOV_COLOR = 0,
|
||||
AOV_SHADING_NORMAL,
|
||||
AOV_GEOMETRIC_NORMAL,
|
||||
AOV_POSITION,
|
||||
AOV_DEPTH,
|
||||
AOV_TEXCOORD,
|
||||
AOV_VARYCOORD,
|
||||
AOV_VERTEXCOLOR
|
||||
};
|
||||
int aov_mode{AOV_COLOR};
|
||||
|
||||
|
||||
example::AOV aov; // framebuffer
|
||||
|
||||
int width = 1024;
|
||||
int height = 768;
|
||||
|
||||
int mouse_x = -1;
|
||||
int mouse_y = -1;
|
||||
|
||||
bool mouse_left_down = false;
|
||||
bool shift_pressed = false;
|
||||
bool ctrl_pressed = false;
|
||||
bool tab_pressed = false;
|
||||
|
||||
float yaw = 90.0f; // for Z up scene
|
||||
float pitch = 0.0f;
|
||||
float roll = 0.0f;
|
||||
|
||||
// float curr_quat[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
// std::array<float, 4> prev_quat[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
// std::array<float, 3> eye = {0.0f, 0.0f, 5.0f};
|
||||
// std::array<float, 3> lookat = {0.0f, 0.0f, 0.0f};
|
||||
// std::array<float, 3> up = {0.0f, 1.0f, 0.0f};
|
||||
|
||||
example::RenderScene render_scene;
|
||||
|
||||
example::Camera camera;
|
||||
|
||||
std::atomic<bool> update_texture{false};
|
||||
std::atomic<bool> redraw{true}; // require redraw
|
||||
std::atomic<bool> quit{false};
|
||||
|
||||
int render_width = 512;
|
||||
int render_height = 512;
|
||||
|
||||
// scene reload
|
||||
tinyusdz::Stage stage;
|
||||
std::atomic<bool> request_reload{false};
|
||||
std::string filename;
|
||||
|
||||
#if __EMSCRIPTEN__ || defined(EMULATE_EMSCRIPTEN)
|
||||
bool render_finished{false};
|
||||
int current_render_line = 0;
|
||||
int render_line_size = 32; // render images with this lines per animation loop.
|
||||
// for emscripten environment
|
||||
#endif
|
||||
};
|
||||
|
||||
extern GUIContext g_gui_ctx;
|
||||
|
||||
|
||||
// Setup scene. Only need to call once USD scene(ctx.scene) is loaded.
|
||||
bool SetupScene(GUIContext &ctx);
|
||||
|
||||
// Render the scene(and store rendered image to ctx.aov)
|
||||
bool RenderScene(GUIContext &ctx);
|
||||
|
||||
// Get rendered image from ctx.aov as Android ARGB_8888 IntArray.
|
||||
void GetRenderedImage(const GUIContext &ctx, std::vector<uint32_t> *argb);
|
||||
|
||||
} // example
|
|
@ -0,0 +1,215 @@
|
|||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.example.hellotinyusdz
|
||||
|
||||
import android.content.res.AssetManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.GestureDetector
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
import android.graphics.Bitmap
|
||||
import android.util.Log
|
||||
|
||||
import androidx.core.view.MotionEventCompat
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.BitmapFactory
|
||||
import kotlinx.android.synthetic.main.activity_main.sample_text
|
||||
|
||||
class MainActivity : AppCompatActivity(), GestureDetector.OnGestureListener {
|
||||
|
||||
val render_width = 512
|
||||
val render_height = 512
|
||||
var lastTouchTime: Long = -1
|
||||
var motionX = -1.0f
|
||||
var motionY = -1.0f
|
||||
|
||||
fun updateRender() {
|
||||
renderImage(render_width, render_height);
|
||||
|
||||
var conf = Bitmap.Config.ARGB_8888
|
||||
var b = Bitmap.createBitmap(render_width, render_height, conf)
|
||||
|
||||
var pixels = IntArray(render_width * render_height)
|
||||
|
||||
grabImage(pixels, render_width, render_height)
|
||||
|
||||
b.setPixels(pixels, 0, render_width, 0, 0, render_width, render_height)
|
||||
|
||||
var img = findViewById<ImageView>(R.id.imageView)
|
||||
|
||||
img.setImageBitmap(b)
|
||||
}
|
||||
|
||||
|
||||
override fun onLongPress(event: MotionEvent) {
|
||||
Log.d("tinyusdz", "onLongPress: $event")
|
||||
}
|
||||
|
||||
override fun onScroll(
|
||||
event1: MotionEvent,
|
||||
event2: MotionEvent,
|
||||
distanceX: Float,
|
||||
distanceY: Float
|
||||
): Boolean {
|
||||
Log.d("tinyusdz", "onScroll: $event1 $event2")
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onShowPress(event: MotionEvent) {
|
||||
|
||||
Log.d("tinyusdz", "onShowPress: $event")
|
||||
}
|
||||
|
||||
override fun onSingleTapUp(event: MotionEvent): Boolean {
|
||||
Log.d("tinyusdz", "onSingleTapUp: $event")
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onDown(event: MotionEvent): Boolean {
|
||||
Log.d("tinyusdz", "onDown: $event")
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onFling(
|
||||
event1: MotionEvent,
|
||||
event2: MotionEvent,
|
||||
velocityX: Float,
|
||||
velocityY: Float
|
||||
): Boolean {
|
||||
Log.d("tinyusdz", "onFling: $event1 $event2")
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent) : Boolean {
|
||||
val action: Int = MotionEventCompat.getActionMasked(event)
|
||||
|
||||
return when (action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
Log.d("tinyusdz", "Action was DOWN")
|
||||
motionX = event.getX()
|
||||
motionY = event.getY()
|
||||
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
var x = event.getX()
|
||||
var y = event.getY()
|
||||
|
||||
if ((lastTouchTime < 0) || (event.eventTime < lastTouchTime)) {
|
||||
motionX = x
|
||||
motionY = y
|
||||
}
|
||||
|
||||
var eventDuration = event.eventTime - event.downTime;
|
||||
lastTouchTime = eventDuration
|
||||
|
||||
|
||||
var dx = x - motionX
|
||||
var dy = y - motionY
|
||||
|
||||
Log.d("tinyusdz", "Action was MOVE. duration " + eventDuration + ", dx " + dx + ", dy = " + dy)
|
||||
|
||||
touchMove(dx, dy)
|
||||
|
||||
updateRender()
|
||||
|
||||
motionX = x
|
||||
motionY = y
|
||||
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
Log.d("tinyusdz", "Action was UP")
|
||||
|
||||
motionX = event.getX()
|
||||
motionY = event.getY()
|
||||
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
Log.d("tinyusdz", "Action was CANCEL")
|
||||
true
|
||||
}
|
||||
MotionEvent.ACTION_OUTSIDE -> {
|
||||
Log.d("tinyusdz", "Movement occurred outside bounds of current screen element")
|
||||
true
|
||||
}
|
||||
else -> {
|
||||
Log.d("tinyusdz", "Another action")
|
||||
super.onTouchEvent(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
val view = findViewById<View>(R.id.container)
|
||||
|
||||
|
||||
// Set up a touch listener which calls the native sound engine
|
||||
view.setOnTouchListener {_, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
//playSound(true)
|
||||
} else if (event.action == MotionEvent.ACTION_UP) {
|
||||
//playSound(false)
|
||||
} else {
|
||||
return@setOnTouchListener false
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
var n = initScene(getAssets(), "suzanne.usdc");
|
||||
|
||||
if (n <= 0) {
|
||||
val errorString : String = "Failed to load USD file"
|
||||
Toast.makeText(applicationContext, errorString,Toast.LENGTH_LONG).show()
|
||||
sample_text.text = errorString
|
||||
} else {
|
||||
val s : String = "Loaded USD. # of geom_meshes " + n
|
||||
Toast.makeText(applicationContext, s,Toast.LENGTH_LONG).show()
|
||||
sample_text.text = s
|
||||
|
||||
updateRender()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
|
||||
private external fun initScene(mgr: AssetManager, filename: String) : Int
|
||||
private external fun renderImage(width: Int, height: Int) : Int
|
||||
private external fun grabImage(img: IntArray, width: Int, height: Int) : Int
|
||||
private external fun touchMove(dx: Float, dy: Float) : Int
|
||||
|
||||
companion object {
|
||||
// Used to load native code calling oboe on app startup.
|
||||
init {
|
||||
System.loadLibrary("hello-tinyusdz")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
|
@ -0,0 +1,170 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#008577"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/container"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sample_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/prompt_msg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_launcher_background" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
</resources>
|
|
@ -0,0 +1,4 @@
|
|||
<resources>
|
||||
<string name="app_name">Hello TinyUSDZ</string>
|
||||
<string name="prompt_msg">Tap to play!</string>
|
||||
</resources>
|
|
@ -0,0 +1,11 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,28 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.6.21'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
android.useAndroidX=true
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,234 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -0,0 +1 @@
|
|||
include ':app'
|
|
@ -0,0 +1,114 @@
|
|||
#include <unistd.h>
|
||||
#include "ubench.h"
|
||||
|
||||
#include "value-types.hh"
|
||||
#include "prim-types.hh"
|
||||
#include "usdGeom.hh"
|
||||
|
||||
using namespace tinyusdz;
|
||||
|
||||
UBENCH(perf, vector_double_push_back_10M)
|
||||
{
|
||||
std::vector<double> v;
|
||||
constexpr size_t niter = 10 * 10000;
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
v.push_back(double(i));
|
||||
}
|
||||
}
|
||||
|
||||
UBENCH(perf, any_value_double_10M)
|
||||
{
|
||||
constexpr size_t niter = 10 * 10000;
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
linb::any a;
|
||||
a = double(i);
|
||||
}
|
||||
}
|
||||
|
||||
UBENCH(perf, thelink2012_any_float_10M)
|
||||
{
|
||||
constexpr size_t niter = 10 * 10000;
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
linb::any a;
|
||||
a = float(i);
|
||||
}
|
||||
}
|
||||
|
||||
UBENCH(perf, thelink2012_any_double_10M)
|
||||
{
|
||||
constexpr size_t niter = 10 * 10000;
|
||||
|
||||
std::vector<linb::any> v;
|
||||
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
v.push_back(double(i));
|
||||
}
|
||||
}
|
||||
|
||||
UBENCH(perf, any_value_100M)
|
||||
{
|
||||
constexpr size_t niter = 100 * 10000;
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
tinyusdz::value::Value a;
|
||||
a = i;
|
||||
}
|
||||
}
|
||||
|
||||
UBENCH(perf, timesamples_double_10M)
|
||||
{
|
||||
constexpr size_t ns = 10 * 10000;
|
||||
|
||||
tinyusdz::value::TimeSamples ts;
|
||||
|
||||
for (size_t i = 0; i < ns; i++) {
|
||||
ts.times.push_back(double(i));
|
||||
ts.values.push_back(double(i));
|
||||
}
|
||||
}
|
||||
|
||||
UBENCH(perf, gprim_10M)
|
||||
{
|
||||
constexpr size_t niter = 10 * 10000;
|
||||
std::vector<value::Value> prims;
|
||||
|
||||
tinyusdz::Xform xform;
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
prims.emplace_back(xform);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Its rougly 3.5x slower compared to `string_vector_10M` in single-threaded run on Threadripper 1950X
|
||||
// (even not using thread_safe_databse(no mutex))
|
||||
UBENCH(perf, token_vector_10M)
|
||||
{
|
||||
constexpr size_t niter = 10 * 10000;
|
||||
std::vector<value::token> v;
|
||||
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
value::token tok(std::to_string(i));
|
||||
v.emplace_back(tok);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UBENCH(perf, string_vector_10M)
|
||||
{
|
||||
constexpr size_t niter = 10 * 10000;
|
||||
std::vector<std::string> v;
|
||||
|
||||
for (size_t i = 0; i < niter; i++) {
|
||||
std::string s(std::to_string(i));
|
||||
v.emplace_back(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//int main(int argc, char **argv)
|
||||
//{
|
||||
// benchmark_any_type();
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
UBENCH_MAIN();
|
|
@ -0,0 +1,823 @@
|
|||
/*
|
||||
The latest version of this library is available on GitHub;
|
||||
https://github.com/sheredom/ubench.h
|
||||
*/
|
||||
|
||||
/*
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
|
||||
#ifndef SHEREDOM_UBENCH_H_INCLUDED
|
||||
#define SHEREDOM_UBENCH_H_INCLUDED
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/*
|
||||
Disable warning about not inlining 'inline' functions.
|
||||
TODO: We'll fix this later by not using fprintf within our macros, and
|
||||
instead use snprintf to a realloc'ed buffer.
|
||||
*/
|
||||
#pragma warning(disable : 4710)
|
||||
|
||||
/*
|
||||
Disable warning about inlining functions that are not marked 'inline'.
|
||||
TODO: add a UBENCH_NOINLINE onto the macro generated functions to fix this.
|
||||
*/
|
||||
#pragma warning(disable : 4711)
|
||||
|
||||
/*
|
||||
Disable warning about replacing undefined preprocessor macro '__cplusplus' with
|
||||
0 emitted from microsofts own headers.
|
||||
See: https://developercommunity.visualstudio.com/t/issue-in-corecrth-header-results-in-an-undefined-m/433021
|
||||
*/
|
||||
#pragma warning(disable : 4668)
|
||||
|
||||
/*
|
||||
Disabled warning about dangerous use of section.
|
||||
section '.CRT$XCU' is reserved for C++ dynamic initialization. Manually
|
||||
creating the section will interfere with C++ dynamic initialization and may lead to undefined behavior
|
||||
*/
|
||||
#if defined(_MSC_FULL_VER)
|
||||
#if _MSC_FULL_VER >= 192930100 // this warning was introduced in Visual Studio 2019 version 16.11
|
||||
#pragma warning(disable : 5247)
|
||||
#pragma warning(disable : 5248)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define UBENCH_C_FUNC extern "C"
|
||||
#else
|
||||
#define UBENCH_C_FUNC
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define UBENCH_NULL NULL
|
||||
#else
|
||||
#define UBENCH_NULL 0
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1920)
|
||||
typedef __int64 ubench_int64_t;
|
||||
typedef unsigned __int64 ubench_uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
typedef int64_t ubench_int64_t;
|
||||
typedef uint64_t ubench_uint64_t;
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef union {
|
||||
struct {
|
||||
unsigned long LowPart;
|
||||
long HighPart;
|
||||
} DUMMYSTRUCTNAME;
|
||||
struct {
|
||||
unsigned long LowPart;
|
||||
long HighPart;
|
||||
} u;
|
||||
ubench_int64_t QuadPart;
|
||||
} ubench_large_integer;
|
||||
|
||||
UBENCH_C_FUNC __declspec(dllimport) int __stdcall QueryPerformanceCounter(ubench_large_integer *);
|
||||
UBENCH_C_FUNC __declspec(dllimport) int __stdcall QueryPerformanceFrequency(ubench_large_integer *);
|
||||
#elif defined(__linux__)
|
||||
|
||||
/*
|
||||
slightly obscure include here - we need to include glibc's features.h, but
|
||||
we don't want to just include a header that might not be defined for other
|
||||
c libraries like musl. Instead we include limits.h, which we know on all
|
||||
glibc distributions includes features.h
|
||||
*/
|
||||
#include <limits.h>
|
||||
|
||||
#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
|
||||
#include <time.h>
|
||||
|
||||
#if ((2 < __GLIBC__) || ((2 == __GLIBC__) && (17 <= __GLIBC_MINOR__)))
|
||||
/* glibc is version 2.17 or above, so we can just use clock_gettime */
|
||||
#define UBENCH_USE_CLOCKGETTIME
|
||||
#else
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define UBENCH_C_FUNC extern "C"
|
||||
#else
|
||||
#define UBENCH_C_FUNC
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||
#define UBENCH_NOEXCEPT noexcept
|
||||
#else
|
||||
#define UBENCH_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(_MSC_VER)
|
||||
#define UBENCH_NOTHROW __declspec(nothrow)
|
||||
#else
|
||||
#define UBENCH_NOTHROW
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1920)
|
||||
#define UBENCH_PRId64 "I64d"
|
||||
#define UBENCH_PRIu64 "I64u"
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
|
||||
#define UBENCH_PRId64 PRId64
|
||||
#define UBENCH_PRIu64 PRIu64
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define UBENCH_INLINE __forceinline
|
||||
#define UBENCH_NOINLINE __declspec(noinline)
|
||||
|
||||
#if defined(_WIN64)
|
||||
#define UBENCH_SYMBOL_PREFIX
|
||||
#else
|
||||
#define UBENCH_SYMBOL_PREFIX "_"
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define UBENCH_INITIALIZER_BEGIN_DISABLE_WARNINGS \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-variable-declarations\"")
|
||||
|
||||
#define UBENCH_INITIALIZER_END_DISABLE_WARNINGS _Pragma("clang diagnostic pop")
|
||||
#else
|
||||
#define UBENCH_INITIALIZER_BEGIN_DISABLE_WARNINGS
|
||||
#define UBENCH_INITIALIZER_END_DISABLE_WARNINGS
|
||||
#endif
|
||||
|
||||
#pragma section(".CRT$XCU", read)
|
||||
#define UBENCH_INITIALIZER(f) \
|
||||
static void __cdecl f(void); \
|
||||
UBENCH_INITIALIZER_BEGIN_DISABLE_WARNINGS __pragma( \
|
||||
comment(linker, "/include:" UBENCH_SYMBOL_PREFIX #f "_")) \
|
||||
UBENCH_C_FUNC __declspec(allocate(".CRT$XCU")) void(__cdecl * \
|
||||
f##_)(void) = f; \
|
||||
UBENCH_INITIALIZER_END_DISABLE_WARNINGS static void __cdecl f(void)
|
||||
#else
|
||||
#if defined(__linux__)
|
||||
#if defined(__clang__)
|
||||
#if __has_warning("-Wreserved-id-macro")
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define __STDC_FORMAT_MACROS 1
|
||||
|
||||
#if defined(__clang__)
|
||||
#if __has_warning("-Wreserved-id-macro")
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define UBENCH_INLINE inline
|
||||
#define UBENCH_NOINLINE __attribute__((noinline))
|
||||
|
||||
#define UBENCH_INITIALIZER(f) \
|
||||
static void f(void) __attribute__((constructor)); \
|
||||
static void f(void)
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define UBENCH_CAST(type, x) static_cast<type>(x)
|
||||
#define UBENCH_PTR_CAST(type, x) reinterpret_cast<type>(x)
|
||||
#define UBENCH_EXTERN extern "C"
|
||||
#else
|
||||
#define UBENCH_CAST(type, x) ((type)(x))
|
||||
#define UBENCH_PTR_CAST(type, x) ((type)(x))
|
||||
#define UBENCH_EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/*
|
||||
io.h contains definitions for some structures with natural padding. This is
|
||||
uninteresting, but for some reason MSVC's behaviour is to warn about
|
||||
including this system header. That *is* interesting
|
||||
*/
|
||||
#pragma warning(disable : 4820)
|
||||
#pragma warning(push, 1)
|
||||
#include <io.h>
|
||||
#pragma warning(pop)
|
||||
#define UBENCH_COLOUR_OUTPUT() (_isatty(_fileno(stdout)))
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define UBENCH_COLOUR_OUTPUT() (isatty(STDOUT_FILENO))
|
||||
#endif
|
||||
|
||||
static UBENCH_INLINE ubench_int64_t ubench_ns(void) {
|
||||
#ifdef _MSC_VER
|
||||
ubench_large_integer counter;
|
||||
ubench_large_integer frequency;
|
||||
QueryPerformanceCounter(&counter);
|
||||
QueryPerformanceFrequency(&frequency);
|
||||
return UBENCH_CAST(ubench_int64_t,
|
||||
(counter.QuadPart * 1000000000) / frequency.QuadPart);
|
||||
#elif defined(__linux)
|
||||
struct timespec ts;
|
||||
const clockid_t cid = CLOCK_REALTIME;
|
||||
#if defined(UBENCH_USE_CLOCKGETTIME)
|
||||
clock_gettime(cid, &ts);
|
||||
#else
|
||||
syscall(SYS_clock_gettime, cid, &ts);
|
||||
#endif
|
||||
return UBENCH_CAST(ubench_int64_t, ts.tv_sec) * 1000 * 1000 * 1000 +
|
||||
ts.tv_nsec;
|
||||
#elif __APPLE__
|
||||
return UBENCH_CAST(ubench_int64_t, mach_absolute_time());
|
||||
#endif
|
||||
}
|
||||
|
||||
struct ubench_run_state_s {
|
||||
ubench_int64_t* ns;
|
||||
ubench_int64_t size;
|
||||
ubench_int64_t sample;
|
||||
};
|
||||
|
||||
typedef void (*ubench_benchmark_t)(struct ubench_run_state_s* ubs);
|
||||
|
||||
struct ubench_benchmark_state_s {
|
||||
ubench_benchmark_t func;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct ubench_state_s {
|
||||
struct ubench_benchmark_state_s *benchmarks;
|
||||
size_t benchmarks_length;
|
||||
FILE *output;
|
||||
double confidence;
|
||||
};
|
||||
|
||||
/* extern to the global state ubench needs to execute */
|
||||
UBENCH_EXTERN struct ubench_state_s ubench_state;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define UBENCH_UNUSED
|
||||
#else
|
||||
#define UBENCH_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wvariadic-macros"
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
#endif
|
||||
#define UBENCH_PRINTF(...) \
|
||||
if (ubench_state.output) { \
|
||||
fprintf(ubench_state.output, __VA_ARGS__); \
|
||||
} \
|
||||
printf(__VA_ARGS__)
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wvariadic-macros"
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define UBENCH_SNPRINTF(BUFFER, N, ...) _snprintf_s(BUFFER, N, N, __VA_ARGS__)
|
||||
#else
|
||||
#define UBENCH_SNPRINTF(...) snprintf(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
static UBENCH_INLINE int ubench_do_benchmark(struct ubench_run_state_s* ubs)
|
||||
{
|
||||
ubench_int64_t curr_sample = ubs->sample++;
|
||||
ubs->ns[curr_sample] = ubench_ns();
|
||||
return curr_sample < ubs->size ? 1 : 0;
|
||||
}
|
||||
|
||||
#define UBENCH_DO_BENCHMARK() \
|
||||
while(ubench_do_benchmark(ubench_run_state) > 0)
|
||||
|
||||
#define UBENCH_EX(SET, NAME) \
|
||||
UBENCH_EXTERN struct ubench_state_s ubench_state; \
|
||||
static void ubench_##SET##_##NAME(struct ubench_run_state_s* ubs); \
|
||||
UBENCH_INITIALIZER(ubench_register_##SET##_##NAME) { \
|
||||
const size_t index = ubench_state.benchmarks_length++; \
|
||||
const char *name_part = #SET "." #NAME; \
|
||||
const size_t name_size = strlen(name_part) + 1; \
|
||||
char *name = UBENCH_PTR_CAST(char *, malloc(name_size)); \
|
||||
ubench_state.benchmarks = UBENCH_PTR_CAST( \
|
||||
struct ubench_benchmark_state_s *, \
|
||||
realloc(UBENCH_PTR_CAST(void *, ubench_state.benchmarks), \
|
||||
sizeof(struct ubench_benchmark_state_s) * \
|
||||
ubench_state.benchmarks_length)); \
|
||||
ubench_state.benchmarks[index].func = &ubench_##SET##_##NAME; \
|
||||
ubench_state.benchmarks[index].name = name; \
|
||||
UBENCH_SNPRINTF(name, name_size, "%s", name_part); \
|
||||
} \
|
||||
void ubench_##SET##_##NAME(struct ubench_run_state_s* ubench_run_state)
|
||||
|
||||
#define UBENCH(SET, NAME) \
|
||||
static void ubench_run_##SET##_##NAME(void); \
|
||||
UBENCH_EX(SET, NAME) { \
|
||||
UBENCH_DO_BENCHMARK() { \
|
||||
ubench_run_##SET##_##NAME(); \
|
||||
} \
|
||||
} \
|
||||
void ubench_run_##SET##_##NAME(void)
|
||||
|
||||
#define UBENCH_F_SETUP(FIXTURE) \
|
||||
static void ubench_f_setup_##FIXTURE(struct FIXTURE *ubench_fixture)
|
||||
|
||||
#define UBENCH_F_TEARDOWN(FIXTURE) \
|
||||
static void ubench_f_teardown_##FIXTURE(struct FIXTURE *ubench_fixture)
|
||||
|
||||
#define UBENCH_EX_F(FIXTURE, NAME) \
|
||||
UBENCH_EXTERN struct ubench_state_s ubench_state; \
|
||||
static void ubench_f_setup_##FIXTURE(struct FIXTURE *); \
|
||||
static void ubench_f_teardown_##FIXTURE(struct FIXTURE *); \
|
||||
static void ubench_run_ex_##FIXTURE##_##NAME(struct FIXTURE *, \
|
||||
struct ubench_run_state_s*); \
|
||||
static void ubench_f_##FIXTURE##_##NAME(struct ubench_run_state_s* ubench_run_state) { \
|
||||
struct FIXTURE fixture; \
|
||||
memset(&fixture, 0, sizeof(fixture)); \
|
||||
ubench_f_setup_##FIXTURE(&fixture); \
|
||||
ubench_run_ex_##FIXTURE##_##NAME(&fixture, ubench_run_state); \
|
||||
ubench_f_teardown_##FIXTURE(&fixture); \
|
||||
} \
|
||||
UBENCH_INITIALIZER(ubench_register_##FIXTURE##_##NAME) { \
|
||||
const size_t index = ubench_state.benchmarks_length++; \
|
||||
const char *name_part = #FIXTURE "." #NAME; \
|
||||
const size_t name_size = strlen(name_part) + 1; \
|
||||
char *name = UBENCH_PTR_CAST(char *, malloc(name_size)); \
|
||||
ubench_state.benchmarks = UBENCH_PTR_CAST( \
|
||||
struct ubench_benchmark_state_s *, \
|
||||
realloc(UBENCH_PTR_CAST(void *, ubench_state.benchmarks), \
|
||||
sizeof(struct ubench_benchmark_state_s) * \
|
||||
ubench_state.benchmarks_length)); \
|
||||
ubench_state.benchmarks[index].func = &ubench_f_##FIXTURE##_##NAME; \
|
||||
ubench_state.benchmarks[index].name = name; \
|
||||
UBENCH_SNPRINTF(name, name_size, "%s", name_part); \
|
||||
} \
|
||||
void ubench_run_ex_##FIXTURE##_##NAME(struct FIXTURE *ubench_fixture, \
|
||||
struct ubench_run_state_s* ubench_run_state)
|
||||
|
||||
#define UBENCH_F(FIXTURE, NAME) \
|
||||
static void ubench_run_##FIXTURE##_##NAME(struct FIXTURE *); \
|
||||
UBENCH_EX_F(FIXTURE, NAME) { \
|
||||
UBENCH_DO_BENCHMARK() { \
|
||||
ubench_run_##FIXTURE##_##NAME(ubench_fixture); \
|
||||
} \
|
||||
} \
|
||||
void ubench_run_##FIXTURE##_##NAME(struct FIXTURE *ubench_fixture)
|
||||
|
||||
static UBENCH_INLINE int ubench_should_filter(const char *filter,
|
||||
const char *benchmark);
|
||||
int ubench_should_filter(const char *filter, const char *benchmark) {
|
||||
if (filter) {
|
||||
const char *filter_cur = filter;
|
||||
const char *benchmark_cur = benchmark;
|
||||
const char *filter_wildcard = UBENCH_NULL;
|
||||
|
||||
while (('\0' != *filter_cur) && ('\0' != *benchmark_cur)) {
|
||||
if ('*' == *filter_cur) {
|
||||
/* store the position of the wildcard */
|
||||
filter_wildcard = filter_cur;
|
||||
|
||||
/* skip the wildcard character */
|
||||
filter_cur++;
|
||||
|
||||
while (('\0' != *filter_cur) && ('\0' != *benchmark_cur)) {
|
||||
if ('*' == *filter_cur) {
|
||||
/*
|
||||
we found another wildcard (filter is something like *foo*) so we
|
||||
exit the current loop, and return to the parent loop to handle
|
||||
the wildcard case
|
||||
*/
|
||||
break;
|
||||
} else if (*filter_cur != *benchmark_cur) {
|
||||
/* otherwise our filter didn't match, so reset it */
|
||||
filter_cur = filter_wildcard;
|
||||
}
|
||||
|
||||
/* move benchmark along */
|
||||
benchmark_cur++;
|
||||
|
||||
/* move filter along */
|
||||
filter_cur++;
|
||||
}
|
||||
|
||||
if (('\0' == *filter_cur) && ('\0' == *benchmark_cur)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if the benchmarks have been exhausted, we don't have a match! */
|
||||
if ('\0' == *benchmark_cur) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (*benchmark_cur != *filter_cur) {
|
||||
/* benchmark doesn't match filter */
|
||||
return 1;
|
||||
} else {
|
||||
/* move our filter and benchmark forward */
|
||||
benchmark_cur++;
|
||||
filter_cur++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (('\0' != *filter_cur) ||
|
||||
(('\0' != *benchmark_cur) &&
|
||||
((filter == filter_cur) || ('*' != filter_cur[-1])))) {
|
||||
/* we have a mismatch! */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UBENCH_INLINE int ubench_strncmp(const char *a, const char *b,
|
||||
size_t n) {
|
||||
/* strncmp breaks on Wall / Werror on gcc/clang, so we avoid using it */
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (a[i] < b[i]) {
|
||||
return -1;
|
||||
} else if (a[i] > b[i]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UBENCH_INLINE FILE *ubench_fopen(const char *filename,
|
||||
const char *mode) {
|
||||
#ifdef _MSC_VER
|
||||
FILE *file;
|
||||
if (0 == fopen_s(&file, filename, mode)) {
|
||||
return file;
|
||||
} else {
|
||||
return UBENCH_NULL;
|
||||
}
|
||||
#else
|
||||
return fopen(filename, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
static UBENCH_INLINE int ubench_main(int argc, const char *const argv[]);
|
||||
int ubench_main(int argc, const char *const argv[]) {
|
||||
ubench_uint64_t failed = 0;
|
||||
size_t index = 0;
|
||||
size_t *failed_benchmarks = UBENCH_NULL;
|
||||
size_t failed_benchmarks_length = 0;
|
||||
const char *filter = UBENCH_NULL;
|
||||
ubench_uint64_t ran_benchmarks = 0;
|
||||
|
||||
enum colours { RESET, GREEN, RED };
|
||||
|
||||
const int use_colours = UBENCH_COLOUR_OUTPUT();
|
||||
const char *colours[] = {"\033[0m", "\033[32m", "\033[31m"};
|
||||
if (!use_colours) {
|
||||
for (index = 0; index < sizeof colours / sizeof colours[0]; index++) {
|
||||
colours[index] = "";
|
||||
}
|
||||
}
|
||||
|
||||
/* loop through all arguments looking for our options */
|
||||
for (index = 1; index < UBENCH_CAST(size_t, argc); index++) {
|
||||
/* Informational switches */
|
||||
const char help_str[] = "--help";
|
||||
const char list_str[] = "--list-benchmarks";
|
||||
/* Benchmark config switches */
|
||||
const char filter_str[] = "--filter=";
|
||||
const char output_str[] = "--output=";
|
||||
const char confidence_str[] = "--confidence=";
|
||||
|
||||
if (0 == ubench_strncmp(argv[index], help_str, strlen(help_str))) {
|
||||
printf("ubench.h - the single file benchmarking solution for C/C++!\n"
|
||||
"Command line Options:\n");
|
||||
printf(" --help Show this message and exit.\n"
|
||||
" --filter=<filter> Filter the benchmarks to run (EG. "
|
||||
"MyBench*.a would run MyBenchmark.a but not MyBenchmark.b).\n"
|
||||
" --list-benchmarks List benchmarks, one per line. "
|
||||
"Output names can be passed to --filter.\n"
|
||||
" --output=<output> Output a CSV file of the results.\n"
|
||||
" --confidence=<confidence> Change the confidence cut-off for a "
|
||||
"failed test. Defaults to 2.5%%\n");
|
||||
goto cleanup;
|
||||
} else if (0 ==
|
||||
ubench_strncmp(argv[index], filter_str, strlen(filter_str))) {
|
||||
/* user wants to filter what benchmarks run! */
|
||||
filter = argv[index] + strlen(filter_str);
|
||||
} else if (0 ==
|
||||
ubench_strncmp(argv[index], output_str, strlen(output_str))) {
|
||||
ubench_state.output =
|
||||
ubench_fopen(argv[index] + strlen(output_str), "w+");
|
||||
} else if (0 == ubench_strncmp(argv[index], list_str, strlen(list_str))) {
|
||||
for (index = 0; index < ubench_state.benchmarks_length; index++) {
|
||||
UBENCH_PRINTF("%s\n", ubench_state.benchmarks[index].name);
|
||||
}
|
||||
|
||||
/* when printing the benchmark list, don't actually run the benchmarks */
|
||||
goto cleanup;
|
||||
} else if (0 == ubench_strncmp(argv[index], confidence_str,
|
||||
strlen(confidence_str))) {
|
||||
/* user wants to specify a different confidence */
|
||||
ubench_state.confidence = atof(argv[index] + strlen(confidence_str));
|
||||
|
||||
/* must be between 0 and 100 */
|
||||
if ((ubench_state.confidence < 0) || (ubench_state.confidence > 100)) {
|
||||
fprintf(stderr,
|
||||
"Confidence must be in the range [0..100] (you specified %f)\n",
|
||||
ubench_state.confidence);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (index = 0; index < ubench_state.benchmarks_length; index++) {
|
||||
if (ubench_should_filter(filter, ubench_state.benchmarks[index].name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ran_benchmarks++;
|
||||
}
|
||||
|
||||
printf("%s[==========]%s Running %" UBENCH_PRIu64 " benchmarks.\n",
|
||||
colours[GREEN], colours[RESET],
|
||||
UBENCH_CAST(ubench_uint64_t, ran_benchmarks));
|
||||
|
||||
if (ubench_state.output) {
|
||||
fprintf(ubench_state.output,
|
||||
"name, mean (ns), stddev (%%), confidence (%%)\n");
|
||||
}
|
||||
|
||||
for (index = 0; index < ubench_state.benchmarks_length; index++) {
|
||||
int result = 1;
|
||||
size_t mndex = 0;
|
||||
ubench_int64_t best_avg_ns = 0;
|
||||
double best_deviation = 0;
|
||||
double best_confidence = 101.0;
|
||||
struct ubench_run_state_s ubs;
|
||||
|
||||
#define UBENCH_MIN_ITERATIONS 10
|
||||
#define UBENCH_MAX_ITERATIONS 500
|
||||
ubench_int64_t iterations = 10;
|
||||
const ubench_int64_t max_iterations = UBENCH_MAX_ITERATIONS;
|
||||
const ubench_int64_t min_iterations = UBENCH_MIN_ITERATIONS;
|
||||
/* Add one extra timestamp slot, as we save times between runs and time after exiting the last one */
|
||||
ubench_int64_t ns[UBENCH_MAX_ITERATIONS+1];
|
||||
#undef UBENCH_MAX_ITERATIONS
|
||||
#undef UBENCH_MIN_ITERATIONS
|
||||
|
||||
if (ubench_should_filter(filter, ubench_state.benchmarks[index].name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("%s[ RUN ]%s %s\n", colours[GREEN], colours[RESET],
|
||||
ubench_state.benchmarks[index].name);
|
||||
|
||||
ubs.ns = ns;
|
||||
ubs.size = 1;
|
||||
ubs.sample = 0;
|
||||
|
||||
/* Time once to work out the base number of iterations to use. */
|
||||
ubench_state.benchmarks[index].func(&ubs);
|
||||
|
||||
iterations = (100 * 1000 * 1000) / ((ns[1] <= ns[0]) ? 1 : ns[1] - ns[0]);
|
||||
iterations = iterations < min_iterations ? min_iterations : iterations;
|
||||
iterations = iterations > max_iterations ? max_iterations : iterations;
|
||||
|
||||
for (mndex = 0; (mndex < 100) && (result != 0); mndex++) {
|
||||
ubench_int64_t kndex = 0;
|
||||
ubench_int64_t avg_ns = 0;
|
||||
double deviation = 0;
|
||||
double confidence = 0;
|
||||
|
||||
iterations = iterations * (UBENCH_CAST(ubench_int64_t, mndex) + 1);
|
||||
iterations = iterations > max_iterations ? max_iterations : iterations;
|
||||
|
||||
ubs.sample = 0;
|
||||
ubs.size = iterations;
|
||||
ubench_state.benchmarks[index].func(&ubs);
|
||||
|
||||
/* Calculate benchmark run-times */
|
||||
for (kndex = 0; kndex < iterations; kndex++) {
|
||||
ns[kndex] = ns[kndex + 1] - ns[kndex];
|
||||
}
|
||||
|
||||
for (kndex = 0; kndex < iterations; kndex++) {
|
||||
avg_ns += ns[kndex];
|
||||
}
|
||||
|
||||
avg_ns /= iterations;
|
||||
|
||||
for (kndex = 0; kndex < iterations; kndex++) {
|
||||
const double v = UBENCH_CAST(double, ns[kndex] - avg_ns);
|
||||
deviation += v * v;
|
||||
}
|
||||
|
||||
deviation = sqrt(deviation / UBENCH_CAST(double, iterations));
|
||||
|
||||
/* Confidence is the 99% confidence index - whose magic value is 2.576. */
|
||||
confidence = 2.576 * deviation / sqrt(UBENCH_CAST(double, iterations));
|
||||
confidence = (confidence / UBENCH_CAST(double, avg_ns)) * 100.0;
|
||||
|
||||
deviation = (deviation / UBENCH_CAST(double, avg_ns)) * 100.0;
|
||||
|
||||
/* If we've found a more confident solution, use that. */
|
||||
result = confidence > ubench_state.confidence;
|
||||
|
||||
/* If the deviation beats our previous best, record it. */
|
||||
if (confidence < best_confidence) {
|
||||
best_avg_ns = avg_ns;
|
||||
best_deviation = deviation;
|
||||
best_confidence = confidence;
|
||||
}
|
||||
}
|
||||
|
||||
if (result) {
|
||||
printf("confidence interval %f%% exceeds maximum permitted %f%%\n",
|
||||
best_confidence, ubench_state.confidence);
|
||||
}
|
||||
|
||||
if (ubench_state.output) {
|
||||
fprintf(ubench_state.output, "%s, %" UBENCH_PRId64 ", %f, %f,\n",
|
||||
ubench_state.benchmarks[index].name, best_avg_ns, best_deviation,
|
||||
best_confidence);
|
||||
}
|
||||
|
||||
{
|
||||
const char *const colour = (0 != result) ? colours[RED] : colours[GREEN];
|
||||
const char *const status =
|
||||
(0 != result) ? "[ FAILED ]" : "[ OK ]";
|
||||
const char *unit = "us";
|
||||
|
||||
if (0 != result) {
|
||||
const size_t failed_benchmark_index = failed_benchmarks_length++;
|
||||
failed_benchmarks = UBENCH_PTR_CAST(
|
||||
size_t *, realloc(UBENCH_PTR_CAST(void *, failed_benchmarks),
|
||||
sizeof(size_t) * failed_benchmarks_length));
|
||||
failed_benchmarks[failed_benchmark_index] = index;
|
||||
failed++;
|
||||
}
|
||||
|
||||
printf("%s%s%s %s (mean ", colour, status, colours[RESET],
|
||||
ubench_state.benchmarks[index].name);
|
||||
|
||||
for (mndex = 0; mndex < 2; mndex++) {
|
||||
if (best_avg_ns <= 1000000) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* If the average is greater than a million, we reduce it and change the
|
||||
unit we report. */
|
||||
best_avg_ns /= 1000;
|
||||
|
||||
switch (mndex) {
|
||||
case 0:
|
||||
unit = "ms";
|
||||
break;
|
||||
case 1:
|
||||
unit = "s";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
printf("%" UBENCH_PRId64 ".%03" UBENCH_PRId64
|
||||
"%s, confidence interval +- %f%%)\n",
|
||||
best_avg_ns / 1000, best_avg_ns % 1000, unit, best_confidence);
|
||||
}
|
||||
}
|
||||
|
||||
printf("%s[==========]%s %" UBENCH_PRIu64 " benchmarks ran.\n",
|
||||
colours[GREEN], colours[RESET], ran_benchmarks);
|
||||
printf("%s[ PASSED ]%s %" UBENCH_PRIu64 " benchmarks.\n", colours[GREEN],
|
||||
colours[RESET], ran_benchmarks - failed);
|
||||
|
||||
if (0 != failed) {
|
||||
printf("%s[ FAILED ]%s %" UBENCH_PRIu64 " benchmarks, listed below:\n",
|
||||
colours[RED], colours[RESET], failed);
|
||||
for (index = 0; index < failed_benchmarks_length; index++) {
|
||||
printf("%s[ FAILED ]%s %s\n", colours[RED], colours[RESET],
|
||||
ubench_state.benchmarks[failed_benchmarks[index]].name);
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for (index = 0; index < ubench_state.benchmarks_length; index++) {
|
||||
free(UBENCH_PTR_CAST(void *, ubench_state.benchmarks[index].name));
|
||||
}
|
||||
|
||||
free(UBENCH_PTR_CAST(void *, failed_benchmarks));
|
||||
free(UBENCH_PTR_CAST(void *, ubench_state.benchmarks));
|
||||
|
||||
if (ubench_state.output) {
|
||||
fclose(ubench_state.output);
|
||||
}
|
||||
|
||||
return UBENCH_CAST(int, failed);
|
||||
}
|
||||
|
||||
UBENCH_C_FUNC UBENCH_NOINLINE void ubench_do_nothing(void *const);
|
||||
|
||||
#define UBENCH_DO_NOTHING(x) ubench_do_nothing(x)
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
UBENCH_C_FUNC void _ReadWriteBarrier(void);
|
||||
|
||||
#define UBENCH_DECLARE_DO_NOTHING() \
|
||||
void ubench_do_nothing(void *ptr) { \
|
||||
(void)ptr; \
|
||||
_ReadWriteBarrier(); \
|
||||
}
|
||||
#elif defined(__clang__)
|
||||
#define UBENCH_DECLARE_DO_NOTHING() \
|
||||
void ubench_do_nothing(void *ptr) { \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wlanguage-extension-token\""); \
|
||||
asm volatile("" : : "r,m"(ptr) : "memory"); \
|
||||
_Pragma("clang diagnostic pop"); \
|
||||
}
|
||||
#else
|
||||
#define UBENCH_DECLARE_DO_NOTHING() \
|
||||
void ubench_do_nothing(void *ptr) { \
|
||||
asm volatile("" : : "r,m"(ptr) : "memory"); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
We need, in exactly one source file, define the global struct that will hold
|
||||
the data we need to run ubench. This macro allows the user to declare the
|
||||
data without having to use the UBENCH_MAIN macro, thus allowing them to write
|
||||
their own main() function.
|
||||
|
||||
We also use this to define the 'do nothing' method that lets us keep data
|
||||
that the compiler would normally deem is dead for the purposes of timing.
|
||||
*/
|
||||
#define UBENCH_STATE() \
|
||||
UBENCH_DECLARE_DO_NOTHING() \
|
||||
struct ubench_state_s ubench_state = {0, 0, 0, 2.5}
|
||||
|
||||
/*
|
||||
define a main() function to call into ubench.h and start executing
|
||||
benchmarks! A user can optionally not use this macro, and instead define
|
||||
their own main() function and manually call ubench_main. The user must, in
|
||||
exactly one source file, use the UBENCH_STATE macro to declare a global
|
||||
struct variable that ubench requires.
|
||||
*/
|
||||
#define UBENCH_MAIN() \
|
||||
UBENCH_STATE(); \
|
||||
int main(int argc, const char *const argv[]) { \
|
||||
return ubench_main(argc, argv); \
|
||||
}
|
||||
|
||||
#endif /* SHEREDOM_UBENCH_H_INCLUDED */
|
|
@ -0,0 +1,12 @@
|
|||
rmdir /s /q build
|
||||
mkdir build
|
||||
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="cmake/clang-cl-msvc-windows.cmake" ^
|
||||
-DHOST_ARCH=x64 ^
|
||||
-DLLVM_NATIVE_TOOLCHAIN="C:/Program Files/LLVM/" ^
|
||||
-DMSVC_BASE:FILEPATH="C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\" ^
|
||||
-DWINSDK_BASE="C:\\Program Files (x86)\\Windows Kits\\10\\" ^
|
||||
-DWINSDK_VER="10.0.18362.0" ^
|
||||
..
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
rem Build local Python lib
|
||||
rem Assume running this batch file at the toplevel directory of TinyUSDZ.
|
||||
|
||||
git clone https://github.com/lighttransport/python-cmake-buildsystem ci/python-cmake-buildsystem
|
||||
cd ci/python-cmake-buildsystem
|
||||
git pull origin master
|
||||
cd %~dp0
|
||||
|
||||
rmdir /s /q %~dp0/ci/buil_python
|
||||
|
||||
rem change to "Visual Studio 17 2022" if you use VS2022
|
||||
cmake.exe -G "Visual Studio 16 2019" -A x64 ^
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=%~dp0/ci/dist/python ^
|
||||
-DPYTHON_VERSION="3.10.6" ^
|
||||
-DUSE_SYSTEM_TCL=OFF ^
|
||||
-DUSE_SYSTEM_ZLIB=OFF ^
|
||||
-DUSE_SYSTEM_DB=OFF ^
|
||||
-DUSE_SYSTEM_GDBM=OFF ^
|
||||
-DUSE_SYSTEM_LZMA=OFF ^
|
||||
-DUSE_SYSTEM_READLINE=OFF ^
|
||||
-DUSE_SYSTEM_SQLITE3=OFF ^
|
||||
-DENABLE_SSL=OFF ^
|
||||
-DENABLE_HASHLIB=OFF ^
|
||||
-DENABLE_MD5=OFF ^
|
||||
-DENABLE_SHA=OFF ^
|
||||
-DENABLE_SHA256=OFF ^
|
||||
-DENABLE_SHA512=OFF ^
|
||||
-B %~dp0/ci/build_python ^
|
||||
-S %~dp0/ci/python-cmake-buildsystem && ^
|
||||
cmake.exe --build %~dp0/ci/build_python --config Release --clean-first -- /m && ^
|
||||
cmake.exe --build %~dp0/ci/build_python --config Release --target INSTALL
|
|
@ -0,0 +1,12 @@
|
|||
rem Assume Python is built with `ci-build-python-lib.bat`
|
||||
rem
|
||||
|
||||
rmdir /s /q build
|
||||
mkdir build
|
||||
|
||||
cmake -G "Visual Studio 17 2022" -A x64 ^
|
||||
-DTINYUSDZ_WITH_OPENSUBDIV=On ^
|
||||
-DTINYUSDZ_WITH_PYTHON=1 ^
|
||||
-DTINYUSDZ_PREFER_LOCAL_PYTHON_INSTALLATION=1 ^
|
||||
-DPython3_EXECUTABLE=%~dp0/ci/dist/python/Scripts/python.exe ^
|
||||
-Bbuild -S.
|
|
@ -0,0 +1,9 @@
|
|||
# macOS paths usually start with /Users/*. Unfortunately, clang-cl interprets
|
||||
# paths starting with /U as macro undefines, so we need to put a -- before the
|
||||
# input file path to force it to be treated as a path. CMake's compilation rules
|
||||
# should be tweaked accordingly, but until that's done, and to support older
|
||||
# CMake versions, overriding compilation rules works well enough. This file will
|
||||
# be included by cmake after the default compilation rules have already been set
|
||||
# up, so we can just modify them instead of duplicating them entirely.
|
||||
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_C_COMPILE_OBJECT "${CMAKE_C_COMPILE_OBJECT}")
|
||||
string(REPLACE "-c <SOURCE>" "-c -- <SOURCE>" CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT}")
|
|
@ -0,0 +1,14 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
set(CMAKE_C_COMPILER_TARGET aarch64-linux-gnu)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu/)
|
||||
|
||||
# Sync with GitHub Actions config
|
||||
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
|
||||
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
@ -0,0 +1,327 @@
|
|||
# From llvm/cmake/platforms/WinMsvc.cmake
|
||||
# Modified to use clang-cl on native Windows.
|
||||
|
||||
# Cross toolchain configuration for using clang-cl on non-Windows hosts to
|
||||
# target MSVC.
|
||||
#
|
||||
# Usage:
|
||||
# cmake -G Ninja
|
||||
# -DCMAKE_TOOLCHAIN_FILE=/path/to/this/file
|
||||
# -DHOST_ARCH=[aarch64|arm64|armv7|arm|i686|x86|x86_64|x64]
|
||||
# -DLLVM_NATIVE_TOOLCHAIN=/path/to/llvm/installation
|
||||
# -DMSVC_BASE=/path/to/MSVC/system/libraries/and/includes
|
||||
# -DWINSDK_BASE=/path/to/windows-sdk
|
||||
# -DWINSDK_VER=windows sdk version folder name
|
||||
#
|
||||
# HOST_ARCH:
|
||||
# The architecture to build for.
|
||||
#
|
||||
# LLVM_NATIVE_TOOLCHAIN:
|
||||
# *Absolute path* to a folder containing the toolchain which will be used to
|
||||
# build. At a minimum, this folder should have a bin directory with a
|
||||
# copy of clang-cl, clang, clang++, and lld-link, as well as a lib directory
|
||||
# containing clang's system resource directory.
|
||||
#
|
||||
# MSVC_BASE:
|
||||
# *Absolute path* to the folder containing MSVC headers and system libraries.
|
||||
# The layout of the folder matches that which is intalled by MSVC 2017 on
|
||||
# Windows, and should look like this:
|
||||
#
|
||||
# ${MSVC_BASE}
|
||||
# include
|
||||
# vector
|
||||
# stdint.h
|
||||
# etc...
|
||||
# lib
|
||||
# x64
|
||||
# libcmt.lib
|
||||
# msvcrt.lib
|
||||
# etc...
|
||||
# x86
|
||||
# libcmt.lib
|
||||
# msvcrt.lib
|
||||
# etc...
|
||||
#
|
||||
# For versions of MSVC < 2017, or where you have a hermetic toolchain in a
|
||||
# custom format, you must use symlinks or restructure it to look like the above.
|
||||
#
|
||||
# WINSDK_BASE:
|
||||
# Together with WINSDK_VER, determines the location of Windows SDK headers
|
||||
# and libraries.
|
||||
#
|
||||
# WINSDK_VER:
|
||||
# Together with WINSDK_BASE, determines the locations of Windows SDK headers
|
||||
# and libraries.
|
||||
#
|
||||
# WINSDK_BASE and WINSDK_VER work together to define a folder layout that matches
|
||||
# that of the Windows SDK installation on a standard Windows machine. It should
|
||||
# match the layout described below.
|
||||
#
|
||||
# Note that if you install Windows SDK to a windows machine and simply copy the
|
||||
# files, it will already be in the correct layout.
|
||||
#
|
||||
# ${WINSDK_BASE}
|
||||
# Include
|
||||
# ${WINSDK_VER}
|
||||
# shared
|
||||
# ucrt
|
||||
# um
|
||||
# windows.h
|
||||
# etc...
|
||||
# Lib
|
||||
# ${WINSDK_VER}
|
||||
# ucrt
|
||||
# x64
|
||||
# x86
|
||||
# ucrt.lib
|
||||
# etc...
|
||||
# um
|
||||
# x64
|
||||
# x86
|
||||
# kernel32.lib
|
||||
# etc
|
||||
#
|
||||
# IMPORTANT: In order for this to work, you will need a valid copy of the Windows
|
||||
# SDK and C++ STL headers and libraries on your host. Additionally, since the
|
||||
# Windows libraries and headers are not case-correct, this toolchain file sets
|
||||
# up a VFS overlay for the SDK headers and case-correcting symlinks for the
|
||||
# libraries when running on a case-sensitive filesystem.
|
||||
|
||||
|
||||
# When configuring CMake with a toolchain file against a top-level CMakeLists.txt,
|
||||
# it will actually run CMake many times, once for each small test program used to
|
||||
# determine what features a compiler supports. Unfortunately, none of these
|
||||
# invocations share a CMakeCache.txt with the top-level invocation, meaning they
|
||||
# won't see the value of any arguments the user passed via -D. Since these are
|
||||
# necessary to properly configure MSVC in both the top-level configuration as well as
|
||||
# all feature-test invocations, we set environment variables with the values so that
|
||||
# these environments get inherited by child invocations. We can switch to
|
||||
# CMAKE_TRY_COMPILE_PLATFORM_VARIABLES once our minimum supported CMake version
|
||||
# is 3.6 or greater.
|
||||
function(init_user_prop prop)
|
||||
if(${prop})
|
||||
set(ENV{_${prop}} "${${prop}}")
|
||||
else()
|
||||
set(${prop} "$ENV{_${prop}}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(generate_winsdk_vfs_overlay winsdk_include_dir output_path)
|
||||
set(include_dirs)
|
||||
file(GLOB_RECURSE entries LIST_DIRECTORIES true "${winsdk_include_dir}/*")
|
||||
foreach(entry ${entries})
|
||||
if(IS_DIRECTORY "${entry}")
|
||||
list(APPEND include_dirs "${entry}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(WRITE "${output_path}" "version: 0\n")
|
||||
file(APPEND "${output_path}" "case-sensitive: false\n")
|
||||
file(APPEND "${output_path}" "roots:\n")
|
||||
|
||||
foreach(dir ${include_dirs})
|
||||
file(GLOB headers RELATIVE "${dir}" "${dir}/*.h")
|
||||
if(NOT headers)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
file(APPEND "${output_path}" " - name: \"${dir}\"\n")
|
||||
file(APPEND "${output_path}" " type: directory\n")
|
||||
file(APPEND "${output_path}" " contents:\n")
|
||||
|
||||
foreach(header ${headers})
|
||||
file(APPEND "${output_path}" " - name: \"${header}\"\n")
|
||||
file(APPEND "${output_path}" " type: file\n")
|
||||
file(APPEND "${output_path}" " external-contents: \"${dir}/${header}\"\n")
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(generate_winsdk_lib_symlinks winsdk_um_lib_dir output_dir)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${output_dir}")
|
||||
file(GLOB libraries RELATIVE "${winsdk_um_lib_dir}" "${winsdk_um_lib_dir}/*")
|
||||
foreach(library ${libraries})
|
||||
string(TOLOWER "${library}" all_lowercase_symlink_name)
|
||||
if(NOT library STREQUAL all_lowercase_symlink_name)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||
-E create_symlink
|
||||
"${winsdk_um_lib_dir}/${library}"
|
||||
"${output_dir}/${all_lowercase_symlink_name}")
|
||||
endif()
|
||||
|
||||
get_filename_component(name_we "${library}" NAME_WE)
|
||||
get_filename_component(ext "${library}" EXT)
|
||||
string(TOLOWER "${ext}" lowercase_ext)
|
||||
set(lowercase_ext_symlink_name "${name_we}${lowercase_ext}")
|
||||
if(NOT library STREQUAL lowercase_ext_symlink_name AND
|
||||
NOT all_lowercase_symlink_name STREQUAL lowercase_ext_symlink_name)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||
-E create_symlink
|
||||
"${winsdk_um_lib_dir}/${library}"
|
||||
"${output_dir}/${lowercase_ext_symlink_name}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_VERSION 10.0)
|
||||
set(CMAKE_SYSTEM_PROCESSOR AMD64)
|
||||
|
||||
init_user_prop(HOST_ARCH)
|
||||
init_user_prop(LLVM_NATIVE_TOOLCHAIN)
|
||||
init_user_prop(MSVC_BASE)
|
||||
init_user_prop(WINSDK_BASE)
|
||||
init_user_prop(WINSDK_VER)
|
||||
|
||||
if(NOT HOST_ARCH)
|
||||
set(HOST_ARCH x86_64)
|
||||
endif()
|
||||
if(HOST_ARCH STREQUAL "aarch64" OR HOST_ARCH STREQUAL "arm64")
|
||||
set(TRIPLE_ARCH "aarch64")
|
||||
set(WINSDK_ARCH "arm64")
|
||||
elseif(HOST_ARCH STREQUAL "armv7" OR HOST_ARCH STREQUAL "arm")
|
||||
set(TRIPLE_ARCH "armv7")
|
||||
set(WINSDK_ARCH "arm")
|
||||
elseif(HOST_ARCH STREQUAL "i686" OR HOST_ARCH STREQUAL "x86")
|
||||
set(TRIPLE_ARCH "i686")
|
||||
set(WINSDK_ARCH "x86")
|
||||
elseif(HOST_ARCH STREQUAL "x86_64" OR HOST_ARCH STREQUAL "x64")
|
||||
set(TRIPLE_ARCH "x86_64")
|
||||
set(WINSDK_ARCH "x64")
|
||||
else()
|
||||
message(SEND_ERROR "Unknown host architecture ${HOST_ARCH}. Must be aarch64 (or arm64), armv7 (or arm), i686 (or x86), or x86_64 (or x64).")
|
||||
endif()
|
||||
|
||||
set(MSVC_INCLUDE "${MSVC_BASE}/include")
|
||||
set(ATLMFC_INCLUDE "${MSVC_BASE}/atlmfc/include")
|
||||
set(MSVC_LIB "${MSVC_BASE}/lib")
|
||||
set(ATLMFC_LIB "${MSVC_BASE}/atlmfc/lib")
|
||||
set(WINSDK_INCLUDE "${WINSDK_BASE}/Include/${WINSDK_VER}")
|
||||
set(WINSDK_LIB "${WINSDK_BASE}/Lib/${WINSDK_VER}")
|
||||
|
||||
# Do some sanity checking to make sure we can find a native toolchain and
|
||||
# that the Windows SDK / MSVC STL directories look kosher.
|
||||
if(NOT EXISTS "${LLVM_NATIVE_TOOLCHAIN}/bin/clang-cl.exe" OR
|
||||
NOT EXISTS "${LLVM_NATIVE_TOOLCHAIN}/bin/lld-link.exe")
|
||||
message(SEND_ERROR
|
||||
"LLVM_NATIVE_TOOLCHAIN folder '${LLVM_NATIVE_TOOLCHAIN}' does not "
|
||||
"point to a valid directory containing bin/clang-cl.exe and bin/lld-link.exe "
|
||||
"binaries")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${MSVC_BASE}" OR
|
||||
NOT EXISTS "${MSVC_INCLUDE}" OR
|
||||
NOT EXISTS "${MSVC_LIB}")
|
||||
message(SEND_ERROR
|
||||
"CMake variable MSVC_BASE must point to a folder containing MSVC "
|
||||
"system headers and libraries")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${WINSDK_BASE}" OR
|
||||
NOT EXISTS "${WINSDK_INCLUDE}" OR
|
||||
NOT EXISTS "${WINSDK_LIB}")
|
||||
message(SEND_ERROR
|
||||
"CMake variable WINSDK_BASE and WINSDK_VER must resolve to a valid "
|
||||
"Windows SDK installation")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${WINSDK_INCLUDE}/um/Windows.h")
|
||||
message(SEND_ERROR "Cannot find Windows.h")
|
||||
endif()
|
||||
if(NOT EXISTS "${WINSDK_INCLUDE}/um/WINDOWS.H")
|
||||
set(case_sensitive_filesystem TRUE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER "${LLVM_NATIVE_TOOLCHAIN}/bin/clang-cl.exe" CACHE FILEPATH "")
|
||||
set(CMAKE_CXX_COMPILER "${LLVM_NATIVE_TOOLCHAIN}/bin/clang-cl.exe" CACHE FILEPATH "")
|
||||
set(CMAKE_LINKER "${LLVM_NATIVE_TOOLCHAIN}/bin/lld-link.exe" CACHE FILEPATH "")
|
||||
|
||||
# Even though we're cross-compiling, we need some native tools (e.g. llvm-tblgen), and those
|
||||
# native tools have to be built before we can start doing the cross-build. LLVM supports
|
||||
# a CROSS_TOOLCHAIN_FLAGS_NATIVE argument which consists of a list of flags to pass to CMake
|
||||
# when configuring the NATIVE portion of the cross-build. By default we construct this so
|
||||
# that it points to the tools in the same location as the native clang-cl that we're using.
|
||||
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_ASM_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang")
|
||||
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_C_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang")
|
||||
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_CXX_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang++")
|
||||
|
||||
set(CROSS_TOOLCHAIN_FLAGS_NATIVE "${_CTF_NATIVE_DEFAULT}" CACHE STRING "")
|
||||
|
||||
set(COMPILE_FLAGS
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
--target=${TRIPLE_ARCH}-windows-msvc
|
||||
-fms-compatibility-version=19.11
|
||||
-imsvc "\"${ATLMFC_INCLUDE}\""
|
||||
-imsvc "\"${MSVC_INCLUDE}\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/ucrt\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/shared\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/um\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/winrt\"")
|
||||
|
||||
if(case_sensitive_filesystem)
|
||||
# Ensure all sub-configures use the top-level VFS overlay instead of generating their own.
|
||||
init_user_prop(winsdk_vfs_overlay_path)
|
||||
if(NOT winsdk_vfs_overlay_path)
|
||||
set(winsdk_vfs_overlay_path "${CMAKE_BINARY_DIR}/winsdk_vfs_overlay.yaml")
|
||||
generate_winsdk_vfs_overlay("${WINSDK_BASE}/Include/${WINSDK_VER}" "${winsdk_vfs_overlay_path}")
|
||||
init_user_prop(winsdk_vfs_overlay_path)
|
||||
endif()
|
||||
list(APPEND COMPILE_FLAGS
|
||||
-Xclang -ivfsoverlay -Xclang "${winsdk_vfs_overlay_path}")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " COMPILE_FLAGS "${COMPILE_FLAGS}")
|
||||
|
||||
# We need to preserve any flags that were passed in by the user. However, we
|
||||
# can't append to CMAKE_C_FLAGS and friends directly, because toolchain files
|
||||
# will be re-invoked on each reconfigure and therefore need to be idempotent.
|
||||
# The assignments to the _INITIAL cache variables don't use FORCE, so they'll
|
||||
# only be populated on the initial configure, and their values won't change
|
||||
# afterward.
|
||||
set(_CMAKE_C_FLAGS_INITIAL "${CMAKE_C_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_C_FLAGS "${_CMAKE_C_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(_CMAKE_CXX_FLAGS_INITIAL "${CMAKE_CXX_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(LINK_FLAGS
|
||||
# Prevent CMake from attempting to invoke mt.exe. It only recognizes the slashed form and not the dashed form.
|
||||
/manifest:no
|
||||
|
||||
-libpath:"${ATLMFC_LIB}/${WINSDK_ARCH}"
|
||||
-libpath:"${MSVC_LIB}/${WINSDK_ARCH}"
|
||||
-libpath:"${WINSDK_LIB}/ucrt/${WINSDK_ARCH}"
|
||||
-libpath:"${WINSDK_LIB}/um/${WINSDK_ARCH}")
|
||||
|
||||
if(case_sensitive_filesystem)
|
||||
# Ensure all sub-configures use the top-level symlinks dir instead of generating their own.
|
||||
init_user_prop(winsdk_lib_symlinks_dir)
|
||||
if(NOT winsdk_lib_symlinks_dir)
|
||||
set(winsdk_lib_symlinks_dir "${CMAKE_BINARY_DIR}/winsdk_lib_symlinks")
|
||||
generate_winsdk_lib_symlinks("${WINSDK_BASE}/Lib/${WINSDK_VER}/um/${WINSDK_ARCH}" "${winsdk_lib_symlinks_dir}")
|
||||
init_user_prop(winsdk_lib_symlinks_dir)
|
||||
endif()
|
||||
list(APPEND LINK_FLAGS
|
||||
-libpath:"${winsdk_lib_symlinks_dir}")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " LINK_FLAGS "${LINK_FLAGS}")
|
||||
|
||||
# See explanation for compiler flags above for the _INITIAL variables.
|
||||
set(_CMAKE_EXE_LINKER_FLAGS_INITIAL "${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${_CMAKE_EXE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(_CMAKE_MODULE_LINKER_FLAGS_INITIAL "${CMAKE_MODULE_LINKER_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${_CMAKE_MODULE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(_CMAKE_SHARED_LINKER_FLAGS_INITIAL "${CMAKE_SHARED_LINKER_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${_CMAKE_SHARED_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
# CMake populates these with a bunch of unnecessary libraries, which requires
|
||||
# extra case-correcting symlinks and what not. Instead, let projects explicitly
|
||||
# control which libraries they require.
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
||||
|
||||
# Allow clang-cl to work with macOS paths.
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/ClangClCMakeCompileRules.cmake")
|
|
@ -0,0 +1,327 @@
|
|||
# From llvm/cmake/platforms/WinMsvc.cmake
|
||||
# Modified to use clang-cl on native Windows.
|
||||
|
||||
# Cross toolchain configuration for using clang-cl on non-Windows hosts to
|
||||
# target MSVC.
|
||||
#
|
||||
# Usage:
|
||||
# cmake -G Ninja
|
||||
# -DCMAKE_TOOLCHAIN_FILE=/path/to/this/file
|
||||
# -DHOST_ARCH=[aarch64|arm64|armv7|arm|i686|x86|x86_64|x64]
|
||||
# -DLLVM_NATIVE_TOOLCHAIN=/path/to/llvm/installation
|
||||
# -DMSVC_BASE=/path/to/MSVC/system/libraries/and/includes
|
||||
# -DWINSDK_BASE=/path/to/windows-sdk
|
||||
# -DWINSDK_VER=windows sdk version folder name
|
||||
#
|
||||
# HOST_ARCH:
|
||||
# The architecture to build for.
|
||||
#
|
||||
# LLVM_NATIVE_TOOLCHAIN:
|
||||
# *Absolute path* to a folder containing the toolchain which will be used to
|
||||
# build. At a minimum, this folder should have a bin directory with a
|
||||
# copy of clang-cl, clang, clang++, and lld-link, as well as a lib directory
|
||||
# containing clang's system resource directory.
|
||||
#
|
||||
# MSVC_BASE:
|
||||
# *Absolute path* to the folder containing MSVC headers and system libraries.
|
||||
# The layout of the folder matches that which is intalled by MSVC 2017 on
|
||||
# Windows, and should look like this:
|
||||
#
|
||||
# ${MSVC_BASE}
|
||||
# include
|
||||
# vector
|
||||
# stdint.h
|
||||
# etc...
|
||||
# lib
|
||||
# x64
|
||||
# libcmt.lib
|
||||
# msvcrt.lib
|
||||
# etc...
|
||||
# x86
|
||||
# libcmt.lib
|
||||
# msvcrt.lib
|
||||
# etc...
|
||||
#
|
||||
# For versions of MSVC < 2017, or where you have a hermetic toolchain in a
|
||||
# custom format, you must use symlinks or restructure it to look like the above.
|
||||
#
|
||||
# WINSDK_BASE:
|
||||
# Together with WINSDK_VER, determines the location of Windows SDK headers
|
||||
# and libraries.
|
||||
#
|
||||
# WINSDK_VER:
|
||||
# Together with WINSDK_BASE, determines the locations of Windows SDK headers
|
||||
# and libraries.
|
||||
#
|
||||
# WINSDK_BASE and WINSDK_VER work together to define a folder layout that matches
|
||||
# that of the Windows SDK installation on a standard Windows machine. It should
|
||||
# match the layout described below.
|
||||
#
|
||||
# Note that if you install Windows SDK to a windows machine and simply copy the
|
||||
# files, it will already be in the correct layout.
|
||||
#
|
||||
# ${WINSDK_BASE}
|
||||
# Include
|
||||
# ${WINSDK_VER}
|
||||
# shared
|
||||
# ucrt
|
||||
# um
|
||||
# windows.h
|
||||
# etc...
|
||||
# Lib
|
||||
# ${WINSDK_VER}
|
||||
# ucrt
|
||||
# x64
|
||||
# x86
|
||||
# ucrt.lib
|
||||
# etc...
|
||||
# um
|
||||
# x64
|
||||
# x86
|
||||
# kernel32.lib
|
||||
# etc
|
||||
#
|
||||
# IMPORTANT: In order for this to work, you will need a valid copy of the Windows
|
||||
# SDK and C++ STL headers and libraries on your host. Additionally, since the
|
||||
# Windows libraries and headers are not case-correct, this toolchain file sets
|
||||
# up a VFS overlay for the SDK headers and case-correcting symlinks for the
|
||||
# libraries when running on a case-sensitive filesystem.
|
||||
|
||||
|
||||
# When configuring CMake with a toolchain file against a top-level CMakeLists.txt,
|
||||
# it will actually run CMake many times, once for each small test program used to
|
||||
# determine what features a compiler supports. Unfortunately, none of these
|
||||
# invocations share a CMakeCache.txt with the top-level invocation, meaning they
|
||||
# won't see the value of any arguments the user passed via -D. Since these are
|
||||
# necessary to properly configure MSVC in both the top-level configuration as well as
|
||||
# all feature-test invocations, we set environment variables with the values so that
|
||||
# these environments get inherited by child invocations. We can switch to
|
||||
# CMAKE_TRY_COMPILE_PLATFORM_VARIABLES once our minimum supported CMake version
|
||||
# is 3.6 or greater.
|
||||
function(init_user_prop prop)
|
||||
if(${prop})
|
||||
set(ENV{_${prop}} "${${prop}}")
|
||||
else()
|
||||
set(${prop} "$ENV{_${prop}}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(generate_winsdk_vfs_overlay winsdk_include_dir output_path)
|
||||
set(include_dirs)
|
||||
file(GLOB_RECURSE entries LIST_DIRECTORIES true "${winsdk_include_dir}/*")
|
||||
foreach(entry ${entries})
|
||||
if(IS_DIRECTORY "${entry}")
|
||||
list(APPEND include_dirs "${entry}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(WRITE "${output_path}" "version: 0\n")
|
||||
file(APPEND "${output_path}" "case-sensitive: false\n")
|
||||
file(APPEND "${output_path}" "roots:\n")
|
||||
|
||||
foreach(dir ${include_dirs})
|
||||
file(GLOB headers RELATIVE "${dir}" "${dir}/*.h")
|
||||
if(NOT headers)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
file(APPEND "${output_path}" " - name: \"${dir}\"\n")
|
||||
file(APPEND "${output_path}" " type: directory\n")
|
||||
file(APPEND "${output_path}" " contents:\n")
|
||||
|
||||
foreach(header ${headers})
|
||||
file(APPEND "${output_path}" " - name: \"${header}\"\n")
|
||||
file(APPEND "${output_path}" " type: file\n")
|
||||
file(APPEND "${output_path}" " external-contents: \"${dir}/${header}\"\n")
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(generate_winsdk_lib_symlinks winsdk_um_lib_dir output_dir)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${output_dir}")
|
||||
file(GLOB libraries RELATIVE "${winsdk_um_lib_dir}" "${winsdk_um_lib_dir}/*")
|
||||
foreach(library ${libraries})
|
||||
string(TOLOWER "${library}" all_lowercase_symlink_name)
|
||||
if(NOT library STREQUAL all_lowercase_symlink_name)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||
-E create_symlink
|
||||
"${winsdk_um_lib_dir}/${library}"
|
||||
"${output_dir}/${all_lowercase_symlink_name}")
|
||||
endif()
|
||||
|
||||
get_filename_component(name_we "${library}" NAME_WE)
|
||||
get_filename_component(ext "${library}" EXT)
|
||||
string(TOLOWER "${ext}" lowercase_ext)
|
||||
set(lowercase_ext_symlink_name "${name_we}${lowercase_ext}")
|
||||
if(NOT library STREQUAL lowercase_ext_symlink_name AND
|
||||
NOT all_lowercase_symlink_name STREQUAL lowercase_ext_symlink_name)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||
-E create_symlink
|
||||
"${winsdk_um_lib_dir}/${library}"
|
||||
"${output_dir}/${lowercase_ext_symlink_name}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_VERSION 10.0)
|
||||
set(CMAKE_SYSTEM_PROCESSOR AMD64)
|
||||
|
||||
init_user_prop(HOST_ARCH)
|
||||
init_user_prop(LLVM_NATIVE_TOOLCHAIN)
|
||||
init_user_prop(MSVC_BASE)
|
||||
init_user_prop(WINSDK_BASE)
|
||||
init_user_prop(WINSDK_VER)
|
||||
|
||||
if(NOT HOST_ARCH)
|
||||
set(HOST_ARCH x86_64)
|
||||
endif()
|
||||
if(HOST_ARCH STREQUAL "aarch64" OR HOST_ARCH STREQUAL "arm64")
|
||||
set(TRIPLE_ARCH "aarch64")
|
||||
set(WINSDK_ARCH "arm64")
|
||||
elseif(HOST_ARCH STREQUAL "armv7" OR HOST_ARCH STREQUAL "arm")
|
||||
set(TRIPLE_ARCH "armv7")
|
||||
set(WINSDK_ARCH "arm")
|
||||
elseif(HOST_ARCH STREQUAL "i686" OR HOST_ARCH STREQUAL "x86")
|
||||
set(TRIPLE_ARCH "i686")
|
||||
set(WINSDK_ARCH "x86")
|
||||
elseif(HOST_ARCH STREQUAL "x86_64" OR HOST_ARCH STREQUAL "x64")
|
||||
set(TRIPLE_ARCH "x86_64")
|
||||
set(WINSDK_ARCH "x64")
|
||||
else()
|
||||
message(SEND_ERROR "Unknown host architecture ${HOST_ARCH}. Must be aarch64 (or arm64), armv7 (or arm), i686 (or x86), or x86_64 (or x64).")
|
||||
endif()
|
||||
|
||||
set(MSVC_INCLUDE "${MSVC_BASE}/include")
|
||||
set(ATLMFC_INCLUDE "${MSVC_BASE}/atlmfc/include")
|
||||
set(MSVC_LIB "${MSVC_BASE}/lib")
|
||||
set(ATLMFC_LIB "${MSVC_BASE}/atlmfc/lib")
|
||||
set(WINSDK_INCLUDE "${WINSDK_BASE}/Include/${WINSDK_VER}")
|
||||
set(WINSDK_LIB "${WINSDK_BASE}/Lib/${WINSDK_VER}")
|
||||
|
||||
# Do some sanity checking to make sure we can find a native toolchain and
|
||||
# that the Windows SDK / MSVC STL directories look kosher.
|
||||
if(NOT EXISTS "${LLVM_NATIVE_TOOLCHAIN}/bin/clang-cl" OR
|
||||
NOT EXISTS "${LLVM_NATIVE_TOOLCHAIN}/bin/lld-link")
|
||||
message(SEND_ERROR
|
||||
"LLVM_NATIVE_TOOLCHAIN folder '${LLVM_NATIVE_TOOLCHAIN}' does not "
|
||||
"point to a valid directory containing bin/clang-cl and bin/lld-link "
|
||||
"binaries")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${MSVC_BASE}" OR
|
||||
NOT EXISTS "${MSVC_INCLUDE}" OR
|
||||
NOT EXISTS "${MSVC_LIB}")
|
||||
message(SEND_ERROR
|
||||
"CMake variable MSVC_BASE must point to a folder containing MSVC "
|
||||
"system headers and libraries")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${WINSDK_BASE}" OR
|
||||
NOT EXISTS "${WINSDK_INCLUDE}" OR
|
||||
NOT EXISTS "${WINSDK_LIB}")
|
||||
message(SEND_ERROR
|
||||
"CMake variable WINSDK_BASE and WINSDK_VER must resolve to a valid "
|
||||
"Windows SDK installation")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${WINSDK_INCLUDE}/um/Windows.h")
|
||||
message(SEND_ERROR "Cannot find Windows.h")
|
||||
endif()
|
||||
if(NOT EXISTS "${WINSDK_INCLUDE}/um/WINDOWS.H")
|
||||
set(case_sensitive_filesystem TRUE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER "${LLVM_NATIVE_TOOLCHAIN}/bin/clang-cl" CACHE FILEPATH "")
|
||||
set(CMAKE_CXX_COMPILER "${LLVM_NATIVE_TOOLCHAIN}/bin/clang-cl" CACHE FILEPATH "")
|
||||
set(CMAKE_LINKER "${LLVM_NATIVE_TOOLCHAIN}/bin/lld-link" CACHE FILEPATH "")
|
||||
|
||||
# Even though we're cross-compiling, we need some native tools (e.g. llvm-tblgen), and those
|
||||
# native tools have to be built before we can start doing the cross-build. LLVM supports
|
||||
# a CROSS_TOOLCHAIN_FLAGS_NATIVE argument which consists of a list of flags to pass to CMake
|
||||
# when configuring the NATIVE portion of the cross-build. By default we construct this so
|
||||
# that it points to the tools in the same location as the native clang-cl that we're using.
|
||||
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_ASM_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang")
|
||||
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_C_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang")
|
||||
list(APPEND _CTF_NATIVE_DEFAULT "-DCMAKE_CXX_COMPILER=${LLVM_NATIVE_TOOLCHAIN}/bin/clang++")
|
||||
|
||||
set(CROSS_TOOLCHAIN_FLAGS_NATIVE "${_CTF_NATIVE_DEFAULT}" CACHE STRING "")
|
||||
|
||||
set(COMPILE_FLAGS
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
--target=${TRIPLE_ARCH}-windows-msvc
|
||||
-fms-compatibility-version=19.11
|
||||
-imsvc "\"${ATLMFC_INCLUDE}\""
|
||||
-imsvc "\"${MSVC_INCLUDE}\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/ucrt\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/shared\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/um\""
|
||||
-imsvc "\"${WINSDK_INCLUDE}/winrt\"")
|
||||
|
||||
if(case_sensitive_filesystem)
|
||||
# Ensure all sub-configures use the top-level VFS overlay instead of generating their own.
|
||||
init_user_prop(winsdk_vfs_overlay_path)
|
||||
if(NOT winsdk_vfs_overlay_path)
|
||||
set(winsdk_vfs_overlay_path "${CMAKE_BINARY_DIR}/winsdk_vfs_overlay.yaml")
|
||||
generate_winsdk_vfs_overlay("${WINSDK_BASE}/Include/${WINSDK_VER}" "${winsdk_vfs_overlay_path}")
|
||||
init_user_prop(winsdk_vfs_overlay_path)
|
||||
endif()
|
||||
list(APPEND COMPILE_FLAGS
|
||||
-Xclang -ivfsoverlay -Xclang "${winsdk_vfs_overlay_path}")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " COMPILE_FLAGS "${COMPILE_FLAGS}")
|
||||
|
||||
# We need to preserve any flags that were passed in by the user. However, we
|
||||
# can't append to CMAKE_C_FLAGS and friends directly, because toolchain files
|
||||
# will be re-invoked on each reconfigure and therefore need to be idempotent.
|
||||
# The assignments to the _INITIAL cache variables don't use FORCE, so they'll
|
||||
# only be populated on the initial configure, and their values won't change
|
||||
# afterward.
|
||||
set(_CMAKE_C_FLAGS_INITIAL "${CMAKE_C_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_C_FLAGS "${_CMAKE_C_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(_CMAKE_CXX_FLAGS_INITIAL "${CMAKE_CXX_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_CXX_FLAGS "${_CMAKE_CXX_FLAGS_INITIAL} ${COMPILE_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(LINK_FLAGS
|
||||
# Prevent CMake from attempting to invoke mt.exe. It only recognizes the slashed form and not the dashed form.
|
||||
/manifest:no
|
||||
|
||||
-libpath:"${ATLMFC_LIB}/${WINSDK_ARCH}"
|
||||
-libpath:"${MSVC_LIB}/${WINSDK_ARCH}"
|
||||
-libpath:"${WINSDK_LIB}/ucrt/${WINSDK_ARCH}"
|
||||
-libpath:"${WINSDK_LIB}/um/${WINSDK_ARCH}")
|
||||
|
||||
if(case_sensitive_filesystem)
|
||||
# Ensure all sub-configures use the top-level symlinks dir instead of generating their own.
|
||||
init_user_prop(winsdk_lib_symlinks_dir)
|
||||
if(NOT winsdk_lib_symlinks_dir)
|
||||
set(winsdk_lib_symlinks_dir "${CMAKE_BINARY_DIR}/winsdk_lib_symlinks")
|
||||
generate_winsdk_lib_symlinks("${WINSDK_BASE}/Lib/${WINSDK_VER}/um/${WINSDK_ARCH}" "${winsdk_lib_symlinks_dir}")
|
||||
init_user_prop(winsdk_lib_symlinks_dir)
|
||||
endif()
|
||||
list(APPEND LINK_FLAGS
|
||||
-libpath:"${winsdk_lib_symlinks_dir}")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " LINK_FLAGS "${LINK_FLAGS}")
|
||||
|
||||
# See explanation for compiler flags above for the _INITIAL variables.
|
||||
set(_CMAKE_EXE_LINKER_FLAGS_INITIAL "${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${_CMAKE_EXE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(_CMAKE_MODULE_LINKER_FLAGS_INITIAL "${CMAKE_MODULE_LINKER_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${_CMAKE_MODULE_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
set(_CMAKE_SHARED_LINKER_FLAGS_INITIAL "${CMAKE_SHARED_LINKER_FLAGS}" CACHE STRING "")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${_CMAKE_SHARED_LINKER_FLAGS_INITIAL} ${LINK_FLAGS}" CACHE STRING "" FORCE)
|
||||
|
||||
# CMake populates these with a bunch of unnecessary libraries, which requires
|
||||
# extra case-correcting symlinks and what not. Instead, let projects explicitly
|
||||
# control which libraries they require.
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
||||
|
||||
# Allow clang-cl to work with macOS paths.
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/ClangClCMakeCompileRules.cmake")
|
|
@ -0,0 +1,105 @@
|
|||
# Toolchain config for iOS.
|
||||
#
|
||||
# Usage:
|
||||
# mkdir build; cd build
|
||||
# cmake ..; make
|
||||
# mkdir ios; cd ios
|
||||
# cmake -DLLVM_IOS_TOOLCHAIN_DIR=/path/to/ios/ndk \
|
||||
# -DCMAKE_TOOLCHAIN_FILE=../../cmake/platforms/iOS.cmake ../..
|
||||
# make <target>
|
||||
|
||||
# Original source:
|
||||
# https://opensource.apple.com/source/clang/clang-800.0.42.1/src/cmake/platforms/iOS.cmake
|
||||
# Extensions according to:
|
||||
# https://github.com/google/filament/
|
||||
|
||||
SET(CMAKE_SYSTEM_NAME Darwin)
|
||||
SET(CMAKE_SYSTEM_VERSION 13)
|
||||
SET(CMAKE_CXX_COMPILER_WORKS True)
|
||||
SET(CMAKE_C_COMPILER_WORKS True)
|
||||
SET(DARWIN_TARGET_OS_NAME ios)
|
||||
|
||||
SET(PLATFORM_NAME iphoneos CACHE STRING "iOS platform to build for")
|
||||
SET(PLATFORM_FLAG_NAME ios)
|
||||
|
||||
IF("$ENV{RC_APPLETV}" STREQUAL "YES")
|
||||
MESSAGE(STATUS "Building for tvos")
|
||||
STRING(TOLOWER $ENV{RC_APPLETV_PLATFORM_NAME} PLATFORM_NAME)
|
||||
SET(PLATFORM_FLAG_NAME tvos)
|
||||
ENDIF()
|
||||
|
||||
IF("$ENV{RC_WATCH}" STREQUAL "YES")
|
||||
MESSAGE(STATUS "Building for watchos")
|
||||
STRING(TOLOWER $ENV{RC_WATCH_PLATFORM_NAME} PLATFORM_NAME)
|
||||
STRING(TOLOWER $ENV{RC_WATCH_PLATFORM_NAME} PLATFORM_FLAG_NAME)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT DEFINED ENV{SDKROOT})
|
||||
execute_process(COMMAND xcodebuild -version -sdk ${PLATFORM_NAME} Path
|
||||
OUTPUT_VARIABLE SDKROOT
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
ELSE()
|
||||
execute_process(COMMAND xcodebuild -version -sdk $ENV{SDKROOT} Path
|
||||
OUTPUT_VARIABLE SDKROOT
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT EXISTS ${SDKROOT})
|
||||
MESSAGE(FATAL_ERROR "SDKROOT could not be detected!")
|
||||
ENDIF()
|
||||
|
||||
set(CMAKE_OSX_SYSROOT ${SDKROOT})
|
||||
|
||||
IF(NOT CMAKE_C_COMPILER)
|
||||
execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang
|
||||
OUTPUT_VARIABLE CMAKE_C_COMPILER
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Using c compiler ${CMAKE_C_COMPILER}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT CMAKE_CXX_COMPILER)
|
||||
execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang++
|
||||
OUTPUT_VARIABLE CMAKE_CXX_COMPILER
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Using c compiler ${CMAKE_CXX_COMPILER}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT CMAKE_AR)
|
||||
execute_process(COMMAND xcrun -sdk ${SDKROOT} -find ar
|
||||
OUTPUT_VARIABLE CMAKE_AR_val
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
SET(CMAKE_AR ${CMAKE_AR_val} CACHE FILEPATH "Archiver")
|
||||
message(STATUS "Using ar ${CMAKE_AR}")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT CMAKE_RANLIB)
|
||||
execute_process(COMMAND xcrun -sdk ${SDKROOT} -find ranlib
|
||||
OUTPUT_VARIABLE CMAKE_RANLIB_val
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
SET(CMAKE_RANLIB ${CMAKE_RANLIB_val} CACHE FILEPATH "Ranlib")
|
||||
message(STATUS "Using ranlib ${CMAKE_RANLIB}")
|
||||
ENDIF()
|
||||
|
||||
IF (NOT DEFINED IOS_MIN_TARGET)
|
||||
execute_process(COMMAND xcodebuild -sdk ${SDKROOT} -version SDKVersion
|
||||
OUTPUT_VARIABLE IOS_MIN_TARGET
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
ENDIF()
|
||||
|
||||
SET(IOS_COMMON_FLAGS "-isysroot $ENV{SDKROOT} -m${PLATFORM_FLAG_NAME}-version-min=${IOS_MIN_TARGET}")
|
||||
SET(CMAKE_C_FLAGS "${IOS_COMMON_FLAGS}" CACHE STRING "toolchain_cflags" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS "${IOS_COMMON_FLAGS}" CACHE STRING "toolchain_cxxflags" FORCE)
|
||||
SET(CMAKE_LINK_FLAGS "${IOS_COMMON_FLAGS}" CACHE STRING "toolchain_linkflags" FORCE)
|
||||
|
||||
# We make some convenience additions for consistent handling of the architecture.
|
||||
SET(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS")
|
||||
SET(DIST_ARCH ${IOS_ARCH})
|
||||
ADD_DEFINITIONS(-DIOS)
|
||||
SET(IOS TRUE)
|
|
@ -0,0 +1,17 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR "i386")
|
||||
set(CMAKE_C_COMPILER_TARGET i386-linux-gnu)
|
||||
|
||||
# Assume debian/ubuntu
|
||||
#set(CMAKE_FIND_ROOT_PATH /usr/lib/i386-linux-gnu/)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
# https://stackoverflow.com/questions/41557927/using-usr-lib-i386-linux-gnu-instead-of-usr-lib-x86-64-linux-gnu-to-find-libra
|
||||
set(FIND_LIBRARY_USE_LIB64_PATHS OFF)
|
|
@ -0,0 +1,4 @@
|
|||
# use lld with Clang
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld")
|
|
@ -0,0 +1,24 @@
|
|||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
IF (DEFINED ENV{LLVM_MINGW_DIR})
|
||||
SET(LLVM_MINGW_ROOT "$ENV{LLVM_MINGW_DIR}")
|
||||
ELSE ()
|
||||
SET(LLVM_MINGW_ROOT "/mnt/data/local/llvm-mingw-20200325-ubuntu-18.04")
|
||||
ENDIF()
|
||||
|
||||
|
||||
SET(CMAKE_C_COMPILER ${LLVM_MINGW_ROOT}/bin/x86_64-w64-mingw32-clang)
|
||||
SET(CMAKE_CXX_COMPILER ${LLVM_MINGW_ROOT}/bin/x86_64-w64-mingw32-clang++)
|
||||
SET(CMAKE_RC_COMPILER ${LLVM_MINGW_ROOT}/bin/x86_64-w64-mingw32-windres)
|
||||
|
||||
#SET(CMAKE_C_LINK_EXECUTABLE x86_64-w64-mingw32-gcc)
|
||||
#SET(CMAKE_CXX_LINK_EXECUTABLE x86_64-w64-mingw32-g++)
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LLVM_MINGW_ROOT}/x86_64-w64-mingw32)
|
||||
|
||||
# We may need some advanced thread APIs to compile, so enable 0x601(Win7) if required.
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x601")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -0,0 +1,20 @@
|
|||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
IF (DEFINED ENV{LLVM_MINGW_DIR})
|
||||
SET(LLVM_MINGW_ROOT "$ENV{LLVM_MINGW_DIR}")
|
||||
ELSE ()
|
||||
SET(LLVM_MINGW_ROOT "C:/ProgramData/llvm-mingw")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_C_COMPILER ${LLVM_MINGW_ROOT}/bin/x86_64-w64-mingw32-clang.exe)
|
||||
SET(CMAKE_CXX_COMPILER ${LLVM_MINGW_ROOT}/bin/x86_64-w64-mingw32-clang++.exe)
|
||||
SET(CMAKE_RC_COMPILER ${LLVM_MINGW_ROOT}/bin/x86_64-w64-mingw32-windres.exe)
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LLVM_MINGW_ROOT}/x86_64-w64-mingw32)
|
||||
|
||||
# We may need some advanced thread APIs to compile tinyusz. use 0x601(Win7) if required
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x601")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -0,0 +1,20 @@
|
|||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
IF (DEFINED ENV{MINGW_GCC_DIR})
|
||||
SET(MINGW_GCC_ROOT "$ENV{MINGW_GCC_DIR}")
|
||||
ELSE ()
|
||||
# Assume mingw cross compiler is installed in your system
|
||||
SET(MINGW_GCC_ROOT "/usr")
|
||||
ENDIF()
|
||||
|
||||
# win32 may fail to compile with C++11 threads.
|
||||
|
||||
SET(CMAKE_C_COMPILER ${MINGW_GCC_ROOT}/bin/x86_64-w64-mingw32-gcc-posix)
|
||||
SET(CMAKE_CXX_COMPILER ${MINGW_GCC_ROOT}/bin/x86_64-w64-mingw32-g++-posix)
|
||||
SET(CMAKE_RC_COMPILER ${MINGW_GCC_ROOT}/bin/x86_64-w64-mingw32-windres)
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${MINGW_GCC_ROOT}/x86_64-w64-mingw32)
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -0,0 +1,59 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
# Clang 3.2+ use this version. The no-omit-frame-pointer option is optional.
|
||||
"-g -fsanitize=address -fno-omit-frame-pointer"
|
||||
"-g -fsanitize=address"
|
||||
|
||||
# Older deprecated flag for ASan
|
||||
"-g -faddress-sanitizer"
|
||||
)
|
||||
|
||||
|
||||
if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY))
|
||||
message(FATAL_ERROR "AddressSanitizer is not compatible with "
|
||||
"ThreadSanitizer or MemorySanitizer.")
|
||||
endif ()
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_ADDRESS)
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer"
|
||||
"ASan")
|
||||
|
||||
find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH})
|
||||
mark_as_advanced(ASan_WRAPPER)
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_address TARGET)
|
||||
if (NOT SANITIZE_ADDRESS)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "AddressSanitizer" "ASan")
|
||||
endfunction ()
|
|
@ -0,0 +1,57 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=memory"
|
||||
)
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_MEMORY)
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
||||
"MemorySanitizer is supported for Linux systems only.")
|
||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
||||
"MemorySanitizer is supported for 64bit systems only.")
|
||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
||||
else ()
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer"
|
||||
"MSan")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_memory TARGET)
|
||||
if (NOT SANITIZE_MEMORY)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "MemorySanitizer" "MSan")
|
||||
endfunction ()
|
|
@ -0,0 +1,94 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# If any of the used compiler is a GNU compiler, add a second option to static
|
||||
# link against the sanitizers.
|
||||
option(SANITIZE_LINK_STATIC "Try to link static against sanitizers." Off)
|
||||
|
||||
|
||||
|
||||
|
||||
set(FIND_QUIETLY_FLAG "")
|
||||
if (DEFINED Sanitizers_FIND_QUIETLY)
|
||||
set(FIND_QUIETLY_FLAG "QUIET")
|
||||
endif ()
|
||||
|
||||
find_package(ASan ${FIND_QUIETLY_FLAG})
|
||||
find_package(TSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(MSan ${FIND_QUIETLY_FLAG})
|
||||
find_package(UBSan ${FIND_QUIETLY_FLAG})
|
||||
|
||||
|
||||
|
||||
|
||||
function(sanitizer_add_blacklist_file FILE)
|
||||
if(NOT IS_ABSOLUTE ${FILE})
|
||||
set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
|
||||
endif()
|
||||
get_filename_component(FILE "${FILE}" REALPATH)
|
||||
|
||||
sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}"
|
||||
"SanitizerBlacklist" "SanBlist")
|
||||
endfunction()
|
||||
|
||||
function(add_sanitizers ...)
|
||||
# If no sanitizer is enabled, return immediately.
|
||||
if (NOT (SANITIZE_ADDRESS OR SANITIZE_MEMORY OR SANITIZE_THREAD OR
|
||||
SANITIZE_UNDEFINED))
|
||||
return()
|
||||
endif ()
|
||||
|
||||
foreach (TARGET ${ARGV})
|
||||
# Check if this target will be compiled by exactly one compiler. Other-
|
||||
# wise sanitizers can't be used and a warning should be printed once.
|
||||
get_target_property(TARGET_TYPE ${TARGET} TYPE)
|
||||
if (TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
|
||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
||||
"because it is an interface library and cannot be "
|
||||
"compiled directly.")
|
||||
return()
|
||||
endif ()
|
||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
||||
if (NUM_COMPILERS GREATER 1)
|
||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
||||
"because it will be compiled by incompatible compilers. "
|
||||
"Target will be compiled without sanitizers.")
|
||||
return()
|
||||
|
||||
# If the target is compiled by no or no known compiler, give a warning.
|
||||
elseif (NUM_COMPILERS EQUAL 0)
|
||||
message(WARNING "Sanitizers for target ${TARGET} may not be"
|
||||
" usable, because it uses no or an unknown compiler. "
|
||||
"This is a false warning for targets using only "
|
||||
"object lib(s) as input.")
|
||||
endif ()
|
||||
|
||||
# Add sanitizers for target.
|
||||
add_sanitize_address(${TARGET})
|
||||
add_sanitize_thread(${TARGET})
|
||||
add_sanitize_memory(${TARGET})
|
||||
add_sanitize_undefined(${TARGET})
|
||||
endforeach ()
|
||||
endfunction(add_sanitizers)
|
|
@ -0,0 +1,65 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_THREAD "Enable ThreadSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=thread"
|
||||
)
|
||||
|
||||
|
||||
# ThreadSanitizer is not compatible with MemorySanitizer.
|
||||
if (SANITIZE_THREAD AND SANITIZE_MEMORY)
|
||||
message(FATAL_ERROR "ThreadSanitizer is not compatible with "
|
||||
"MemorySanitizer.")
|
||||
endif ()
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_THREAD)
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND
|
||||
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
||||
"ThreadSanitizer is supported for Linux systems and macOS only.")
|
||||
set(SANITIZE_THREAD Off CACHE BOOL
|
||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
||||
"ThreadSanitizer is supported for 64bit systems only.")
|
||||
set(SANITIZE_THREAD Off CACHE BOOL
|
||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
||||
else ()
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ThreadSanitizer"
|
||||
"TSan")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_thread TARGET)
|
||||
if (NOT SANITIZE_THREAD)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "ThreadSanitizer" "TSan")
|
||||
endfunction ()
|
|
@ -0,0 +1,46 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
option(SANITIZE_UNDEFINED
|
||||
"Enable UndefinedBehaviorSanitizer for sanitized targets." Off)
|
||||
|
||||
set(FLAG_CANDIDATES
|
||||
"-g -fsanitize=undefined"
|
||||
)
|
||||
|
||||
|
||||
include(sanitize-helpers)
|
||||
|
||||
if (SANITIZE_UNDEFINED)
|
||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}"
|
||||
"UndefinedBehaviorSanitizer" "UBSan")
|
||||
endif ()
|
||||
|
||||
function (add_sanitize_undefined TARGET)
|
||||
if (NOT SANITIZE_UNDEFINED)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
sanitizer_add_flags(${TARGET} "UndefinedBehaviorSanitizer" "UBSan")
|
||||
endfunction ()
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# This script is a wrapper for AddressSanitizer. In some special cases you need
|
||||
# to preload AddressSanitizer to avoid error messages - e.g. if you're
|
||||
# preloading another library to your application. At the moment this script will
|
||||
# only do something, if we're running on a Linux platform. OSX might not be
|
||||
# affected.
|
||||
|
||||
|
||||
# Exit immediately, if platform is not Linux.
|
||||
if [ "$(uname)" != "Linux" ]
|
||||
then
|
||||
exec $@
|
||||
fi
|
||||
|
||||
|
||||
# Get the used libasan of the application ($1). If a libasan was found, it will
|
||||
# be prepended to LD_PRELOAD.
|
||||
libasan=$(ldd $1 | grep libasan | sed "s/^[[:space:]]//" | cut -d' ' -f1)
|
||||
if [ -n "$libasan" ]
|
||||
then
|
||||
if [ -n "$LD_PRELOAD" ]
|
||||
then
|
||||
export LD_PRELOAD="$libasan:$LD_PRELOAD"
|
||||
else
|
||||
export LD_PRELOAD="$libasan"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute the application.
|
||||
exec $@
|
|
@ -0,0 +1,177 @@
|
|||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c)
|
||||
# 2013 Matthew Arsenault
|
||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
# Helper function to get the language of a source file.
|
||||
function (sanitizer_lang_of_source FILE RETURN_VAR)
|
||||
get_filename_component(LONGEST_EXT "${FILE}" EXT)
|
||||
# If extension is empty return. This can happen for extensionless headers
|
||||
if("${LONGEST_EXT}" STREQUAL "")
|
||||
set(${RETURN_VAR} "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
# Get shortest extension as some files can have dot in their names
|
||||
string(REGEX REPLACE "^.*(\\.[^.]+)$" "\\1" FILE_EXT ${LONGEST_EXT})
|
||||
string(TOLOWER "${FILE_EXT}" FILE_EXT)
|
||||
string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
|
||||
|
||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach (LANG ${ENABLED_LANGUAGES})
|
||||
list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
|
||||
if (NOT ${TEMP} EQUAL -1)
|
||||
set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
|
||||
return()
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
set(${RETURN_VAR} "" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to get compilers used by a target.
|
||||
function (sanitizer_target_compilers TARGET RETURN_VAR)
|
||||
# Check if all sources for target use the same compiler. If a target uses
|
||||
# e.g. C and Fortran mixed and uses different compilers (e.g. clang and
|
||||
# gfortran) this can trigger huge problems, because different compilers may
|
||||
# use different implementations for sanitizers.
|
||||
set(BUFFER "")
|
||||
get_target_property(TSOURCES ${TARGET} SOURCES)
|
||||
foreach (FILE ${TSOURCES})
|
||||
# If expression was found, FILE is a generator-expression for an object
|
||||
# library. Object libraries will be ignored.
|
||||
string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
|
||||
if ("${_file}" STREQUAL "")
|
||||
sanitizer_lang_of_source(${FILE} LANG)
|
||||
if (LANG)
|
||||
list(APPEND BUFFER ${CMAKE_${LANG}_COMPILER_ID})
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
list(REMOVE_DUPLICATES BUFFER)
|
||||
set(${RETURN_VAR} "${BUFFER}" PARENT_SCOPE)
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to check compiler flags for language compiler.
|
||||
function (sanitizer_check_compiler_flag FLAG LANG VARIABLE)
|
||||
if (${LANG} STREQUAL "C")
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
|
||||
elseif (${LANG} STREQUAL "CXX")
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
|
||||
elseif (${LANG} STREQUAL "Fortran")
|
||||
# CheckFortranCompilerFlag was introduced in CMake 3.x. To be compatible
|
||||
# with older Cmake versions, we will check if this module is present
|
||||
# before we use it. Otherwise we will define Fortran coverage support as
|
||||
# not available.
|
||||
include(CheckFortranCompilerFlag OPTIONAL RESULT_VARIABLE INCLUDED)
|
||||
if (INCLUDED)
|
||||
check_fortran_compiler_flag("${FLAG}" ${VARIABLE})
|
||||
elseif (NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Performing Test ${VARIABLE}")
|
||||
message(STATUS "Performing Test ${VARIABLE}"
|
||||
" - Failed (Check not supported)")
|
||||
endif ()
|
||||
endif()
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper function to test compiler flags.
|
||||
function (sanitizer_check_compiler_flags FLAG_CANDIDATES NAME PREFIX)
|
||||
set(CMAKE_REQUIRED_QUIET ${${PREFIX}_FIND_QUIETLY})
|
||||
|
||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
foreach (LANG ${ENABLED_LANGUAGES})
|
||||
# Sanitizer flags are not dependend on language, but the used compiler.
|
||||
# So instead of searching flags foreach language, search flags foreach
|
||||
# compiler used.
|
||||
set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
||||
if (NOT DEFINED ${PREFIX}_${COMPILER}_FLAGS)
|
||||
foreach (FLAG ${FLAG_CANDIDATES})
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Try ${COMPILER} ${NAME} flag = [${FLAG}]")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
||||
unset(${PREFIX}_FLAG_DETECTED CACHE)
|
||||
sanitizer_check_compiler_flag("${FLAG}" ${LANG}
|
||||
${PREFIX}_FLAG_DETECTED)
|
||||
|
||||
if (${PREFIX}_FLAG_DETECTED)
|
||||
# If compiler is a GNU compiler, search for static flag, if
|
||||
# SANITIZE_LINK_STATIC is enabled.
|
||||
if (SANITIZE_LINK_STATIC AND (${COMPILER} STREQUAL "GNU"))
|
||||
string(TOLOWER ${PREFIX} PREFIX_lower)
|
||||
sanitizer_check_compiler_flag(
|
||||
"-static-lib${PREFIX_lower}" ${LANG}
|
||||
${PREFIX}_STATIC_FLAG_DETECTED)
|
||||
|
||||
if (${PREFIX}_STATIC_FLAG_DETECTED)
|
||||
set(FLAG "-static-lib${PREFIX_lower} ${FLAG}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(${PREFIX}_${COMPILER}_FLAGS "${FLAG}" CACHE STRING
|
||||
"${NAME} flags for ${COMPILER} compiler.")
|
||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
||||
break()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
if (NOT ${PREFIX}_FLAG_DETECTED)
|
||||
set(${PREFIX}_${COMPILER}_FLAGS "" CACHE STRING
|
||||
"${NAME} flags for ${COMPILER} compiler.")
|
||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
||||
|
||||
message(WARNING "${NAME} is not available for ${COMPILER} "
|
||||
"compiler. Targets using this compiler will be "
|
||||
"compiled without ${NAME}.")
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Helper to assign sanitizer flags for TARGET.
|
||||
function (sanitizer_add_flags TARGET NAME PREFIX)
|
||||
# Get list of compilers used by target and check, if sanitizer is available
|
||||
# for this target. Other compiler checks like check for conflicting
|
||||
# compilers will be done in add_sanitizers function.
|
||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
||||
if ("${${PREFIX}_${TARGET_COMPILER}_FLAGS}" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Set compile- and link-flags for target.
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY COMPILE_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY COMPILE_FLAGS " ${SanBlist_${TARGET_COMPILER}_FLAGS}")
|
||||
set_property(TARGET ${TARGET} APPEND_STRING
|
||||
PROPERTY LINK_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
||||
endfunction ()
|
|
@ -0,0 +1,10 @@
|
|||
#usda 1.0
|
||||
|
||||
# example USDA for fileformat example: "my" custom fileformat.
|
||||
def "muda" (
|
||||
references = @bora.my@
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
|
@ -0,0 +1,3 @@
|
|||
Files copied from MaterialX repo: https://github.com/AcademySoftwareFoundation/MaterialX
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
texture files are omitted to save git repo size.
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709" fileprefix="../../../Images/">
|
||||
<nodegraph name="NG_brass1">
|
||||
<tiledimage name="image_color" type="color3">
|
||||
<input name="file" type="filename" value="brass_color.jpg" colorspace="srgb_texture" />
|
||||
<input name="uvtiling" type="vector2" value="1.0, 1.0" />
|
||||
</tiledimage>
|
||||
<tiledimage name="image_roughness" type="float">
|
||||
<input name="file" type="filename" value="brass_roughness.jpg" />
|
||||
<input name="uvtiling" type="vector2" value="1.0, 1.0" />
|
||||
</tiledimage>
|
||||
<output name="out_color" type="color3" nodename="image_color" />
|
||||
<output name="out_roughness" type="float" nodename="image_roughness" />
|
||||
</nodegraph>
|
||||
<standard_surface name="SR_brass1" type="surfaceshader">
|
||||
<input name="base" type="float" value="1" />
|
||||
<input name="base_color" type="color3" value="1, 1, 1" />
|
||||
<input name="specular" type="float" value="0" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_brass1" output="out_roughness" />
|
||||
<input name="metalness" type="float" value="1" />
|
||||
<input name="coat" type="float" value="1" />
|
||||
<input name="coat_color" type="color3" nodegraph="NG_brass1" output="out_color" />
|
||||
<input name="coat_roughness" type="float" nodegraph="NG_brass1" output="out_roughness" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Tiled_Brass" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_brass1" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709" fileprefix="../../../Images/">
|
||||
<nodegraph name="NG_BrickPattern">
|
||||
<input name="brick_color" type="color3" value="0.661876, 0.19088, 0" uiname="Brick Color" uifolder="Color" />
|
||||
<input name="hue_variation" type="float" value="0.083" uimin="0" uimax="1" uiname="Hue Variation" uifolder="Color" />
|
||||
<input name="value_variation" type="float" value="0.787" uimin="0" uimax="1" uiname="Value Variation" uifolder="Color" />
|
||||
<input name="roughness_amount" type="float" value="0.853" uimin="0" uimax="1" uiname="Roughness Amount" uifolder="Roughness" />
|
||||
<input name="dirt_color" type="color3" value="0.56372, 0.56372, 0.56372" uiname="Dirt Color" uifolder="Dirt" />
|
||||
<input name="dirt_amount" type="float" value="0.248" uimin="0" uimax="1" uiname="Dirt Amount" uifolder="Dirt" />
|
||||
<input name="uvtiling" type="float" value="3" uisoftmin="1" uisoftmax="16" uiname="UV Tiling" uifolder="Texturing" />
|
||||
<multiply name="node_multiply_5" type="color3">
|
||||
<input name="in1" type="color3" nodename="node_mix_6" />
|
||||
<input name="in2" type="float" nodename="node_tiledimage_float_7" />
|
||||
</multiply>
|
||||
<mix name="node_mix_8" type="color3">
|
||||
<input name="fg" type="color3" nodename="node_multiply_5" />
|
||||
<input name="bg" type="color3" nodename="node_multiply_9" />
|
||||
<input name="mix" type="float" nodename="node_tiledimage_float_10" />
|
||||
</mix>
|
||||
<constant name="node_color_11" type="color3">
|
||||
<input name="value" type="color3" value="0.263273, 0.263273, 0.263273" />
|
||||
</constant>
|
||||
<multiply name="node_multiply_9" type="color3">
|
||||
<input name="in1" type="color3" nodename="node_color_11" />
|
||||
<input name="in2" type="float" nodename="node_tiledimage_float_7" />
|
||||
</multiply>
|
||||
<rgbtohsv name="node_rgbtohsv_12" type="color3">
|
||||
<input name="in" type="color3" interfacename="brick_color" />
|
||||
</rgbtohsv>
|
||||
<combine3 name="node_combine3_color3_13" type="color3">
|
||||
<input name="in1" type="float" nodename="node_multiply_14" />
|
||||
<input name="in2" type="float" value="0" />
|
||||
<input name="in3" type="float" nodename="node_multiply_15" />
|
||||
</combine3>
|
||||
<add name="node_add_16" type="color3">
|
||||
<input name="in1" type="color3" nodename="node_combine3_color3_13" />
|
||||
<input name="in2" type="color3" nodename="node_rgbtohsv_12" />
|
||||
</add>
|
||||
<hsvtorgb name="node_hsvtorgb_17" type="color3">
|
||||
<input name="in" type="color3" nodename="node_add_16" />
|
||||
</hsvtorgb>
|
||||
<subtract name="node_subtract_18" type="float">
|
||||
<input name="in1" type="float" nodename="node_add_19" />
|
||||
<input name="in2" type="float" value="0.35" />
|
||||
</subtract>
|
||||
<multiply name="node_multiply_14" type="float">
|
||||
<input name="in1" type="float" nodename="node_subtract_18" />
|
||||
<input name="in2" type="float" interfacename="hue_variation" />
|
||||
</multiply>
|
||||
<multiply name="node_multiply_15" type="float">
|
||||
<input name="in1" type="float" nodename="node_add_19" />
|
||||
<input name="in2" type="float" nodename="node_multiply_20" />
|
||||
</multiply>
|
||||
<clamp name="node_clamp_0" type="color3">
|
||||
<input name="in" type="color3" nodename="node_mix_8" />
|
||||
</clamp>
|
||||
<multiply name="node_multiply_1" type="float">
|
||||
<input name="in1" type="float" nodename="node_divide_21" />
|
||||
<input name="in2" type="float" nodename="node_tiledimage_float_22" />
|
||||
</multiply>
|
||||
<max name="node_max_1" type="float">
|
||||
<input name="in1" type="float" nodename="node_tiledimage_float_10" />
|
||||
<input name="in2" type="float" value="0.00001" />
|
||||
</max>
|
||||
<divide name="node_divide_21" type="float">
|
||||
<input name="in1" type="float" interfacename="roughness_amount" />
|
||||
<input name="in2" type="float" nodename="node_max_1" />
|
||||
</divide>
|
||||
<mix name="node_mix_6" type="color3">
|
||||
<input name="fg" type="color3" interfacename="dirt_color" />
|
||||
<input name="bg" type="color3" nodename="node_hsvtorgb_17" />
|
||||
<input name="mix" type="float" nodename="node_multiply_23" />
|
||||
</mix>
|
||||
<multiply name="node_multiply_23" type="float">
|
||||
<input name="in1" type="float" interfacename="dirt_amount" />
|
||||
<input name="in2" type="float" nodename="node_tiledimage_float_24" />
|
||||
</multiply>
|
||||
<multiply name="node_multiply_25" type="float">
|
||||
<input name="in1" type="float" interfacename="hue_variation" />
|
||||
<input name="in2" type="float" nodename="node_tiledimage_float_26" />
|
||||
</multiply>
|
||||
<add name="node_add_19" type="float">
|
||||
<input name="in1" type="float" nodename="node_multiply_25" />
|
||||
<input name="in2" type="float" nodename="node_tiledimage_float_7" />
|
||||
</add>
|
||||
<multiply name="node_multiply_20" type="float">
|
||||
<input name="in1" type="float" interfacename="value_variation" />
|
||||
<input name="in2" type="float" nodename="node_tiledimage_float_26" />
|
||||
</multiply>
|
||||
<normalmap name="node_normalmap_3" type="vector3">
|
||||
<input name="in" type="vector3" nodename="node_tiledimage_vector3_27" />
|
||||
</normalmap>
|
||||
<convert name="node_convert_1" type="vector2">
|
||||
<input name="in" type="float" interfacename="uvtiling" />
|
||||
</convert>
|
||||
<tiledimage name="node_tiledimage_vector3_27" type="vector3">
|
||||
<input name="file" type="filename" value="brick_normal.jpg" />
|
||||
<input name="uvtiling" type="vector2" nodename="node_convert_1" />
|
||||
</tiledimage>
|
||||
<tiledimage name="node_tiledimage_float_22" type="float">
|
||||
<input name="file" type="filename" value="brick_roughness.jpg" />
|
||||
<input name="uvtiling" type="vector2" nodename="node_convert_1" />
|
||||
</tiledimage>
|
||||
<tiledimage name="node_tiledimage_float_10" type="float">
|
||||
<input name="file" type="filename" value="brick_mask.jpg" />
|
||||
<input name="uvtiling" type="vector2" nodename="node_convert_1" />
|
||||
</tiledimage>
|
||||
<tiledimage name="node_tiledimage_float_7" type="float">
|
||||
<input name="file" type="filename" value="brick_base_gray.jpg" />
|
||||
<input name="uvtiling" type="vector2" nodename="node_convert_1" />
|
||||
</tiledimage>
|
||||
<tiledimage name="node_tiledimage_float_26" type="float">
|
||||
<input name="file" type="filename" value="brick_variation_mask.jpg" />
|
||||
<input name="uvtiling" type="vector2" nodename="node_convert_1" />
|
||||
</tiledimage>
|
||||
<tiledimage name="node_tiledimage_float_24" type="float">
|
||||
<input name="file" type="filename" value="brick_dirt_mask.jpg" />
|
||||
<input name="uvtiling" type="vector2" nodename="node_convert_1" />
|
||||
</tiledimage>
|
||||
<output name="base_color_output" type="color3" nodename="node_clamp_0" />
|
||||
<output name="specular_roughness_output" type="float" nodename="node_multiply_1" />
|
||||
<output name="normal_output" type="vector3" nodename="node_normalmap_3" />
|
||||
</nodegraph>
|
||||
<standard_surface name="N_StandardSurface" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_BrickPattern" output="base_color_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_BrickPattern" output="specular_roughness_output" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_BrickPattern" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_BrickPattern" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="N_StandardSurface" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_carpaint" type="surfaceshader">
|
||||
<input name="base" type="float" value="0.5" />
|
||||
<input name="base_color" type="color3" value="0.1037792, 0.59212029, 0.85064936" />
|
||||
<input name="specular" type="float" value="1.0" />
|
||||
<input name="specular_color" type="color3" value="1.0, 1.0, 1.0" />
|
||||
<input name="specular_roughness" type="float" value="0.4" />
|
||||
<input name="specular_anisotropy" type="float" value="0.5" />
|
||||
<input name="coat" type="float" value="1" />
|
||||
<input name="coat_roughness" type="float" value="0" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Car_Paint" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_carpaint" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,555 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<!-- Chess Set geometry and material contributed by Side Effects, artwork by Moeen Sayed and Mujtaba Sayed. -->
|
||||
|
||||
<!-- Bishop Black -->
|
||||
<nodegraph name="NG_BishopBlack">
|
||||
<image name="diffuse2" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/bishop_black_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic2" type="float">
|
||||
<input name="file" type="filename" value="chess_set/bishop_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness2" type="float">
|
||||
<input name="file" type="filename" value="chess_set/bishop_black_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal2" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/bishop_black_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap4" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal2" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse2" />
|
||||
<output name="metalness_output" type="float" nodename="metallic2" />
|
||||
<output name="roughness_output" type="float" nodename="roughness2" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap4" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Bishop_B" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_BishopBlack" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_BishopBlack" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_BishopBlack" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_BishopBlack" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_BishopBlack" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_BishopBlack" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Bishop_B" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Bishop_B" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Bishop White -->
|
||||
<nodegraph name="NG_BishopWhite">
|
||||
<image name="diffuse3" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/bishop_white_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic3" type="float">
|
||||
<input name="file" type="filename" value="chess_set/bishop_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness3" type="float">
|
||||
<input name="file" type="filename" value="chess_set/bishop_white_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal3" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/bishop_white_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap5" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal3" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse3" />
|
||||
<output name="metalness_output" type="float" nodename="metallic3" />
|
||||
<output name="roughness_output" type="float" nodename="roughness3" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap5" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Bishop_W" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_BishopWhite" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_BishopWhite" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_BishopWhite" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_BishopWhite" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_BishopWhite" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_BishopWhite" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Bishop_W" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Bishop_W" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Castle Black -->
|
||||
<nodegraph name="NG_CastleBlack">
|
||||
<image name="diffuse6" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/castle_black_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic6" type="float">
|
||||
<input name="file" type="filename" value="chess_set/castle_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness6" type="float">
|
||||
<input name="file" type="filename" value="chess_set/castle_shared_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal6" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/castle_shared_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap8" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal6" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse6" />
|
||||
<output name="metalness_output" type="float" nodename="metallic6" />
|
||||
<output name="roughness_output" type="float" nodename="roughness6" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap8" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Castle_B" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_CastleBlack" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_CastleBlack" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_CastleBlack" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_CastleBlack" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_CastleBlack" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_CastleBlack" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Castle_B" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Castle_B" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Castle White -->
|
||||
<nodegraph name="NG_CastleWhite">
|
||||
<image name="diffuse7" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/castle_white_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic7" type="float">
|
||||
<input name="file" type="filename" value="chess_set/castle_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness7" type="float">
|
||||
<input name="file" type="filename" value="chess_set/castle_shared_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal7" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/castle_shared_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap9" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal7" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse7" />
|
||||
<output name="metalness_output" type="float" nodename="metallic7" />
|
||||
<output name="roughness_output" type="float" nodename="roughness7" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap9" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Castle_W" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_CastleWhite" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_CastleWhite" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_CastleWhite" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_CastleWhite" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_CastleWhite" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_CastleWhite" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Castle_W" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Castle_W" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Chess Board -->
|
||||
<nodegraph name="NG_ChessBoard">
|
||||
<image name="mtlximage13" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/chessboard_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="mtlximage16" type="float">
|
||||
<input name="file" type="filename" value="chess_set/chessboard_metallic.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage17" type="float">
|
||||
<input name="file" type="filename" value="chess_set/chessboard_roughness.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage15" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/chessboard_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap12" type="vector3">
|
||||
<input name="in" type="vector3" nodename="mtlximage15" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="mtlximage13" />
|
||||
<output name="metalness_output" type="float" nodename="mtlximage16" />
|
||||
<output name="roughness_output" type="float" nodename="mtlximage17" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap12" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Chessboard" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_ChessBoard" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_ChessBoard" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_ChessBoard" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_ChessBoard" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_ChessBoard" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_ChessBoard" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Chessboard" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Chessboard" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- King Black -->
|
||||
<nodegraph name="NG_KingBlack">
|
||||
<image name="mtlximage1" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/king_black_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="mtlximage2" type="float">
|
||||
<input name="file" type="filename" value="chess_set/king_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage4" type="float">
|
||||
<input name="file" type="filename" value="chess_set/king_black_roughness.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage3" type="float">
|
||||
<input name="file" type="filename" value="chess_set/king_shared_scattering.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage6" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/king_black_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap1" type="vector3">
|
||||
<input name="in" type="vector3" nodename="mtlximage6" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="mtlximage1" />
|
||||
<output name="metalness_output" type="float" nodename="mtlximage2" />
|
||||
<output name="roughness_output" type="float" nodename="mtlximage4" />
|
||||
<output name="subsurface_output" type="float" nodename="mtlximage3" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap1" />
|
||||
</nodegraph>
|
||||
<standard_surface name="King_B" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_KingBlack" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_KingBlack" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_KingBlack" output="roughness_output" />
|
||||
<input name="subsurface" type="float" nodegraph="NG_KingBlack" output="subsurface_output" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_KingBlack" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_KingBlack" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_KingBlack" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_King_B" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="King_B" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- King White -->
|
||||
<nodegraph name="NG_KingWhite">
|
||||
<image name="mtlximage7" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/king_white_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="mtlximage10" type="float">
|
||||
<input name="file" type="filename" value="chess_set/king_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage11" type="float">
|
||||
<input name="file" type="filename" value="chess_set/king_white_roughness.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage8" type="float">
|
||||
<input name="file" type="filename" value="chess_set/king_shared_scattering.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage9" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/king_white_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap11" type="vector3">
|
||||
<input name="in" type="vector3" nodename="mtlximage9" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="mtlximage7" />
|
||||
<output name="metalness_output" type="float" nodename="mtlximage10" />
|
||||
<output name="roughness_output" type="float" nodename="mtlximage11" />
|
||||
<output name="subsurface_output" type="float" nodename="mtlximage8" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap11" />
|
||||
</nodegraph>
|
||||
<standard_surface name="King_W" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_KingWhite" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_KingWhite" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_KingWhite" output="roughness_output" />
|
||||
<input name="subsurface" type="float" nodegraph="NG_KingWhite" output="subsurface_output" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_KingWhite" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_KingWhite" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_KingWhite" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_King_W" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="King_W" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Knight Black -->
|
||||
<nodegraph name="NG_KnightBlack">
|
||||
<image name="diffuse4" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/knight_black_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="roughness4" type="float">
|
||||
<input name="file" type="filename" value="chess_set/knight_black_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal4" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/knight_black_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap6" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal4" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse4" />
|
||||
<output name="roughness_output" type="float" nodename="roughness4" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap6" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Knight_B" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_KnightBlack" output="base_color_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_KnightBlack" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_KnightBlack" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_KnightBlack" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_KnightBlack" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Knight_B" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Knight_B" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Knight White -->
|
||||
<nodegraph name="NG_KnightWhite">
|
||||
<image name="diffuse5" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/knight_white_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="roughness5" type="float">
|
||||
<input name="file" type="filename" value="chess_set/knight_white_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal5" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/knight_white_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap7" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal5" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse5" />
|
||||
<output name="roughness_output" type="float" nodename="roughness5" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap7" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Knight_W" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_KnightWhite" output="base_color_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_KnightWhite" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_KnightWhite" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_KnightWhite" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_KnightWhite" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Knight_W" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Knight_W" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Pawn Body Black -->
|
||||
<nodegraph name="NG_PawnBodyBlack">
|
||||
<image name="diffuse9" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/pawn_black_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic9" type="float">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness9" type="float">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal9" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap13" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal9" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse9" />
|
||||
<output name="metalness_output" type="float" nodename="metallic9" />
|
||||
<output name="roughness_output" type="float" nodename="roughness9" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap13" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Pawn_Body_B" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_PawnBodyBlack" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_PawnBodyBlack" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_PawnBodyBlack" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_PawnBodyBlack" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_PawnBodyBlack" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_PawnBodyBlack" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Pawn_Body_B" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Pawn_Body_B" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Pawn Body White -->
|
||||
<nodegraph name="NG_PawnBodyWhite">
|
||||
<image name="diffuse8" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/pawn_white_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic8" type="float">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness8" type="float">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_roughness.jpg" />
|
||||
</image>
|
||||
<image name="normal8" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap10" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal8" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse8" />
|
||||
<output name="metalness_output" type="float" nodename="metallic8" />
|
||||
<output name="roughness_output" type="float" nodename="roughness8" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap10" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Pawn_Body_W" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_PawnBodyWhite" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_PawnBodyWhite" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_PawnBodyWhite" output="roughness_output" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_PawnBodyWhite" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_PawnBodyWhite" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_PawnBodyWhite" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Pawn_Body_W" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Pawn_Body_W" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Pawn Top Black -->
|
||||
<nodegraph name="NG_PawnTopBlack">
|
||||
<image name="mtlximage19" type="float">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_roughness.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage18" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap14" type="vector3">
|
||||
<input name="in" type="vector3" nodename="mtlximage18" />
|
||||
</normalmap>
|
||||
<output name="roughness_output" type="float" nodename="mtlximage19" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap14" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Pawn_Top_B" type="surfaceshader">
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_PawnTopBlack" output="roughness_output" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_PawnTopBlack" output="normal_output" />
|
||||
<input name="base_color" type="color3" value="1, 1, 1" />
|
||||
<input name="transmission" type="float" value="1" />
|
||||
<input name="transmission_color" type="color3" value="0.2995, 0.5, 0.450276" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" value="1, 1, 1" />
|
||||
<input name="subsurface_radius" type="color3" value="1, 1, 1" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Pawn_Top_B" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Pawn_Top_B" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Pawn Top White -->
|
||||
<nodegraph name="NG_PawnTopWhite">
|
||||
<image name="mtlximage21" type="float">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_roughness.jpg" />
|
||||
</image>
|
||||
<image name="mtlximage20" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/pawn_shared_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap15" type="vector3">
|
||||
<input name="in" type="vector3" nodename="mtlximage20" />
|
||||
</normalmap>
|
||||
<output name="roughness_output" type="float" nodename="mtlximage21" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap15" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Pawn_Top_W" type="surfaceshader">
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_PawnTopWhite" output="roughness_output" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_PawnTopWhite" output="normal_output" />
|
||||
<input name="base_color" type="color3" value="1, 1, 1" />
|
||||
<input name="transmission" type="float" value="1" />
|
||||
<input name="transmission_color" type="color3" value="1, 1, 0.828" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" value="1, 1, 1" />
|
||||
<input name="subsurface_radius" type="color3" value="1, 1, 1" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Pawn_Top_W" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Pawn_Top_W" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Queen Black -->
|
||||
<nodegraph name="NG_QueenBlack">
|
||||
<image name="diffuse" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/queen_black_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic" type="float">
|
||||
<input name="file" type="filename" value="chess_set/queen_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness" type="float">
|
||||
<input name="file" type="filename" value="chess_set/queen_black_roughness.jpg" />
|
||||
</image>
|
||||
<image name="sss" type="float">
|
||||
<input name="file" type="filename" value="chess_set/queen_shared_scattering.jpg" />
|
||||
</image>
|
||||
<image name="normal" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/queen_black_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap2" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse" />
|
||||
<output name="metalness_output" type="float" nodename="metallic" />
|
||||
<output name="roughness_output" type="float" nodename="roughness" />
|
||||
<output name="subsurface_output" type="float" nodename="sss" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap2" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Queen_B" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_QueenBlack" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_QueenBlack" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_QueenBlack" output="roughness_output" />
|
||||
<input name="subsurface" type="float" nodegraph="NG_QueenBlack" output="subsurface_output" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_QueenBlack" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_QueenBlack" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.003" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_QueenBlack" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Queen_B" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Queen_B" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Queen White -->
|
||||
<nodegraph name="NG_QueenWhite">
|
||||
<image name="diffuse1" type="color3">
|
||||
<input name="file" type="filename" value="chess_set/queen_white_base_color.jpg" colorspace="srgb_texture" />
|
||||
</image>
|
||||
<image name="metallic1" type="float">
|
||||
<input name="file" type="filename" value="chess_set/queen_shared_metallic.jpg" />
|
||||
</image>
|
||||
<image name="roughness1" type="float">
|
||||
<input name="file" type="filename" value="chess_set/queen_white_roughness.jpg" />
|
||||
</image>
|
||||
<image name="sss1" type="float">
|
||||
<input name="file" type="filename" value="chess_set/queen_shared_scattering.jpg" />
|
||||
</image>
|
||||
<image name="normal1" type="vector3">
|
||||
<input name="file" type="filename" value="chess_set/queen_white_normal.jpg" />
|
||||
</image>
|
||||
<normalmap name="mtlxnormalmap3" type="vector3">
|
||||
<input name="in" type="vector3" nodename="normal1" />
|
||||
</normalmap>
|
||||
<output name="base_color_output" type="color3" nodename="diffuse1" />
|
||||
<output name="metalness_output" type="float" nodename="metallic1" />
|
||||
<output name="roughness_output" type="float" nodename="roughness1" />
|
||||
<output name="subsurface_output" type="float" nodename="sss1" />
|
||||
<output name="normal_output" type="vector3" nodename="mtlxnormalmap3" />
|
||||
</nodegraph>
|
||||
<standard_surface name="Queen_W" type="surfaceshader">
|
||||
<input name="base_color" type="color3" nodegraph="NG_QueenWhite" output="base_color_output" />
|
||||
<input name="metalness" type="float" nodegraph="NG_QueenWhite" output="metalness_output" />
|
||||
<input name="specular_roughness" type="float" nodegraph="NG_QueenWhite" output="roughness_output" />
|
||||
<input name="subsurface" type="float" nodegraph="NG_QueenWhite" output="subsurface_output" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_QueenWhite" output="base_color_output" />
|
||||
<input name="subsurface_radius" type="color3" nodegraph="NG_QueenWhite" output="base_color_output" />
|
||||
<input name="subsurface_scale" type="float" value="0.001" />
|
||||
<input name="normal" type="vector3" nodegraph="NG_QueenWhite" output="normal_output" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="M_Queen_W" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="Queen_W" />
|
||||
</surfacematerial>
|
||||
|
||||
<!-- Chess Set Look -->
|
||||
<look name="L_ChessSet">
|
||||
<materialassign name="Chessboard" geom="Chessboard" material="M_Chessboard" />
|
||||
<materialassign name="Bishop_B" geom="Bishop_B" material="M_Bishop_B" />
|
||||
<materialassign name="Bishop_W" geom="Bishop_W" material="M_Bishop_W" />
|
||||
<materialassign name="Castle_B" geom="Castle_B" material="M_Castle_B" />
|
||||
<materialassign name="Castle_W" geom="Castle_W" material="M_Castle_W" />
|
||||
<materialassign name="Knight_B" geom="Knight_B" material="M_Knight_B" />
|
||||
<materialassign name="Knight_W" geom="Knight_W" material="M_Knight_W" />
|
||||
<materialassign name="King_B" geom="King_B" material="M_King_B" />
|
||||
<materialassign name="King_W" geom="King_W" material="M_King_W" />
|
||||
<materialassign name="Pawn_Body_B" geom="Pawn_Body_B" material="M_Pawn_Body_B" />
|
||||
<materialassign name="Pawn_Top_B" geom="Pawn_Top_B" material="M_Pawn_Top_B" />
|
||||
<materialassign name="Pawn_Body_W" geom="Pawn_Body_W" material="M_Pawn_Body_W" />
|
||||
<materialassign name="Pawn_Top_W" geom="Pawn_Top_W" material="M_Pawn_Top_W" />
|
||||
<materialassign name="Queen_B" geom="Queen_B" material="M_Queen_B" />
|
||||
<materialassign name="Queen_W" geom="Queen_W" material="M_Queen_W" />
|
||||
</look>
|
||||
</materialx>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_chrome" type="surfaceshader">
|
||||
<input name="base" type="float" value="1" />
|
||||
<input name="base_color" type="color3" value="1.0, 1.0, 1.0" />
|
||||
<input name="specular" type="float" value="1" />
|
||||
<input name="specular_color" type="color3" value="1.0, 1.0, 1.0" />
|
||||
<input name="specular_roughness" type="float" value="0" />
|
||||
<input name="metalness" type="float" value="1" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Chrome" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_chrome" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_copper" type="surfaceshader">
|
||||
<input name="base" type="float" value="1" />
|
||||
<input name="base_color" type="color3" value="1, 1, 1" />
|
||||
<input name="specular" type="float" value="0" />
|
||||
<input name="specular_roughness" type="float" value="0.25" />
|
||||
<input name="metalness" type="float" value="1" />
|
||||
<input name="coat" type="float" value="1" />
|
||||
<input name="coat_color" type="color3" value="0.96467984, 0.37626296, 0.25818297" />
|
||||
<input name="coat_roughness" type="float" value="0.20000000298023224" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Copper" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_copper" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_default" type="surfaceshader">
|
||||
<input name="base" type="float" value="1.0" />
|
||||
<input name="base_color" type="color3" value="0.8, 0.8, 0.8" />
|
||||
<input name="diffuse_roughness" type="float" value="0" />
|
||||
<input name="specular" type="float" value="1" />
|
||||
<input name="specular_color" type="color3" value="1, 1, 1" />
|
||||
<input name="specular_roughness" type="float" value="0.2" />
|
||||
<input name="specular_IOR" type="float" value="1.5" />
|
||||
<input name="specular_anisotropy" type="float" value="0" />
|
||||
<input name="specular_rotation" type="float" value="0" />
|
||||
<input name="metalness" type="float" value="0" />
|
||||
<input name="transmission" type="float" value="0" />
|
||||
<input name="transmission_color" type="color3" value="1, 1, 1" />
|
||||
<input name="transmission_depth" type="float" value="0" />
|
||||
<input name="transmission_scatter" type="color3" value="0, 0, 0" />
|
||||
<input name="transmission_scatter_anisotropy" type="float" value="0" />
|
||||
<input name="transmission_dispersion" type="float" value="0" />
|
||||
<input name="transmission_extra_roughness" type="float" value="0" />
|
||||
<input name="subsurface" type="float" value="0" />
|
||||
<input name="subsurface_color" type="color3" value="1, 1, 1" />
|
||||
<input name="subsurface_radius" type="color3" value="1, 1, 1" />
|
||||
<input name="subsurface_scale" type="float" value="1" />
|
||||
<input name="subsurface_anisotropy" type="float" value="0" />
|
||||
<input name="sheen" type="float" value="0" />
|
||||
<input name="sheen_color" type="color3" value="1, 1, 1" />
|
||||
<input name="sheen_roughness" type="float" value="0.3" />
|
||||
<input name="thin_walled" type="boolean" value="false" />
|
||||
<input name="coat" type="float" value="0" />
|
||||
<input name="coat_color" type="color3" value="1, 1, 1" />
|
||||
<input name="coat_roughness" type="float" value="0.1" />
|
||||
<input name="coat_anisotropy" type="float" value="0.0" />
|
||||
<input name="coat_rotation" type="float" value="0.0" />
|
||||
<input name="coat_IOR" type="float" value="1.5" />
|
||||
<input name="coat_affect_color" type="float" value="0" />
|
||||
<input name="coat_affect_roughness" type="float" value="0" />
|
||||
<input name="thin_film_thickness" type="float" value="0" />
|
||||
<input name="thin_film_IOR" type="float" value="1.5" />
|
||||
<input name="emission" type="float" value="0" />
|
||||
<input name="emission_color" type="color3" value="1, 1, 1" />
|
||||
<input name="opacity" type="color3" value="1, 1, 1" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Default" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_default" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_glass" type="surfaceshader">
|
||||
<input name="base" type="float" value="0.0" />
|
||||
<input name="specular" type="float" value="1" />
|
||||
<input name="specular_color" type="color3" value="1, 1, 1" />
|
||||
<input name="specular_roughness" type="float" value="0.01" />
|
||||
<input name="specular_IOR" type="float" value="1.52" />
|
||||
<input name="transmission" type="float" value="1" />
|
||||
<input name="transmission_color" type="color3" value="1, 1, 1" />
|
||||
<input name="transmission_depth" type="float" value="0" />
|
||||
<input name="transmission_scatter" type="color3" value="0, 0, 0" />
|
||||
<input name="transmission_scatter_anisotropy" type="float" value="0" />
|
||||
<input name="transmission_dispersion" type="float" value="0" />
|
||||
<input name="transmission_extra_roughness" type="float" value="0" />
|
||||
<input name="opacity" type="color3" value="1, 1, 1" colorspace="lin_rec709" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Glass" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_glass" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_glass_tinted" type="surfaceshader">
|
||||
<input name="base" type="float" value="0" />
|
||||
<input name="specular" type="float" value="1" />
|
||||
<input name="specular_color" type="color3" value="1, 1, 1" />
|
||||
<input name="specular_roughness" type="float" value="0.15" />
|
||||
<input name="specular_IOR" type="float" value="1.54" />
|
||||
<input name="transmission" type="float" value="1" />
|
||||
<input name="transmission_color" type="color3" value="0.2, 0.1, 1" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="GlassTinted" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_glass_tinted" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_gold" type="surfaceshader">
|
||||
<input name="base" type="float" value="1" />
|
||||
<input name="base_color" type="color3" value="0.944, 0.776, 0.373" />
|
||||
<input name="specular" type="float" value="1" />
|
||||
<input name="specular_color" type="color3" value="0.998, 0.981, 0.751" />
|
||||
<input name="specular_roughness" type="float" value="0.02" />
|
||||
<input name="metalness" type="float" value="1" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Gold" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_gold" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_greysphere" type="surfaceshader">
|
||||
<input name="base" type="float" value="1.0" />
|
||||
<input name="base_color" type="color3" value="0.18, 0.18, 0.18" />
|
||||
<input name="diffuse_roughness" type="float" value="0" />
|
||||
<input name="specular_roughness" type="float" value="0.7" />
|
||||
<input name="specular_IOR" type="float" value="1.5" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Greysphere" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_greysphere" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709" fileprefix="../../../Images/">
|
||||
<nodegraph name="NG_Greysphere_Calibration">
|
||||
<texcoord name="texcoord1" type="vector2" />
|
||||
<place2d name="place2d" type="vector2">
|
||||
<input name="texcoord" type="vector2" nodename="texcoord1" />
|
||||
<input name="offset" type="vector2" value="-1.66, -0.49" />
|
||||
<input name="scale" type="vector2" value="0.21, 0.21" />
|
||||
<input name="pivot" type="vector2" value="0.5, 0.5" />
|
||||
</place2d>
|
||||
<image name="image1" type="color3">
|
||||
<input name="texcoord" type="vector2" nodename="place2d" />
|
||||
<input name="file" type="filename" value="greysphere_calibration.png" colorspace="srgb_texture" />
|
||||
<input name="uaddressmode" type="string" value="clamp" />
|
||||
<input name="vaddressmode" type="string" value="clamp" />
|
||||
</image>
|
||||
<output name="out1" type="color3" nodename="image1" />
|
||||
</nodegraph>
|
||||
<standard_surface name="SR_Greysphere_Calibration" type="surfaceshader">
|
||||
<input name="base" type="float" value="1.0" />
|
||||
<input name="base_color" type="color3" nodegraph="NG_Greysphere_Calibration" output="out1" />
|
||||
<input name="diffuse_roughness" type="float" value="0" />
|
||||
<input name="specular_roughness" type="float" value="0.7" />
|
||||
<input name="specular_IOR" type="float" value="1.5" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Greysphere_Calibration" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_Greysphere_Calibration" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<standard_surface name="SR_jade" type="surfaceshader">
|
||||
<input name="base" type="float" value="0.5" />
|
||||
<input name="base_color" type="color3" value="0.0603, 0.4398, 0.1916" />
|
||||
<input name="specular_roughness" type="float" value="0.25" />
|
||||
<input name="specular_IOR" type="float" value="2.418" />
|
||||
<input name="specular_anisotropy" type="float" value="0.5" />
|
||||
<input name="subsurface" type="float" value="0.4" />
|
||||
<input name="subsurface_color" type="color3" value="0.0603, 0.4398, 0.1916" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Jade" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_jade" />
|
||||
</surfacematerial>
|
||||
</materialx>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include href="standard_surface_brass_tiled.mtlx" />
|
||||
<xi:include href="standard_surface_greysphere_calibration.mtlx" />
|
||||
<look name="Brass_Look">
|
||||
<materialassign name="preview" geom="Preview_Mesh" material="Tiled_Brass" />
|
||||
<materialassign name="calibration" geom="Calibration_Mesh" material="Greysphere_Calibration" />
|
||||
</look>
|
||||
</materialx>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include href="standard_surface_wood_tiled.mtlx" />
|
||||
<xi:include href="standard_surface_greysphere_calibration.mtlx" />
|
||||
<look name="Wood_Look">
|
||||
<materialassign name="preview" geom="Preview_Mesh" material="Tiled_Wood" />
|
||||
<materialassign name="calibration" geom="Calibration_Mesh" material="Greysphere_Calibration" />
|
||||
</look>
|
||||
</materialx>
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0"?>
|
||||
<materialx version="1.38" colorspace="lin_rec709">
|
||||
<nodegraph name="NG_marble1">
|
||||
<input name="base_color_1" type="color3" value="0.8, 0.8, 0.8" uiname="Color 1" uifolder="Marble Color" />
|
||||
<input name="base_color_2" type="color3" value="0.1, 0.1, 0.3" uiname="Color 2" uifolder="Marble Color" />
|
||||
<input name="noise_scale_1" type="float" value="6.0" uisoftmin="1.0" uisoftmax="10.0" uiname="Scale 1" uifolder="Marble Noise" />
|
||||
<input name="noise_scale_2" type="float" value="4.0" uisoftmin="1.0" uisoftmax="10.0" uiname="Scale 2" uifolder="Marble Noise" />
|
||||
<input name="noise_power" type="float" value="3.0" uisoftmin="1.0" uisoftmax="10.0" uiname="Power" uifolder="Marble Noise" />
|
||||
<input name="noise_octaves" type="integer" value="3" uisoftmin="1" uisoftmax="8" uiname="Octaves" uifolder="Marble Noise" />
|
||||
<position name="obj_pos" type="vector3" />
|
||||
<dotproduct name="add_xyz" type="float">
|
||||
<input name="in1" type="vector3" nodename="obj_pos" />
|
||||
<input name="in2" type="vector3" value="1, 1, 1" />
|
||||
</dotproduct>
|
||||
<multiply name="scale_xyz" type="float">
|
||||
<input name="in1" type="float" nodename="add_xyz" />
|
||||
<input name="in2" type="float" interfacename="noise_scale_1" />
|
||||
</multiply>
|
||||
<multiply name="scale_pos" type="vector3">
|
||||
<input name="in1" type="vector3" nodename="obj_pos" />
|
||||
<input name="in2" type="float" interfacename="noise_scale_2" />
|
||||
</multiply>
|
||||
<fractal3d name="noise" type="float">
|
||||
<input name="octaves" type="integer" interfacename="noise_octaves" />
|
||||
<input name="position" type="vector3" nodename="scale_pos" />
|
||||
</fractal3d>
|
||||
<multiply name="scale_noise" type="float">
|
||||
<input name="in1" type="float" nodename="noise" />
|
||||
<input name="in2" type="float" value="3.0" />
|
||||
</multiply>
|
||||
<add name="sum" type="float">
|
||||
<input name="in1" type="float" nodename="scale_xyz" />
|
||||
<input name="in2" type="float" nodename="scale_noise" />
|
||||
</add>
|
||||
<sin name="sin" type="float">
|
||||
<input name="in" type="float" nodename="sum" />
|
||||
</sin>
|
||||
<multiply name="scale" type="float">
|
||||
<input name="in1" type="float" nodename="sin" />
|
||||
<input name="in2" type="float" value="0.5" />
|
||||
</multiply>
|
||||
<add name="bias" type="float">
|
||||
<input name="in1" type="float" nodename="scale" />
|
||||
<input name="in2" type="float" value="0.5" />
|
||||
</add>
|
||||
<power name="power" type="float">
|
||||
<input name="in1" type="float" nodename="bias" />
|
||||
<input name="in2" type="float" interfacename="noise_power" />
|
||||
</power>
|
||||
<mix name="color_mix" type="color3">
|
||||
<input name="bg" type="color3" interfacename="base_color_1" />
|
||||
<input name="fg" type="color3" interfacename="base_color_2" />
|
||||
<input name="mix" type="float" nodename="power" />
|
||||
</mix>
|
||||
<output name="out" type="color3" nodename="color_mix" />
|
||||
</nodegraph>
|
||||
<standard_surface name="SR_marble1" type="surfaceshader">
|
||||
<input name="base" type="float" value="1" />
|
||||
<input name="base_color" type="color3" nodegraph="NG_marble1" output="out" />
|
||||
<input name="specular_roughness" type="float" value="0.1" />
|
||||
<input name="subsurface" type="float" value="0.4" />
|
||||
<input name="subsurface_color" type="color3" nodegraph="NG_marble1" output="out" />
|
||||
</standard_surface>
|
||||
<surfacematerial name="Marble_3D" type="material">
|
||||
<input name="surfaceshader" type="surfaceshader" nodename="SR_marble1" />
|
||||
</surfacematerial>
|
||||
</materialx>
|