|
| 1 | +# Setup The Development Environment and Build iceoryx2 on Windows |
| 2 | + |
| 3 | +## Windows Installation |
| 4 | + |
| 5 | +In case you do not have a Windows installation, Microsoft provides free |
| 6 | +developer images from |
| 7 | +[here](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/). |
| 8 | + |
| 9 | +> [!NOTE] |
| 10 | +> Due to ongoing technical issues, as of October 23, 2024, downloads are |
| 11 | +> temporarily unavailable. |
| 12 | +
|
| 13 | +Alternatively, [Quickemu](https://github.com/quickemu-project/quickemu) can be |
| 14 | +used to |
| 15 | +[download and install Windows](https://github.com/quickemu-project/quickemu/wiki/04-Create-Windows-virtual-machines). |
| 16 | + |
| 17 | +> [!NOTE] |
| 18 | +> You might need to obtain a license from Microsoft after installation. |
| 19 | +
|
| 20 | +## Development Setup |
| 21 | + |
| 22 | +### Install Microsoft Build Tools |
| 23 | + |
| 24 | +Since we are targeting native Windows builds, you need to install the |
| 25 | +[Microsoft Build Tools](https://visualstudio.microsoft.com/en/visual-cpp-build-tools). |
| 26 | + |
| 27 | +While the website mentions `Microsoft Build Tools for C++`, they are also |
| 28 | +required for the Rust compiler on Windows. |
| 29 | + |
| 30 | +During the installation process, you are presented with a list of options. |
| 31 | +The most straightforward choice is `Desktop Development with C++`. Please select |
| 32 | +that option and continue with the installation process. |
| 33 | + |
| 34 | +### Install Rust |
| 35 | + |
| 36 | +The easiest way to install Rust is via `Rustup` from |
| 37 | +<!-- markdownlint-disable-next-line MD044 --> |
| 38 | +[rust-lang.org/learn/get-started](https://www.rust-lang.org/learn/get-started). |
| 39 | + |
| 40 | +Execute `rustup-init` and proceed with the standard installation. |
| 41 | + |
| 42 | +### Install Git |
| 43 | + |
| 44 | +There are multiple ways to install `git` on Windows. One option is |
| 45 | +[gitforwindows.org](https://gitforwindows.org/). Another option is the |
| 46 | +[chocolatey](https://community.chocolatey.org) community repository for Windows. |
| 47 | + |
| 48 | +With `chocolatey`, you can follow the instructions for the |
| 49 | +[individual install](https://chocolatey.org/install#individual) and then use the |
| 50 | +following commands to install `git`. |
| 51 | + |
| 52 | +```powershell |
| 53 | +choco install -y git |
| 54 | +``` |
| 55 | + |
| 56 | +Additional packages can be found [here](https://community.chocolatey.org/packages). |
| 57 | + |
| 58 | +### Install CMake |
| 59 | + |
| 60 | +To build the C and C++ bindings, `cmake` is required. Similar to `git`, there |
| 61 | +are multiple options. You can get it from the |
| 62 | +[CMake](https://cmake.org/download/) project itself or via `choco`. It is |
| 63 | +suggested to to set the option to add `CMake` to the system `PATH` for all |
| 64 | +users should be set when it is installed. |
| 65 | + |
| 66 | +```powershell |
| 67 | +choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' |
| 68 | +``` |
| 69 | + |
| 70 | +### Install LLVM |
| 71 | + |
| 72 | +In order to access some POSIX functions, `iceoryx2` uses `bindgen`, which in turn |
| 73 | +needs `libclang`, which is provided by the LLVM project. We'll use `choco` to |
| 74 | +get `llvm` with the following command. |
| 75 | + |
| 76 | +```powershell |
| 77 | +choco install -y llvm |
| 78 | +``` |
| 79 | + |
| 80 | +### Install cargo-nextest [optional] |
| 81 | + |
| 82 | +[cargo-nextest](https://nexte.st/) is a next-gen test runner for Rust. It can be |
| 83 | +used as direct replacement for `cargo test` and has a nicer output than the |
| 84 | +default test runner. |
| 85 | + |
| 86 | +```powershell |
| 87 | +cargo install cargo-nextest |
| 88 | +``` |
| 89 | + |
| 90 | +## Build iceoryx2 |
| 91 | + |
| 92 | +### Get iceoryx2 |
| 93 | + |
| 94 | +> [!NOTE] |
| 95 | +> If you installed `llvm`, `git` and `cmake` with `choco`, you need to open a |
| 96 | +> new powershell instance to execute the following commands, else you will get |
| 97 | +> a `the term 'git' is not recognized` error! |
| 98 | +
|
| 99 | +```powershell |
| 100 | +git clone https://github.com/eclipse-iceoryx/iceoryx2.git |
| 101 | +cd iceoryx2 |
| 102 | +``` |
| 103 | + |
| 104 | +### Build the Rust Crates |
| 105 | + |
| 106 | +```powershell |
| 107 | +cargo build --workspace --all-targets |
| 108 | +``` |
| 109 | + |
| 110 | +### C and C++ Bindings |
| 111 | + |
| 112 | +The simplest way to build the C and C++ bindings is with the following commands. |
| 113 | + |
| 114 | +```powershell |
| 115 | +cmake -S . -B target/ffi/build -DBUILD_EXAMPLES=ON |
| 116 | +cmake --build target/ffi/build -j 4 |
| 117 | +``` |
| 118 | + |
| 119 | +This will re-build the Rust crates and automatically download and build |
| 120 | +`iceoryx_hoofs` for the C++ bindings. This is fine for a Development setup. |
| 121 | +For a production setup, please have a look at `iceoryx2-ffi/c/README.md` and |
| 122 | +`iceoryx2-ffi/cxx/README.md`. Although the instructions are for Linux, it |
| 123 | +should be easy to adapt them for Windows. |
0 commit comments