UNPKG

4.24 kBPlain TextView Raw
1cmake_minimum_required(VERSION 3.5)
2project(nan)
3
4set(CMAKE_CXX_STANDARD 11)
5
6set(CPPLINT "${CMAKE_CURRENT_SOURCE_DIR}/cpplint.py")
7set(MODULES symbols strings)
8set(SOURCES "")
9set(ADDONS "")
10
11foreach(MODULE ${MODULES})
12 list(APPEND SOURCES "test/cpp/${MODULE}.cpp")
13 list(APPEND ADDONS "test/build/${CMAKE_BUILD_TYPE}/${MODULE}.node")
14endforeach()
15
16set(LINT_SOURCES examples/async_pi_estimate/addon.cc
17 examples/async_pi_estimate/async.cc
18 examples/async_pi_estimate/async.h
19 examples/async_pi_estimate/pi_est.cc
20 examples/async_pi_estimate/pi_est.h
21 examples/async_pi_estimate/sync.cc
22 examples/async_pi_estimate/sync.h
23 nan.h
24 nan_callbacks.h
25 nan_callbacks_12_inl.h
26 nan_callbacks_pre_12_inl.h
27 nan_converters.h
28 nan_converters_43_inl.h
29 nan_converters_pre_43_inl.h
30 nan_define_own_property_helper.h
31 nan_implementation_12_inl.h
32 nan_implementation_pre_12_inl.h
33 nan_json.h
34 nan_maybe_43_inl.h
35 nan_maybe_pre_43_inl.h
36 nan_new.h
37 nan_object_wrap.h
38 nan_persistent_12_inl.h
39 nan_persistent_pre_12_inl.h
40 nan_private.h
41 nan_scriptorigin.h
42 nan_string_bytes.h
43 nan_weak.h
44 test/cpp/accessors.cpp
45 test/cpp/accessors2.cpp
46 test/cpp/asyncresource.cpp
47 test/cpp/asyncworker.cpp
48 test/cpp/asyncprogressworker.cpp
49 test/cpp/asyncprogressworkerstream.cpp
50 test/cpp/asyncprogressworkersignal.cpp
51 test/cpp/asyncprogressqueueworker.cpp
52 test/cpp/asyncprogressqueueworkerstream.cpp
53 test/cpp/asyncworkererror.cpp
54 test/cpp/buffer.cpp
55 test/cpp/bufferworkerpersistent.cpp
56 test/cpp/error.cpp
57 test/cpp/gc.cpp
58 test/cpp/indexedinterceptors.cpp
59 test/cpp/callbackcontext.cpp
60 test/cpp/converters.cpp
61 test/cpp/isolatedata.cpp
62 test/cpp/json-parse.cpp
63 test/cpp/json-stringify.cpp
64 test/cpp/makecallback.cpp
65 test/cpp/maybe.cpp
66 test/cpp/morenews.cpp
67 test/cpp/multifile1.cpp
68 test/cpp/multifile2.cpp
69 test/cpp/multifile2.h
70 test/cpp/namedinterceptors.cpp
71 test/cpp/nancallback.cpp
72 test/cpp/nannew.cpp
73 test/cpp/news.cpp
74 test/cpp/objectwraphandle.cpp
75 test/cpp/persistent.cpp
76 test/cpp/private.cpp
77 test/cpp/returnemptystring.cpp
78 test/cpp/returnnull.cpp
79 test/cpp/returnundefined.cpp
80 test/cpp/returnvalue.cpp
81 test/cpp/setcallhandler.cpp
82 test/cpp/settemplate.cpp
83 test/cpp/sleep.h
84 test/cpp/strings.cpp
85 test/cpp/symbols.cpp
86 test/cpp/threadlocal.cpp
87 test/cpp/trycatch.cpp
88 test/cpp/typedarrays.cpp
89 test/cpp/weak.cpp
90 test/cpp/weak2.cpp
91 test/cpp/wrappedobjectfactory.cpp
92 node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc)
93
94set(FILTER "-build/include_subdir,-whitespace/parens")
95
96find_package(Python COMPONENTS Interpreter Development REQUIRED)
97
98execute_process(
99 COMMAND npm install
100 OUTPUT_FILE node_modules
101 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
102)
103
104add_custom_target(lint
105 COMMAND ${Python_EXECUTABLE} ${CPPLINT} --filter=${FILTER} ${LINT_SOURCES}
106 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
107)
108
109add_custom_target(test
110 DEPENDS ${ADDONS}
111 COMMAND npm test
112)
113
114add_custom_target(forcetest
115 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
116 COMMAND ../node_modules/.bin/node-gyp rebuild
117 COMMAND npm test
118)
119
120add_custom_target(docs
121 DEPENDS README.md doc/.build.sh doc/asyncworker.md doc/buffers.md doc/callback.md
122 doc/converters.md doc/errors.md doc/maybe_types.md doc/methods.md doc/new.md
123 doc/node_misc.md doc/persistent.md doc/scopes.md doc/script.md doc/string_bytes.md
124 doc/v8_internals.md doc/json.md doc/v8_misc.md
125 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
126 COMMAND doc/.build.sh
127)
128
129add_custom_command(OUTPUT ${ADDONS}
130 DEPENDS ${SOURCES} nan.h nan_new.h nan_implementation_pre_12_inl.h nan_implementation_12_inl.h
131 nan_callbacks.h nan_callbacks_12_inl.h nan_callbacks_pre_12_inl.h nan_converters.h
132 nan_converters_43_inl.h nan_converters_pre_43_inl.h nan_define_own_property_helper.h
133 nan_json.h nan_maybe_43_inl.h nan_maybe_pre_43_inl.h nan_persistent_12_inl.h
134 nan_persistent_pre_12_inl.h nan_private.h nan_weak.h nan_scriptorigin.h nan_string_bytes.h
135 test/binding.gyp
136 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
137 COMMAND ../node_modules/.bin/node-gyp rebuild
138)
\No newline at end of file