Update Building the source code

Lucas Schwiderski 2023-11-28 13:14:19 +01:00
parent bf71a6bad5
commit db09381f79

@ -1,23 +1,29 @@
## Prerequisites
## Build with Docker
The Docker images set up all the requirements and dependencies for both the native Linux build, and the Windows cross-platform build.
1. Clone the repository. Make sure to initialize submodules (e.g. `git clone --recurse-submodules`).
2. Place the Oodle library files into `lib/oodle`. See the linked page above for how to acquire them.
3. Build the Linux image, which also serves as base for the Windows cross-platform build: `docker build -t dtmt-ci-base-linux -f .ci/image/Dockerfile.linux .ci/image`
4. (Optional) Build the Windows image: `docker build -t dtmt-ci-base-msvc -f .ci/image/Dockerfile.msvc .ci/image`
5. Run the build command:
- Linux: `docker run --rm -ti --user $(id -u) -v ./:/src/dtmt dtmt-ci-base-linux cargo --color always build --profile release-lto --locked`
- Windows: `docker run --rm -ti --user $(id -u) -v ./:/src/dtmt dtmt-ci-base-msvc cargo --color always build --release --target x86_64-pc-windows-msvc --locked -Zbuild-std`
## Native build
### Prerequisites
* On Windows: [MSVC](https://visualstudio.microsoft.com/vs/features/cplusplus/)
* On Linux: The usual `build-essential` packages
* [Rust](https://www.rust-lang.org/tools/install)
* [Git](https://git-scm.com/)
* [CMake](https://cmake.org/)
* [Oodle](Obtaining-the-Oodle-library)
## Build manually
### Steps
1. Clone the repository. Make sure to initialize submodules (e.g. `git clone --recurse-submodules`).
2. Place the Oodle library files into `lib/oodle`. See the linked page above for how to acquire them.
3. Run `cargo build --release`.
4. Find the executables in `target/release`.
## Build with Docker
1. Clone the repository. Make sure to initialize submodules (e.g. `git clone --recurse-submodules`).
2. Place the Oodle library files into `lib/oodle`. See the linked page above for how to acquire them.
3. Build the Linux build image, which also serves as base for the Windows cross-platform build: `docker build -t dtmt-ci-base-linux -f .ci/image/Dockerfile.linux .ci/image`
4. (Optional) Build the Windows build image: `docker build -t dtmt-ci-base-msvc -f .ci/image/Dockerfile.msvc .ci/image`
5. Run the build command
5.1. Linux: `docker run --rm -ti --user $(id -u) -v ./:/src/dtmt dtmt-ci-base-linux cargo --color always build --profile release-lto --locked`
5.2. Windows: `docker run --rm -ti --user $(id -u) -v ./:/src/dtmt dtmt-ci-base-msvc cargo --color always build --release --target x86_64-pc-windows-msvc --locked -Zbuild-std`
4. Find the executables in `target/release`.