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 分钟前
首尾元素相同的间隔循环策略
c++·笔记·循环·ptx
今儿敲了吗23 分钟前
计算机网络第三章笔记(三)
笔记·计算机网络
week_泽23 分钟前
第2课:深度剖析AI Agent核心模块 - 学习笔记_2
人工智能·笔记·学习·ai agent
week_泽34 分钟前
第9课:LangMem SDK高效实现长期记忆管理 - 学习笔记_9
人工智能·笔记·学习·ai agent
Lucifer__hell42 分钟前
【Pytest】笔记
笔记·pytest·测试
Yu_Lijing42 分钟前
基于C++的《Head First设计模式》笔记——命令模式
c++·笔记·设计模式
淬炼之火1 小时前
笔记:场景图生成综述(Scene Understanding)
图像处理·笔记·计算机视觉·知识图谱·场景感知
AI视觉网奇1 小时前
PlayerStreaming 驱动audio2face 学习笔记
笔记·学习·ue5
swan4161 小时前
SCAU期末笔记 - 计算机网络题库解析
笔记·计算机网络
week_泽1 小时前
第3课:构建AI代理系统面临的挑战 - 学习笔记_3
人工智能·笔记·学习·ai agent