Getting Started With Omni
Step 1 - What you will need
To get started using the Omni library, you will first need a C++ tool chain (e.g. a C++ compiler, any necessary system libraries, etc.) for the platforms you wish to deploy to and ensure you have set up your build environment properly.
top

Step 2 - Getting the source
You can grab the latest source as a zip here and the latest zipped offline documentation here, you can also visit the source viewer to walk through the code or visit the download page to view other download options.

Additionally, you can view the synced git repo, or if you have git installed, you can git clone https://github.com/Zeriph/omni.git
top

Step 3 - 'Installing' the source
After you have downloaded the latest source, you simply extract the src.zip file contents to where you want the Omni library code to reside. As an example, the build files reference the source at C:\source\omni\ for Windows and /source/omni on other platforms.

After you have extracted the source to where you want, you can start developing with the library.
top

Step 4 - Using the source
Let's start with a very basic thread example, assuming the following code in a file called main.cpp:
/* main.cpp */
#include <omnilib>

void thread_func()
{
    std::cout << "In thread ... sleeping 5 seconds" << std::endl;
    omni::sync::sleep(5000);
}

int main(int argc, char* argv[])
{
    omni::sync::thread t(&thread_func, omni::sync::thread_option::AUTO_JOIN, true);
    t.start();
    std::cout << "returning from main, thread will automatically join on destruction" << std::endl;
    return 0;
}
And then to build the above source (assuming you have extracted the Omni source to C:\source\omni\ or /source/omni), you could do the following command-line build:

Windows1:
cl main.cpp C:\source\omni\library.cpp /IC:\source\omni\ /EHa2 /Feomni.exe

Apple/Unix/Linux/POSIX3:
g++ main.cpp /source/omni/library.cpp -I/source/omni -pthread4 -o omni.bin

And when run, the output could5 be:
In thread ... sleeping 5 seconds
returning from main, thread will automatically join on destruction
1.) Command line build using Visual Studio's Command Line Build tools with the environment set for proper Windows SDK reference.
2.) /EHa enables C++ exception handling; if your platform or library does not support exception handling, you can define the OMNI_NO_THROW compile flag.
3.) Command line build using the GNU GCC compiler; options would be similar with other compilers.
4.) The -pthread option is needed to link against the target POSIX.1c thread library. Some compilers will accept either -pthread or -lpthread and some might need -lrt.
5.) In this context could is with regards to the order of the output, since the thread could request to print before or after the main thread.
top

Step 5 - May the source be with you
That's it! After you get your build environment set up, download and reference the source, you're ready to go!
top

But wait, there's more!
Omni is designed to be flexible for the various needs of a developer, as such, you can also build and work with the library in your favorite IDE; for templates to build Omni as a static library with various IDE's (as well as via command line), you can visit the build help page, where you can download the various solution and project files. And if you need help with a specific class or function, you can visit the class index page where you can browse a hierarchical view of the library and get help and examples of the individual classes and members of the various namespaces. You can also view the examples page to browse examples of how to use the features of Omni.

If you need to verify your platform is supported or have questions about platform support, you can visit the cross-platform page for more information or visit the system API page which covers the API's called throughout the library. You can also visit the options page to view compile flags that affect the library operation and helper macros that can be utilized in user code.
top