Building SORT with source code

SORT is a cross-platform project that runs on multiple platforms, including Windows, Mac OS, and Ubuntu. It is a fully open-source, meaning that everyone can compile it by himself.

Following are the mandatory software to compile SORT:

Setup Compiling Environment

Platform Independent Compiling Options

There are only a few compiling options for us to pay attention in SORT CMake generation.

Download Dependencies before Compiling

SORT uses a third-party library that is not deployed with the source code together. In order to compile SORT successfully, it is mandatory to download the dependencies before compiling. Otherwise, it will have trouble locating the library, leading to the error in CMake generation.

To download the dependency files, simply run ‘make update_dep’ to retrieve it. However, if the script doesn’t work somehow, it is also fine to download the file directly. It is necessary to make sure the platform matches the target platform it runs on. The exact folder to put the dependencies should be ‘dependencies’ in the root folder.

The last resort is to compile the library with source code by yourself. This is not suggested to compile the source code of easy_profiler due to potential changes in different version may cause unknown problems in SORT. The pre-compiled ones are more desired than compiling it by yourself.

Windows

It is necessary to install Visual Studio 2015 or above to compile SORT on Windows. And please also make sure that ‘msbuild.exe’ is in the system ‘Path’ folder so that the script can run it directly.

Mac OS

Please install XCode first before compiling on MacOS.

Ubuntu

Unlike the other two platforms, for which SORT has packed all necessary libararies in the dependency, some of the depedent libraries is OS dependent. SORT doesn’t pack those OS dependent libraries with it, it is programmer’s responsibility to setup the correct environment before building it, meaning compiling SORT on Ubuntu requires some basic setup first.

Following is the tools and library needed by SORT and the correct way to install them on Ubuntu (Xenial)

There is no need to setup G++ on Ubuntu Bionic since the default version comes with the system is already G++7, which is sufficient for compiling SORT.

Unfortunately, due to limited resources, I don’t have time trying and maintaining SORT on every single version of Ubuntu. If you happen to build SORT on other version, you need to rebuild OSL library by yourself and setup the rest of the development environment, which you can consult this OSL main page for detail information.

Compiling SORT

Of course, it is also possible to manually generate the project and load it by yourself in any proper way you see fit.

Other Available Commands

Generated Binary

Only one executable file will be generated. It will be generated in a newly created folder ‘bin’ in the SORT root folder. For release version build, an executable named ‘sort_r’ will be generated. For debug version build, it is named ‘sort_d’.



Deploying SORT

Copying Blender Plugin

There is a folder with the name ‘sortblend’ in SORT root folder, which has all blender plugin python source code in it. In order to add SORT in Blender as a new renderer, it is mandatory to copy the source code folder to the following folder,

Depending the exact version of Blender, the above paths could be slightly different. However, the paths should be very similar with them.

Activate SORT in Blender

After compiling SORT with source code, there should be a binary folder with the name ‘bin’ in SORT root folder. Usually, the binary is named ‘sort_r’ for release version build and ‘sort_d’ for debugging version build. It is also fine to generate or copy the binary to any other desired folder with other binary file names.

Open the ‘Blender User Preferences’ in Blender by choosing ‘User Preferences’ in ‘File’ menu.

Tick the checkbox before SORT and set the path of SORT binary to the folder that has SORT binary. There is another optional path to be set, it is supposed to be set to the binary path of PBRT so that it can export some scene to PBRT for a reference rendering result. The compilation of PBRT is out of scope of this wiki, please refer this page for further detail. This path is totally optional, meaning SORT will work just fine without it being set to anything.

Picking SORT as the Renderer

After SORT is activated in Blender, the next step is to pick SORT as the renderer in Blender so that Blender will send jobs to SORT for rendering.

Simply by choosing SORT in engine will pick it as the main renderer. The rendering process is no difference from other engines.



Copyright© 2011-2020 Jiayin Cao. All rights reserved.