Git Product home page Git Product logo

boost-lib's Introduction

CMake.js (MIT)

Node CI npm

About

CMake.js is a Node.js native addon build tool which works (almost) exactly like node-gyp, but instead of gyp, it is based on CMake build system. It's compatible with the following runtimes:

  • Node.js 14.15+ since CMake.js v7.0.0 (for older runtimes please use an earlier version of CMake.js). Newer versions can produce builds targeting older runtimes
  • NW.js: all CMake.js based native modules are compatible with NW.js out-of-the-box, there is no nw-gyp like magic required
  • Electron: out-of-the-box build support, no post build steps required

If you use node-api for your module instead of nan it should be able to run on all the runtimes above without needing to be built separately for each.

Installation

npm install cmake-js

Help:

cmake-js --help
Usage: cmake-js [<command>] [options]

Commands:
  cmake-js install                Install Node.js distribution files if needed
  cmake-js configure              Configure CMake project
  cmake-js print-configure        Print the configuration command
  cmake-js print-cmakejs-src      Print the value of the CMAKE_JS_SRC variable
  cmake-js print-cmakejs-include  Print the value of the CMAKE_JS_INC variable
  cmake-js print-cmakejs-lib      Print the value of the CMAKE_JS_LIB variable
  cmake-js build                  Build the project (will configure first if
                                  required)
  cmake-js print-build            Print the build command
  cmake-js clean                  Clean the project directory
  cmake-js print-clean            Print the clean command
  cmake-js reconfigure            Clean the project directory then configure the
                                  project
  cmake-js rebuild                Clean the project directory then build the
                                  project
  cmake-js compile                Build the project, and if build fails, try a
                                  full rebuild

Options:
      --version          Show version number                           [boolean]
  -h, --help             Show help                                     [boolean]
  -l, --log-level        set log level (silly, verbose, info, http, warn,
                         error), default is info                        [string]
  -d, --directory        specify CMake project's directory (where CMakeLists.txt
                         located)                                       [string]
  -D, --debug            build debug configuration                     [boolean]
  -B, --config           specify build configuration (Debug, RelWithDebInfo,
                         Release), will ignore '--debug' if specified   [string]
  -c, --cmake-path       path of CMake executable                       [string]
  -m, --prefer-make      use Unix Makefiles even if Ninja is available (Posix)
                                                                       [boolean]
  -x, --prefer-xcode     use Xcode instead of Unix Makefiles           [boolean]
  -g, --prefer-gnu       use GNU compiler instead of default CMake compiler, if
                         available (Posix)                             [boolean]
  -G, --generator        use specified generator                        [string]
  -t, --toolset          use specified toolset                          [string]
  -A, --platform         use specified platform name                    [string]
  -T, --target           only build the specified target                [string]
  -C, --prefer-clang     use Clang compiler instead of default CMake compiler,
                         if available (Posix)                          [boolean]
      --cc               use the specified C compiler                   [string]
      --cxx              use the specified C++ compiler                 [string]
  -r, --runtime          the runtime to use                             [string]
  -v, --runtime-version  the runtime version to use                     [string]
  -a, --arch             the architecture to build in                   [string]
  -p, --parallel         the number of threads cmake can use            [number]
      --CD               Custom argument passed to CMake in format:
                         -D<your-arg-here>                              [string]
  -i, --silent           Prevents CMake.js to print to the stdio       [boolean]
  -O, --out              Specify the output directory to compile to, default is
                         projectRoot/build                              [string]

Requirements:

  • CMake
  • A proper C/C++ compiler toolchain of the given platform
    • Windows:
      • Visual C++ Build Tools. If you installed nodejs with the installer, you can install these when prompted.
      • An alternate way is to install the Chocolatey package manager, and run choco install visualstudio2017-workload-vctools in an Administrator Powershell
      • If you have multiple versions installed, you can select a specific version with npm config set msvs_version 2017 (Note: this will also affect node-gyp)
    • Unix/Posix:
      • Clang or GCC
      • Ninja or Make (Ninja will be picked if both present)

Usage

General

It is advised to use Node-API for new projects instead of NAN. It provides ABI stability making usage simpler and reducing maintainance.

