Dependency Tokens
ot_add_dependency(<Target> <TOKEN> ...) is where you list the project
dependencies to build. Each token is a short name that the build system turns into the
right include directories (on the _core object library) and the right link
directories and link libraries (on the final target).
ot_add_dependency(MyTarget
OTCore OTCommunication # OpenTwin libraries
QtWidgets # Qt
RJSON CURL MONGO_C # third party
OSLibs # OS system libraries
)
Order does not matter. A token that is not recognised produces a warning at configure time, so typos are easy to spot.
OpenTwin library tokens
Any token that names an OpenTwin library (OTCore, OTSystem,
OTCommunication, OTGui, OTGuiAPI, OTWidgets,
OTServiceFoundation, OTModelAPI, OTModelEntities,
OTDataStorage, OTBlockEntities, OToolkitAPI and so on) is resolved
through its OT_<NAME>_ROOT environment variable. The build system adds the
library’s include directory to your core target and links its import library to
the final target, picking the correct paths per configuration.
Most names follow a simple rule: OTFooBar maps to OT_FOO_BAR_ROOT. A few
older names break that rule and are mapped by hand:
Token |
Environment variable |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you add a new OpenTwin library whose root variable does not match the
OT_FOO_BAR_ROOT pattern, add a mapping in the _ot_get_ot_root_envvar
function in OTProject.cmake.
This will be revised in the upcoming Environment setup changes via Python in the future.
Qt tokens
Qt tokens create the imported Qt6::* targets on demand and link them. As soon
as one Qt* token is present, AUTOMOC is turned on for you at finalize.
Token |
Links |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Core, Gui, Widgets, Network, Svg, Xml, OpenGLWidgets, SvgWidgets, Qml, WebSockets |
Qt resource (.qrc) files are handled by
ot_add_qt_resources(T), which turns on AUTORCC.
Third party tokens
These map to the vendored third party headers and libraries through their own environment variables. Header only tokens add an include directory; the rest add both include and link information.
Token |
Library |
Kind |
|---|---|---|
|
RapidJSON |
header only |
|
base64, compiled into the target |
source |
|
TinyXML-2, compiled into the target |
source |
|
tinyexpr, compiled into the target (C) |
source |
|
earcut polygon triangulation |
header only |
|
libcurl |
lib |
|
MongoDB C driver |
lib |
|
MongoDB C++ driver |
lib |
|
Boost headers used by the Mongo C++ driver |
header only |
|
Boost |
lib |
|
Boost.Filesystem |
lib |
|
Qt Advanced Docking System |
lib |
|
Qwt plotting |
lib |
|
OpenSceneGraph |
lib |
|
OpenCASCADE |
lib |
|
VTK |
lib |
|
Embree |
lib |
|
GMP |
lib |
|
Gmsh |
lib |
|
ngspice |
lib |
|
CPython 3.11 |
lib |
|
Legacy CPython include and numpy paths |
include |
Use the PYTHON token together with ot_initialize_bin_python (see
Runtime library).
System and special tokens
Token |
Effect |
|---|---|
|
Links the standard Windows system libraries: |
|
Links a single Windows system library, for example
|
|
Adds the encryption key include directory only. |
For example, OTSystem needs the Windows crypto library for single sign on:
ot_add_dependency(OTSystem
OSLibs
WINLIB:Crypt32
)
Fallbacks
If a token is none of the above, the build system looks for a matching set of environment variables and wires it up generically:
include:
<TOKEN>_INC(or per config<TOKEN>_INCD/<TOKEN>_INCR)link dirs:
<TOKEN>_LIBPATHD/<TOKEN>_LIBPATHRlink libs:
<TOKEN>_LIBD/<TOKEN>_LIBR(or a single<TOKEN>_LIB)
So a simple new third party dependency can often be added just by defining those
variables in SetupEnvironment.bat and using the token, with no change to
OTProject.cmake. For anything less regular, add a branch in
_ot_apply_dep_to_core and _ot_apply_dep_to_final.