- JDK & JAVA_HOME 环境变量
- 安装好 cmake ninja
brew install cmake
brew install ninja
卸载系统自带的版本(太老)
apt remove cmake
wget https://github.com/Kitware/CMake/releases/download/v3.24.0-rc5/cmake-3.24.0-rc5.tar.gz
tar -xvf cmake-3.24.0-rc5.tar.gz
cd make-3.24.0-rc5
./configure && make && make install
apt install ninja-build
打开 terminal
窗口,执行以下命令:
// 进入 wrapper-java 目录
cd wrapper-java
// step 1
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S ./src/main -B ./build/cmake
// step 2
cmake --build ./build/cmake --target quickjs-java-wrapper -j 6
so 链库地址:
wrapper-java/build/cmake/libquickjs-java-wrapper.dylib
- 跨平台编译方式(在单一平台编译出其他平台产物)