Skip to content

Commit

Permalink
Separate language into docker and project folders
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsGonzo committed Nov 21, 2024
1 parent 2ded4cb commit c3589b7
Show file tree
Hide file tree
Showing 87 changed files with 73 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:
with:
platforms: linux/amd64,linux/arm64
registry: ${{ env.REGISTRY }}
context: program/${{ matrix.compiler }}
context: program/${{ matrix.compiler }}/docker
push: true
tags: ghcr.io/libriscv/${{ matrix.compiler }}_compiler:latest
2 changes: 1 addition & 1 deletion program/cpp/cmake/api
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions program/rust/build.sh → program/rust/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ if [ -z "$output" ]; then
usage
fi

if [ "$locally" = true ]; then
cargo +nightly build --release # --color never
cp target/riscv64gc-unknown-linux-gnu/release/rust_program $output
exit
fi

# We are in /usr/src now, so what we need to do is copy the input files to the project directory
# The project is in /usr/project
cp $@ /usr/project/src/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions program/rust/project/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build]
target = "riscv64gc-unknown-linux-gnu"

[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc-12"
rustflags = ["-C", "target-feature=+crt-static","-Zexport-executable-symbols", "-C", "link_args=-Wl,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memcmp"]
4 changes: 4 additions & 0 deletions program/rust/project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Rust ignore
Cargo.lock
target/
*.elf
8 changes: 8 additions & 0 deletions program/rust/project/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "rust_program"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
32 changes: 32 additions & 0 deletions program/rust/project/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e

usage() {
echo "Usage: $0 [--api] [-o output] -- [input...]"
echo " --api Instead of compiling, copy the API files to the output."
echo " -o output Compile sources into an output ELF file, including API and inputs."
echo " --debug Compile with debug information."
echo " --version Print the current version of the API."
echo " -v Verbose output."
echo " -- Separate options from input files."
exit 1
}

verbose=false
current_version=5
output="rust.elf"

while [[ "$#" -gt 0 ]]; do
case $1 in
--api) cp -r /usr/api $1; exit ;;
-o) shift; output="$1"; shift; break ;;
--debug) shift ;;
--version) shift; echo "$current_version"; exit ;;
-v) verbose=true; shift ;;
--) shift; break ;;
*) usage ;;
esac
done

cargo +nightly build --release # --color never
cp target/riscv64gc-unknown-linux-gnu/release/rust_program $output
1 change: 1 addition & 0 deletions program/rust/project/src/godot
12 changes: 12 additions & 0 deletions program/rust/project/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mod godot;
use godot::variant::*;

pub fn main() {
}

#[no_mangle]
pub fn public_function() -> Variant {
print1(&Variant::new_string("Hello from Rust!"));

return Variant::new_float(3.14);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions program/zig/project/api
2 changes: 1 addition & 1 deletion src/syscalls.h

0 comments on commit c3589b7

Please sign in to comment.