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);  
}
相关推荐
【上下求索】7 小时前
学习笔记090——Ubuntu 中 UFW 防火墙的使用
笔记·学习·ubuntu
NeRF_er7 小时前
STORM代码阅读笔记
大数据·笔记·storm
UQWRJ7 小时前
菜鸟教程Linux ViVimYumApt笔记
linux·运维·笔记
程序员Xu7 小时前
【OD机试题解法笔记】查找接口成功率最优时间段
笔记·算法
wb1899 小时前
企业WEB应用服务器TOMCAT
运维·前端·笔记·tomcat·云计算
Se_ren_di_pity9 小时前
CS231n2017-Lecture9经典CNN架构笔记
人工智能·笔记·cnn
Yueeyuee_10 小时前
【C#学习Day15笔记】拆箱装箱、 Equals与== 、文件读取IO
笔记·学习·c#
এ旧栎10 小时前
Gitee
笔记·gitee·学习方法
kfepiza11 小时前
vim的`:q!` 与 `ZQ` 笔记250729
linux·笔记·编辑器·vim