In a nutshell. (For more complete documentation please see the first tutorial.)

  • Install cmake-js for your module npm install --save cmake-js
  • Put a CMakeLists.txt file into your module root with this minimal required content:
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0042 NEW)

project (your-addon-name-here)

add_definitions(-DNAPI_VERSION=4)

include_directories(${CMAKE_JS_INC})

file(GLOB SOURCE_FILES "your-source files-location-here")

add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB})

if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
  # Generate node.lib
  execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
endif()
  • Add the following into your package.json scripts section:
"scripts": {
    "install": "cmake-js compile"
  }
  • Add the following into your package.json, using the same NAPI_VERSION value you provided to cmake
"binary": {
    "napi_versions": [7]
  },

Commandline

With cmake-js installed as a depdendency or devDependency of your module, you can access run commands directly with:

npx cmake-js --help
# OR
yarn cmake-js --help

Please refer to the --help for the lists of available commands (they are like commands in node-gyp).

You can override the project default runtimes via --runtime and --runtime-version, such as: --runtime=electron --runtime-version=0.26.0. See below for more info on runtimes.

CMake Specific

CMAKE_JS_VERSION variable will reflect the actual CMake.js version. So CMake.js based builds could be detected, eg.:

if (CMAKE_JS_VERSION)
    add_subdirectory(node_addon)
else()
    add_subdirectory(other_subproject)
endif()

NPM Config Integration

You can set npm configuration options for CMake.js.

For all users (global):

npm config set cmake_<key> <value> --global

For current user:

npm config set cmake_<key> <value>

CMake.js will set a variable named "<key>" to <value> (by using -D<key>="<value>" option). User settings will overwrite globals.

UPDATE:

You can set CMake.js command line arguments with npm config using the following pattern:

npm config set cmake_js_G "Visual Studio 56 Win128"

Which sets the CMake generator, basically defaults to:

cmake-js -G "Visual Studio 56 Win128"

Example:

Enter at command prompt:

npm config set cmake_Foo="bar"

Then write to your CMakeLists.txt the following:

message (STATUS ${Foo})

This will print during configure:

--- bar

Custom CMake options

You can add custom CMake options by beginning option name with CD.

Example

In command prompt:

cmake-js compile --CDFOO="bar"

Then in your CMakeLists.txt:

message (STATUS ${FOO})

This will print during configure:

--- bar

Runtimes

Important

It is important to understand that this setting is to be configured in the application's root package.json file. If you're creating a native module targeting nw.js for example, then do not specify anything in your module's package.json. It's the actual application's decision to specify its runtime, your module's just compatible anything that was mentioned in the About chapter. Actually defining cmake-js key in your module's package.json file may lead to an error. Why? If you set it up to use nw.js 0.12.1 for example, then when it gets compiled during development time (to run its unit tests for example) it's gonna be compiled against io.js 1.2 runtime. But if you're having io.js 34.0.1 at the command line then, which is binary incompatible with 1.2, then your unit tests will fail for sure. So it is advised to not use cmake-js target settings in your module's package.json, because that way CMake.js will use that you have, and your tests will pass.

Configuration

If any of the runtime, runtimeVersion, or arch configuration parameters is not explicitly configured, sensible defaults will be auto-detected based on the JavaScript environment where CMake.js runs within.

You can configure runtimes for compiling target for all depending CMake.js modules in an application. Define a cmake-js key in the application's root package.json file, eg.:

{
	"name": "ta-taram-taram",
	"description": "pa-param-pam-pam",
	"version": "1.0.0",
	"main": "app.js",
	"cmake-js": {
		"runtime": "node",
		"runtimeVersion": "0.12.0",
		"arch": "ia32"
	}
}

Available settings:

  • runtime: application's target runtime, possible values are:
    • node: Node.js
    • nw: nw.js
    • electron: Electron
  • runtimeVersion: version of the application's target runtime, for example: 0.12.1
  • arch: architecture of application's target runtime (eg: x64, ia32, arm64, arm). Notice: on non-Windows systems the C++ toolset's architecture's gonna be used despite this setting. If you don't specify this on Windows, then architecture of the main node runtime is gonna be used, so you have to choose a matching nw.js runtime.

Node-API and node-addon-api

