Skip to content

Commit

Permalink
Merge branch 'AcademySoftwareFoundation:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoryD2017 committed Dec 3, 2023
2 parents f4462a6 + eb24c5e commit 61ea1dc
Show file tree
Hide file tree
Showing 29 changed files with 192 additions and 116 deletions.
37 changes: 16 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ 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
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
Expand All @@ -52,20 +54,19 @@ jobs:
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 Down Expand Up @@ -197,10 +198,7 @@ jobs:
run: find source \( -name *.h -o -name *.cpp -o -name *.mm \) ! -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
Expand Down Expand Up @@ -312,10 +310,7 @@ jobs:

- 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'
Expand Down
42 changes: 22 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 @@ -61,13 +61,21 @@ 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 @@ -81,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 @@ -339,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
8 changes: 3 additions & 5 deletions javascript/build_javascript_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ if NOT ["%errorlevel%"]==["0"] pause
@echo --------------------- Build MaterialX With JavaScript ---------------------
@echo on
cd %MATERIALX_LOCATION%
mkdir javascript\build
cd javascript\build
cmake -DMATERIALX_BUILD_JS=ON -DMATERIALX_EMSDK_PATH=%EMSDK_LOCATION% -G Ninja -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_TESTS=OFF -DMATERIALX_BUILD_GEN_OSL=OFF -DMATERIALX_BUILD_GEN_MDL=OFF ..\..
cmake --build . --target install --config RelWithDebInfo --parallel 2
cmake -S . -B javascript/build -DMATERIALX_BUILD_JS=ON -DMATERIALX_EMSDK_PATH=%EMSDK_LOCATION% -G Ninja
cmake --build javascript/build --target install --config RelWithDebInfo --parallel 2
if NOT ["%errorlevel%"]==["0"] pause
@echo --------------------- Run JavaScript Tests ---------------------
@echo on
cd ../MaterialXTest
cd javascript/MaterialXTest
call npm install
call npm run test
call npm run test:browser
Expand Down
3 changes: 1 addition & 2 deletions python/Scripts/baketextures.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import sys, os, argparse
from sys import platform

import MaterialX as mx
from MaterialX import PyMaterialXGenShader
from MaterialX import PyMaterialXGenGlsl
from MaterialX import PyMaterialXRender as mx_render
from MaterialX import PyMaterialXRenderGlsl as mx_render_glsl
if platform == "darwin":
Expand Down
9 changes: 5 additions & 4 deletions python/Scripts/generateshader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
'''

import sys, os, argparse, subprocess

import MaterialX as mx
import MaterialX.PyMaterialXGenShader as mx_gen_shader
import MaterialX.PyMaterialXGenGlsl as mx_gen_glsl
import MaterialX.PyMaterialXGenOsl as mx_gen_osl
import MaterialX.PyMaterialXGenMdl as mx_gen_mdl
import MaterialX.PyMaterialXGenMsl as mx_gen_msl
import MaterialX.PyMaterialXGenOsl as mx_gen_osl
import MaterialX.PyMaterialXGenShader as mx_gen_shader

def validateCode(sourceCodeFile, codevalidator, codevalidatorArgs):
if codevalidator:
Expand All @@ -24,7 +25,7 @@ def validateCode(sourceCodeFile, codevalidator, codevalidatorArgs):
print(cmd_flatten)
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
result = output.decode(encoding='utf-8')
return output.decode(encoding='utf-8')
except subprocess.CalledProcessError as out:
return (out.output.decode(encoding='utf-8'))
return ""
Expand Down Expand Up @@ -82,7 +83,7 @@ def main():
try:
mx.loadLibraries(libraryFolders, searchPath, stdlib)
doc.importLibrary(stdlib)
except err:
except Exception as err:
print('Generation failed: "', err, '"')
sys.exit(-1)

Expand Down
10 changes: 6 additions & 4 deletions python/Scripts/genmdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
Generate MDL implementation directory based on MaterialX nodedefs
'''

