Files
UnrealEngineUWP/Engine/Source/ThirdParty/MaterialX/BuildForWindows.bat
matt johnson 0017860286 MaterialX: add build script, build products, and module rules for using MaterialX in the engine on Windows
This change includes MaterialX version 1.38.1 built for use in UE5 on Windows.

The module rules do not currently account for installing the MaterialX standard data
libraries (definitions of pattern and shading nodes) anywhere, so prospective clients
of MaterialX may need to reach directly into the MaterialX deployment for now. This
will be addressed in a subsequent change.

Note also that the "cmake" directory of the installation is excluded from the deployed
build products. There are fixes coming in a future release of MaterialX that place the
"cmake" directory correctly inside the "lib" directory, which is necessary to ensure
that the CMake files generated for the various platforms do not collide. When we
upgrade to that future release, those files can then be added per-platform.

#jira UE-142380
#rb danny.kabrane
#preflight 620c2f12565043444caf23b1

[CL 19039130 by matt johnson in ue5-main branch]
2022-02-17 14:18:59 -05:00

65 lines
1.8 KiB
Batchfile
Executable File

@echo off
setlocal
set MATERIALX_VERSION=1.38.1
rem Set as VS2015 for backwards compatibility even though VS2019 is used
rem when building.
set COMPILER_VERSION_NAME=VS2015
set ARCH_NAME=x64
set UE_MODULE_LOCATION=%cd%
set SOURCE_LOCATION=%UE_MODULE_LOCATION%\MaterialX-%MATERIALX_VERSION%
set BUILD_LOCATION=%UE_MODULE_LOCATION%\Intermediate
set INSTALL_INCLUDEDIR=include
set INSTALL_LIB_DIR=%COMPILER_VERSION_NAME%\%ARCH_NAME%\lib
set INSTALL_LOCATION=%UE_MODULE_LOCATION%\Deploy\MaterialX-%MATERIALX_VERSION%
set INSTALL_INCLUDE_LOCATION=%INSTALL_LOCATION%\%INSTALL_INCLUDEDIR%
set INSTALL_WIN_LOCATION=%INSTALL_LOCATION%\%COMPILER_VERSION_NAME%
if exist %BUILD_LOCATION% (
rmdir %BUILD_LOCATION% /S /Q)
if exist %INSTALL_INCLUDE_LOCATION% (
rmdir %INSTALL_INCLUDE_LOCATION% /S /Q)
if exist %INSTALL_WIN_LOCATION% (
rmdir %INSTALL_WIN_LOCATION% /S /Q)
mkdir %BUILD_LOCATION%
pushd %BUILD_LOCATION%
echo Configuring build for MaterialX version %MATERIALX_VERSION%...
cmake -G "Visual Studio 16 2019" %SOURCE_LOCATION%^
-DCMAKE_INSTALL_PREFIX="%INSTALL_LOCATION%"^
-DMATERIALX_INSTALL_INCLUDE_PATH="%INSTALL_INCLUDEDIR%"^
-DMATERIALX_INSTALL_LIB_PATH="%INSTALL_LIB_DIR%"^
-DMATERIALX_BUILD_TESTS=OFF^
-DMATERIALX_TEST_RENDER=OFF^
-DCMAKE_DEBUG_POSTFIX=_d
if %errorlevel% neq 0 exit /B %errorlevel%
echo Building MaterialX for Debug...
cmake --build . --config Debug -j8
if %errorlevel% neq 0 exit /B %errorlevel%
echo Installing MaterialX for Debug...
cmake --install . --config Debug
if %errorlevel% neq 0 exit /B %errorlevel%
echo Building MaterialX for Release...
cmake --build . --config Release -j8
if %errorlevel% neq 0 exit /B %errorlevel%
echo Installing MaterialX for Release...
cmake --install . --config Release
if %errorlevel% neq 0 exit /B %errorlevel%
popd
echo Done.
endlocal