Skip to content
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

node-gyp cannot generate cmake #33

Open
khrushjing opened this issue Apr 2, 2022 · 4 comments
Open

node-gyp cannot generate cmake #33

khrushjing opened this issue Apr 2, 2022 · 4 comments
Labels
wontfix This will not be worked on

Comments

@khrushjing
Copy link

It is well known that node-gyp cannot be parsed by ide. So the usual practice is to generate cmake, using the following command:

 node-gyp configure -- -f cmake

This command will eventually generate a CMakeList.txt, which can eventually be parsed by ide.
However, this approach seems to fail in this project, and neither an error is reported nor any results are output.

@mmomtchev
Copy link
Owner

This project uses node-pre-gyp which is the reason why it is not fully compatible with the usual node-gyp mechanisms

Why do you need a CMakeLists.txt?

node-gyp is a huge problem in the Node.js ecosystem - it is inherited by the Chromium project - which itself does not use it anymore - but any cmake alternatives are still not mature enough. There is no really an easy way around it.

@mmomtchev
Copy link
Owner

@khrushjing, if you add this to your binding.gyp, you will make it work:

diff --git a/binding.gyp b/binding.gyp
index 76499503..44734bb0 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -8,6 +8,8 @@
                "enable_logging%": "false",
                "enable_asan%": "false",
                "enable_coverage%": "false",
+              "module_name": "gdal",
+              "module_path": "./lib/binding",
                "sources_node_gdal": [
                                "src/utils/typed_array.cpp",
                                "src/utils/string_list.cpp",

But I am not willing to merge this, because it will break other things - normally these variables should come from node-pre-gyp

@khrushjing
Copy link
Author

If I use the following command:

./node_modules/.bin/node-pre-gyp configure -- -f cmake

node-pre-gyp will automatically fill in the variables, but the real problem is that the cmake cannot be generated.
In clion, VSCode and other ide, it is possible to parse cmake syntactically, but support for other pure makefile projects is poor.

@mmomtchev mmomtchev added the wontfix This will not be worked on label Apr 19, 2022
@khrushjing
Copy link
Author

node-gyp is now able to generate the cmakelist file, whose output is under the build folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants