2.0.1 • Published 2 years ago

smake v2.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

交叉编译系统

注:v1 版本与 v0.x 版本不兼容

依赖

安装

npm i -g smake

功能

  • macOS 下编译 macOS
  • macOS 下编译 Linux
  • macOS 下编译 Windows
  • Windows 下编译 macOS
  • Windows 下编译 Linux
  • Windows 下编译 Windows

设置

所有路径在 Windows 下请使用 / 代替 \ 。如:C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910

# LLVM 可执行文件目录前缀。
# 如果已在 PATH 中可以不设置。
export SMAKE_LLVM_PREFIX="/opt/homebrew/opt/llvm/bin/"

# Clang 目录
# 仅在 useClangHeaders = true 时需要
export SMAKE_LLVM_CLANG_PATH="/opt/homebrew/opt/llvm/lib/clang/11.1.0"

Windows SDK 设置

# _MVC_VER 版本号
export SMAKE_LLVM_MSVC_VERSION=1928
# Windows Kits 10 版本号
export SMAKE_LLVM_WINDOWS_KITS_10_VERSION=10.0.19041.0

MSVC 目录

export SMAKE_LLVM_MSVC_PATH="/opt/sysroots/win32/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910"

Windows Kits 10 目录

export SMAKE_LLVM_WINDOWS_KITS_10_PATH="/opt/sysroots/win32/Program Files (x86)/Windows Kits/10"

> Linux SDK 设置
```bash
# 规则为设置 SMAKE_LLVM_SYSROOT_${编译目标大写} 至 sysroot 目录
# aarch64-linux-gnu
export SMAKE_LLVM_SYSROOT_AARCH64_LINUX_GNU=/opt/sysroots/ubuntu14.04-aarch64-linux-gnu
# x86_64-linux-gnu
export SMAKE_LLVM_SYSROOT_X86_64_LINUX_GNU=/opt/sysroots/ubuntu14.04-x86_64-linux-gnu
# arm-linux-gnueabihf
export SMAKE_LLVM_SYSROOT_ARM_LINUX_GNUEABIHF=/opt/sysroots/ubuntu14.04-arm-linux-gnueabihf

Nodejs 下载镜像设置(官方下载太慢)(可选)

# 使用淘宝镜像
export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node

使用方法

  • 在项目目录下创建 package.json 文件。
  • 安装项目依赖 npm i -D smake
  • 在项目目录下创建 smake.js 文件。
const { LLVM } = require('smake');

const executable = new LLVM('executable', 'aarch64-linux-gnu');
executable.files = ['src/main.c'];

module.exports = [
  executable,
];

运行 npx smake build 编译。

更多请查看 examples 目录。

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.13

3 years ago

0.3.12

3 years ago

0.3.9

3 years ago

0.3.11

3 years ago

0.3.10

3 years ago

0.3.8

3 years ago

0.3.6

3 years ago

0.3.7

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago