Building#
The active development is done on a linux operating system (Ubuntu in particular) and Windows 11. The raytracer is platform independent to a large extend and works on Linux, Windows and Mac OS operating systems. A reasonable powerful machine is recommended to have any fun with raytracing.
Automatic Setup#
The recommended way to setup Ignis for development on any operating system. This mini tutorial is expecting some basic knowledge about build systems and a recent PowerShell (also available on Linux).
Clone Ignis from PearCoding/Ignis.
(Optional) Copy the config file
scripts/setup/config.json
and change it to your needs. Normally you do not have to change anything. The optionLOCATION
can be used to specify a different location for the dependencies.Run the script
scripts/setup/setup.ps1
. If you use a different config file, specify the path as an argument to the script. The script will download all the necessary dependencies, except CUDA, compile it and create a new directorydeps/
on the directory on top of Ignis or the location specified in the config. This step has to be done only once, or if some of the dependencies got updated.By default the
build/
directory contains a Ninja basedRelease
configuration.The
Release
configuration is well tested and should be used for most purposes. Any other configuration is experimental and may fail at any time.
Note
It might be necessary to run the script scripts/setup/vc_dev_env.ps1
every time a new terminal is opened to ensure the correct visual studio environment is available on Windows.
To change from the single build configuration using `Ninja
to a multiconfig-generator, remove or adapt the following line in scripts/setup/config.json
:
"CMAKE_EXTRA_ARGS": ["-GNinja", "-UCMAKE_CONFIGURATION_TYPES"]
Linux & Mac OS (Manual)#
A quick and dirty tutorial to show how to setup AnyDSL and Ignis on a typical Linux OS or an Apple machine.
The following will need cmake
and a working C++ development environment.
Clone AnyDSL from AnyDSL/anydsl
Copy the
config.sh.template
toconfig.sh
.Change
: ${BUILD_TYPE:=Debug}
to: ${BUILD_TYPE:=Release}
insideconfig.sh
Optional: Use
ninja
instead ofmake
as it is superior in all regards.Run
./setup.sh
inside a terminal at the root directory and get a coffee.
Clone Ignis from PearCoding/Ignis
Make sure all the dependencies listed in README.md are installed.
Run
mkdir build && cd build && cmake -DAnyDSL_runtime_DIR="ANYDSL_ROOT/runtime/build/share/anydsl/cmake" ..
, withANYDSL_ROOT
being the path to the root of the AnyDSL framework.Run
cmake --build .
inside thebuild/
directory and get your second coffee.
Run
./bin/igview ../scenes/diamond_scene.json
inside thebuild/
directory to see if your setup works. You should be able to see three diamonds lit by an area light.
Note
MacOS CPU vectorization and GPU support is still very experimental and limited.
Windows (Manual)#
Note
It is recommended to use the new automatic windows setup instead of the following one! It may also be outdated.
This mini tutorial is expecting some basic knowledge about CMake and the Windows build system based on Visual Studio. I highly recommend using the CMake Ninja generator in favour of the Visual Studio ones, as Visual Studio as an IDE itself has support for both.
Clone AnyDSL from AnyDSL/anydsl. You have to use the
cmake-based-setup
branch.Make sure all the necessary dependencies are installed. Especially zlib and potentially CUDA.
Create a new directory named
build
Open the command line interface in the newly created directory. Make sure the recent VC environment is available.
Use CMake and the following command line to configure the project. It is very likely that you have to change some paths.
Also make sure that the following snippet is written in a single line and, if necessary, the
\
in paths is properly escaped:cmake -DRUNTIME_JIT=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE="Release" -DAnyDSL_runtime_BUILD_SHARED=ON -DAnyDSL_PKG_LLVM_AUTOBUILD=ON -DAnyDSL_PKG_LLVM_VERSION="14.0.6" -DAnyDSL_PKG_RV_TAG="origin/release/14.x" -DAnyDSL_PKG_LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/llvm-project-14.0.6.src.tar.xz" -DTHORIN_PROFILE=OFF -DBUILD_SHARED_LIBS=OFF -DCUDAToolkit_NVVM_LIBRARY="C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.7\\nvvm\\lib\\x64\\nvvm.lib" -DZLIB_LIBRARY="C:\\Development\\Dependencies\\zlib\\lib\\zlib.lib" -DZLIB_INCLUDE_DIR="C:\\Development\\Dependencies\\zlib\\include" ..
If you get a similar cmake error like the following:
CMake Error in build/_deps/rv-src/src/CMakeLists.txt: Target "RV" INTERFACE_INCLUDE_DIRECTORIES property contains path: "C:/Development/Projects/AnyDSL/build/_deps/rv-src/include" which is prefixed in the build directory.
Just ignore it. A file named
AnyDSL.sln
should still be created in the build folder. This might only be relevant for cmake configs with Visual Studio generators, however.If you are using the Visual Studio generator, you can now use the generated
.sln
to compile the project. This will take some time. Make sure that you use theRelease
configuration. Make sure theruntime
,clang
andartic
project are built successfully, the others might fail for unknown reasons.For other IDEs use
cmake --build ..
Clone Ignis from PearCoding/Ignis. This time the
master
branch is fine.Getting AnyDSL to work is the hardest part. Congrats if you made it so far. However, Ignis requires some dependencies and configurations to work with AnyDSL.
Make sure zlib and Intel oneAPI TBB are installed on your system. It is also recommended to install SDL2 to be able to use the viewer.
Create a new directory named
build
Open the command line interface in the newly created directory. Make sure the recent VC environment is available.
In the command line interface write the following and adapt it to your AnyDSL setup:
set PATH=%PATH%;C:\Development\Projects\AnyDSL\build\_deps\llvm-build\Release\bin
Use CMake and the following command line to configure the project. Make sure you use the
Makefile
orNinja
generator, as the Visual Studio one is not working. It is very likely that you have to change some paths. Especially, adapt it to your AnyDSL setup.Also make sure that the following snippet is written in a single line and, if necessary, the
\
in paths is properly escaped:cmake -DCMAKE_BUILD_TYPE="Release" -DBUILD_TESTING=OFF -DClang_BIN="C:\\Development\\Projects\\AnyDSL\\build\\_deps\\llvm-build\\Release\\bin\\clang.exe" -DAnyDSL_runtime_DIR="C:\\Development\\Projects\\AnyDSL\\build\\share\\anydsl\\cmake" -DArtic_BINARY_DIR="C:\\Development\\Projects\\AnyDSL\\build\\bin\\Release" -DArtic_BIN="C:\\Development\\Projects\\AnyDSL\\build\\bin\\Release\\artic.exe" -DTBB_tbb_LIBRARY_RELEASE="C:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2021.1.1\\lib\\intel64\\vc_mt\\tbb12.lib" -DTBB_tbbmalloc_LIBRARY_RELEASE="C:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2021.1.1\\lib\\intel64\\vc_mt\\tbbmalloc.lib" -DTBB_INCLUDE_DIR="C:\\Program Files (x86)\\Intel\\oneAPI\\tbb\\2021.1.1\\include" -DZLIB_LIBRARY_RELEASE="C:\\Development\\Dependencies\\zlib\\lib\\zlib.lib" -DZLIB_INCLUDE_DIR="C:\\Development\\Dependencies\\zlib\\include" -DSDL2_LIBRARY="C:\\Development\\Dependencies\\SDL2\\lib\\x64\\SDL2.lib" -DSDL2_INCLUDE_DIR="C:\\Development\\Dependencies\\SDL2\\include" ..
You can ignore the
SDL2
entries if you decide not to useigview
or change the build type toDebug
if necessary.In contrary to the AnyDSL setup you can not use the newly generated
.sln
file directly. Usecmake --build . --config Release
or use Visual Studio with the CMake interface.To run the frontends you might have to add multiple shared libraries (
*.dlls
) to thePATH
environment variable or copy it next to the executables. Currently the shared librariesruntime.dll
,runtime_jit_artic.dll
,nvvm64.dll
ornvvm64_40_0.dll
,tbb.dll
,SDL2.dll
,zlib.dll
are known to be required. The list is not exhaustive however, as the final list of dependencies depends on the system, current state of development and other external factors. Use one of the many dll dependency viewers available on Windows to find missing dlls and copy it next to the build executable or add it to thePATH
environment variable.
Known Issues#
If you get a
CommandLine Error: Option 'help-list' registered more than once!
, most likely the AnyDSL LLVM library and system LLVM library with exposed symbols are loaded at the same time. A known cause is thatigview
and SDL are using a graphic driver which is loading the system LLVM library in the background. On Linux, using accelerated rendering load the X11 drivers, which in return load the system LLVM, which in return clash with the custom LLVM. Setting the environment variableSDL_RENDER_DRIVER=software
andSDL_FRAMEBUFFER_ACCELERATION=0
should be a good workaround. This will not prevent you of using the GPU for raytracing however, only the UI will be software rendered.If running
artic
orclang
fails when building Ignis it might be due to the two executables not able to findzlib.dll
. Make sure it is available for them. A simple solution is to just copy thezlib.dll
next to the executables.Getting the following cmake error in LLVM:
CMake Error at build/_deps/llvm-src/llvm/cmake/modules/AddLLVM.cmake:1985 (string): string begin index: -1 is out of range 0 - 23 Call Stack (most recent call first): build/_deps/llvm-src/llvm/tools/llvm-ar/CMakeLists.txt:20 (add_llvm_tool_symlink)
can be fixed by explicitly unsetting the cmake variable
CMAKE_CONFIGURATION_TYPES
via-UCMAKE_CONFIGURATION_TYPES
in the command line or in thescripts/setup/windows/config.json
when using the automatic script.