Contributing

[warning: nidium is currently under heavy development and we are looking for contributors to join our efforts. The main goal of nidium is to enable developers to build cross platform application with JavaScript.]

Depending of your skills you can help us on various areas :

If you are interested in contributing to nidium, drop us a message on Slack, IRC or GitHub so we can help you and give you insights.

Overview of nidium projects

Building nidium

To build nidium you need about 6GB of disk space. A build from scratch may take 30 min to a few hours, depending of the speed of your computer.

On a debian based system, a few commands will get you started.

$ apt-get install libpci-dev python2.7 git make patch clang pkg-config libgtk2.0-dev libgtk-3-dev mesa-common-dev libglu1-mesa-dev libosmesa6-dev yasm libasound2 libasound2-dev libbz2-1.0
$ git clone https://github.com/nidium/NidiumTools.git
$ git clone --recursive https://github.com/nidium/Nidium.git
$ export PYTHONPATH=$(pwd)/NidiumTools/src
$ cd Nidium
$ ./configure_frontend
$ ./bin/nidium

Three configure script are available for building the product of your choice :

Each of these configure script accept various options. The most useful one are :

Note : debug build result in increased binary size and reduced performance.

nidium directory structure

Directory Usage
bin/ nidium executable
build/ Build files for nidium and third party
docs/ Documentation of JavaScript bindings using doukmentor
gyp/ Build files for nidium. We are using GYP as a tool to generate the buildfiles for each platform.
patch/ Patch for third party libraries.
resources/ Icons, OS specific files resources.
src Nidium source code
src/AV/ Audio & Video framework
src/Binding/ JavaScript Bindings
src/Core/ Various base helper (Path, Args, DB, SharedMessages, TaskManager, Context)
src/Embed/ JavaScript files bundled with nidium. Contains various additions to native JS class.
src/Frontend/ Code related to nidium frontend (NML, Context, Application entrypoint for each OS)
src/Graphics/ OpenGL related code (Canvas 2D & 3D, Image, Skia interactions)
src/IO/ Input/Output related code (File, Stream)
src/Interface/ Specific implementation for each OS :
  • System : System directories, Notifications, Language.
  • Interface : Window creation/interaction, Menu, File picker, Input hander
src/Net/ Implementation of HTTP and WebSocket protocol (client & server)
src/Server/ Nidium server implementation
src/libapenetwork/ libapenetwork subrepo (event loop)
tests/ Nidium unit-tests
tests/gunittest/ Low-level tests in C++, based on the googletest framework.
tests/jsunittests/ JavaScript unit-tests for nidium bindings.
tests/jsautotest/ JavaScript unit-tests automatically created by the examples from the documentation.
tests/tests-server/ HTTP server used for network tests (Socket, HTTP, WebSocket). One pubic server is running at http://tests.nidium.com but you can run your own. Check the README.md file in the directory.
third-party/ Third-party libraries downloaded by the configure script when they are needed in the build-process.

Note : The extracted directories are symlinked to this directory depending of the configuration used during the configure script. The real files are stored in hidden directories (.default .default-debug, ...)
tools/ Nidium Installer for each platform & various tools

Coding practices

Coding Style

In general, follow the style of the surrounding code, and adhere to the following style guide. Code will be read often, so structured, and readable code is welcome, as well as sensible naming of variables, classes, functions etc.

Control structure style :

if (...) {
} else if (...) {
} else {
}

// Short conditional statements may be written on one line if this enhances readability.
if (...) x = z;

// Always use curly brace for single-line statements
if (...) {
    x = z;
}

while (...) {
}

for (...; ...; ...) {
}

switch (...) {
  case 1: {
    // When you need to declare a variable in a switch, put the block in braces
    int var;
    break;
  }
  case 2:
    ...
    break;
  default:
    break;
}

Class, Namespace, Function:

namespace Nidium {

class MyClass : public A
{
public:
    MyClass(int var, int anotherVar)
        : m_Var(var), m_Var2(anotherVar)
    {
       ...
    }

    // Tiny constructors and destructors can be written on a single line.
    MyClass() { }

    // Tiny functions can be written in a single line.
    int myFunction() { return mVar; }

    static int StaticMethod()
    {
        ...
    }

private:
    // Member variable are prefixed with m_
    int m_Var;
    int m_Var2 = 0; // Variable should be initialised when declared
};

} // namespace Nidium

License block :

Nidium MIT license should be but at the top of each new file.

For C/C++/JavaScript :

/*
   Copyright 2017 Nidium Inc. All rights reserved.
   Use of this source code is governed by a MIT license
   that can be found in the LICENSE file.
*/

For Python and Bash :

# Copyright 2017 Nidium Inc. All rights reserved.
# Use of this source code is governed by a MIT license
# that can be found in the LICENSE file.

Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!