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);  
}
相关推荐
老当益壮梁奶奶2 小时前
51单片机DS18B20温度传感器详解:单总线时序与C51驱动实现
笔记·stm32·单片机·嵌入式硬件·51单片机
小叶肥辉3 小时前
LangChain链和LangGraph图的学习笔记【三】——分别用langchain_openai库和langchain_community库调用大模型
笔记·python·langchain
从零开始的嵌入式之旅5 小时前
day44
arm开发·经验分享·笔记·嵌入式硬件
商业白皮书8 小时前
杭州企业做 GEO 怎么选服务商?B2B 制造、外贸出海与品牌连锁选型指南
笔记
商业白皮书8 小时前
密不透风的瑕疵防线:东集SEV400视觉传感器,定义“轻量化”精准检测
笔记
谢白羽11 小时前
MiniMax-H3 : 4卡 H20-3e一套权重部署实践/8卡H200部署优化实测
笔记·llm·论文·大模型部署·sglang
志尊宝11 小时前
Vue3 零基础每日笔记(024):组件的创建与使用——从 import 到自动导入
前端·vue.js·笔记·前端框架·html5
chnyi6_ya12 小时前
论文阅读笔记:VBVR-Pro 把「用生成来推理」变成一个可训练、可验证、可优化的闭环
论文阅读·笔记
contro1_h12 小时前
关于ArcGIS许可管理器服务无法启动的问题
经验分享·笔记·学习方法
1314lay_100712 小时前
SQL SERVER 修改已创建的表
经验分享·笔记