CMakeLists.txt 4.1 KB

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