Make sure you have Rust toolchain installed
You won't be able to execute program or run tests as sdk supports only windows
- Add windows target
rustup target add x86_64-pc-windows-gnu
- Add MinGW (e.g. for the alpine
apk add mingw-w64-gcc
) - Specify target by env
CARGO_BUILD_TARGET=x86_64-pc-windows-gnu
You can now build some of the examples using cargo build --example disable_light_for_5_sec
, but you have to run it on any other windows machine with the Dragon Center installed.
Should work without any hassle.
Run cargo run --example disable_light_for_5_sec
to run example and cargo test
to run tests
There is a catch - wsl 2 runs in linux environment, but it still can run windows executable, so we can use WSL 2 linux environment to build actual program and then run built .exe file
- Install additional libs to able to build windows app following linux instructions
- Open WSL2 Terminal as Administrator
- Go to this repository folder
- Run
cargo test
or anycargo run --example ...
command to either execute tests or run an example
If you are using Rust inside Docker container you not able to run .exe files from inside it, but you can use named pipe to pass commands to the host WSL 2 instance that able to run .exe
For this either use Remote Containers extension with the provided .devcontainer
setup or follow next instruction
- Install additional libs to able to build windows app following linux instructions
- Mount existing named pipe and scripts to the docker container
type=bind,src=${localWorkspaceFolder}/.devcontainer,dst=${containerWorkspaceFolder}/.devcontainer
- Specify environment variables for container, you can use
wsl2-docker.env
file for reference or direct usage:CONTAINER_PROJECT_HOME
- path to the project inside the containerHOST_PROJECT_HOME
- path to projects in WSL.CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER
- relative path to.devcontainer/send.fish
script
- Run the container
- Start new WSL terminal with admin right and execute script
.devcontainer/execute.fish
that will listen for new commands and execute it - Run any
cargo
command - Execution will end without any info, but you should see test running output in the WSL terminal
Run cargo run --example disable_light_for_5_sec
to run example