npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

boost-lib

v0.11.3

Published

Boost dependency manager for CMake.js based native modules

Downloads

52

Readme

boost-lib (MIT)

About

boos-lib is a Boost dependency manager for CMake.js based native modules.

Everyone knowns about Boost. It's the base of almost all C++ projects out there. But using it in native node addons was not so easy (until now). It's a huge download that can be accessible by navigating through the infamous Sourceforge Crapware Screens. After downloading, you will get the source files, bundled with Jam based build system that is impossible to integrate with node-gyp.

So, if you wanted to create a native node module with Boost dependency, then you had the only option that to write down somewhere in the readme that your module requires Boost 1.x, and that's it. Your module consumers had to install Boost 1.x, compile it, set some environment variables pointing to their installation, and hope for that works with your module. There is not a miracle that there is no Boost based native node module exists ... yet.

The good news there is hope. With CMake.js you can create native modules with Boost dependency. If your module consumer has the appropriate Boost version installed, then your module will use that. If not, then boost-lib module downloads Boost from Github, compiles the required libraries (only the required ones), and your module will use that installation. Everything is automatic and as fast as possible. A typical Boost installation with one required library takes about ~1.5 minutes, and that has to be done only once, any following module installations will use that deployment.

CMake.js

CMake.js is a Node.js/io.js native addon build tool which works exactly like node-gyp, but instead of gyp, it is based on CMake build system. It's on the npm.

Installation

npm install boost-lib

Usage

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

1. Include

Install boost-lib module from npm.

npm install boost-lib --save

Enter the following into your project's root CMakeLists.txt file to include BoostLib CMake module:

# Include BoostLib module
SET(CMAKE_MODULE_PATH  
    "${CMAKE_CURRENT_SOURCE_DIR}/node_modules/boost-lib/cmake")

include(BoostLib)

2. Require

This makes require_boost_libs function available. It has two arguments:

  • in the first argument you have to specify required Boost library's semver specification like that you can use in package.json. For example to use Boost 1.58, enter 1.58.0, to use Boost 1.57 or above, enter ">= 1.57.0". See semver modules's documentation for further details.
  • in the second argument you can specify required Boost's to-be-compiled libraries separated by semicolon. Leave blank if you need header only libraries. For example to depend on Boost.coroutine and Boost.DateTime, enter coroutine;date_time.

Examples:

Boost 1.57 or above required with thread and context libraries:

require_boost_libs(">= 1.57.0" thread;context)

Boost 1.58 required with header only libraries:

require_boost_libs(1.57.0 "")

Known to-be-build Boost libraries so far:

  • chrono
  • coroutine
  • context
  • filesystem
  • graph
  • locale
  • log
  • system
  • thread
  • timer
  • wave

Their internal dependencies are handled automatically. So if you're requireing coroutine which depends on context and system, you don't have to sepcify them all, only coroutine.

3. Use

Boost's include path should be registered by entering:

include_directories(${Boost_INCLUDE_DIRS})

And you have to link your addon with Boost libraries:

target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB};${Boost_LIBRARIES})

Example and tutorial

The tutorial is about making the example module, which can be downloaded from there:

git clone https://github.com/unbornchikken/cmake-js-tut-04-boost-module