Browse Source

Add rust cross-compile

Aditya Kulkarni 5 years ago
parent
commit
7fa888c45c
  1. 7
      src/scripts/docker/Dockerfile

7
src/scripts/docker/Dockerfile

@ -43,13 +43,20 @@ RUN cd /opt && \
make -j$(nproc) MXE_TARGETS=x86_64-w64-mingw32.static qtbase qtwebsockets
# Add rust
RUN apt install -y gcc-aarch64-linux-gnu
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.32.0 -y
RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc
RUN ~/.cargo/bin/rustup target add x86_64-pc-windows-gnu
RUN ~/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
# Append the linker to the cargo config for Windows cross compile
RUN echo "[target.x86_64-pc-windows-gnu]" >> ~/.cargo/config && \
echo "linker = 'x86_64-w64-mingw32.static-gcc'" >> ~/.cargo/config
RUN echo "[target.aarch64-unknown-linux-gnu]" >> ~/.cargo/config && \
echo "linker = '/usr/bin/aarch64-linux-gnu-gcc'" >> ~/.cargo/config
ENV CC_x86_64_pc_windows_gnu="x86_64-w64-mingw32.static-gcc"
ENV CC_aarch64_unknown_linux_gnu="aarch64-linux-gnu-gcc"
ENV PATH="/opt/mxe/usr/bin:${PATH}"

Loading…
Cancel
Save