Giter Site home page Giter Site logo

richardo2016-forks / fibjs_vender Goto Github PK

View Code? Open in Web Editor NEW

This project forked from svenalbert/fibjs_vender

0.0 0.0 0.0 215.2 MB

Home Page: http://fibjs.org

Shell 0.01% CMake 0.06% C 26.92% C++ 72.97% JavaScript 0.03% Objective-C 0.01% Batchfile 0.01% Objective-C++ 0.01%

fibjs_vender's Introduction

About fibjs_vender

fibjs_vender 是一个fibjs的依赖库,本身基于 Google v8 JavaScript 引擎

fibjs入口 (fibjs github): https://github.com/fibjs/fibjs

文档入口 (General docs (Chinese)): http://fibjs.org/

Pre-requisites

编译该项目需依赖:

依赖 Windows Linux Darwin
cmake >= 3.10
clang Optional
git Optional Optional Optional
visual studio 2017 (with C++ Tool)
docker

Windows

下载并安装这些工具:

如果你希望使用 clang 编译, 你还需要安装:

安装好后, 确保你的环境变量 PATH 中能查到这些命令:

  • cmake
  • clang/clang++(使用 LLVM 编译时)
  • make(使用 LLVM 编译时)

如果你无法在 cmd 中执行这些命令, 说明安装有误, 请检查你是否安装了这些软件并将它们添加到环境变量 PATH.

我们来一步步设置:

Visual Studio 2017

下载 VS2017 并安装, https://visualstudio.microsoft.com/zh-hans/vs/older-downloads/.

安装时需选择:

  • C++ 工具
  • Windows Kits 10

Install Clang

Windows 上要求 clang >= 9.0, 下载地址

安装时选择将 LLVM 工具添加到你的用户环境变量 PATH系统环境变量 PATH, 你也可以在安装完之后手动将其 bin 目录路径添加到环境变量 PATH.

Install make.exe

直接从 make.exe 下载, 解压后, 将其 bin/make.exe 添加到任何一个你的环境变量 PATH 包含的路径中, 比如 C:\Windows\System32.

Compile On Windows

在 Windows 上默认会对单个项目开启多核并行编译.

使用 MSVC 编译

  1. 打开 Developer Command Prompt VS 2017, 切换到当前项目的根路径
  2. 运行 .\build.cmd

注意 如果你使用 msvc 编译, 则必须在 Developer Command Prompt VS 2017 中执行, 且不能添加 --use-clang 参数

使用 clang 编译

  1. 打开一个简单的 Powershell/Cmd (推荐使用 Powershell 或在 Windows Terminal 里打开 Cmd, 它对 LLVM 的输出格式有更好的色彩支持), 切换到当前项目的根路径
  2. 直接运行 .\build.cmd --use-clang 编译.

注意 不能在 Developer Command Prompt VS 2017 使用 --use-clang 参数.

除此外, 在 Windows 上使用 clang 编译 fibjs_vender 时需要注意:

  1. 不能使用 VS2017 自带的 clang, 因为它默认会使用 clang-cl 模式编译; 同理, 也不要使用从 VS2017 安装的 cmake.
  2. clang/LLVM 版本需要 >= 9.0
  3. 你需要安装 VS2017(附带桌面端 C++ 工具), 你需要使用它的头文件, 该项目的 clang 目前仍然要求 使用 MSV>=1900.

Linux / Darwin

在 Unix 环境下, 确保 pre-requisites 中对应的这些工具安装好即可.

macOS

macOS 自带 apple-clang, 你只需安装 cmake 即可

brew install cmake

在 macOS 下可以直接编译:

./build -j8 amd64
./build -j8 i386

Linux

在 Linux 下, 我们使用 docker 来编译, 如下就是编译 amd64/release 版本的 fibjs_vender:

DIR=`pwd`;
docker run -t \
     -v ${DIR}:/home/ci fibjs/build-env:clang /bin/sh -c "cd /home/ci; sh build -j2 amd64 release"

传入对应的参数, 在 Linux 下就可以直接进行交叉编译:

sh build -j2 [amd64|i386|arm|arm64|mips|mips64] [debug|release]

使用对应的架构参数来向 docker 指定你希望的编译目标架构.

脚本选项

每个平台上对应的编译脚本都支持一些选项:

编译选项 含义 适用平台
amd64 编译到 x86_64 架构 Windows / Linux / Darwin
i386 编译到 x86 架构 Windows / Linux / Darwin
release 编译 release 版本 Windows / Linux / Darwin
debug 编译 debug 版本 Windows / Linux / Darwin
clean 清理已生成的中间产物, 库文件和二进制文件 Windows / Linux / Darwin

fibjs_vender's People

Contributors

asionius avatar gmxyb avatar hi-rube avatar ngot avatar richardo2016 avatar verdantyang avatar xicilion avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.