From 98a73c0443acaa263ef435ea9487f0a5bf868eb5 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sun, 29 Dec 2024 03:30:22 +0100 Subject: [PATCH] added wasm64 support --- Crafter.Build-Project.cpp | 7 ++++++- README.md | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Crafter.Build-Project.cpp b/Crafter.Build-Project.cpp index cb79530..c45e29e 100644 --- a/Crafter.Build-Project.cpp +++ b/Crafter.Build-Project.cpp @@ -161,13 +161,18 @@ void Project::Build(Configuration config, std::string outputDir) { pcmDir = config.buildDir; } std::string clangDir; - if(config.target == "wasm32-unknown-wasi"){ + if(config.target == "wasm32-unknown-wasi" || config.target == "wasm64-unknown-wasi"){ clangDir = "${WASI_SDK_PATH}/bin/clang++ --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot"; name+=".wasm"; } else{ clangDir = "clang++"; } + if(config.target == "wasm32" || config.target == "wasm64") { + clangDir = "${WASI_SDK_PATH}/bin/clang++ --no-standard-libraries -Wl,--no-entry -Wl,--export-all -Wno-unused-command-line-argument"; + name+=".wasm"; + } + for(const std::string& moduleFile : config.moduleFiles){ system(std::format("{} -std={} {}.cppm --precompile -fprebuilt-module-path={} -o {}/{}.pcm {}", clangDir, config.standard, moduleFile, pcmDir, pcmDir, moduleFile, target).c_str()); } diff --git a/README.md b/README.md index d665a29..1eb35f1 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Save and close, then run ``crafter-build -c debug``. Now you can run the ``hello ``target`` Clang triplet this configuration uses, please refer to the [relevant clang documentation](https://clang.llvm.org/docs/CrossCompilation.html#target-triple). -Note: the WASI SDK needs to be installed to use the ``wasm32-unknown-wasi`` to compile to webassmbly, and ``$WASI_SDK_PATH`` needs to be set, please refer to the [wasi-sdk installation guide](https://github.com/WebAssembly/wasi-sdk?tab=readme-ov-file#install). +Note: the WASI SDK needs to be installed to compile to webassmbly, and ``$WASI_SDK_PATH`` needs to be set, please refer to the [wasi-sdk installation guide](https://github.com/WebAssembly/wasi-sdk?tab=readme-ov-file#install).