|
1 | 1 | set windows-shell := ["pwsh", "-c"] |
2 | 2 |
|
| 3 | +renderLibVersion := "0.3.2" |
| 4 | + |
| 5 | +default: frontend dotnet-test |
| 6 | + |
| 7 | +# deletes all build files |
| 8 | +[windows] |
| 9 | +[confirm] |
| 10 | +clean: |
| 11 | + Remove-Item -Recurse -Force ./prebuilt |
| 12 | + |
| 13 | +# deletes all build files |
| 14 | +[unix] |
| 15 | +[confirm] |
| 16 | +clean: |
| 17 | + rm -rf ./prebuilt |
| 18 | + |
| 19 | +# builds flipbook.js via npm |
3 | 20 | [working-directory: 'FlipViewer'] |
4 | 21 | frontend: |
5 | 22 | npm install |
6 | 23 | npm run build |
7 | 24 | echo "Copying .js to python package..." |
8 | 25 | cp ./dist/flipbook.js ../PyWrapper/simpleimageio/flipbook.js |
9 | 26 |
|
| 27 | +[unix] |
| 28 | +_ensure_dirs: |
| 29 | + mkdir -p runtimes/linux-x64/native |
| 30 | + mkdir -p runtimes/win-x64/native |
| 31 | + mkdir -p runtimes/osx-x64/native |
| 32 | + mkdir -p runtimes/osx-arm64/native |
| 33 | + mkdir -p build |
| 34 | + |
| 35 | +[windows] |
| 36 | +_ensure_dirs: |
| 37 | + New-Item -ItemType Directory runtimes/linux-x64/native > $null |
| 38 | + New-Item -ItemType Directory runtimes/win-x64/native > $null |
| 39 | + New-Item -ItemType Directory runtimes/osx-x64/native > $null |
| 40 | + New-Item -ItemType Directory runtimes/osx-arm64/native > $null |
| 41 | + New-Item -ItemType Directory build > $null |
| 42 | + |
| 43 | +# Downloads the precompiled binaries for OIDN from GitHub |
| 44 | +[windows] |
| 45 | +_download: |
| 46 | + if (-not(Test-Path -Path "prebuilt" -PathType Container)) |
| 47 | + { |
| 48 | + Invoke-WebRequest -Uri "https://github.com/pgrit/RenderLibs/releases/download/v{{renderLibVersion}}/RenderLibs-v{{renderLibVersion}}.zip" -OutFile "prebuilt.zip" |
| 49 | + Expand-Archive "prebuilt.zip" -DestinationPath ./prebuilt |
| 50 | + rm prebuilt.zip |
| 51 | + } |
| 52 | + |
| 53 | +# Downloads the precompiled binaries for OIDN from GitHub |
| 54 | +[unix] |
| 55 | +_download: |
| 56 | + if ! {{ path_exists("./prebuilt") }}; then \ |
| 57 | + wget "https://github.com/pgrit/RenderLibs/releases/download/v{{renderLibVersion}}/RenderLibs-v{{renderLibVersion}}.zip" -O prebuilt.zip ;\ |
| 58 | + unzip -d ./prebuilt/ prebuilt.zip ;\ |
| 59 | + rm prebuilt.zip ;\ |
| 60 | + fi |
| 61 | + |
| 62 | +# Copies the precompiled binaries to their appropriate places |
| 63 | +copy-oidn: _ensure_dirs _download |
| 64 | + cp prebuilt/linux/lib/libtbb.so.12.12 runtimes/linux-x64/native/libtbb.so.12 |
| 65 | + cp prebuilt/linux/lib/libOpenImageDenoise.so.2.2.0 runtimes/linux-x64/native/libOpenImageDenoise.so |
| 66 | + cp prebuilt/linux/lib/libOpenImageDenoise_core.so.2.2.0 runtimes/linux-x64/native/ |
| 67 | + cp prebuilt/linux/lib/libOpenImageDenoise_device_cpu.so.2.2.0 runtimes/linux-x64/native/ |
| 68 | + |
| 69 | + cp prebuilt/win/bin/tbb12.dll runtimes/win-x64/native/ |
| 70 | + cp prebuilt/win/bin/OpenImageDenoise.dll runtimes/win-x64/native/OpenImageDenoise.dll |
| 71 | + cp prebuilt/win/bin/OpenImageDenoise_core.dll runtimes/win-x64/native/ |
| 72 | + cp prebuilt/win/bin/OpenImageDenoise_device_cpu.dll runtimes/win-x64/native/ |
| 73 | + |
| 74 | + cp prebuilt/osx/lib/libtbb.12.12.dylib runtimes/osx-x64/native/libtbb.12.dylib |
| 75 | + cp prebuilt/osx/lib/libOpenImageDenoise.2.2.0.dylib runtimes/osx-x64/native/libOpenImageDenoise.dylib |
| 76 | + cp prebuilt/osx/lib/libOpenImageDenoise_core.2.2.0.dylib runtimes/osx-x64/native/ |
| 77 | + cp prebuilt/osx/lib/libOpenImageDenoise_device_cpu.2.2.0.dylib runtimes/osx-x64/native/ |
| 78 | + |
| 79 | + cp prebuilt/osx-arm64/lib/libtbb.12.12.dylib runtimes/osx-arm64/native/libtbb.12.dylib |
| 80 | + cp prebuilt/osx-arm64/lib/libOpenImageDenoise.2.2.0.dylib runtimes/osx-arm64/native/libOpenImageDenoise.dylib |
| 81 | + cp prebuilt/osx-arm64/lib/libOpenImageDenoise_core.2.2.0.dylib runtimes/osx-arm64/native/ |
| 82 | + cp prebuilt/osx-arm64/lib/libOpenImageDenoise_device_cpu.2.2.0.dylib runtimes/osx-arm64/native/ |
| 83 | + |
| 84 | +# Builds the C++ wrapper library for x86 and arm |
| 85 | +[macos] |
| 86 | +[working-directory: "./build/" ] |
| 87 | +build-native: |
| 88 | + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" .. |
| 89 | + cmake --build . --config Release |
| 90 | + |
| 91 | + # Empty the build folder first to avoid cache issues |
| 92 | + rm -rf * |
| 93 | + |
| 94 | + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64" .. |
| 95 | + cmake --build . --config Release |
| 96 | + |
| 97 | +# Builds the C++ wrapper library |
| 98 | +[linux] |
| 99 | +[windows] |
| 100 | +[working-directory: "./build/" ] |
| 101 | +build-native: |
| 102 | + cmake -DCMAKE_BUILD_TYPE=Release .. |
| 103 | + cmake --build . --config Release |
| 104 | + |
| 105 | +# Builds the python package for deployment. Assumes the frontend was built. |
| 106 | +python: |
| 107 | + python -m pip install build wheel |
| 108 | + python -m build --sdist |
| 109 | + |
| 110 | +# Force installs a fresh build of the python package in the user directory |
| 111 | +[unix] |
| 112 | +python-dev: |
| 113 | + rm -rf ./dist/* |
| 114 | + python -m build --wheel |
| 115 | + whl=$(find ./dist -name *.whl);\ |
| 116 | + python -m pip install --user $whl;\ |
| 117 | + python -m pip install --user --force-reinstall --no-deps $whl |
| 118 | + |
| 119 | +# Force installs a fresh build of the python package in the user directory |
| 120 | +[windows] |
| 121 | +python-dev: |
| 122 | + python -m build --wheel |
| 123 | + $latestWhl = Get-ChildItem -Path "./dist/*.whl" | Sort-Object LastAccessTime -Descending | Select-Object -First 1 |
| 124 | + python -m pip install --user $latestWhl.FullName |
| 125 | + python -m pip install --user --force-reinstall --no-deps $latestWhl.FullName |
| 126 | + |
| 127 | +[working-directory: "./PyTest/"] |
| 128 | +python-test: python-dev |
| 129 | + python -m unittest |
| 130 | + |
| 131 | +# Builds and tests the .NET library |
| 132 | +dotnet-test: build-native copy-oidn |
| 133 | + dotnet build |
| 134 | + dotnet test |
0 commit comments