Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use local node-gyp for benchmark addon #16160

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ test-valgrind: all
test-check-deopts: all
$(PYTHON) tools/test.py --mode=release --check-deopts parallel sequential -J

benchmark/misc/function_call/build/Release/binding.node: all \
benchmark/misc/function_call/binding.cc \
benchmark/misc/function_call/binding.gyp
$(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--python="$(PYTHON)" \
--directory="$(shell pwd)/benchmark/misc/function_call" \
--nodedir="$(shell pwd)"

# Implicitly depends on $(NODE_EXE). We don't depend on it explicitly because
# it always triggers a rebuild due to it being a .PHONY rule. See the comment
# near the build-addons rule for more background.
Expand Down Expand Up @@ -904,8 +912,7 @@ bench-http: all
bench-fs: all
@$(NODE) benchmark/run.js fs

bench-misc: all
@$(MAKE) -C benchmark/misc/function_call/
bench-misc: benchmark/misc/function_call/build/Release/binding.node
@$(NODE) benchmark/run.js misc

bench-array: all
Expand Down Expand Up @@ -958,6 +965,7 @@ LINT_CPP_EXCLUDE += $(wildcard test/addons-napi/??_*/*.cc test/addons-napi/??_*/
LINT_CPP_EXCLUDE += src/tracing/trace_event.h src/tracing/trace_event_common.h

LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
benchmark/misc/function_call/binding.cc \
src/*.c \
src/*.cc \
src/*.h \
Expand Down
2 changes: 0 additions & 2 deletions benchmark/misc/function_call/Makefile

This file was deleted.

9 changes: 3 additions & 6 deletions benchmark/misc/function_call/binding.cc
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#include <v8.h>
#include <node.h>

using namespace v8;

static int c = 0;

void Hello(const FunctionCallbackInfo<Value>& args) {
void Hello(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(c++);
}

extern "C" void init (Local<Object> target) {
HandleScope scope(Isolate::GetCurrent());
void Initialize(v8::Local<v8::Object> target) {
NODE_SET_METHOD(target, "hello", Hello);
}

NODE_MODULE(NODE_GYP_MODULE_NAME, init)
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)