-
Notifications
You must be signed in to change notification settings - Fork 48
Home
Welcome to the forge wiki!
Document Outline:
- GLFW or SDL2
- freetype
- boost - not a runtime dependency.
- FreeImage - (optional).
- fontconfig on Linux and OSX.
- Documentation Generation (preferred & recommended version of python is 3.*)
- Doxygen
- Sphinx with extensions: Breathe, recommonmark
Linux/Unix: Dependencies should be available via respective package managers. Windows: We recommend vcpkg.
$ git clone https://github.com/arrayfire/forge.git
CMake Options:
Options | Descrition | Default |
---|---|---|
BUILD_SHARED_LIBS | Build Shared Library | ON |
CMAKE_BUILD_TYPE | Set build type | Release1 |
CMAKE_INSTALL_PREFIX | Location for install target | <path> |
FG_BUILD_DOCS | Build documentation | ON 2 |
FG_BUILD_EXAMPLES | Build examples | ON 3 |
FG_RENDERING_BACKEND | Choice of Rendering backend | OpenGL 4 |
FG_USE_WINDOW_TOOLKIT | Choice of window toolkit | glfw3 5 |
FG_WITH_FREEIMAGE | Use Freeimage library | ON 6 |
-
1 Defaults to
Debug
for cloned repository,Release
otherwise. - 2 Turned ON if doxygen is found.
- 3 CPU examples are built always. CUDA & OpenCL examples are built if CUDA toolkit and OpenCL libraries are found.
-
4 Currently, only
OpenGL
available. - 5 SDL2 is the only current alternative.
- 5 FreeImage support only turned ON if dev package is found.
1. Configure
Dependency installation is also taken care of by the below cmake configure command.
cd forge
mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 \
-DCMAKE_TOOLCHAIN_FILE="<vcpkg_dir>\scripts\buildsystems\vcpkg.cmake" \
-DVCPKG_MANIFEST_DIR=..\vcpkg ..
If you are building the CUDA examples with Visual Studio 2017 (v15.5 and above), you will need to point to the v140(or later) toolset during the configuration step:
cmake -Tv140 -G "Visual Studio 15 2017 Win64" \
-DCMAKE_TOOLCHAIN_FILE="<vcpkg_dir>\scripts\buildsystems\vcpkg.cmake" ..
Follow the instructions from here to install v140 toolset in Visual Studio 2017.
2. Build ArrayFire
Once Forge has been configured, you may build Forge by opening the
build\Forge.sln
file in Visual Studio.
With latest master, there is no need to install dependencies manually. However, in the case your workflow is setup in such fashion do keep note of the following points.
- Using freetype installed in vcpkg folder is sufficient for developement purposes. However, if the intention behind building forge is to create a custom package(using
cpack
), then we recommend using a static version of freetype that can be installed in vcpkg using the instructions from this page. - As of writing this page, there is an issue with freetype (dynamic library version) provided by vcpkg when we do the following: freetype link-library(lib file) is installed instead of the dll file. Until this is fixed upstream, the above mentioned work around can be employed to correctly package forge usign
cpack
.
install(FILES $<TARGET_FILE:Freetype::Freetype> ...)
The instructions are based on Ubuntu 16.04. Change the packages and package manager to the distro of your choice.
- Required: gcc (>=4.7), g++, git (>=1.8), make, cmake(v3.5.1 and above)
- Recommended: FreeImage (version 3), cmake-curses-gui
sudo apt-get install -y build-essential git cmake
sudo apt-get install -y cmake-curses-gui
sudo apt-get install -y libboost-all-dev libfontconfig1-dev libfreeimage-dev libglfw3-dev
Fontconfig package installs freetype as it's dependency.
cd /path/to/dir/forge
mkdir build && cd build && cmake ..
make -j8 # or number of threads of your choosing
The default installation prefix is /usr/local
. That is, includes are installed to /usr/local/include
, libs are installed to /usr/local/lib
, and examples are installed to /usr/local/forge
.
To change the install prefix use
cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install/dir
NOTE: If the default gcc
on your machine is gcc >= 6.1 and you will have to do the following to build CUDA examples.
For example on archlinux, you'd have to install gcc version suitable for CUDA compilation from the Arch repositories and then run the followinng commad.
cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install/dir -DCUDA_HOST_COMPILER:FILEPATH=/usr/bin/g++-<compatible-version-number>
Then run make install
(use sudo to install to system directories).
The instructions are based on OSX 10.9 or later.
- Required: cmake(v3.5.1 and above)
brew install cmake
brew install boost fontconfig freeimage glfw3
cd /path/to/dir/forge
mkdir build && cd build && cmake ..
make -j8 # or number of threads of your choosing
The default installation prefix is /usr/local
. That is, includes are installed to /usr/local/include
, libs are installed to /usr/local/lib
, examples are installed to /usr/local/forge
.
To change the install prefix use
cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install/dir
Make sure you are still in build
folder, then:
make install