ABI-stable Node.js API (Node-API), which was previously known as N-API, supplies a set of C APIs that allow to compilation and loading of native modules by different versions of Node.js that support Node-API which includes all versions of Node.js v10.x and later.

To compile a native module that uses only the plain C Node-API calls, follow the directions for plain node native modules.

You must also add the following lines to your CMakeLists.txt, to allow for building on windows

if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
  # Generate node.lib
  execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
endif()

To compile a native module that uses the header-only C++ wrapper classes provided by node-addon-api, you need to make your package depend on it with:

npm install --save node-addon-api

cmake-js will then add it to the include search path automatically

You should add the following to your package.json, with the correct version number, so that cmake-js knows the module is node-api and that it can skip downloading the nodejs headers

"binary": {
    "napi_versions": [7]
  },

Electron

On Windows, the win_delay_load_hook is required to be embedded in the module or it will fail to load in the render process. cmake-js will add the hook if the CMakeLists.txt contains the library ${CMAKE_JS_SRC}.

Without the hook, the module can only be called from the render process using the Electron remote module.

Runtime options in CMakeLists.txt

The actual node runtime parameters are detectable in CMakeLists.txt files, the following variables are set:

  • NODE_RUNTIME: "node", "nw", "electron"
  • NODE_RUNTIMEVERSION: for example: "0.12.1"
  • NODE_ARCH: "x64", "ia32", "arm64", "arm"

NW.js

To make compatible your NW.js application with any NAN CMake.js based modules, write the following to your application's package.json file (this is not neccessary for node-api modules):

{
	"cmake-js": {
		"runtime": "nw",
		"runtimeVersion": "nw.js-version-here",
		"arch": "whatever-setting-is-appropriate-for-your-application's-windows-build"
	}
}

That's it. There is nothing else to do either on the application's or on the module's side, CMake.js modules are compatible with NW.js out-of-the-box. For more complete documentation please see the third tutorial.

Heroku

Heroku uses the concept of a buildpack to define how an application should be prepared to run in a dyno. The typical buildpack for note-based applications, heroku/nodejs, provides an environment capable of running node-gyp, but not CMake.

The least "painful" way of addressing this is to use heroku's multipack facility:

  • Set the applications' buildpack to https://github.com/heroku/heroku-buildpack-multi.git

  • In the root directory of the application, create a file called .buildpacks with these two lines:

        https://github.com/brave/heroku-cmake-buildpack.git
        https://github.com/heroku/heroku-buildpack-nodejs.git
    
  • Deploy the application to have the changes take effect

The heroku-buildpack-multi will run each buildpack in order allowing the node application to reference CMake in the Heroku build environment.

Tutorials

Real examples

  • @julusian/jpeg-turbo - A Node-API wrapping around libjpeg-turbo. cmake-js was a good fit here, as libjpeg-turbo provides cmake files that can be used, and would be hard to replicate correctly in node-gyp
  • node-datachannel - Easy to use WebRTC data channels and media transport
  • aws-iot-device-sdk-v2 AWS IoT Device SDK for JavaScript v2

Open a PR to add your own project here.

Changelog

View changelog.md

Credits

https://github.com/cmake-js/cmake-js/graphs/contributors

Ty all!

boost-lib's People

Contributors

0181532686cf4a31163be0bf3e6bb6732bf avatar unbornchikken avatar xtansia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

boost-lib's Issues

node_modules directory empty at install time

I have a module i'm developing that depends on boost and I'm to get this working.

It works fine when i run npm install from the root of the directory itself. But when i actually push the module to github and npm install this module from another project the install script fails because it can't find the boost-lib directory anywhere. These seems to be because the node_modules directory is not available at the time npm runs the install script.

Here is the relevant bit of my CMakeLists.txt:

