diff --git a/kclvm/compiler/src/codegen/llvm/emit.rs b/kclvm/compiler/src/codegen/llvm/emit.rs index 1259e1b8c..a795ae444 100644 --- a/kclvm/compiler/src/codegen/llvm/emit.rs +++ b/kclvm/compiler/src/codegen/llvm/emit.rs @@ -29,12 +29,13 @@ pub fn emit_code( ) -> Result<(), Box> { // Init LLVM targets LLVM_INIT.get_or_init(|| { - // TODO: WASM target. #[cfg(target_os = "linux")] inkwell::targets::Target::initialize_x86(&Default::default()); #[cfg(all(target_os = "linux", target_arch = "aarch64"))] inkwell::targets::Target::initialize_aarch64(&Default::default()); - #[cfg(not(target_os = "linux"))] + #[cfg(target_arch = "wasm32")] + inkwell::targets::Target::initialize_webassembly(&Default::default()); + #[cfg(not(any(target_os = "linux", target_arch = "wasm32")))] inkwell::targets::Target::initialize_all(&Default::default()); }); // Create a LLVM context