zoukankan      html  css  js  c++  java
  • node-gpy 使用lib和dll

    1. 创建静态库 "hello.lib"

    • release x64
    • 编译前,选择多线程MT,否则可能出现这个错误(error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MD_DynamicRelease”不匹配值“MT_StaticRelease”)
    • 生成解决方案

    2. gyp设置

    • 将hello.lib拷贝到 /<(project_dir)deps/hello/hello.lib
    • 将hello.h拷贝到/<(project_dir)deps/hello/include/hello.h
    {
        'variables': {
        },
        "targets": [
            {
                "target_name": "node-windows-x64",
                "sources": [
                    "src/main.cpp",
                ],
                "include_dirs": [
                    "<!@(node -p "require('node-addon-api').include")",
                    '<(module_root_dir)/deps/hello/include', # 头文件
                    '<(module_root_dir)/deps/asmjit/include',
                ],
                'defines': ['NAPI_DISABLE_CPP_EXCEPTIONS'],
                'libraries': [
                    '-l<(module_root_dir)/deps\asmjit\asmjit.lib',
                    '-l<(module_root_dir)/deps\asmjit\asmjit.lib', # lib文件
                ],
                "copies": [
                    {
                        "destination": "<(module_root_dir)/build/Release/",
                        "files": ["<(module_root_dir)/deps\asmjit\asmjit.dll"]
                    }
                ]
            },
        ]
    }
    

    3. 运行

    node-gyp configure --release && node-gyp build --release
    
  • 相关阅读:
    人生之清单(list of life)
    grpc编译错误解决
    windows tensorflow 版本与升级
    PermissionError: [Errno 13] in python
    经典分析--HTTP协议
    介绍 JSON
    Json 不同语言的使用
    JSON标准格式
    JSON 数据格式
    SKINTOOL 系统不能正常运行
  • 原文地址:https://www.cnblogs.com/ajanuw/p/14423965.html
Copyright © 2011-2022 走看看