-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot open include file: 'napi.h' #309
Comments
I fixed it with this target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/node_modules/node-addon-api" "${CMAKE_SOURCE_DIR}/../../node-addon-api" "src" ) But is there a better way to handle this ? |
Also while not related to the issue, Is it possible to have Native Package B, depend on Native Package A such that B can import and use all headers and such defined in A? Like in my case I have a torch package that has basic tensor operations and another package for torchvision. but I do not want to have to redefine tensors and all that and instead want to use what I already have done in the previous package. |
I'm not entirely following what you are asking, but probably. It sounds like a more general cmake question than something specific to this lib |
"binary": {
"napi_versions": [
7
]
} in If you include this property, it will correctly add the AFAIK, currently there is no such requirement for Additionally, when My proposal is to make it a little bit less intelligent. Always include the low-level API as retrieved from the remote server. And try to simply detect the presence of |
@TareHimself open a separate issue with this question, and I will share my experience on this matter, which does not have a simple solution. |
I was hitting this too, and figured out why by enabling If In my project, Node is only one of the many platforms we build for. Thus we have CMakeLists.txt in the root, and The README says " -d, --directory specify CMake project's directory (where CMakeLists.txt located)` - it doesn't say package.json has to be in the same directory as the CMakeLists.txt (if it did I'm not sure why this option would exist). It also doesn't say where the directory needs to be in relation to the package.json, which is why my understanding is putting CMakeLists.txt in a parent dir should work.
isNode Api does const tmpRequire = require('module').createRequire(path.join(projectRoot, 'package.json'))
|
I was missing node.lib this is the fixed CMakeList https://github.com/nodeml/torch/blob/main/CMakeLists.txt |
I am getting this error
Cannot open include file: 'napi.h'
in multiple source files. This is my CmakeListsIt only works when I uncomment
# target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/node_modules/node-addon-api" "src" )
But that does not when I try to install the module elsewhere.
This is the repository https://github.com/nodeml/torch
The text was updated successfully, but these errors were encountered: