Getting Started | C++

Installation

Install trueform via pip (with cmake/conan modules) or manually.

trueform is a C++17 header-only library with Python bindings and VTK integration. It depends on oneTBB.

From pip

The pip package includes C++ headers with cmake and conan integration modules:

pip install trueform

Choose your build system below.

Conan

Add trueform to your local Conan cache. Conan handles TBB automatically.

python -m trueform.conan create

Then use it in your project's conanfile.txt:

conanfile.txt
[requires]
trueform/[>=0.1.0]

Or in conanfile.py:

conanfile.py
def requirements(self):
    self.requires("trueform/[>=0.1.0]")

Build with Conan:

conan install . --build=missing
cmake --preset conan-release
cmake --build --preset conan-release
  • Defaults to --build=missing if no --build option is provided
  • python -m trueform.conan create [options] — pass additional arguments to conan create
  • python -m trueform.conan --path — print conanfile directory for manual use

CMake

Requires TBB installed separately.

brew install tbb

Use the header-only library as a CMake package:

CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(my_app LANGUAGES CXX)

find_package(trueform REQUIRED CONFIG)

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE tf::trueform)

Configure your build so CMake can find the package:

cmake -B build -Dtrueform_ROOT=$(python -m trueform.cmake)
cmake --build build
Additional commands:
  • python -m trueform.cmake — CMake config directory
  • python -m trueform.cmake --include_dir — C++ headers path
If TBB is in a non-standard location:
cmake -B build -DTBB_ROOT=/path/to/tbb

Manual Installation

For users who prefer not to use pip.

Conan

Create the package from the recipe in the repository:

git clone https://github.com/polydera/trueform.git
conan create trueform/conan/trueform --build=missing

Then use in your project as shown above.

The recipe automatically pulls TBB as a dependency. If your Conan profile defaults to an older C++ standard, add -s compiler.cppstd=17.

CMake

Requires TBB installed separately — see CMake section above for installation instructions.

FetchContent

Download trueform at configure time.

CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(my_app LANGUAGES CXX)

include(FetchContent)

FetchContent_Declare(
  trueform
  GIT_REPOSITORY https://github.com/polydera/trueform.git
  GIT_TAG        main
)

FetchContent_MakeAvailable(trueform)

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE tf::trueform)
cmake -B build
cmake --build build
Pin to a specific version using a git tag or commit hash in GIT_TAG.

System Install

Clone and install trueform system-wide.

git clone https://github.com/polydera/trueform.git
cd trueform

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --config Release

Then use find_package in your project:

CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(my_app LANGUAGES CXX)

find_package(trueform REQUIRED CONFIG)

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE tf::trueform)
cmake -B build
cmake --build build
To install to a custom location:
cmake --install build --prefix ~/mylibs
Then configure with:
cmake -B build -DCMAKE_PREFIX_PATH=~/mylibs

Verify Installation

main.cpp
#include <trueform/trueform.hpp>
#include <iostream>

int main() {
    auto pt = tf::make_point(1.0, 2.0, 3.0);
    std::cout << "trueform is working!" << std::endl;
    return 0;
}

VTK Integration

For VTK integration (tf::vtk), see the VTK documentation for build and installation instructions.