如何根据配置更改库路径?
How to change library paths based on configuration?
我正在构建一个需要 link 静态库的本机模块。该库的路径。我的 binding.gyp 文件具有以下外观:
{
"targets": [
{
"target_name": "DcpServer",
"sources": [
"DcpServer.cc"
],
"include_dirs": [
"../../coratools",
"../../../boost-1.65.1"
],
"libraries": [
"<(module_root_dir)/../../coratools/release_uni64/coratools.lib"
],
"defines": [ "CSIWEB_EMBEDDED", "UNICODE", "_UNICODE" ],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
}
},
"Debug": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
}
}
}
}
]
}
coratools.lib 的路径将根据选择的是调试配置还是发布配置而有所不同。问题是 node-gyp 不允许我将 "libraries" 键放在 "configurations" 属性 中。有没有办法通过使库路径有条件来做我想做的事情?
我从来没有发现如何做到这一点。最后,我转而使用 cmake-js 来构建我的原生模块。
我正在构建一个需要 link 静态库的本机模块。该库的路径。我的 binding.gyp 文件具有以下外观:
{
"targets": [
{
"target_name": "DcpServer",
"sources": [
"DcpServer.cc"
],
"include_dirs": [
"../../coratools",
"../../../boost-1.65.1"
],
"libraries": [
"<(module_root_dir)/../../coratools/release_uni64/coratools.lib"
],
"defines": [ "CSIWEB_EMBEDDED", "UNICODE", "_UNICODE" ],
"configurations": {
"Release": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
}
},
"Debug": {
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
}
}
}
}
]
}
coratools.lib 的路径将根据选择的是调试配置还是发布配置而有所不同。问题是 node-gyp 不允许我将 "libraries" 键放在 "configurations" 属性 中。有没有办法通过使库路径有条件来做我想做的事情?
我从来没有发现如何做到这一点。最后,我转而使用 cmake-js 来构建我的原生模块。