Setup
Requirements
The C++ wrapper library requires a compiler that supports C++11. If C++17 is supported some additional wrappers are available for a more comfortable API.
Setting up the Build Environment
The C++ API around fluxEngine is a header-only wrapper around the low-level C API that is provided. The steps required to set up a build environment follow those when using the C API, but contain an additional directory with the header files of the C++ wrapper library.
fluxEngine is distributed in form of an archive with the following relevant subdirectories:
bin: All the runtime library files (Windows only)
lib: Library files required for linking fluxEngine
On Windows systems this will contain a file
fluxEngineC1.def
from which the user can create an import library for their own compiler.Additionally the import library is provided for both Microsoft’s Visual C/C++ compiler, as well as GNU GCC (MinGW).
The file
fluxEngineC1.lib
is the import library for MSVC (Microsoft’s Visual C/C++ compiler).The file
libfluxEngineC1.dll.a
is the import library for GNU GCC (MinGW).On Linux systems this will contain two libraries, as well as the dependencies of fluxEngine:
libfluxEngineC1.so.0
, which is the actual implementation of the public API of fluxEngine. This will be loaded at runtime.A library
libfluxEngineC1.so
(without the.0
suffix) that is a stub import library that may be used while linking your library. This library is not required at runtime, but ensures that even if the GCC version on the system is older than the GCC used to compile fluxEngine, linking your executable will still work.
On macOS systems this will contain
libfluxEngineC1.dylib
as well as dependency libraries of fluxEngine.
include: Contains all the header files required to compile C programs
c++/include: Contains the C++ wrapper library around the low-level C functions
One needs to add the lib
directory to the library search path and
link against the fluxEngineC1
library (via e.g. -lfluxEngineC1
for Linux, macOS and MinGW), and add both the include
and
c++/include
directories to the header file search path.
Building with CMake
The following CMake snippet will allow the user to use CMake to generate working binaries that are linked against fluxEngine across all platforms:
1 set(FLUXENGINE_DIR "" CACHE PATH "The directory where fluxEngine is installed")
2 if(FLUXENGINE_DIR STREQUAL "")
3 message(FATAL_ERROR "Please specify the FLUXENGINE_DIR setting.")
4 endif()
5 if(NOT EXISTS "${FLUXENGINE_DIR}/include/fluxEngine/fluxEngine.h")
6 message(FATAL_ERROR "FLUXENGINE_DIR does not point to the directory fluxEngine is located in.")
7 endif()
8
9 target_include_directories(target_name PRIVATE "${FLUXENGINE_DIR}/c++/include" "${FLUXENGINE_DIR}/include")
10 target_link_directories(target_name PRIVATE "${FLUXENGINE_DIR}/lib")
11 target_link_libraries(target_name fluxEngineC1)
Replace target_name
with the name of your CMake target.