...
message("Searching In: ${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB_RECURSE boostlib_cmake_path "${CMAKE_CURRENT_SOURCE_DIR}/node_modules" "BoostLib.cmake")
list(GET boostlib_cmake_path 0 boostlib_cmake_path)
get_filename_component(boostlib_cmake_path "${boostlib_cmake_path}" DIRECTORY)
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${boostlib_cmake_path}")
include(BoostLib)
require_boost_libs(">= 1.6.0" system)
...

The package.json of the module itself has the following:

{
// ...
  "scripts": {
    "install": "ls node_modules && cmake-js compile"
  },
  "dependencies": {
    "boost-lib": "^0.11.3",
    "cmake-js": "^3.4.0",
    "nan": "^2.5.1"
  },
}

The error CMake gives when i try to npm install the module from another project:

CMake Error at CMakeLists.txt:22 (list):
  list GET given empty list


CMake Error at CMakeLists.txt:25 (include):
  include could not find load file:

    BoostLib


CMake Error at CMakeLists.txt:26 (require_boost_libs):
  Unknown CMake command "require_boost_libs".

The result of running ls node_modules at the time the module's npm install script gets called:

ls: node_modules: No such file or directory

Not sure where i should be looking for boost-lib if there's no node_modules directory yet. Thoughts?

Boost download fails due to 'Unhandled stream error'

I cannot get a native module I am creating to build, since the cmake-js rebuild fails to finish downloading Boost. I tried cloning your tutorial repository and had the same experience. Included below is the cmake-js output and a link to a gist of the full npm error log.

info CMD CLEAN
info RUN cmake -E remove_directory "C:\Users\toxicwolf\OneDrive\Documents\Development\cmake-js-tut-04-boost-module\build"
info CMD CONFIGURE
info RUN cmake "C:\Users\toxicwolf\OneDrive\Documents\Development\cmake-js-tut-04-boost-module" --no-warn-unused-cli -G"Visual Studio 14 2015 Win64" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_JS_INC="C:\Users\toxicwolf\.cmake-js\iojs-x64\v2.3.1\src;C:\Users\toxicwolf\.cmake-js\iojs-x64\v2.3.1\deps\v8\include;C:\Users\toxicwolf\.cmake-js\iojs-x64\v2.3.1\deps\uv\include;C:\Users\toxicwolf\OneDrive\Documents\Development\cmake-js-tut-04-boost-module\node_modules\nan" -DNODE_RUNTIME="iojs" -DNODE_RUNTIMEVERSION="2.3.1" -DNODE_ARCH="x64" -DCMAKE_JS_LIB="C:\Users\toxicwolf\.cmake-js\iojs-x64\v2.3.1\win-x64\iojs.lib"
Not searching for unused variables given on the command line.
-- The C compiler identification is MSVC 19.0.23026.0
-- The CXX compiler identification is MSVC 19.0.23026.0
-- Check for working C compiler using: Visual Studio 14 2015 Win64
-- Check for working C compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64
-- Check for working CXX compiler using: Visual Studio 14 2015 Win64 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Require Boost Libs module started.
-- Required Boost version: >= 1.58.0
-- Required libs: coroutine
-- Boost Lib Installer starting.
-- Invoking boost-lib to download Boost >= 1.58.0.
info BOOST Searching for Boost >= 1.58.0 in 'C:\Users\toxicwolf\.cmake-js\boost'.
info BOOST Boost found in 'C:\Users\toxicwolf\.cmake-js\boost\1.58.0'.
info BOOST Downloading submodules of director 'libs'.
info BOOST Downloading submodules of director 'numeric'.
http BOOST Downloading: https://github.com/boostorg/numeric_conversion/archive/boost-1.58.0.tar.gz
http BOOST Downloading: https://github.com/boostorg/numeric_interval/archive/boost-1.58.0.tar.gz
http BOOST Downloading: https://github.com/boostorg/numeric_odeint/archive/boost-1.58.0.tar.gz
http BOOST Downloading: https://github.com/boostorg/numeric_ublas/archive/boost-1.58.0.tar.gz
stream.js:74
      throw er; // Unhandled stream error in pipe.
            ^
Error: incorrect header check
    at Zlib._handle.onerror (zlib.js:363:17)
CMake Error at node_modules/boost-lib/cmake/DownloadBoost.cmake:10 (message):
  Download error.
Call Stack (most recent call first):
  node_modules/boost-lib/cmake/BoostLibInstaller.cmake:23 (download_boost)
  node_modules/boost-lib/cmake/BoostLib.cmake:19 (boost_lib_installer)
  CMakeLists.txt:17 (require_boost_libs)

https://gist.github.com/toxicwolf/a476630506cff18b2b72

Deprecation warning when building on recent OSX

When using the lib with recent XCode, I'm getting a bunch of deprecation warnings like this one:

In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/ip/tcp.hpp:19:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/basic_socket_acceptor.hpp:19:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/basic_io_object.hpp:19:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/io_service.hpp:767:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/impl/io_service.hpp:71:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/detail/task_io_service.hpp:196:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/detail/impl/task_io_service.hpp:19:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/detail/completion_handler.hpp:20:
In file included from /Users/administrator/.cmake-js/boost/1.61.0/boost/asio/detail/fenced_block.hpp:24:
/Users/administrator/.cmake-js/boost/1.61.0/boost/asio/detail/macos_fenced_block.hpp:45:5: warning: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12
      - Use std::atomic_thread_fence() from <atomic> instead [-Wdeprecated-declarations]
    OSMemoryBarrier();
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libkern/OSAtomicDeprecated.h:749:9: note: 
      'OSMemoryBarrier' has been explicitly marked deprecated here
void    OSMemoryBarrier( void );
        ^

GCC version fix

While building example repo, got another error (after #3 ):

[30/42] Performing build step for 'boost_coroutine_jam'
FAILED: cd /home/lyssdod/.cmake-js/boost/1.61.0 && /usr/bin/cmake -P /storage/work/cmake-js-tut-04-boost-module/build/boost-1.61.0/boost_coroutine_jam-build-Release.cmake && /usr/bin/cmake -E touch /storage/work/cmake-js-tut-04-boost-module/build/boost-1.61.0/boost_coroutine_jam-build
CMake Error at /storage/work/cmake-js-tut-04-boost-module/build/boost-1.61.0/boost_coroutine_jam-build-Release.cmake:16 (message):
  Command failed: 1

   './b2' 'link=static' 'threading=multi' 'runtime-link=shared' '--build-dir=Build' '--ignore-site-config' 'stage' '--stagedir=stage' '-d+2' '--hash' 'variant=release' '--layout=tagged' '-sNO_BZIP2=1' 'cxxflags=-fPIC' 'cxxflags=-std=c++11' 'toolset=gcc-5.4' '--with-coroutine'

  See also

    /storage/work/cmake-js-tut-04-boost-module/build/boost-1.61.0/boost_coroutine_jam-build-*.log

Solution: https://safenetforum.org/t/build-on-arch-x64-fails/2209/2

Linking against wrong library path

Hi!

Using

Node 16.13.1 and CMake 3.24.3 I fail to link against boost libraries via

include(BoostLib)

require_boost_libs("1.69.0" "date_time")
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})

