From bd2d7900c81dfe30bb18aea89edfa07a0b31583b Mon Sep 17 00:00:00 2001 From: legendecas Date: Tue, 10 Oct 2023 01:05:51 +0800 Subject: [PATCH] gyp: add common targets --- .gitignore | 4 ++++ benchmark/binding.gyp | 8 ++++---- common.gypi | 1 - doc/setup.md | 44 +++++++++++++------------------------------ index.js | 3 ++- node_addon_api.gyp | 32 +++++++++++++++++++++++++++++++ test/binding.gyp | 15 +++++++-------- 7 files changed, 62 insertions(+), 45 deletions(-) create mode 100644 node_addon_api.gyp diff --git a/.gitignore b/.gitignore index b1233109f..bcded4821 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ /benchmark/src /test/addon_build/addons /.vscode + +# ignore node-gyp generated files outside its build directory +/test/*.Makefile +/test/*.mk diff --git a/benchmark/binding.gyp b/benchmark/binding.gyp index 72f68a13e..879d4a569 100644 --- a/benchmark/binding.gyp +++ b/benchmark/binding.gyp @@ -4,22 +4,22 @@ { 'target_name': 'function_args', 'sources': [ 'function_args.cc' ], - 'includes': [ '../except.gypi' ], + 'dependencies': ['../node_addon_api.gyp:node_addon_api_except'], }, { 'target_name': 'function_args_noexcept', 'sources': [ 'function_args.cc' ], - 'includes': [ '../noexcept.gypi' ], + 'dependencies': ['../node_addon_api.gyp:node_addon_api'], }, { 'target_name': 'property_descriptor', 'sources': [ 'property_descriptor.cc' ], - 'includes': [ '../except.gypi' ], + 'dependencies': ['../node_addon_api.gyp:node_addon_api_except'], }, { 'target_name': 'property_descriptor_noexcept', 'sources': [ 'property_descriptor.cc' ], - 'includes': [ '../noexcept.gypi' ], + 'dependencies': ['../node_addon_api.gyp:node_addon_api'], }, ] } diff --git a/common.gypi b/common.gypi index 9be254f0b..e80a2b06a 100644 --- a/common.gypi +++ b/common.gypi @@ -15,7 +15,6 @@ } }] ], - 'include_dirs': ["@(build_sources)'] }, { 'target_name': 'binding_noexcept', - 'includes': ['../noexcept.gypi'], + 'dependencies': ['../node_addon_api.gyp:node_addon_api'], 'sources': ['>@(build_sources)'] }, { 'target_name': 'binding_noexcept_maybe', - 'includes': ['../noexcept.gypi'], + 'dependencies': ['../node_addon_api.gyp:node_addon_api_maybe'], 'sources': ['>@(build_sources)'], - 'defines': ['NODE_ADDON_API_ENABLE_MAYBE'] }, { 'target_name': 'binding_swallowexcept', - 'includes': ['../except.gypi'], + 'dependencies': ['../node_addon_api.gyp:node_addon_api_except'], 'sources': [ '>@(build_sources_swallowexcept)'], 'defines': ['NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS'] }, { 'target_name': 'binding_swallowexcept_noexcept', - 'includes': ['../noexcept.gypi'], + 'dependencies': ['../node_addon_api.gyp:node_addon_api'], 'sources': ['>@(build_sources_swallowexcept)'], 'defines': ['NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS'] }, { 'target_name': 'binding_type_check', - 'includes': ['../noexcept.gypi'], + 'dependencies': ['../node_addon_api.gyp:node_addon_api'], 'sources': ['>@(build_sources_type_check)'], 'defines': ['NODE_ADDON_API_ENABLE_TYPE_CHECK_ON_AS'] }, { 'target_name': 'binding_custom_namespace', - 'includes': ['../noexcept.gypi'], + 'dependencies': ['../node_addon_api.gyp:node_addon_api'], 'sources': ['>@(build_sources)'], 'defines': ['NAPI_CPP_CUSTOM_NAMESPACE=cstm'] },