chili3d 笔记16 emscripten配置 |用cnpm i 安装 |hello world 编译

复制代码
find /usr -name Emscripten.cmake
复制代码
/usr/share/emscripten/cmake/Modules/Platform/Emscripten.cmake



复制代码
find /usr -wholename "*/emscripten/bind.h"
复制代码
/usr/share/emscripten/system/include/emscripten/bind.h
/usr/share/emscripten/cache/sysroot/include/emscripten/bind.h

上面那个文件夹缺version.h

include_directories(/usr/share/emscripten/cache/sysroot/include/)







apt的不行

复制代码
git clone https://github.com/emscripten-core/emscripten.git

/home/chen/代码/chili3d/cpp/build/emscripten/system/include




复制代码
export PATH="/home/chen/软件/emsdk:$PATH"
export EMSDK="/home/chen/软件/emsdk"
export EM_CONFIG="$EMSDK/.emscripten"
export EMSCRIPTEN="$EMSDK/upstream/emscripten"

总结,加环境变量,bootstrap一下就好了




The "workspaces" field in package.json is not supported by pnpm. Create a "pnpm-workspace.yaml" file instead.

+

用pnpm i 会这样

复制代码
npm install -g cnpm --registry=https://registry.npmmirror.com



cpp 复制代码
#include "shared.hpp"  
#include <emscripten/bind.h>  
#include <iostream>  
#include <string>  
  
using namespace emscripten;  
  
class HelloWorld {  
public:  
    static std::string sayHello() {  
        return "Hello, World from C++!";  
    }  
      
    static std::string greet(const std::string& name) {  
        return "Hello, " + name + " from C++!";  
    }  
};  
  
EMSCRIPTEN_BINDINGS(HelloWorld) {  
    class_<HelloWorld>("HelloWorld")  
        .class_function("sayHello", &HelloWorld::sayHello)  
        .class_function("greet", &HelloWorld::greet);  
}
相关推荐
hnult1 天前
全功能学练考证在线考试平台,赋能技能认证
大数据·人工智能·笔记·课程设计
yangzheui1 天前
【VUE2转VUE3学习笔记】-Day1:模板语法
vue.js·笔记·学习
Hammer_Hans1 天前
DFT笔记27
笔记
Timmylyx05181 天前
类欧几里得学习笔记
笔记·学习·算法
aluluka1 天前
Emacs折腾日记(三十六)——打造个人笔记系统
笔记·python·emacs
d_b_1 天前
UCIE 笔记(一)
笔记·学习·芯片
悠哉悠哉愿意1 天前
【强化学习学习笔记】强化学习简介
笔记·学习·强化学习
Jack___Xue1 天前
LangGraph学习笔记(六)---LangGraph ReAct应用
笔记·学习·react.js
呱呱巨基1 天前
Linux 第一个系统程序 进度条
linux·c++·笔记·学习
林深现海1 天前
【刘二大人】PyTorch深度学习实践笔记 —— 第二集:线性模型(凝练版)
pytorch·笔记·深度学习