import sys
import os
import string; os.environ['PYTHONIOENCODING'] = 'utf-8'
import sys

os.environ['PYTHONIOENCODING'] = 'utf-8'

import MaterialX as mx

def usage():
Expand Down Expand Up @@ -345,7 +347,7 @@ def main():

doc = mx.createDocument()
searchPath = os.path.join(_startPath, 'libraries')
libraryPath = os.path.join(searchPath, 'stdlib')
libraryPath = os.path.join(searchPath, LIBRARY)
_loadLibraries(doc, searchPath, libraryPath)

DEFINITION_PREFIX = 'ND_'
Expand Down Expand Up @@ -522,7 +524,7 @@ def main():
if isinstance(elem, mx.Output):
outputValue = elem.getAttribute('default')
if outputValue == '[]':
outputvalue = ''
outputValue = ''
if not outputValue:
outputValue = elem.getAttribute('defaultinput')
if outputValue:
Expand Down
4 changes: 3 additions & 1 deletion python/Scripts/mxdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Print markdown documentation for each nodedef in the given document.
'''

import sys, os, argparse
import argparse
import sys

import MaterialX as mx

HEADERS = ('Name', 'Type', 'Default Value',
Expand Down
4 changes: 3 additions & 1 deletion python/Scripts/mxformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
the documents to the latest version of the standard.
'''

import sys, os, argparse
import argparse
import os

import MaterialX as mx

def main():
Expand Down
6 changes: 4 additions & 2 deletions python/Scripts/mxvalidate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Verify that the given file is a valid MaterialX document.
'''

import sys, os, argparse
import argparse
import sys

import MaterialX as mx

def main():
Expand All @@ -25,7 +27,7 @@ def main():
stdlib = mx.createDocument()
try:
mx.loadLibraries(mx.getDefaultDataLibraryFolders(), mx.getDefaultDataSearchPath(), stdlib)
except err:
except Exception as err:
print(err)
sys.exit(0)
doc.importLibrary(stdlib)
Expand Down
6 changes: 2 additions & 4 deletions python/Scripts/translateshader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
'''

import sys, os, argparse
import MaterialX as mx

from sys import platform

import MaterialX as mx
from MaterialX import PyMaterialXGenShader as mx_gen_shader
from MaterialX import PyMaterialXGenGlsl as ms_gen_glsl
from MaterialX import PyMaterialXRender as mx_render
from MaterialX import PyMaterialXRenderGlsl as mx_render_glsl
if platform == "darwin":
from MaterialX import PyMaterialXGenMsl as ms_gen_msl
from MaterialX import PyMaterialXRenderMsl as mx_render_msl

def main():
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXCore/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const std::tuple<int, int, int> LIBRARY_VERSION_TUPLE(MATERIALX_MAJOR_VERSION,

bool invalidNameChar(char c)
{
return !isalnum(c) && c != '_' && c != ':';
return !isalnum((unsigned char) c) && c != '_' && c != ':';
}

} // anonymous namespace
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXFormat/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const string MATERIALX_SEARCH_PATH_ENV_VAR = "MATERIALX_SEARCH_PATH";

inline bool hasWindowsDriveSpecifier(const string& val)
{
return (val.length() > 1 && std::isalpha(val[0]) && (val[1] == ':'));
return (val.length() > 1 && std::isalpha((unsigned char) val[0]) && (val[1] == ':'));
}

//
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXGraphEditor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (NOT IS_DIRECTORY "${DEAR_IMGUI_PREFIX}/backends")
endif()

if(MSVC)
add_compile_options(-wd4100)
add_compile_options(-wd4100 -wd4152 -wd4201 -wd4244 -wd4456)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-unused -Wno-deprecated -Wno-comment -Wno-unused-variable)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
Expand Down
Loading

0 comments on commit 61ea1dc

Please sign in to comment.