Niotso - Compile guide

This page walks you through the steps to compiling the entire Niotso codebase for your target platform.

No proprietary software of any kind is required.

Windows

 * Install 7-Zip.


 * Install Git, preferably for Windows cmd (it also installs its own version of bash on the side, even if you select a cmd installation), but (when it asks you) without overwriting the basic Windows commands like find.


 * Install any version of MinGW-builds of your choosing; to do so, extract it in a location such as C:\MinGW64, and then add C:\MinGW64\bin to your environment paths. To perform the latter, click Start, type in "advanced system settings" and press enter (also accessible from Start -> right-click Computer -> Properties -> Advanced system settings), click the Environment Variables... button at the lower right, and in the dialog that comes up, in the lower box (labeled System variables), scroll down to "Path" (case-sensitive), select it, click Edit, and somewhere near the beginning (before Cygwin, Strawberry Perl, Octave, hell even AMD has shipped a version of GCC with their OpenCL SDK; this needs to come before all of them) add "C:\MinGW64\bin;" (don't forget the semicolon). Then click OK to all of these dialogs.
 * We use the "Toolchains targetting Win64/Personal Builds/mingw-builds/ /threads-win32/sjlj" version of MinGW-builds and use the -m32 flag to compile for 32-bit Windows.
 * To confirm that cmd is reading from the correct version of GCC, close all of the currently opened cmd instances, start a new one, and run "gcc --version". Additionally, you can see all locations of gcc.exe with "where gcc"; yours should come up first.


 * Download glext.h and drop it in C:\MinGW64\x86_64-w64-mingw32\include\GL\. (It's licensed under the MIT license.)


 * Install nasm. Just because it's easier to update it this way (because you most likely don't want two versions of nasm installed concurrently), you should download the zip package of it (rather than the installer) and extract the contents of the bin folder into C:\nasm; you only have to add this location to your environment paths once.


 * Install doxygen.


 * Install cmake.


 * In cmd, run:


 * Make a directory somewhere and call it, say, "niotso git", and cd into that folder. Run:


 * Once it's finished downloading, in the top level of the repository (where the .git folder resides), make four new folders called "_build", "_deps", "_dist", and "_docs" right next to Client, Libraries, and so on. Then you will need to download a few things. Download the binaries and the dependencies for tar and wget from GnuWin32, and download the Windows binary for xzdec from the XZ Utils homepage; extract just the exes and dlls into the _deps folder.


 * Then, again with cmd (not bash/cygwin/MSYS), in the top level of the repository, run:


 * Assuming everything downloaded and extracted without error, cd into the _build folder and run:
 * Note: This command is case-sensitive. Also, don't forget the "..".
 * Note: This command is case-sensitive. Also, don't forget the "..".

At this point, everything should be set up. From now on, you run  inside the _build folder to compile,   in the _build folder to delete all compiled objects, and whenever you update the repository,   from the top level of the repository to update the libraries with new ones hosted by Niotso. You can also run, where # is the number of cores on your machine, to speed up the compile process, or   to debug include or link errors. Run  from the topmost level of the repository (outside the _build folder) to generate documentation into the _docs folder.

Resolving Windows dependencies
If you have Chocolatey on your Windows computer, then you may install the above with this simple command:



Keep in mind, this process will take some time, and installs in order they were typed.

Cross-compiling from Linux
The Windows version of Niotso must be statically linked with third-party libraries (libpng, libjpeg-turbo, ...). These must be downloaded with the update-libraries.sh script rather than through your package manager.


 * First things first, install the dependencies.


 * Debian-based:


 * Ubuntu-based:


 * RPM-based:


 * Every one of these packages is required; if one is missing, look it up or compile it from source.


 * Make your "niotso git" directory somewhere, cd into it, clone the repository, and then in the top level of the repository (where the .git folder resides), make four new folders called "_build", "_deps", "_dist", and "_docs" right next to Client, Libraries, and so on.


 * From the top level of the repository, run:


 * Configure cmake for a Windows cross-compile. (As this really hasn't been done before yet, you'll need to learn this part yourself... inform us.)
 * Assuming everything downloaded and extracted without error, cd into the _build folder and run:
 * Note: This command is case-sensitive. Also, don't forget the "..".
 * Note: This command is case-sensitive. Also, don't forget the "..".

At this point, everything should be set up. From now on, you run  inside the _build folder to compile,   in the _build folder to delete all compiled objects, and whenever you update the repository,   from the top level of the repository to update the libraries with new ones hosted by Niotso. You can also run, where # is the number of cores on your machine, to speed up the compile process, or   to debug include or link errors. Run  from the topmost level of the repository (outside the _build folder) to generate documentation into the _docs folder.

Linux

 * First things first, install the dependencies.


 * Debian-based:


 * Ubuntu-based:


 * RPM-based:


 * Every one of these packages is required; if one is missing, look it up or compile it from source.
 * Note that on Fedora, libmpg123 requires the RPMFusion free repository.

Then, in the root directory, run:
 * Make your "niotso git" directory somewhere, cd into it, clone the repository, and then in the top level of the repository (where the .git folder resides), make three new folders called "_build", "_dist", and "_docs" right next to Client, Libraries, and so on.
 * cd into the _build folder and run:
 * Note: This command is case-sensitive. Also, don't forget the "..".
 * Note: This command is case-sensitive. Also, don't forget the "..".

At this point, everything should be set up. From now on, you run  inside the _build folder to compile and   in the _build folder to delete all compiled objects. You can also run, where # is the number of cores on your machine, to speed up the compile process, or   to debug include or link errors. Run  from the topmost level of the repository (outside the _build folder) to generate documentation into the _docs folder.

Using Valgrind
Valgrind is essentially for Unix-like OSes only.


 * Start off by installing it.


 * Debian-based:


 * RPM-based:


 * Compile Niotso using the Debug profile. (More information later.)


 * You may run any binary through Valgrind by passing its name and arguments, like such:

Using gdb

 * Start off by installing it.


 * Debian-based:


 * RPM-based:


 * Compile Niotso using the Debug profile. (More information later.)


 * You may run any binary through gdb like such:

Others
Support for Mac OS X is a requirement for grand release, but still not expected for quite some time. Full support for Android, iOS, and possibly others is not expected until after the Niotso grand release, unless we are approached by a maintainer before then. Tech Preview 1 should arrive on Android unless Fatbag runs into problems.