I get error:

make[2]: *** No rule to make target '~/.cmake-js/boost/1.69.0/stage/lib/libboost_iostreams-mt-d.a', needed by 'Debug/CppAddon.node'.  Stop.

for both OSX and Linux.

The issue is that BoostLibInstaller.cmake is setting the lib_path:

if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "") OR (NOT DEFINED CMAKE_BUILD_TYPE))
    set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt-d.a")
else()
    set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt.a")
endif()

that is used:

set_target_properties(${boost_lib} PROPERTIES
    IMPORTED_LOCATION "${lib_path}"
    LINKER_LANGUAGE CXX)

However, using the b2 args:

Linux:

link=static;threading=multi;runtime-link=shared;--build-dir=Build;stage;--stagedir=stage;-d+2;--hash;--ignore-site-config;variant=debug;--layout=tagged;-sNO_BZIP2=1;cxxflags=-fPIC;cxxflags=-std=c++11;toolset=gcc

OSX:

link=static;threading=multi;runtime-link=shared;--build-dir=Build;stage;--stagedir=stage;-d+2;--hash;--ignore-site-config;variant=debug;toolset=clang;cxxflags=-fPIC;cxxflags=-std=c++11;cxxflags=-stdlib=libc++;linkflags=-stdlib=libc++;architecture=combined;address-model=32_64;--layout=tagged

will generate binaries like:

Linux:

libboost_chrono-mt-d-x64.a

OSX:

libboost_chrono-mt-d-c32_64.a

Linking will later fail, as the path is set to the non existing libboost_chrono-mt-d.a lib.

I am not sure why these suffixes are added by BOOST build system, but the BoostLibInstaller.cmake can be patched like so:

