diff --git a/README.md b/README.md index 1e2ee79d6..a1a0c51b7 100644 --- a/README.md +++ b/README.md @@ -32,193 +32,7 @@ Linux and Windows screenshots to be added soon. - [x] Good support for dark mode (Thanks to QT). - [x] Typescript support -## Development setup and getting started - -This guide is for setting up `nodegui` for contributors of nodegui. -The actual getting started guide for users will be added once we reach a bit of stable level. - -Make sure you have setup `qode` and installed it globally. - -### MacOSX: - -**Requirements** - -1. Node version: > 9 -2. Python and gcc -3. Make sure you dont have spaces inside your home path. NodeGYP has issues with spaces in the path. https://github.com/nodejs/node-gyp/issues/209 - -**Setting up** - -1. Install latest version of Qt (5.12) via homebrew only. - -``` -brew install qt5 -``` - -### Windows: - -**Requirements** - -1. Node version: > 9 -2. Python and MSVC++ - -**Setting up** --- Instructions will be added soon -- - -### Linux: - -**Requirements** - -1. Node version: > 9 -2. Python, Make, GCC, pkg-config and Qt5
- -On Ubuntu: `$ sudo apt-get install pkg-config build-essentials` should install everything except Qt5. - -**Setting up** - -1. Make sure you have downloaded and installed Qt5 sdk. -2. Before running `yard build`, do - `export PKG_CONFIG_PATH="/5.11.0/gcc_64/lib/pkgconfig"` - -### Common: - -1. Once you have setup the platform specific stuff as mentioned above, follow these: - -2. `git clone` this repo. - -3. Keep note of the install directory of qt. You should probably find it at `/usr/local/Cellar/qt/5.12.1`. Copy this path and - edit the file `config/common.gypi`.
- Change the field - - ``` - 'qt_home_dir': ' // example : ../../core/YogaWidget/yogawidget.h -``` - -So for nlabel I would run it as: - -``` -moc nlabel.h -o nlabel_moc.cpp --include ../../core/YogaWidget/yogawidget.h -``` - -This will run moc on `headername.h` and generate `headername_moc.cpp`. We will include `headername_moc.cpp` in `config/moc.gypi`. If you dont do this. Then it will give a symbol not found error. - -I hope QLabel's example is enough for now. For more examples and inspirations we can take a look at other wrapped widgets. - -## More docs for contributing +## Docs for contributing Looking to contribute? If you wish to implement a new widget/add more features and need help understanding the codebase. You can start here: @@ -226,16 +40,6 @@ Contributing developer docs link: https://github.com/master-atul/node-native-ui/tree/master/devdocs -# DEBUGGING - -https://medium.com/@atulanand94/debugging-nodejs-c-addons-using-vs-code-27e9940fc3ad - -https://medium.com/cameron-nokes/how-to-debug-native-node-addons-in-mac-osx-66f69f81afcb - -# Common errors - -1. Segmentation fault: Segmentation fault occurs when you access a Pointer that is pointing to an invalid memory address. One major reason for this can be that JS garbage collector would have garbage collected the addon generated value and you try accessing it after a while. This is mostly the case if you see seg fault happening randomly after some time of startup. - ### LICENSE Since we do not in any way modify the code of Qt and only link to it dynamically, I beleive we are in compliance with the LGPL license requirements of QT. And hence this library can be licensed under its own License (for which we have chosen MIT License). diff --git a/devdocs/common_errors.md b/devdocs/common_errors.md new file mode 100644 index 000000000..0288bdd1f --- /dev/null +++ b/devdocs/common_errors.md @@ -0,0 +1,3 @@ +# Common errors + +1. Segmentation fault: Segmentation fault occurs when you access a Pointer that is pointing to an invalid memory address. One major reason for this can be that JS garbage collector would have garbage collected the addon generated value and you try accessing it after a while. This is mostly the case if you see seg fault happening randomly after some time of startup. diff --git a/devdocs/debugging.md b/devdocs/debugging.md index 61b11fe49..aa31e25ad 100644 --- a/devdocs/debugging.md +++ b/devdocs/debugging.md @@ -1,5 +1,11 @@ # debugging -Debugging JS +## Debugging JS -Debugging C++ +// TODO + +## Debugging C++ + +https://medium.com/@atulanand94/debugging-nodejs-c-addons-using-vs-code-27e9940fc3ad + +https://medium.com/cameron-nokes/how-to-debug-native-node-addons-in-mac-osx-66f69f81afcb diff --git a/devdocs/setting_up.md b/devdocs/setting_up.md index f8ef419d9..119fb6eb8 100644 --- a/devdocs/setting_up.md +++ b/devdocs/setting_up.md @@ -1 +1,187 @@ # Setup project for development + +## Development setup and getting started + +This guide is for setting up `nodegui` for contributors of nodegui. +The actual getting started guide for users will be added once we reach a bit of stable level. + +Make sure you have setup `qode` and installed it globally. + +### MacOSX: + +**Requirements** + +1. Node version: > 9 +2. Python and gcc +3. Make sure you dont have spaces inside your home path. NodeGYP has issues with spaces in the path. https://github.com/nodejs/node-gyp/issues/209 + +**Setting up** + +1. Install latest version of Qt (5.12) via homebrew only. + +``` +brew install qt5 +``` + +### Windows: + +**Requirements** + +1. Node version: > 9 +2. Python and MSVC++ + +**Setting up** +-- Instructions will be added soon -- + +### Linux: + +**Requirements** + +1. Node version: > 9 +2. Python, Make, GCC, pkg-config and Qt5
+ +On Ubuntu: `$ sudo apt-get install pkg-config build-essentials` should install everything except Qt5. + +**Setting up** + +1. Make sure you have downloaded and installed Qt5 sdk. +2. Before running `yard build`, do + `export PKG_CONFIG_PATH="/5.11.0/gcc_64/lib/pkgconfig"` + +### Common: + +1. Once you have setup the platform specific stuff as mentioned above, follow these: + +2. `git clone` this repo. + +3. Keep note of the install directory of qt. You should probably find it at `/usr/local/Cellar/qt/5.12.1`. Copy this path and + edit the file `config/common.gypi`.
+ Change the field + + ``` + 'qt_home_dir': ' // example : ../../core/YogaWidget/yogawidget.h +``` + +So for nlabel I would run it as: + +``` +moc nlabel.h -o nlabel_moc.cpp --include ../../core/YogaWidget/yogawidget.h +``` + +This will run moc on `headername.h` and generate `headername_moc.cpp`. We will include `headername_moc.cpp` in `config/moc.gypi`. If you dont do this. Then it will give a symbol not found error. + +I hope QLabel's example is enough for now. For more examples and inspirations we can take a look at other wrapped widgets. + +## Learning Materials: + +1. Beginners guide to NodeJS Addon - https://medium.com/@atulanand94/beginners-guide-to-writing-nodejs-addons-using-c-and-n-api-node-addon-api-9b3b718a9a7f +2. First read this: N-API in nodejs docs +3. https://www.youtube.com/watch?v=-Oniup60Afs&feature=youtu.be +4. See samples at https://github.com/nodejs/abi-stable-node-addon-examples/ + 4.1. You can see the readme of https://github.com/nodejs/node-addon-api.git/ +5. See node-qt implementation. It is implemented in Nan (explained in video). +6. Now try to match the implementation in node-qt and convert to N-API using examples from samples. +7. Implementations not in node-qt need to be done with effort.