Skip to content

Commit

Permalink
rust add windows
Browse files Browse the repository at this point in the history
  • Loading branch information
beicause committed Aug 3, 2024
1 parent 0454824 commit 67bcbc8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ jobs:
with:
submodules: recursive

- name: Set up Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup default nightly
cargo install cxxbridge-cmd
- name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore
with:
Expand Down
20 changes: 19 additions & 1 deletion modules/a_rust/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,25 @@ Import("env")
Import("env_modules")
env_module = env_modules.Clone()

target = f"{'aarch64' if env['arch']=='arm64' else env['arch']}-{'unknown-linux-gnu' if env['platform']=='linuxbsd' else 'linux-android' if env['platform']=='android' else env['platform']}"
rust_target_arch=''
rust_target_os=''
if env['arch']=="arm64":
rust_target_arch = "aarch64"
elif env['arch']=="x86_64":
rust_target_arch = "x86_64"
else:
raise Exception(f"unsupported arch {env['arch']}")

if env['platform']=="linuxbsd":
rust_target_os = "unknown-linux-gnu"
elif env['platform']=="android":
rust_target_os = "linux-android"
elif env['platform']=="windows":
rust_target_os="pc-windows-msvc"
else:
raise Exception(f"unsupported platform {env['platform']}")

target = f"{rust_target_arch}-{rust_target_os}"

# build rust crates
cargo_cmd = ""
Expand Down
9 changes: 6 additions & 3 deletions modules/a_rust/config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
def can_build(env,platform):
env.module_add_dependencies("a_rust", ["a_lz4","a_jsonnet"])
return env["platform"] in ["android","linuxbsd"] and env["arch"] in ["arm64","x86_64"]
def can_build(env, platform):
env.module_add_dependencies("a_rust", ["a_lz4", "a_jsonnet"])
return env["platform"] in ["android", "linuxbsd", "windows"] and env["arch"] in ["arm64", "x86_64"]


def configure(env):
pass


def get_doc_classes():
return [
"Glicol",
Expand All @@ -13,5 +15,6 @@ def get_doc_classes():
"JSONConverter",
]


def get_doc_path():
return "doc_classes"

0 comments on commit 67bcbc8

Please sign in to comment.