Skip to content

Commit

Permalink
Merge branch 'main' into fix-split-sum-ibl
Browse files Browse the repository at this point in the history
  • Loading branch information
jstone-lucasfilm authored Dec 15, 2023
2 parents e006bb0 + cd82ea5 commit 7e8bd86
Show file tree
Hide file tree
Showing 175 changed files with 3,275 additions and 3,125 deletions.
134 changes: 79 additions & 55 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,48 @@ jobs:
python: 3.7
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON

- name: Linux_GCC_11_Python39
os: ubuntu-20.04
compiler: gcc
compiler_version: "11"
python: 3.9
build_javascript: ON

- name: Linux_GCC_12_Python311
os: ubuntu-22.04
compiler: gcc
compiler_version: "12"
python: 3.11
upload_shaders: ON
build_javascript: ON

- name: Linux_GCC_13_Python312
os: ubuntu-22.04
compiler: gcc
compiler_version: "13"
python: 3.12
static_analysis: ON
cmake_config: -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

- name: Linux_GCC_CoverageAnalysis
os: ubuntu-22.04
compiler: gcc
compiler_version: "None"
python: None
coverage_analysis: ON
cmake_config: -DMATERIALX_COVERAGE_ANALYSIS=ON -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_PYTHON=OFF

- name: Linux_Clang_10_Python37
os: ubuntu-20.04
compiler: clang
compiler_version: "10"
python: 3.7
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON
static_analysis: ON

- name: Linux_Clang_14_Python311
- name: Linux_Clang_15_Python312
os: ubuntu-22.04
compiler: clang
compiler_version: "14"
python: 3.11
compiler_version: "15"
python: 3.12
test_render: ON
clang_format: ON

- name: Linux_Clang_14_DynamicAnalysis
- name: Linux_Clang_DynamicAnalysis
os: ubuntu-22.04
compiler: clang
compiler_version: "14"
compiler_version: "15"
python: None
cmake_config: -DMATERIALX_DYNAMIC_ANALYSIS=ON
dynamic_analysis: ON
Expand All @@ -70,17 +78,17 @@ jobs:
cmake_config: -DMATERIALX_BUILD_SHARED_LIBS=ON
python: 3.7

- name: MacOS_Xcode_13_Python39
os: macos-12
compiler: xcode
compiler_version: "13.4"
python: 3.9

- name: MacOS_Xcode_14_Python311
os: macos-13
compiler: xcode
compiler_version: "14.3"
python: 3.11

- name: MacOS_Xcode_15_Python312
os: macos-13
compiler: xcode
compiler_version: "15.0"
python: 3.12
test_shaders: ON

- name: iOS_Xcode_15
Expand All @@ -96,18 +104,19 @@ jobs:
python: 3.7
cmake_config: -G "Visual Studio 16 2019" -A "Win32" -DMATERIALX_BUILD_SHARED_LIBS=ON

- name: Windows_VS2022_x64_Python39
- name: Windows_VS2022_x64_Python311
os: windows-2022
architecture: x64
python: 3.9
python: 3.11
cmake_config: -G "Visual Studio 17 2022" -A "x64"
test_shaders: ON

- name: Windows_VS2022_x64_Python311
- name: Windows_VS2022_x64_Python312
os: windows-2022
architecture: x64
python: 3.11
python: 3.12
cmake_config: -G "Visual Studio 17 2022" -A "x64"
test_shaders: ON
upload_shaders: ON

