Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ on:
type: string
nametag:
type: string
rust:
type: string
secrets:
PASSED_GITHUB_TOKEN:
required: false
Expand Down Expand Up @@ -155,6 +157,15 @@ jobs:
if: inputs.clang_format == '1'
shell: bash
run: src/build-scripts/run-clang-format.bash
- name: Rust Install Toolchain
if: inputs.rust == '1'
uses: dtolnay/rust-toolchain@4305c38b25d97ef35a8ad1f985ccf2d2242004f2 # stable
- name: Rust Test
if: inputs.rust == '1'
shell: bash
env:
OIIO_CXX_STANDARD: c++${{inputs.cxx_std}}
run: src/build-scripts/ci-rust-test.bash
- name: Code coverage
if: inputs.coverage == '1'
run: src/build-scripts/ci-coverage.bash
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ jobs:
ctest_test_timeout: ${{ matrix.ctest_test_timeout }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
rust: ${{ matrix.rust || 0 }}
strategy:
fail-fast: false
matrix:
Expand All @@ -293,6 +294,7 @@ jobs:
fmt_ver: 10.1.1
pybind11_ver: v2.10.0
setenvs: PUGIXML_VERSION=v1.13
rust: 1
- desc: VFX2023 icc/C++17 py3.10 exr3.1 ocio2.1 qt5.15
nametag: linux-vfx2023.icc
runner: ubuntu-latest
Expand Down Expand Up @@ -335,6 +337,7 @@ jobs:
pybind11_ver: v2.12.0
benchmark: 1
setenvs: PUGIXML_VERSION=v1.14
rust: 1
- desc: VFX2024 clang/C++17 py3.11 exr3.2 ocio2.3
nametag: linux-vfx2024.clang
runner: ubuntu-latest
Expand All @@ -347,6 +350,7 @@ jobs:
pybind11_ver: v2.12.0
benchmark: 1
setenvs: PUGIXML_VERSION=v1.14
rust: 1
- desc: VFX2025 gcc11/C++17 py3.11 exr3.3 ocio2.4
nametag: linux-vfx2025
runner: ubuntu-latest
Expand Down Expand Up @@ -456,7 +460,7 @@ jobs:
FREETYPE_VERSION=master
QT_VERSION=0 INSTALL_OPENCV=0
# The installed OpenVDB has a TLS conflict with Python 3.8
# Disabling the `apt-get update` in gh-installdeps.bash
# Disabling the `apt-get update` in gh-installdeps.bash
# addresses a job killing problem in the GHA Ubuntu
# 24.04 runners that cropped up circa May 29 2024. Maybe
# it will be fixed and we can do the update again later?
Expand Down Expand Up @@ -548,6 +552,7 @@ jobs:
ctest_test_timeout: ${{ matrix.ctest_test_timeout || '800' }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
rust: ${{ matrix.rust || 0 }}
strategy:
fail-fast: false
matrix:
Expand All @@ -563,6 +568,7 @@ jobs:
ctest_test_timeout: 1200
setenvs: export MACOSX_DEPLOYMENT_TARGET=12.0
benchmark: 1
rust: 1
- desc: MacOS-14-ARM aclang15/C++20/py3.12
runner: macos-14
nametag: macos14-arm-py312
Expand All @@ -578,6 +584,7 @@ jobs:
cxx_std: 20
python_ver: "3.13"
benchmark: 1
rust: 1


#
Expand Down Expand Up @@ -614,6 +621,7 @@ jobs:
ctest_test_timeout: ${{ matrix.ctest_test_timeout }}
coverage: ${{ matrix.coverage || 0 }}
sonar: ${{ matrix.sonar || 0 }}
rust: ${{ matrix.rust || 0 }}
strategy:
fail-fast: false
matrix:
Expand All @@ -625,13 +633,15 @@ jobs:
generator: "Visual Studio 16 2019"
python_ver: "3.9"
setenvs: export OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH=1
rust: 1
- desc: Windows-2022 VS2022
runner: windows-2022
nametag: windows-2022
vsver: 2022
generator: "Visual Studio 17 2022"
python_ver: "3.9"
setenvs: export OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH=1
rust: 1
- desc: Windows-2025 VS2022
runner: windows-2025
nametag: windows-2025
Expand All @@ -640,3 +650,4 @@ jobs:
python_ver: "3.9"
setenvs: export OPENIMAGEIO_PYTHON_LOAD_DLLS_FROM_PATH=1
benchmark: 1
rust: 1
31 changes: 31 additions & 0 deletions src/build-scripts/ci-rust-test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# Copyright Contributors to the OpenImageIO project.
# SPDX-License-Identifier: Apache-2.0
# https://github.com/AcademySoftwareFoundation/OpenImageIO

# Important: set -ex causes this whole script to terminate with error if
# any command in it fails. This is crucial for CI tests.
# (Though we let it run all the way through for code coverage workflows.)
if [[ "${CODECOV}" == "" ]]; then
set -ex
fi

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OpenImageIO_ROOT/lib
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$OpenImageIO_ROOT/lib/pkgconfig
export OIIO_INCLUDE_DIR=$OpenImageIO_ROOT/include
export OIIO_LIBRARY_DIR=$OpenImageIO_ROOT/lib

echo "Using C++ STD ${OIIO_CXX_STANDARD}"

echo "Running Rust oiio-sys tests"

pushd src/rust/oiio-sys
time cargo test --all-features
popd

echo "Running Rust oiio tests"

pushd src/rust
time cargo test --all-features
popd
3 changes: 3 additions & 0 deletions src/rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cargo.lock
target/
.vscode/
34 changes: 34 additions & 0 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "oiio"
version = "0.1.0"
edition = "2021"
description = "High-level OpenImageIO bindings over oiio-sys"
documentation = "https://docs.rs/oiio"
authors = [
"Scott Wilson <scott@propersquid.com>",
"David Aguilar <davvid@gmail.com>",
]
license = "Apache-2.0"
keywords = ["graphics", "images", "render", "texture", "vfx"]
categories = ["graphics", "multimedia::images", "rendering::data-formats"]
readme = "README.md"
homepage = "https://github.com/AcademySoftwareFoundation/OpenImageIO"
repository = "https://github.com/AcademySoftwareFoundation/OpenImageIO.git"

[workspace]
members = ["oiio-sys"]

[dependencies]
oiio-sys = { path = "oiio-sys", version = "0.1.0" }
thiserror = "2.0.12"

[dev-dependencies]
proptest = "1.6.0"
proptest-derive = "0.5.1"

# The docs are the same across all platforms so we only need to build once.
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
rustc-args = ["--cfg", "docsrs"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
130 changes: 130 additions & 0 deletions src/rust/oiio-sys/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
Language: Cpp
BasedOnStyle: WebKit

AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
#AlignConsecutiveAssignments: Consecutive
#AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: false
#AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: TopLevel
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: ".*"
Priority: 1
IncludeIsMainRegex: "(Test)?$"
IndentCaseLabels: false
IndentExternBlock: NoIndent
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 3
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 40
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 75
PenaltyReturnTypeOnItsOwnLine: 50
PointerAlignment: Left
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++17
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
#...
10 changes: 10 additions & 0 deletions src/rust/oiio-sys/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Checks: "-*,clang-analyzer-security*"
WarningsAsErrors: ""
HeaderFilterRegex: '(OpenImageIO/[a-zA-Z0-9_]+\.h)|(imageio)|(oiio)|(iv/)|(_pvt\.h)'
AnalyzeTemporaryDtors: false
User: lg
CheckOptions:
- key: modernize-use-nullptr.NullMacros
value: "NULL"
- key: modernize-use-emplace.SmartPointers
value: "OIIO::intrusive_ptr"
37 changes: 37 additions & 0 deletions src/rust/oiio-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "oiio-sys"
version = "0.1.0"
edition = "2021"
description = "Rust sys bindings for OpenImageIO https://github.com/AcademySoftwareFoundation/OpenImageIO"
documentation = "https://docs.rs/oiio-sys"
authors = [
"Scott Wilson <scott@propersquid.com>",
"David Aguilar <davvid@gmail.com>",
]
license = "Apache-2.0"
keywords = ["graphics", "images", "render", "texture", "vfx"]
categories = ["graphics", "multimedia::images", "rendering::data-formats"]
readme = "README.md"
homepage = "https://github.com/AcademySoftwareFoundation/OpenImageIO"
repository = "https://github.com/AcademySoftwareFoundation/OpenImageIO.git"
links = "OpenImageIO"

[dependencies]
cxx = { version = "1.0.158", features = ["c++17"] }

[build-dependencies]
anyhow = "1.0.98"
cxx-build = "1.0.158"
glob = "0.3.2"
pkg-config = "0.3.32"

[dev-dependencies]
proptest = "1.6.0"
proptest-derive = "0.5.1"

# The docs are the same across all platforms so we only need to build once.
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
rustc-args = ["--cfg", "docsrs"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Loading
Loading