rebuild icon indicating copy to clipboard operation
rebuild copied to clipboard

cmake.js support

Open xVanTuring opened this issue 6 years ago • 10 comments

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 avatar Jan 17 '19 01:01 xVanTuring

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

xVanTuring avatar Jan 17 '19 02:01 xVanTuring

@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

incomingstick avatar Oct 02 '19 01:10 incomingstick

Are there any plans on adding this feature?

almoghamdani avatar Dec 16 '19 15:12 almoghamdani

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!

malept avatar Dec 18 '19 19:12 malept

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 avatar Jan 30 '21 20:01 smalls12

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.

smalls12 avatar Jan 31 '21 02:01 smalls12

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 avatar Jun 10 '21 23:06 zhex900

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

zhex900 avatar Jun 16 '21 04:06 zhex900

Is cmake-js supported now?

dogeFu avatar Nov 10 '21 08:11 dogeFu

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

asmbaty avatar Sep 20 '22 13:09 asmbaty