binding.gyp: 如何使用 "copies" 部分在多个位置复制文件
binding.gyp: How to use "copies" section to copy files in multiple location
我正在编写代码以从 electron 加载 c++ dll。我正在使用节点 gyp。在我的 binding.gyp 文件中,我使用 "copies" 标签将 dll 复制到 Release 文件夹。但是我想复制更多文件以复制到其他位置。我试过 hit 和 trial 方法来做到这一点,但没有成功。这是我的 binding.gyp 的样子:
{
"targets": [{
"conditions":[
["OS=='win'", {
"copies":[{
'destination': './build/Release',
'files':[
'../../cl-fc-client-thirdparty/bugtrap/BugTrapU-x64.dll',
'../build/bin/msvc/Release64/cloudDrive2Lib.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/ssleay32MD.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoZip64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoXML64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoUtil64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNetSSL64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNet64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoJSON64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoFoundation64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoCrypto64.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/libeay32MD.dll'
]
}]
}]
],
"target_name": "electronToCppBridge",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"src/electronToCppBridge.cc",
],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': ["../libs/cloudDrive2Lib.lib"],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}]
}
没关系,我是通过以下方式实现的:
{
"targets": [{
"conditions":[
["OS=='win'", {
"copies":[
{
'destination': './build/Release',
'files':[
'../../cl-fc-client-thirdparty/bugtrap/BugTrapU-x64.dll',
'../build/bin/msvc/Release64/cloudDrive2Lib.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/ssleay32MD.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoZip64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoXML64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoUtil64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNetSSL64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNet64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoJSON64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoFoundation64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoCrypto64.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/libeay32MD.dll'
]
},
{
'destination': './libs',
'files':['../build/bin/msvc/Release64/cloudDrive2Lib.lib']
}
]
}]
],
"target_name": "electronToCppBridge",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"src/electronToCppBridge.cc",
],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': ["../libs/cloudDrive2Lib.lib"],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}]
}
我正在编写代码以从 electron 加载 c++ dll。我正在使用节点 gyp。在我的 binding.gyp 文件中,我使用 "copies" 标签将 dll 复制到 Release 文件夹。但是我想复制更多文件以复制到其他位置。我试过 hit 和 trial 方法来做到这一点,但没有成功。这是我的 binding.gyp 的样子:
{
"targets": [{
"conditions":[
["OS=='win'", {
"copies":[{
'destination': './build/Release',
'files':[
'../../cl-fc-client-thirdparty/bugtrap/BugTrapU-x64.dll',
'../build/bin/msvc/Release64/cloudDrive2Lib.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/ssleay32MD.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoZip64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoXML64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoUtil64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNetSSL64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNet64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoJSON64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoFoundation64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoCrypto64.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/libeay32MD.dll'
]
}]
}]
],
"target_name": "electronToCppBridge",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"src/electronToCppBridge.cc",
],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': ["../libs/cloudDrive2Lib.lib"],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}]
}
没关系,我是通过以下方式实现的:
{
"targets": [{
"conditions":[
["OS=='win'", {
"copies":[
{
'destination': './build/Release',
'files':[
'../../cl-fc-client-thirdparty/bugtrap/BugTrapU-x64.dll',
'../build/bin/msvc/Release64/cloudDrive2Lib.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/ssleay32MD.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoZip64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoXML64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoUtil64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNetSSL64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoNet64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoJSON64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoFoundation64.dll',
'../../cl-fc-client-thirdparty/poco/1.7.5/bin64/PocoCrypto64.dll',
'../../cl-fc-client-thirdparty/openssl/1.0.2j/lib/x86_64-win32/libeay32MD.dll'
]
},
{
'destination': './libs',
'files':['../build/bin/msvc/Release64/cloudDrive2Lib.lib']
}
]
}]
],
"target_name": "electronToCppBridge",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"src/electronToCppBridge.cc",
],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': ["../libs/cloudDrive2Lib.lib"],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}]
}