-
Notifications
You must be signed in to change notification settings - Fork 71
Building 1.1
In order to build the library, python3 needs to exist in your PATH, even if you are not compiling the python bindings. This is because some of the header files are auto-generated using a python script. Building the library is as simple as:
Linux or Mac:
mkdir build && cd build
cmake ../
make -j8
Windows:
mkdir build
cd bulid
cmake ../
msbuild "Inverse Kinematics.sln"
Or just open the file build/Inverse Kinematics.sln
using Visual Studio.
The library is installed to CMAKE_PREFIX_PATH
when building the install
target. You can change the default location with cmake -DCMAKE_INSTALL_PREFIX=path/to/install
.
make install
It's also possible to add the ik library as a cmake dependency to your own project. Simply add the project as a subdirectory, you can then link the library using the ik
target.
add_subdirectory ("ik")
target_link_libraries (myproj ik)
CMake Option | Default | Explanation |
---|---|---|
IK_API_NAME | "ik" | Controls the symbol exported for consumers of the library and also controls the module name for the python bindings. If you happen to have a symbol called "ik" somewhere else in your project and want to avoid name conflicts, you can change the symbol name with this. |
IK_BENCHMARKS | OFF | Enables building the ik_benchmarks executable using google's benchmark framework (requries a C++ compiler) |
IK_DOT_EXPORT | OFF | Enables code for writing the internal structures to DOT, a graph description language. This feature is only useful for debugging IK internal structures. |
IK_LIB_TYPE | STATIC | Set this to "SHARED" if you want to build a shared library/DLL or set this to "STATIC" if you want a static library. Note that if you enable IK_PYTHON you will need to change this to "SHARED" if you want to be able to import the library. |
IK_MEMORY_DEBUGGING | OFF | Enables malloc/free wrappers, which try to match every malloc() call to a corresponding free() call. Allows you to detect memory leaks and invalid free() calls. This has a notible performance impact and should be left OFF for release builds. |
IK_MEMORY_BACKTRACE | OFF | The library will generate a backtrace to every malloc() call and print the backtrace to allocations that were never freed. This has a huge performance impact and should be left OFF for release builds. Note that this option is ignored if IK_MEMORY_DEBUGGING is OFF. Currently, this feature is only implemented on linux. |
IK_PIC | ON | Enables position independent code. |
IK_PRECISION | "double" | The type used for ikreal_t. Valid options are "float", "double" and "long double". Note that python doesn't support "long double". |
IK_PROFILING | OFF | When compiling with gcc or clang, enables -pg and -fno-omit-frame-pointer. Will slightly decrease performance if enabled. |
IK_PYTHON | OFF | Enables CPython bindings, which are compiled into the library. It will then be possible to import the library as a python module using "import ik". |
IK_PYTHON_VERSION | "3" | The version of python to look for when compiling bindings. You can specify a more exact version, e.g. "3.6.1" |
IK_TESTS | OFF | Enables building the ik_tests executable using googlemock (requires a C++ compiler). If python is enabled, python unit tests are also compiled. |
Here are some common configurations you can use depending on the situation:
You want to use ik in your C++ project:
cmake -DIK_PIC=OFF ../
You want to use ik in a C++ project that compiles into a shared library/DLL:
cmake ../
You want to use ik in your python project:
cmake -DIK_PYTHON=ON -DIK_LIB_TYPE=SHARED ../
You want to do performance measurements of the ik algorithms:
cmake -DIK_BENCHMARKS=ON -DIK_PROFILING=ON ../
You want to run unit tests:
cmake -DIK_TESTS=ON -DCMAKE_BUILD_TYPE=Debug ../
You want to do some development on the ik library:
cmake -DCMAKE_BUILD_TYPE=Debug -DIK_BENCHMARKS=ON -DIK_DOT_EXPORT=ON -DIK_LIB_TYPE=SHARED -DIK_MEMORY_DEBUGGING=ON -DIK_MEMORY_BACKTRACE=ON -DIK_PYTHON=ON -DIK_TESTS=ON ../
Note that the memory debugging flags are enabled automatically if the build type is "DEBUG", but are included here to make it clear.