Crates.io | megadrive-sys |
lib.rs | megadrive-sys |
version | 0.1.0 |
source | src |
created_at | 2021-02-25 01:11:02.119837 |
updated_at | 2021-02-25 01:11:02.119837 |
description | Bindings to the Sega Mega Drive (Genesis) hardware. |
homepage | https://github.com/ricky26/rust-mega-drive |
repository | https://github.com/ricky26/rust-mega-drive |
max_upload_size | |
id | 360192 |
size | 48,083 |
This repository hosts a few packages for use with the SEGA Mega Drive.
At the moment, these packages only work with a fork of LLVM & Rust. To use them you will need to build both.
Checkout the llvm-12
branch from
LLVM project fork.
Build the toolchain with cmake:
cd M68x0-mono-repo
mkdir build
cd build
cmake -G Ninja "-DLLVM_USE_LINKER=lld" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DLLVM_ENABLE_ASSERTIONS=ON" "-DLLVM_PARALLEL_LINK_JOBS=1" "-DLLVM_TARGETS_TO_BUILD=X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=M68k" "-DLLVM_ENABLE_PROJECTS=clang;lld" ..
ninja -j16
(This step can take along time and a lot of memory if used with a lot of threads.)build/bin
.Checkout the Rust fork (clone the m68k-linux branch).
Copy config.toml.example
to config.toml
and edit:
[build] target = ["x86_64-unknown-linux-gnu", "m68k-unknown-linux-gnu"
[target.x86_64-unknown-linux-gnu] llvm-config = "path/to/build/bin/llvm-config"
Build:
./x.py build --stage=2 rustc cargo
You should now have a Rust toolchain in build/x86_64-unknown-linux-gnu/stage2
.
Link the toolchain in rustup so it is easier to use:
rustup toolchain link m68k "path/to/build/x86_64-unknown-linux-gnu/stage2"
export MEGADRIVE_HOME=path/to/repo
export RUSTUP_TOOLCHAIN=m68k
export LLVM_CONFIG=path=/to/llvm/build/bin/llvm-config
cargo build --release
cd tools/cargo-megadrive
cargo install --path=.
cd examples/megapong
cargo megadrive build
target/m68k-none-eabi/release/megapong.md
.This suite is distributed under the terms of the MIT license. The full license text can be read in LICENSE.