1. {
    2. "variables": {
    3. # 定义变量
    4. "dll_files": [
    5. "libgreeting_shared.dll"
    6. ]
    7. },
    8. "targets": [
    9. {
    10. # 打包名称 greeting.node
    11. "target_name": "greeting",
    12. # 打包类型:默认动态库 shared_library
    13. # "type": "static_library",
    14. "cflags!": [ "-fno-exceptions" ],
    15. "cflags_cc!": [ "-fno-exceptions" ],
    16. 'cflags' : [ '-std=c++14' ],
    17. "sources": [ "greeting.cc" ],
    18. # 静态链接库
    19. "libraries": [
    20. "libgreeting_static.a",
    21. # "-lstdc++",
    22. "-L<(module_root_dir)/build/Release"
    23. ],
    24. "link_settings": {
    25. # 静态链接库目录
    26. "library_dirs": [
    27. "<(module_root_dir)"
    28. ],
    29. # "libraries": [
    30. # "<(dll_files)"
    31. # ]
    32. },
    33. # 需要引用的头文件所在目录
    34. "include_dirs": [
    35. "<!@(node -p \"require('node-addon-api').include\")",
    36. "<(module_root_dir)/include"
    37. ],
    38. # 复制
    39. "copies": [
    40. {
    41. "destination": "<(module_root_dir)/build/Release/",
    42. "files": [
    43. "<(module_root_dir)/libgreeting_shared.dll"
    44. ]
    45. }
    46. ],
    47. 'defines': [ 'NAPI_CPP_EXCEPTIONS' ],
    48. # 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
    49. }
    50. ]
    51. }