if(UNIX)
    set(LIBSUFFIX "-x32")
    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
            set(LIBSUFFIX "-x64")
    endif()
endif()
if(APPLE)
    string(REGEX MATCH "address-model\\=([0-9_]+)" model "${b2Args}")
    set(ADDRESS_MODEL ${CMAKE_MATCH_1})
    set(LIBSUFFIX "-c${ADDRESS_MODEL}")
endif()
if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "") OR (NOT DEFINED CMAKE_BUILD_TYPE))
    set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt-d${LIBSUFFIX}.a")
else()
    set(lib_path "${install_dir}/${stage_dir}/lib/libboost_${lib_name}-mt${LIBSUFFIX}.a")
endif()

which is a bit better than the symlink step users of the BoostLib can use instead:

if (Boost_FOUND)
    # https://github.com/cmake-js/boost-lib/blob/master/cmake/GetBoostLibB2Args.cmake
    get_boots_lib_b2_args()
    string(REGEX MATCH "address-model\\=([0-9_]+)" model "${b2Args}")
    set(ADDRESS_MODEL ${CMAKE_MATCH_1})
    if(APPLE)
        set(ADDRESS_MODEL "c${ADDRESS_MODEL}")
    endif()
    if (NOT ADDRESS_MODEL OR ADDRESS_MODEL STREQUAL "")
        set(ADDRESS_MODEL "x64") # Lets assume x64 for linux
    endif()
    string(REGEX MATCH "variant\\=([A-Za-z0-9_])" variant "${b2Args}")
    set(VARIANT "-${CMAKE_MATCH_1}")

    foreach(lib ${Boost_LIBRARIES})
        set(want_lib "lib${lib}-mt${VARIANT}.a")
        set(have_lib "lib${lib}-mt${VARIANT}-${ADDRESS_MODEL}.a")
        if(NOT EXISTS "${Boost_INCLUDE_DIR}/stage/lib/${want_lib}")
            EXECUTE_PROCESS(COMMAND ln -sf ${have_lib} ${want_lib}
                WORKING_DIRECTORY "${Boost_INCLUDE_DIR}/stage/lib"
            )
            message(STATUS "Symlinked ${Boost_INCLUDE_DIR}/stage/lib/${have_lib} -> ${Boost_INCLUDE_DIR}/stage/lib/${want_lib}")
        endif()
    endforeach()
endif()

Best would be if the b2 output lib did not get prefixed...

Error on "Generating headers..." when using boost >= 1.70.0

I have a workaround for this now because I am using boost 1.69.0, but I have found that the error is connected to this issue: #boostorg/bcp#9.
Here is the error:

-- Generating headers ...
boost-install.jam: No such file or directory
CMake Error at node_modules/boost-lib/cmake/BoostLibInstaller.cmake:187 (message):
b2 error:

Jamroot:308: in boost-install

ERROR: rule "boost-install.boost-install" unknown in module
"Jamfile<C:\Users\Hrvoje.cmake-js\boost\1.74.0>".

libs\atomic\build\Jamfile.v2:58: in modules.load

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src/build\project.jam:372:
in load-jamfile

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src/build\project.jam:64:
in load

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src/build\project.jam:89:
in load-used-projects

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src/build\project.jam:75:
in load

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src/build\project.jam:142:
in project.find

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src\build-system.jam:618:
in load

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src/kernel\modules.jam:295:
in import

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/tools/build/src/kernel/bootstrap.jam:139:
in boost-build

C:/Users/Hrvoje/.cmake-js/boost/1.74.0/boost-build.jam:17: in module scope

Call Stack (most recent call first):
node_modules/boost-lib/cmake/BoostLib.cmake:19 (boost_lib_installer)
cmake_modules/dependencies/sb/Boost.cmake:5 (require_boost_libs)
cmake_modules/dependencies/sb/SBDependencies.cmake:4 (include)
cmake_modules/dependencies/Dependencies.cmake:3 (include)
CMakeLists.txt:27 (include)

Embedding

Hi, I have to ship my addon as a precompiled binary (I think via node-pre-gyp). As far as I can see, boost-lib is compiled as static now, what are my steps to make the installation redistributable?

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.