Installation¶
Prerequisites¶
First we need to clone the repository:
# First, we need to clone the repository (here a https remote is used):
$> git clone https://gitlab.xlim.fr/haiku/haiku-hpp.git --recurse-submodules
# If you forgot the --recurse-submodules, you just have to move into the folder and type the following
$> cd haiku-hpp/
$> git submodule update --init --recursive
CMake : to generate the build system and some source files (absolute paths for sample code, etc.). You can install it using
apt
on Linux,brew
on Mac or the download page on Windows.On Linux : Because Haiku is using GLFW, you will need
xorg-dev
package
Compilation¶
Using the command line, you can build the project on all platforms using the following commands:
# First, we need to create a build folder:
$> mkdir build/
$> cd build/
# Then, we need to configure the project.
$> cmake ..
# Now we can build the project:
$> cmake --build . --config [Debug or Release]
The main CMakeLists.txt provides several options:
HAIKU_BUILD_INSTALL
to create the installation targetHAIKU_BUILD_SAMPLES
to build samples targetsHAIKU_BUILD_GL33
to build haikuhpp with Opengl 3.3 backendHAIKU_BUILD_DOCS
to build the documentation cmake targets
If you want to compile the code samples, you just have to enable the HAIKU_BUILD_SAMPLES
option during the cmake configuration:
# In the build directory, we need to configure the project with the HAIKU_BUILD_SAMPLES option
$> cmake .. -D HAIKU_BUILD_SAMPLES:BOOL=ON
# Now we can build the project:
$> cmake --build . --config [Debug or Release]
If you need the OpenGL 3.3 backend (required on MAC OS), you just have to enable the HAIKU_BUILD_GL33
option during the cmake configuration:
# In the build directory, we need to configure the project with the HAIKU_BUILD_SAMPLES option
$> cmake .. -D HAIKU_BUILD_GL33:BOOL=ON
# Now we can build the project:
$> cmake --build . --config [Debug or Release]
Installation¶
If you want to install the library in a custom location, you have to enable HAIKU_BUILD_INSTALL
and CMAKE_INSTALL_PREFIX
options during the cmake configuration:
# In the build directory, we need to configure the project with the HAIKU_BUILD_SAMPLES option
$> cmake .. -D CMAKE_INSTALL_PREFIX:PATH=<your-installation-folder> -D HAIKU_BUILD_INSTALL:BOOL=ON
# Now we can build the project:
$> cmake --build . --config [Debug or Release] --target install
You can also compile and install on Windows using MSVC and Visual Studios Command Prompt:
$> MSBuild ALL_BUILD.vcxproj /property:Configuration=Release;Platform=x64
## if HAIKU_BUILD_INSTALL is enabled
$> MSBuild INSTALL.vcxproj /property:Configuration=Release;Platform=x64
You can also compile and install on Linux using make commands:
$> make
## if HAIKU_BUILD_INSTALL is enabled
$> make install
Usage using CMake¶
If the repository is used as a git submodule, you can just use the add_subdirectory()
directive.
Otherwise, if haikuhpp was installed, haiku can be added in your projects using CMake
:
find_package(haikuhpp REQUIRED)
add_executable(yourprogram src/main.cpp)
target_link_libraries(yourprogram PRIVATE haiku::haiku)
You will need to specify the folder where you install haikuhpp (the directory containing haikuhpp-config.cmake
):
$> cmake .. -D haikuhpp_DIR:PATH=<your-installation-folder>