steps:
- name: Sync Repository
Expand All @@ -120,28 +129,32 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install xorg-dev mesa-utils
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.compiler_version }} g++-${{ matrix.compiler_version }}-multilib
echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.compiler_version }} libc++-${{ matrix.compiler_version }}-dev libc++abi-${{ matrix.compiler_version }}-dev
echo "CC=clang-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
if [ "${{ matrix.compiler_version }}" != 'None' ]; then
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.compiler_version }} g++-${{ matrix.compiler_version }}-multilib
echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
else
sudo apt-get install -y clang-${{ matrix.compiler_version }} libc++-${{ matrix.compiler_version }}-dev libc++abi-${{ matrix.compiler_version }}-dev
echo "CC=clang-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=clang++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
fi
fi
- name: Install Dependencies (MacOS)
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.compiler }}" = "gcc" ]; then
brew install gcc@${{ matrix.compiler_version }}
echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
else
ls -ls /Applications/
sudo xcode-select -switch /Applications/Xcode_${{ matrix.compiler_version }}.app
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
if [ "${{ matrix.compiler_version }}" != 'None' ]; then
if [ "${{ matrix.compiler }}" = "gcc" ]; then
brew install gcc@${{ matrix.compiler_version }}
echo "CC=gcc-${{ matrix.compiler_version }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.compiler_version }}" >> $GITHUB_ENV
else
ls -ls /Applications/
sudo xcode-select -switch /Applications/Xcode_${{ matrix.compiler_version }}.app
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
fi
fi
- name: Install Dependencies (Windows)
Expand All @@ -160,6 +173,10 @@ jobs:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.architecture }}

- name: Install Python Dependencies
if: matrix.python != 'None'
run: pip install setuptools

- name: Install Emscripten
if: matrix.build_javascript == 'ON'
run: |
Expand All @@ -178,17 +195,13 @@ jobs:

- name: Run Clang Format
if: matrix.clang_format == 'ON'
run: find source \( -name *.h -o -name *.cpp -o -name *.mm \) ! -path "*/External/*" ! -path "*/NanoGUI/*" | xargs clang-format -i --verbose
run: find source \( -name *.h -o -name *.cpp -o -name *.mm -o -name *.inl \) ! -path "*/External/*" ! -path "*/NanoGUI/*" | xargs clang-format -i --verbose

- name: CMake Generate
run: |
mkdir build
cd build
cmake -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_TEST_RENDER=OFF -DMATERIALX_WARNINGS_AS_ERRORS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ${{matrix.cmake_config}} ..
run: cmake -S . -B build -DMATERIALX_BUILD_PYTHON=ON -DMATERIALX_BUILD_VIEWER=ON -DMATERIALX_BUILD_GRAPH_EDITOR=ON -DMATERIALX_TEST_RENDER=OFF -DMATERIALX_WARNINGS_AS_ERRORS=ON ${{matrix.cmake_config}}

- name: CMake Build
run: cmake --build . --target install --config Release --parallel 2
working-directory: build
run: cmake --build build --target install --config Release --parallel 2

- name: CMake Unit Tests
run: ctest -VV --output-on-failure --build-config Release
Expand Down Expand Up @@ -222,6 +235,14 @@ jobs:
run: |
python python/Scripts/generateshader.py resources/Materials/Examples/StandardSurface --target msl --validator "xcrun metal --language=metal" --validatorArgs="-w"
- name: Coverage Analysis Tests
if: matrix.coverage_analysis == 'ON'
run: |
sudo apt-get install gcovr
mkdir coverage
gcovr --html --html-details --output coverage/index.html --exclude .*\/External\/.* --root .. .
working-directory: build

- name: Static Analysis Tests
if: matrix.static_analysis == 'ON' && runner.os == 'Linux'
run: |
Expand Down Expand Up @@ -279,17 +300,20 @@ jobs:
name: Renders_${{ matrix.name }}
path: build/render/*.png

- name: Upload Coverage Report
uses: actions/upload-artifact@v3
if: matrix.coverage_analysis == 'ON'
with:
name: MaterialX_Coverage
path: build/coverage

- name: JavaScript CMake Generate
if: matrix.build_javascript == 'ON'
run: |
mkdir javascript/build
cd javascript/build
cmake -DMATERIALX_BUILD_JS=ON -DMATERIALX_EMSDK_PATH=${{ env.EMSDK }} -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_TESTS=OFF -DMATERIALX_BUILD_GEN_OSL=OFF -DMATERIALX_BUILD_GEN_MDL=OFF ../..
run: cmake -S . -B javascript/build -DMATERIALX_BUILD_JS=ON -DMATERIALX_EMSDK_PATH=${{ env.EMSDK }}

- name: JavaScript CMake Build
if: matrix.build_javascript == 'ON'
run: cmake --build . --target install --config Release --parallel 2
working-directory: javascript/build
run: cmake --build javascript/build --target install --config Release --parallel 2

- name: JavaScript Unit Tests
if: matrix.build_javascript == 'ON'
Expand Down
53 changes: 33 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(MATERIALX_BUILD_VERSION 9)
set(MATERIALX_LIBRARY_VERSION ${MATERIALX_MAJOR_VERSION}.${MATERIALX_MINOR_VERSION}.${MATERIALX_BUILD_VERSION})

# Cmake setup
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_MACOSX_RPATH ON)
Expand Down Expand Up @@ -45,27 +45,37 @@ option(MATERIALX_BUILD_GEN_MSL "Build the MSL shader generator back-end." ON)
option(MATERIALX_BUILD_RENDER "Build the MaterialX Render modules." ON)
option(MATERIALX_BUILD_OIIO "Build OpenImageIO support for MaterialXRender." OFF)
option(MATERIALX_BUILD_TESTS "Build unit tests." ON)
option(MATERIALX_BUILD_BENCHMARK_TESTS "Build benchmark tests." OFF)

option(MATERIALX_BUILD_SHARED_LIBS "Build MaterialX libraries as shared rather than static." OFF)
option(MATERIALX_PYTHON_LTO "Enable link-time optimizations for MaterialX Python." ON)
option(MATERIALX_INSTALL_PYTHON "Install the MaterialX Python package as a third-party library when the install target is built." ON)
option(MATERIALX_INSTALL_RESOURCES "Install the resources folder when building render modules." ON)
option(MATERIALX_TEST_RENDER "Run rendering tests for MaterialX Render module. GPU required for graphics validation." ON)
option(MATERIALX_WARNINGS_AS_ERRORS "Interpret all compiler warnings as errors." OFF)
option(MATERIALX_COVERAGE_ANALYSIS "Build MaterialX libraries with coverage analysis on supporting platforms." OFF)
option(MATERIALX_DYNAMIC_ANALYSIS "Build MaterialX libraries with dynamic analysis on supporting platforms." OFF)
option(MATERIALX_OSL_LEGACY_CLOSURES "Build OSL shader generation supporting the legacy OSL closures." ON)

option(MATERIALX_BUILD_IOS "Build MaterialX for iOS." OFF)
if (MATERIALX_BUILD_IOS)
set(CMAKE_SYSTEM_NAME iOS)
add_definitions(-DTARGET_OS_IOS=1)
set(MATERIALX_BUILD_PYTHON OFF)
set(MATERIALX_BUILD_VIEWER OFF)
set(MATERIALX_BUILD_GRAPH_EDITOR OFF)
set(MATERIALX_BUILD_GEN_GLSL OFF)
set(MATERIALX_BUILD_GEN_OSL OFF)
set(MATERIALX_BUILD_GEN_MDL OFF)
set(MATERIALX_BUILD_TESTS OFF)
set(MATERIALX_BUILD_PYTHON OFF)
set(MATERIALX_BUILD_VIEWER OFF)
set(MATERIALX_BUILD_GRAPH_EDITOR OFF)
set(MATERIALX_BUILD_GEN_GLSL OFF)
set(MATERIALX_BUILD_GEN_OSL OFF)
set(MATERIALX_BUILD_GEN_MDL OFF)
set(MATERIALX_BUILD_TESTS OFF)
endif()

if (MATERIALX_BUILD_JS)
set(MATERIALX_BUILD_GEN_OSL OFF)
set(MATERIALX_BUILD_GEN_MSL OFF)
set(MATERIALX_BUILD_GEN_MDL OFF)
set(MATERIALX_BUILD_RENDER OFF)
set(MATERIALX_BUILD_TESTS OFF)
endif()

set(MATERIALX_PYTHON_VERSION "" CACHE STRING
Expand All @@ -79,10 +89,6 @@ set(MATERIALX_PYTHON_PYBIND11_DIR "" CACHE PATH

set(MATERIALX_OIIO_DIR "" CACHE PATH "Path to the root folder of the OpenImageIO installation.")

if (MATERIALX_BUILD_JS)
set(MATERIALX_BUILD_GEN_GLSL ON)
endif()

# Settings to define installation layout
set(MATERIALX_INSTALL_INCLUDE_PATH "include" CACHE STRING "Install header include path (e.g. 'inc', 'include').")
set(MATERIALX_INSTALL_LIB_PATH "lib" CACHE STRING "Install lib path (e.g. 'libs', 'lib').")
Expand Down Expand Up @@ -130,6 +136,7 @@ mark_as_advanced(MATERIALX_BUILD_GEN_MSL)
mark_as_advanced(MATERIALX_BUILD_RENDER)
mark_as_advanced(MATERIALX_BUILD_OIIO)
mark_as_advanced(MATERIALX_BUILD_TESTS)
mark_as_advanced(MATERIALX_BUILD_BENCHMARK_TESTS)
mark_as_advanced(MATERIALX_BUILD_SHARED_LIBS)
mark_as_advanced(MATERIALX_NAMESPACE_SUFFIX)
mark_as_advanced(MATERIALX_LIBNAME_SUFFIX)
Expand All @@ -138,6 +145,7 @@ mark_as_advanced(MATERIALX_INSTALL_PYTHON)
mark_as_advanced(MATERIALX_INSTALL_RESOURCES)
mark_as_advanced(MATERIALX_TEST_RENDER)
mark_as_advanced(MATERIALX_WARNINGS_AS_ERRORS)
mark_as_advanced(MATERIALX_COVERAGE_ANALYSIS)
mark_as_advanced(MATERIALX_DYNAMIC_ANALYSIS)
mark_as_advanced(MATERIALX_PYTHON_VERSION)
mark_as_advanced(MATERIALX_PYTHON_EXECUTABLE)
Expand Down Expand Up @@ -175,6 +183,9 @@ endif()
if(MATERIALX_TEST_RENDER)
add_definitions(-DMATERIALX_TEST_RENDER)
endif()
if (MATERIALX_BUILD_BENCHMARK_TESTS)
add_definitions(-DMATERIALX_BUILD_BENCHMARK_TESTS)
endif()

if (MATERIALX_BUILD_GEN_MDL)
add_definitions(-DMATERIALX_MDLC_EXECUTABLE=\"${MATERIALX_MDLC_EXECUTABLE}\")
Expand Down Expand Up @@ -228,6 +239,10 @@ else()
if(MATERIALX_WARNINGS_AS_ERRORS)
add_compile_options(-Werror)
endif()
if(MATERIALX_COVERAGE_ANALYSIS)
add_compile_options(--coverage -O0)
add_link_options(--coverage)
endif()
if(MATERIALX_DYNAMIC_ANALYSIS)
set(DYNAMIC_ANALYSIS_OPTIONS -fsanitize=address -fsanitize=leak -fsanitize=undefined -fno-sanitize-recover=all)
add_compile_options(${DYNAMIC_ANALYSIS_OPTIONS})
Expand Down Expand Up @@ -328,14 +343,12 @@ if(MATERIALX_BUILD_JS)
add_subdirectory(source/JsMaterialX)
endif()

if(${CMAKE_VERSION} VERSION_GREATER "3.6.2")
if(MATERIALX_BUILD_VIEWER)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MaterialXView)
elseif(MATERIALX_BUILD_GRAPH_EDITOR)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MaterialXGraphEditor)
elseif(MATERIALX_BUILD_TESTS)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MaterialXTest)
endif()
if(MATERIALX_BUILD_VIEWER)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MaterialXView)
elseif(MATERIALX_BUILD_GRAPH_EDITOR)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MaterialXGraphEditor)
elseif(MATERIALX_BUILD_TESTS)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MaterialXTest)
endif()

# Install root-level documents
Expand Down
Loading

0 comments on commit 7e8bd86

Please sign in to comment.