|
| 1 | +# Getting Started |
| 2 | + |
| 3 | +Please see the platform-specific guides below: |
| 4 | + - [Apple macOS](#macOS) |
| 5 | + - [Microsoft Windows](#windows) |
| 6 | + |
| 7 | +## Apple macOS |
| 8 | + |
| 9 | +These instructions are only a suggestion. Other setup options are possible. |
| 10 | +These instructions were tested manually in a fresh Virtual Machine installation |
| 11 | +of macOS Big Sur (11.5.2) on 2021-08-21. |
| 12 | + |
| 13 | +### Toolchain Installation |
| 14 | + |
| 15 | + 1. Install the |
| 16 | + [Rust toolchain](https://www.rust-lang.org/tools/install) using `rustup`. |
| 17 | + |
| 18 | + 1. Install the [Haskell toolchain](https://www.haskell.org/ghcup/) using |
| 19 | + `ghcup`. You may need to run the install command twice, the second time |
| 20 | + after being prompted to install the XCode command line tools. Instructions |
| 21 | + will be displayed in the terminal. You may need to use `ghcup tui` to |
| 22 | + select an appropriate GHC version (GHC 8.10.5). |
| 23 | + |
| 24 | +### Build and Run an Example |
| 25 | + |
| 26 | + 1. Clone the repository. In a terminal: |
| 27 | + |
| 28 | + ```sh |
| 29 | + git clone https://github.com/lancelet/wgpu-hs.git |
| 30 | + cd wgpu-hs |
| 31 | + git submodule update --init --recursive |
| 32 | + ``` |
| 33 | + |
| 34 | + 1. Build the Rust library `libwgpu_native.dylib`: |
| 35 | + |
| 36 | + ```sh |
| 37 | + pushd wgpu-raw-hs-codegen/wgpu-native |
| 38 | + WGPU_NATIVE_VERSION='v0.9.2.2' make lib-native |
| 39 | + popd |
| 40 | + ``` |
| 41 | + |
| 42 | + 1. Set `LD_LIBRARY_PATH` to include the Rust dynamic library that was just |
| 43 | + built: |
| 44 | + |
| 45 | + ```sh |
| 46 | + export LD_LIBRARY_PATH=$(pwd)/wgpu-raw-hs-codegen/wgpu-native/target/debug/:$LD_LIBRARY_PATH |
| 47 | + ``` |
| 48 | + |
| 49 | + 1. Build and run the `triangle` example: |
| 50 | + |
| 51 | + ```sh |
| 52 | + cabal run triangle |
| 53 | + ``` |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +## Microsoft Windows |
| 58 | + |
| 59 | +These instructions are only a suggestion. Other setup options are possible. |
| 60 | +These instructions were tested manually in a fresh Virtual Machine installation |
| 61 | +of Windows 10 on 2021-08-21. |
| 62 | + |
| 63 | +### Toolchain Installation |
| 64 | + |
| 65 | + 1. Install the |
| 66 | + [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/). |
| 67 | + Select the "Desktop development with C++" option as a minimum. |
| 68 | + |
| 69 | + 1. Install the [Rust toolchain](https://www.rust-lang.org/tools/install) using |
| 70 | + `rustup` (ie. `RUSTUP-INIT.EXE` - 64 bit). |
| 71 | + |
| 72 | + 1. Install the [Haskell toolchain](https://www.haskell.org/ghcup/) using |
| 73 | + `ghcup`. `HLS` and `Stack` are optional installations, but make sure to |
| 74 | + install `MSys2`. You may need to use `ghcup tui` to select an appropriate |
| 75 | + GHC version (GHC 8.10.5). |
| 76 | + |
| 77 | + 1. Install the [Chocolatey](https://chocolatey.org/) package manager. |
| 78 | + |
| 79 | + 1. Install the required Chocolatey packages. In an Administrator PowerShell: |
| 80 | + |
| 81 | + ```powershell |
| 82 | + choco install git make llvm -y |
| 83 | + ``` |
| 84 | + |
| 85 | +### Build and Run an Example |
| 86 | + |
| 87 | + 1. Clone the repository. In PowerShell: |
| 88 | + |
| 89 | + ```powershell |
| 90 | + git clone https://github.com/lancelet/wgpu-hs.git |
| 91 | + cd wgpu-hs |
| 92 | + git submodule update --init --recursive |
| 93 | + ``` |
| 94 | + |
| 95 | + 1. Build the Rust library `wgpu-native.dll`: |
| 96 | + |
| 97 | + ```powershell |
| 98 | + pushd wgpu-raw-hs-codegen/wgpu-native |
| 99 | + set WGPU_NATIVE_VERSION='v0.9.2.2' |
| 100 | + make lib-native |
| 101 | + popd |
| 102 | + ``` |
| 103 | + |
| 104 | + 1. Copy the DLL file so that it can be found when running the example: |
| 105 | + |
| 106 | + ```powershell |
| 107 | + cp wgpu-raw-hs-codegen/wgpu-native/target/debug/wgpu_native.dll wgpu_native.dll |
| 108 | + ``` |
| 109 | + |
| 110 | + 1. Build and run the `triangle` example: |
| 111 | + |
| 112 | + ```powershell |
| 113 | + cabal run triangle |
| 114 | + ``` |
0 commit comments