[英]node-gyp - Handling “.h.in” files
我创建了一个包含git子模块libxml2
的项目。 我想在我的binding.gyp
使用此文件,但是在运行node-gyp build
出现错误。 这里的问题是只有xmlversion.h.in
文件,但是需要xmlversion.h
文件。
当我运行autogen.sh
脚本libxml2
第一一切工作正常,因为autotools
将创建xmlversion.h
文件出的xmlversion.h.in
。
有没有一种方法可以使用node-gyp
xmlversion.h
创建xmlversion.h
文件?
我当前的bindings.gyp
看起来像这样:
{
'targets': [{
'target_name': 'library',
'product_extension': 'node',
'type': 'shared_library',
'include_dirs': [
'libxml2/include',
'libxml2',
"<!(node -e \"require('nan')\")"
],
'cflags': [ '-Wall' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-Wall' ]
},
'sources': [
# src/my_files.cc
# libxml2/libxml2_files.c
]
}]
}
解决文件中.h.in
问题的最佳解决方案是使用autotools
对其进行一次构建,然后将创建的.h
文件复制到项目的其他目录(这样子模块将不会受到影响)。 此外,您可能必须为多个平台或体系结构构建这些文件。 之后,您可以将新文件夹添加到您的包含文件中。 这里提供了一个很好的解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.