diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..2673951 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,64 @@ +image: Visual Studio 2017 + +clone_folder: c:\projects\USDPackaging + +branches: + only: + - gbk + +platform: + - x64 + +install: + - ps: $env:USD_YY_VERSION = (Get-Content c:\projects\USD\cmake\defaults\Version.cmake | Where-Object {$_ -match 'PXR_MINOR_VERSION'}).Split("( )")[2].Trim('"').PadLeft(2, "0") + - ps: $env:USD_MM_VERSION = (Get-Content c:\projects\USD\cmake\defaults\Version.cmake | Where-Object {$_ -match 'PXR_PATCH_VERSION'}).Split("( )")[2].Trim('"').PadLeft(2, "0") + - ps: Update-AppveyorBuild -Version "$env:USD_YY_VERSION.$env:USD_MM_VERSION-$env:APPVEYOR_REPO_BRANCH-build$env:APPVEYOR_BUILD_NUMBER" + - ps: Invoke-WebRequest https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2019/Autodesk_Maya_2019_2_Update_DEVKIT_Windows.zip -OutFile devkit_maya2019.zip + - echo "extracting maya devkit 2019 archive..." + - ps: Expand-Archive -Path devkit_maya2019.zip -DestinationPath c:/USDgen/src/devkit_maya2019 -Force + - ps: Invoke-WebRequest https://s3-us-west-2.amazonaws.com/autodesk-adn-transfer/ADN+Extranet/M%26E/Maya/devkit+2018/Autodesk_Maya_2018_6_Update_DEVKIT_Windows.zip -OutFile devkit_maya2018.zip + - echo "extracting maya devkit 2018 archive..." + - ps: Expand-Archive -Path devkit_maya2018.zip -DestinationPath C:/USDgen/src/devkit_maya2018 -Force + +cache: + - C:\USDgen\build\boost -> build_scripts/build_usd.py + - C:\USDgen\build\IlmBase -> build_scripts/build_usd.py + - C:\USDgen\build\OpenEXR -> build_scripts/build_usd.py + - C:\USDgen\build\OpenSubdiv-3_1_1 -> build_scripts/build_usd.py + - C:\USDgen\build\zlib-1.2.11 -> build_scripts/build_usd.py + - C:\USDgen\src -> build_scripts/build_usd.py + +init: + - set PATH=c:/Python27-x64;c:/Python27-x64/Scripts;%PATH% + - C:\"Program Files (x86)"\"Microsoft Visual Studio"\2017\Community\VC\Auxiliary\Build\vcvarsall.bat amd64 + - git clone --single-branch --branch gbk https://github.com/goodbyekansas/USD c:/projects/USD + - git clone --single-branch --branch gbk-master https://github.com/goodbyekansas/maya-usd c:/projects/maya-usd + - git clone https://github.com/goodbyekansas/usd-qt.git c:/projects/usd-qt + +before_build: + - python -m pip install --upgrade pip + - pip install pyside + - pip install PyOpenGL + +build_script: + - cd c:/projects/USD + - python build_scripts/build_usd.py -vvv --build c:/USDgen/build --src c:/USDgen/src %APPVEYOR_BUILD_FOLDER%/USDinst/USD-core + - cd c:/USDgen/build + - dir + - cd c:/projects/maya-usd + - python build.py -v 3 --pxrusd-location %APPVEYOR_BUILD_FOLDER%/USDinst/USD-core --build-args="-DSKIP_USDMAYA_TESTS=ON,-DUFE_INCLUDE_DIR=c:/USDgen/src/devkit_maya2019/devkitBase/devkit/ufe/include,-DUFE_LIBRARY=c:/USDgen/src/devkit_maya2019/devkitBase/devkit/ufe/lib,-DMAYA_INCLUDE_DIRS=c:/USDgen/src/devkit_maya2019/devkitBase/include" --install-location c:/Usdinst/maya-usd-2019 /tmp/workspace_maya2019 --devkit-location=c:/USDgen/src/devkit_maya2019/devkitBase/devkit + - python build.py -v 3 --pxrusd-location %APPVEYOR_BUILD_FOLDER%/USDinst/USD-core --build-args="-DSKIP_USDMAYA_TESTS=ON,-DUFE_INCLUDE_DIR=c:/USDgen/src/devkit_maya2018/devkitBase/devkit/ufe/include,-DUFE_LIBRARY=c:/USDgen/src/devkit_maya2018/devkitBase/devkit/ufe/lib,-DMAYA_INCLUDE_DIRS=c:/USDgen/src/devkit_maya2018/devkitBase/include" --install-location c:/Usdinst/maya-usd-2018 /tmp/workspace_maya2018 --devkit-location=c:/USDgen/src/devkit_maya2018/devkitBase/devkit + +artifacts: + - path: USDInst + name: USD.19 + type: zip + +deploy: + - provider: GitHub + artifact: USD.19.zip + draft: false + prerelease: True + on: + branch: dev + diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml new file mode 100644 index 0000000..64dc329 --- /dev/null +++ b/.github/workflows/windows.yaml @@ -0,0 +1,74 @@ +name: Windows Packaging +on: push + +jobs: + build-core: + name: Build USD Core + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - name: Get version for USD GBK fork + run: echo "::set-env name=USD_REF::$((Get-Content .\versions.json | ConvertFrom-Json).core)" + - name: Checkout USD GBK fork + uses: actions/checkout@v1 + with: + repository: goodbyekansas/USD + ref: ${{ env.USD_REF }} + path: usd-core + - name: Set up Python 2.7 Environment + uses: actions/setup-python@v1 + with: + python-version: '2.7.x' + architecture: 'x64' + - name: Install Python prereqs + run: | + pip install PySide PyOpenGL Jinja2 + - name: Build USD Core + run: | + . ./windows/latest-vs.ps1 + ./windows/build-usd-core.ps1 -pythondir "$Env:pythonLocation" -installdir ../result/usd-core -srcdir ../usd-core -builddir ../build/usd-core + - name: Zip USD Core Installed Files + run: 7z a usd-core-windows.zip ..\result\usd-core\* + - name: Upload USD Core Installation + uses: actions/upload-artifact@v1 + with: + name: usd-core-windows + path: usd-core-windows.zip + + build-usd-maya-2019: + name: Build USD Maya 2019 + runs-on: windows-latest + needs: build-core + steps: + - uses: actions/checkout@v1 + - name: Checkout Maya USD GBK fork + uses: actions/checkout@v1 + with: + repository: goodbyekansas/maya-usd + ref: gbk-master + path: usd-maya + - name: Set up Python 2.7 Environment + uses: actions/setup-python@v1 + with: + python-version: '2.7.x' + architecture: 'x64' + - name: Download USD core build + uses: actions/download-artifact@v1 + with: + name: usd-core-windows + path: ../result/usd-core + - name: Download Maya 2019 DevKit + run: | + Invoke-WebRequest https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2019/Autodesk_Maya_2019_2_Update_DEVKIT_Windows.zip -OutFile devkit_maya2019.zip + Expand-Archive -Path devkit_maya2019.zip -DestinationPath ..\maya-devkit -Force + - name: Install Python prereqs + run: pip install PySide PyOpenGL Jinja2 + - name: Compile USD Maya 2019 + run: ./windows/build-maya-usd.ps1 -srcdir ../usd-maya -builddir ../build/usd-maya -pythondir $Env:pythonLocation -usdcorelocation ../result/usd-core -patchdir ./windows/patches -devkitlocation ../maya-devkit -installdir ../result/usd-maya + - name: Zip all the files + run: 7z a usd-maya-2019-windows.zip ..\result\usd-maya\* + - name: Upload USD Maya 2019 build + uses: actions/upload-artifact@v1 + with: + name: usd-maya-2019 + path: usd-maya-2019-windows.zip diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bead760 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +sources +result diff --git a/README.md b/README.md index 0621e24..1528285 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ # USDPackaging Packaging for USD on Windows and Linux + +# Building on Windows + +- Download and install Visual Studio 2019 (Community Edition is fine) from + [here](https://visualstudio.microsoft.com/downloads/). Make sure to select the "Desktop development with C++" workload during the installation. +- Make sure Python 2 is installed and available in PATH + +## USD Core +- Open a powershell prompt with administrative permissions. +- First, some environment variables need to be set up for Visual Studio. This is done by using the + Powershell script at `./windows/latest-vs.ps1` like this: + ```shell + . ./windows/latest-vs.ps1 + ``` +- Kick off the build process by issuing: +```shell +./windows/build-usd-core.ps1 -installdir -srcdir -builddir +``` + +You can also use the python build script in the USD core sync directly but our powershell script +makes sure to set needed boost options for building maya USD later. + +## USD Maya diff --git a/maya-devkit.nix b/maya-devkit.nix new file mode 100644 index 0000000..e42f5ec --- /dev/null +++ b/maya-devkit.nix @@ -0,0 +1,16 @@ +{ nixpkgs ? import {} }: +with nixpkgs; +stdenv.mkDerivation { + name = "maya-devkit"; + src = fetchurl { + url = "https://autodesk-adn-transfer.s3-us-west-2.amazonaws.com/ADN+Extranet/M%26E/Maya/devkit+2019/Autodesk_Maya_2019_2_Update_DEVKIT_Linux.tgz"; + sha256 = "11v7hi1n01j7p7wkqabdjllndkic96mv6nq83rqh845psc684hs1"; + }; + + phases = [ "unpackPhase" "buildPhase" ]; + + buildPhase = '' + cp -r . $out + ''; +} + diff --git a/maya-usd.nix b/maya-usd.nix new file mode 100644 index 0000000..b323461 --- /dev/null +++ b/maya-usd.nix @@ -0,0 +1,43 @@ +{ nixpkgs ? import {} }: +let + usd-core = nixpkgs.callPackage ./usd-core.nix {}; + maya-devkit = nixpkgs.callPackage ./maya-devkit.nix {}; +in + with nixpkgs; + (overrideCC stdenv gcc6).mkDerivation { + name = "maya-usd"; + nativeBuildInputs = [ + cmake + git + cacert + ]; + + buildInputs = [ + libGL + usd-core + python27 + maya-devkit + python27Packages.jinja2 + python27Packages.pyopengl + python27Packages.pyside2 + xorg.libX11 + ]; + + src = fetchFromGitHub { + owner = "goodbyekansas"; + repo = "maya-usd"; + rev = "master"; + sha256 = "0idwxim4hfgkjv22rdikpbjzrm8zr7s6rfhlbp95ai4xb59zp0p0"; + }; + + + + phases = [ "unpackPhase" "buildPhase" ]; + + buildPhase = '' + ls ${usd-core}/bin + export PATH=${usd-core}/bin:$PATH + ${python27}/bin/python build.py --pxrusd-location ${usd-core} --maya-location /usr/autodesk/maya2019 --build-args="-DSKIP_USDMAYA_TESTS=ON" --install-location $out /tmp/workspace + ''; + } + diff --git a/usd-core.nix b/usd-core.nix new file mode 100644 index 0000000..be67e53 --- /dev/null +++ b/usd-core.nix @@ -0,0 +1,40 @@ +{ nixpkgs ? import {} }: +let + pyenv = (nixpkgs.python27.withPackages (ps: with ps; [ pyside2 jinja2 pyopengl pyside2-tools ])); +in +with nixpkgs; +gcc6Stdenv.mkDerivation { + name = "USD-Core"; + nativeBuildInputs = [ + cmake + cacert + ]; + + buildInputs = [ + glew + xorg.libXxf86vm + xorg.libXrandr + xorg.libXcursor + xorg.libXinerama + xorg.libXi + zlib + ]; + + propagatedBuildInputs = [ + pyenv + ]; + + src = fetchFromGitHub { + owner = "goodbyekansas"; + repo = "USD"; + rev = "gbk"; + sha256 = "0i9b42sncs7mbg60198x6xzm8zr93g3c0pk0iwwf2srmn4vfz5cz"; + }; + + phases = [ "unpackPhase" "buildPhase" ]; + + TBB_PLATFORM=linux; + buildPhase = '' + ${pyenv}/bin/python build_scripts/build_usd.py --build-args boost,"--with-date_time --with-thread --with-system --with-filesystem" --no-maya -v $out/ + ''; +} diff --git a/versions.json b/versions.json new file mode 100644 index 0000000..2ebf058 --- /dev/null +++ b/versions.json @@ -0,0 +1,4 @@ +{ + "core": "6bb97b31ccf6cbc5919aa1b376798ddf226e82cd", + "maya": "gbk-master" +} diff --git a/windows/build-maya-usd.ps1 b/windows/build-maya-usd.ps1 new file mode 100644 index 0000000..f39c9a9 --- /dev/null +++ b/windows/build-maya-usd.ps1 @@ -0,0 +1,30 @@ +param ( + [Parameter(Mandatory=$true)][string]$srcdir, + [Parameter(Mandatory=$true)][string]$builddir, + [Parameter(Mandatory=$true)][string]$installdir, + [Parameter(Mandatory=$true)][string]$usdcorelocation, + [Parameter(Mandatory=$true)][string]$devkitlocation, + [string]$pythondir = "C:\Python27", + [Parameter(Mandatory=$true)][string]$patchdir + ) + +# these need to be full paths for CMake to find things +$usdcorelocation = (Resolve-Path $usdcorelocation).Path +$devkitlocation = (Resolve-Path $devkitlocation).Path + +echo "Applying patches to usd core..." +git apply --directory=$usdcorelocation --unsafe-paths (get-item $patchdir\*.patch) + +if ($?) { + echo "Patches applied" +} else { + echo "Failed to apply patches, exiting..." + #exit 1 +} + +python $srcdir/build.py $builddir ` +--devkit-location $devkitlocation/devkitBase ` +--pxrusd-location $usdcorelocation ` +--install-location $installdir ` +--generator "Visual Studio 16 2019" ` +--build-relwithdebug diff --git a/windows/build-usd-core.ps1 b/windows/build-usd-core.ps1 new file mode 100644 index 0000000..eaa9e5e --- /dev/null +++ b/windows/build-usd-core.ps1 @@ -0,0 +1,26 @@ +param ( + [string]$pythondir, + [string]$installdir = "installed", + [Parameter(Mandatory=$true)][string]$srcdir, + [Parameter(Mandatory=$true)][string]$builddir + ) + +$srcdir = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($srcdir) +$installdir = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($installdir) +$builddir = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($builddir) + +$pythondirarg = "" +if ($pythondir) { + $pythondirarg = "-DPython_ROOT_DIR='$pythondir' -DPython_EXECUTABLE='$pythondir\python.exe'" +} + +$usdoptions = "" +if ($pythondirarg) { + $usdoptions = "USD,$pythondirarg" +} + +python $srcdir/build_scripts/build_usd.py ` +--build $builddir/build ` +--src $builddir/src ` +$installdir ` +--build-args $usdoptions boost,"--with-date_time --with-thread --with-system --with-filesystem" diff --git a/windows/latest-vs.ps1 b/windows/latest-vs.ps1 new file mode 100644 index 0000000..3ab6ddb --- /dev/null +++ b/windows/latest-vs.ps1 @@ -0,0 +1,6 @@ +$vswhere = "$Env:ProgramFiles (x86)\Microsoft Visual Studio\Installer\vswhere.exe" +$installationPath = & $vswhere -latest -property installationPath +& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -no_logo -arch=amd64 && set" | foreach-object { + $name, $value = $_ -split '=', 2 + set-content env:\"$name" $value +} diff --git a/windows/patches/hdstream.patch b/windows/patches/hdstream.patch new file mode 100644 index 0000000..f6f3339 --- /dev/null +++ b/windows/patches/hdstream.patch @@ -0,0 +1,11 @@ +--- a/cmake/pxrTargets-release.cmake ++++ b/cmake/pxrTargets-release.cmake +@@ -343,7 +343,7 @@ set_target_properties(hdStream PROPERTIES + ) + + list(APPEND _IMPORT_CHECK_TARGETS hdStream ) +-list(APPEND _IMPORT_CHECK_FILES_FOR_hdStream "${_IMPORT_PREFIX}/plugin/usd/hdStream.lib" "${_IMPORT_PREFIX}/plugin/usd/hdStream.dll" ) ++# list(APPEND _IMPORT_CHECK_FILES_FOR_hdStream "${_IMPORT_PREFIX}/plugin/usd/hdStream.lib" "${_IMPORT_PREFIX}/plugin/usd/hdStream.dll" ) + + # Import target "usdImaging" for configuration "Release" + set_property(TARGET usdImaging APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) diff --git a/windows/patches/usddancingcubes.patch b/windows/patches/usddancingcubes.patch new file mode 100644 index 0000000..49ee517 --- /dev/null +++ b/windows/patches/usddancingcubes.patch @@ -0,0 +1,11 @@ +--- a/cmake/pxrTargets-release.cmake ++++ b/cmake/pxrTargets-release.cmake +@@ -433,7 +433,7 @@ set_target_properties(usdDancingCubesExample PROPERTIES + ) + + list(APPEND _IMPORT_CHECK_TARGETS usdDancingCubesExample ) +-list(APPEND _IMPORT_CHECK_FILES_FOR_usdDancingCubesExample "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdDancingCubesExample.lib" "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdDancingCubesExample.dll" ) ++# list(APPEND _IMPORT_CHECK_FILES_FOR_usdDancingCubesExample "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdDancingCubesExample.lib" "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdDancingCubesExample.dll" ) + + # Import target "usdRecursivePayloadsExample" for configuration "Release" + set_property(TARGET usdRecursivePayloadsExample APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) diff --git a/windows/patches/usdobj.patch b/windows/patches/usdobj.patch new file mode 100644 index 0000000..2bca8d5 --- /dev/null +++ b/windows/patches/usdobj.patch @@ -0,0 +1,11 @@ +--- a/cmake/pxrTargets-release.cmake ++++ b/cmake/pxrTargets-release.cmake +@@ -423,7 +423,7 @@ set_target_properties(usdObj PROPERTIES + ) + + list(APPEND _IMPORT_CHECK_TARGETS usdObj ) +-list(APPEND _IMPORT_CHECK_FILES_FOR_usdObj "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdObj.lib" "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdObj.dll" ) ++# list(APPEND _IMPORT_CHECK_FILES_FOR_usdObj "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdObj.lib" "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdObj.dll" ) + + # Import target "usdDancingCubesExample" for configuration "Release" + set_property(TARGET usdDancingCubesExample APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) diff --git a/windows/patches/usdrecursivepayload.patch b/windows/patches/usdrecursivepayload.patch new file mode 100644 index 0000000..2aa9704 --- /dev/null +++ b/windows/patches/usdrecursivepayload.patch @@ -0,0 +1,11 @@ +--- a/cmake/pxrTargets-release.cmake ++++ b/cmake/pxrTargets-release.cmake +@@ -443,7 +443,7 @@ set_target_properties(usdRecursivePayloadsExample PROPERTIES + ) + + list(APPEND _IMPORT_CHECK_TARGETS usdRecursivePayloadsExample ) +-list(APPEND _IMPORT_CHECK_FILES_FOR_usdRecursivePayloadsExample "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdRecursivePayloadsExample.lib" "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdRecursivePayloadsExample.dll" ) ++# list(APPEND _IMPORT_CHECK_FILES_FOR_usdRecursivePayloadsExample "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdRecursivePayloadsExample.lib" "${_IMPORT_PREFIX}/share/usd/examples/plugin/usdRecursivePayloadsExample.dll" ) + + # Import target "usdSchemaExamples" for configuration "Release" + set_property(TARGET usdSchemaExamples APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) diff --git a/windows/patches/usdshaders.patch b/windows/patches/usdshaders.patch new file mode 100644 index 0000000..6d1e3eb --- /dev/null +++ b/windows/patches/usdshaders.patch @@ -0,0 +1,11 @@ +--- a/cmake/pxrTargets-release.cmake ++++ b/cmake/pxrTargets-release.cmake +@@ -373,7 +373,7 @@ set_target_properties(usdShaders PROPERTIES + ) + + list(APPEND _IMPORT_CHECK_TARGETS usdShaders ) +-list(APPEND _IMPORT_CHECK_FILES_FOR_usdShaders "${_IMPORT_PREFIX}/lib/usdShaders.lib" "${_IMPORT_PREFIX}/lib/libusdShaders.dll" ) ++# list(APPEND _IMPORT_CHECK_FILES_FOR_usdShaders "${_IMPORT_PREFIX}/lib/usdShaders.lib" "${_IMPORT_PREFIX}/lib/libusdShaders.dll" ) + + # Import target "usdSkelImaging" for configuration "Release" + set_property(TARGET usdSkelImaging APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)