Visualization Library uses the CMake building system to target several platforms and compilers.
At the moment Visualization Library supports the following development platforms:
- Windows: Visual Studio & MinGW
- Linux: GNU make/GCC
- Mac OS X: Xcode
Note that CMake supports many other platforms and operating systems as well, in which you can probably also run Visualization Library.
Please visit http://www.cmake.org to download the latest CMake distribution for your operating system.
In order to compile Visualization Library with CMake you have to understand a few simple concepts that remain valid for all the platforms. When building Visualization Library you will need 3 directories:
- a source directory: the directory where Visualization Library sources are located (containing the main CMakeLists.txt)
- a build directory: the directory used to keep the temporary object and project files generated for and during the building process.
- an install directory: the directory in which Visualization Libary's executables, libraries and header files will be installed.
Run CMake, select the source directory and the build directory, then press the Configure button:
Select your building environment and press the Finish button:
The basic build environment is ready:
Variables overview:
- CMAKE_BUID_TYPE: set it to Release if you want to compile VL for maximum performance or to Debug if you want to compile VL with debugging symbols. Note that this variable is not available under Visual Studio since you can manage the Release and Debug configurations directly from the Visual Studio gui.
- CMAKE_INSTALL_PREFIX: this is the location where Visualization Library will be installed. In order to install visualization library you can either call
make
install
under Unix-like environments or build the INSTALL
project under Visual Studio.
- VL_GUI_*_SUPPORT and VL_GUI_*_EXAMPLES: check the appropriate variable if you would like to build the binding classes for a particular GUI framework. Note that after selecting this variable and pressing the Configure button CMake might require more information to locate the required libraries and include files (like the location of the SDL library, of the GLUT header files etc.).
- VL_IO_2D_*: check the resource file formats that you want to be natively supported by VL. Selecting less modules will make Visualization Library smaller. Note that if you select modules like VL_IO_2D_JPG or VL_IO_2D_PNG CMake will require more information to locate the libpng and libjpeg libraries and include files.
Press the Configure button, you should see something similar to:
If you would like to reset your configuration go to the menu File
-> Delete Cache
.
To finalize and generate the building environment press Generate. Now you can close CMake and go to the specified build directory. If you are using a Unix-like environment you can simply type make
then make
install
. If you are using Visual Studio you just need to double click on the VisualizationLibrarySDK.sln
file and build the BUILD_ALL
project and then the INSTALL
project.
You are now ready to use Visualization Library!
- Using VL from a CMake project
Let's say that you are working on a project that uses VL and you would like to take advantage of CMake to support several compilers and operating system, your CMakeLists.txt would look like similar to the following example:
project(My_VL_Project)
# must be called after project!
cmake_minimum_required(VERSION 2.6)
# let CMake locate the FindVL.cmake if you haven't installed in any standard location
# this will look for the FindVL.cmake file where the CMakeLists.txt is
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
# set VL_ROOT to point to where VL have been installed.
# you can set the VL_ROOT either here or as an environment variable
# set(VL_ROOT "D:/VL/Install")
# for static linking do this
# find_package(VL COMPONENTS VLCore VLGraphics VLVG VLVolume VLMolecule VLWin32 FreeType JPG PNG TIFF ZLib REQUIRED)
# add_definitions(-DVL_STATIC_LINKING)
# for dynamic linking do this
# find_package(VL COMPONENTS VLCore VLGraphics VLVG VLVolume VLMolecule VLWin32 REQUIRED)
# NOTE:
# - FreeType, JPG, PNG, TIFF, ZLib, are not required with dynamic linking because they have been linked already in VLCore and VLGraphics.
# - VLWin32 is the library implementing the VL/Win32 gui bindings, here is required because Win32_example.cpp uses it.
# - For a full list of available modules and all the details see the instructions inside FindVL.cmake.
# add VL include directories
include_directories(${VL_INCLUDE_DIRS})
# find ${OPENGL_LIBRARIES} to be used later
find_package(OpenGL REQUIRED)
# adds a new executable with sources
add_executable(vlWin32_example WIN32 Win32_example.cpp App_RotatingCube.hpp)
# defines which libraries to link to the previously defined executable
target_link_libraries(vlWin32_example ${VL_LIBRARIES} ${OPENGL_LIBRARIES})
# install everything in the destination path defined at CMake configuration time
install( TARGETS vlWin32_example
RUNTIME DESTINATION "."
LIBRARY DESTINATION "."
ARCHIVE DESTINATION "."
)
- Third Party Libraries
This is a convenience list of third party libraries used by Visualization Library: