electron / rebuild

Package to rebuild native Node.js modules against the currently installed Electron version
MIT License
1.01k stars 174 forks source link

cmake.js support #268

Open xVanTuring opened 5 years ago

xVanTuring commented 5 years ago

CMake.js is quite awesome and easy to use. Even used in Microsoft/napajs! It will be greate to add support for cmake.js. Currently electron-rebuild can only recognize the binding.gyp file, I think it should be quite easy to add support for cmake.js.

xVanTuring commented 5 years ago

Well, Simply add an empty binding.gyp will work . Official support will be awesome. Should I Leave it open?

incomingstick commented 4 years ago

@xVanTuring thank you for the slight work around. When I make your suggested change, it does build via cmake, but not at the correct Node Module Version on my end. Do you have any suggestions?

I would also appreciate official support for cmake-js

almoghamdani commented 4 years ago

Are there any plans on adding this feature?

malept commented 4 years ago

This is on my TODO list, but it's pretty far down. We'd be happy to have a contribution to add support for this from the community, though!

smalls12 commented 3 years ago

Any update on this?

I have a native module that when built with cmake-js it works fine. When it builds with node-gyp it behaves differently.

Obviously that is just an issue on my end, but if electron-rebuild could use cmake-js it would solve my problem lol

I tried the blank binding.gyp trick noted above, but electron-rebuild then says it can't parse the file :(

smalls12 commented 3 years ago

Found the problem between node-gyp and cmake-js node-gyp is patching extra definitions behind the scenes https://github.com/cmake-js/cmake-js/issues/222#issuecomment-732746074

Adding them into my cmake-js then everything works and I can run my native module in electron compiling my module outside of electron-rebuild and then just bringing it in manually.

Figured I would close the loop on this; other people might come here with issues.

zhex900 commented 3 years ago

I am trying to rebuild aws-crt so it will work with electron.

@xVanTuring said adding an empty binding.gyp will work. Where do I add this file?

@smalls12 what exactly did you do to make your native module work?

zhex900 commented 3 years ago

An empty binding.gyp does not work for me. By adding binding.gyp to aws-crt I get these errors:

gyp info spawn C:\Users\jake\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Code\\mir-kiosk-electron\\electron-kiosk\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Code\\mir-kiosk-electron\\electron-kiosk\\node_modules\\aws-crt\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Code\\mir-kiosk-electron\\electron-kiosk\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\jake\\.electron-gyp\\13.1.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\jake\\.electron-gyp\\13.1.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Code\\mir-kiosk-electron\\electron-kiosk\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\jake\\\\.electron-gyp\\\\13.1.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Code\\mir-kiosk-electron\\electron-kiosk\\node_modules\\aws-crt',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Code\\mir-kiosk-electron\\electron-kiosk\\node_modules\\aws-crt\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
\ Preparing native dependencies: 0 / 1gyp: Unable to find targets in build file binding.gyp while trying to load binding.gyp
× Preparing native dependencies: 0 / 1
dogeFu commented 2 years ago

Is cmake-js supported now?

asmbaty commented 1 year ago

Is there a final workaround for how to use cmake-js with electron-rebuild or how to avoid it?