Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ matrix:
- ./scripts/publish.sh --toolset=${TOOLSET:-} --debug=$([ "${BUILDTYPE}" == 'debug' ] && echo "true" || echo "false")
# g++ build (default builds all use clang++)
- os: linux
env: BUILDTYPE=debug CXX="g++-6" CC="gcc-6"
env: BUILDTYPE=debug CXX="g++-6" CC="gcc-6" CXXFLAGS="-Weffc++"
node_js: 4
addons:
apt:
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
MODULE_NAME := $(shell node -e "console.log(require('./package.json').binary.module_name)")

# Whether to turn compiler warnings into errors
export WERROR ?= true

default: release

node_modules:
Expand All @@ -8,11 +11,11 @@ node_modules:
npm install --ignore-scripts

release: node_modules
V=1 ./node_modules/.bin/node-pre-gyp configure build --loglevel=error
V=1 ./node_modules/.bin/node-pre-gyp configure build --error_on_warnings=$(WERROR) --loglevel=error
@echo "run 'make clean' for full rebuild"

debug: node_modules
V=1 ./node_modules/.bin/node-pre-gyp configure build --loglevel=error --debug
V=1 ./node_modules/.bin/node-pre-gyp configure build --error_on_warnings=$(WERROR) --loglevel=error --debug
@echo "run 'make clean' for full rebuild"

coverage:
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ make # build binaries
make test
```

Note: by default the build errors on compiler warnings. To disable this do:

```
WERROR=false make
```


# Code coverage

Code coverage is critical for knowing how well your tests actually test all your code. To see code coverage you can view current results online at [![codecov](https://codecov.io/gh/mapbox/node-cpp-skel/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/node-cpp-skel) or you can build in a customized way and display coverage locally like:
Expand Down
23 changes: 23 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
'includes': [ 'common.gypi' ],
'variables': {
'error_on_warnings%':'true',
# includes we don't want warnings for.
# As a variable to make easy to pass to
# cflags (linux) and xcode (mac)
'system_includes': [
"-isystem <(module_root_dir)/<!(node -e \"require('nan')\")"
]
},
'targets': [
{
'target_name': '<(module_name)',
Expand All @@ -11,10 +20,24 @@
'ldflags': [
'-Wl,-z,now',
],
'conditions': [
['error_on_warnings == "true"', {
'cflags_cc' : [ '-Werror' ],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-Werror' ]
}
}]
],
'cflags': [
'<@(system_includes)'
],
'xcode_settings': {
'OTHER_LDFLAGS':[
'-Wl,-bind_at_load'
],
'OTHER_CPLUSPLUSFLAGS': [
'<@(system_includes)'
],
'GCC_ENABLE_CPP_RTTI': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'MACOSX_DEPLOYMENT_TARGET':'10.8',
Expand Down
7 changes: 7 additions & 0 deletions src/hello_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ NAN_METHOD(HelloWorld::wave)
class AsyncBaton
{
public:
AsyncBaton() :
request(),
cb(),
phrase(),
louder(false),
error_name(),
result() {}
uv_work_t request; // required
Nan::Persistent<v8::Function> cb; // callback function type
std::string phrase;
Expand Down