Skip to content

Instantly share code, notes, and snippets.

@chrisheckey
Last active September 15, 2018 02:26
Show Gist options
  • Save chrisheckey/97d8cf4c52097316bcbe170b8a16b396 to your computer and use it in GitHub Desktop.
Save chrisheckey/97d8cf4c52097316bcbe170b8a16b396 to your computer and use it in GitHub Desktop.
Build OpenVDB Maya Plugin
@echo off
rem works with https://github.com/chrisheckey/openvdb/tree/win_build
call :DATETIME
echo Started Building OpenVDB on %_DATETIME%
title OpenVDB Build %_DATETIME%
setlocal
:: Clone
set ROOT_DIR=%~dp0
set CLONE_DIR=openvdb
set CLONE_ROOT=%ROOT_DIR%%CLONE_DIR%
set INSTALL_DIR=install
set INSTALL_ROOT=%ROOT_DIR%%INSTALL_DIR%
if exist %CLONE_ROOT% del /f /q %CLONE_ROOT% && rmdir /s /q %CLONE_ROOT%\
if exist %CLONE_ROOT% del /f /q %CLONE_ROOT% && rmdir /s /q %CLONE_ROOT%\
git clone https://github.com/chrisheckey/openvdb.git --branch win_build --depth 10 %CLONE_DIR%
cd %CLONE_ROOT%
if exist %INSTALL_ROOT% move %INSTALL_ROOT% %INSTALL_ROOT%_%_DATETIME%
mkdir %INSTALL_ROOT%
mkdir %INSTALL_ROOT%\maya2018
:: Settings
set OPENVDB_ABI="4"
set SHARED=ON
set STATIC=OFF
rem Put Boost in the DEPS_DIR before running
set DEPS_DIR=%~dp0deps
set CMAKE_GENERATOR="Visual Studio 14 2015 Win64"
set VCPKG_ROOT=G:/Dropbox/Dev/Win/vcpkg
set VCPKG_x64_SHARED_ROOT=%VCPKG_ROOT%/installed/x64-windows
set VCPKG_x64_STATIC_ROOT=%VCPKG_ROOT%/installed/x64-windows-static
:: Install Packages with vcpkg before running
rem vcpkg install glew glfw3 zlib blosc openexr tbb cppunit
rem vcpkg integrate install
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%VCPKG_x64_SHARED_ROOT%
set BOOST_ROOT=%DEPS_DIR%\boost_1_67_0
set BOOST_LIBRARYDIR=%BOOST_ROOT%\lib64-msvc-14.0
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_ROOT%
set PYTHON_ROOT="G:/Dropbox/Dev/Win/Pythons/msc-1900/2.7.11"
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%PYTHON_ROOT%
set MAYA_ROOT="C:/Program Files/Autodesk/Maya2018"
:: Check for Build Type
if "%~1"=="maya" (
set MAYA_BUILD=ON
set TBB_ROOT=%MAYA_ROOT%
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%MAYA_ROOT%
) else (
set MAYA_BUILD=OFF
set TBB_ROOT=%VCPKG_x64_SHARED_ROOT%
)
:: Build
mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ^
-DCMAKE_CONFIGURATION_TYPES="Release" ^
-DCMAKE_INSTALL_PREFIX=%INSTALL_ROOT% ^
-DOPENVDB_ABI_VERSION_NUMBER=%OPENVDB_ABI% ^
-DUSE_GLFW3=ON ^
-DOPENVDB_SHARED=%SHARED% ^
-DOPENVDB_STATIC=%STATIC% ^
-DOPENVDB_BUILD_TOOLS=OFF ^
-DOPENVDB_BUILD_PYTHON_MODULE=OFF ^
-DOPENVDB_BUILD_UNITTESTS=OFF ^
-DOPENVDB_BUILD_DOCS=OFF ^
-DBOOST_ROOT=%BOOST_ROOT% ^
-DZLIB_INCLUDE_DIR=%VCPKG_x64_STATIC_ROOT%/include ^
-DZLIB_LIBRARY=%VCPKG_x64_STATIC_ROOT%/lib/zlib.lib ^
-DCPPUNIT_LOCATION=%VCPKG_x64_SHARED_ROOT% ^
-DOPENEXR_LOCATION=%VCPKG_x64_SHARED_ROOT% ^
-DILMBASE_LOCATION=%VCPKG_x64_SHARED_ROOT% ^
-DTBB_LOCATION=%TBB_ROOT% ^
-DBLOSC_LOCATION=%VCPKG_x64_SHARED_ROOT% ^
-DGLEW_LOCATION=%VCPKG_x64_SHARED_ROOT% ^
-DGLFW3_LOCATION=%VCPKG_x64_SHARED_ROOT% ^
-DPYTHON_INCLUDE_DIR=%PYTHON_ROOT%/include ^
-DPYTHON_EXECUTABLE=%PYTHON_ROOT%/python.exe ^
-DPYTHON_LIBRARY=%PYTHON_ROOT%/libs/python27.lib ^
-DMAYA_LOCATION=%MAYA_ROOT% ^
-DOPENVDB_BUILD_MAYA_PLUGIN=%MAYA_BUILD% ^
-DOPENVDB_MAYA_INSTALL_MOD=ON ^
-DOPENVDB_MAYA_SUBDIR=OFF ^
-DOPENVDB_MAYA_INSTALL_BASE_DIR=%INSTALL_ROOT%/maya2018 ^
..
rem -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build . --config "Release" --target install
cd %~dp0
GOTO :EOF
:: --------
:DATETIME
set __hr=%time:~0,2%
set __hr=%__hr: =0%
set _DATETIME=%date:~10,4%%date:~4,2%%date:~7,2%_%__hr%h%time:~3,2%m%time:~6,2%s
EXIT /B 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment