Files
UnrealEngine/Engine/Source/ThirdParty/Alembic/BuildForWindows.bat
2025-05-18 13:04:45 +08:00

95 lines
2.8 KiB
Batchfile

@echo off
setlocal
rem Copyright Epic Games, Inc. All Rights Reserved.
set LIBRARY_NAME=Alembic
set REPOSITORY_NAME=alembic
set BUILD_SCRIPT_NAME=%~n0%~x0
set BUILD_SCRIPT_LOCATION=%~dp0
rem Get version and architecture from arguments.
set LIBRARY_VERSION=%1
if [%LIBRARY_VERSION%]==[] goto usage
set ARCH_NAME=%2
if [%ARCH_NAME%]==[] goto usage
rem Set as VS2015 for backwards compatibility even though VS2022 is used
rem when building.
set COMPILER_VERSION_NAME=VS2015
set UE_MODULE_LOCATION=%BUILD_SCRIPT_LOCATION%
set UE_SOURCE_THIRD_PARTY_LOCATION=%UE_MODULE_LOCATION%\..
set IMATH_CMAKE_LOCATION=%UE_SOURCE_THIRD_PARTY_LOCATION%\Imath\Deploy\Imath-3.1.12\%COMPILER_VERSION_NAME%\%ARCH_NAME%\lib\cmake\Imath
set SOURCE_LOCATION=%UE_MODULE_LOCATION%\%REPOSITORY_NAME%-%LIBRARY_VERSION%
set BUILD_LOCATION=%UE_MODULE_LOCATION%\Intermediate
rem Specify all of the include/bin/lib directory variables so that CMake can
rem compute relative paths correctly for the imported targets.
set INSTALL_INCLUDEDIR=include
set INSTALL_BIN_DIR=%COMPILER_VERSION_NAME%\%ARCH_NAME%\bin
set INSTALL_LIB_DIR=%COMPILER_VERSION_NAME%\%ARCH_NAME%\lib
set INSTALL_LOCATION=%UE_MODULE_LOCATION%\Deploy\%REPOSITORY_NAME%-%LIBRARY_VERSION%
set INSTALL_INCLUDE_LOCATION=%INSTALL_LOCATION%\%INSTALL_INCLUDEDIR%
set INSTALL_WIN_ARCH_LOCATION=%INSTALL_LOCATION%\%COMPILER_VERSION_NAME%\%ARCH_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_ARCH_LOCATION% (
rmdir %INSTALL_WIN_ARCH_LOCATION% /S /Q)
mkdir %BUILD_LOCATION%
pushd %BUILD_LOCATION%
set NUM_CPU=8
echo Configuring build for %LIBRARY_NAME% version %LIBRARY_VERSION%...
cmake -G "Visual Studio 17 2022" %SOURCE_LOCATION%^
-A %ARCH_NAME%^
-DCMAKE_INSTALL_PREFIX="%INSTALL_LOCATION%"^
-DCMAKE_PREFIX_PATH="%IMATH_CMAKE_LOCATION%"^
-DCMAKE_INSTALL_INCLUDEDIR="%INSTALL_INCLUDEDIR%"^
-DCMAKE_INSTALL_BINDIR="%INSTALL_BIN_DIR%"^
-DCMAKE_INSTALL_LIBDIR="%INSTALL_LIB_DIR%"^
-DUSE_TESTS=OFF^
-DALEMBIC_SHARED_LIBS=OFF^
-DUSE_BINARIES=OFF^
-DALEMBIC_ILMBASE_LINK_STATIC=ON^
-DCMAKE_DEBUG_POSTFIX=_d
if %errorlevel% neq 0 exit /B %errorlevel%
echo Building %LIBRARY_NAME% for Debug...
cmake --build . --config Debug -j%NUM_CPU%
if %errorlevel% neq 0 exit /B %errorlevel%
echo Installing %LIBRARY_NAME% for Debug...
cmake --install . --config Debug
if %errorlevel% neq 0 exit /B %errorlevel%
echo Building %LIBRARY_NAME% for Release...
cmake --build . --config Release -j%NUM_CPU%
if %errorlevel% neq 0 exit /B %errorlevel%
echo Installing %LIBRARY_NAME% for Release...
cmake --install . --config Release
if %errorlevel% neq 0 exit /B %errorlevel%
popd
echo Done.
goto :eof
:usage
echo Usage: %BUILD_SCRIPT_NAME% ^<version^> ^<architecture: x64 or ARM64^>
exit /B 1
endlocal