Operating System | Build Status |
---|---|
Ubuntu (x64) |
Follow the instructions to install the project.
This repository provides the XType base class as well as all necessary tools to generate your custom XTypes.
The xtypes_generator was initiated and is currently developed at the Robotics Innovation Center of the German Research Center for Artificial Intelligence (DFKI) in Bremen, together with the Robotics Group of the University of Bremen.
XTypes are an object-oriented type definition which like a normal class hold properties and can have member functions; but furthermore, they can hold relations to other XTypes. Due to their neat implementation, XTypes instances are out of the box ready to be stored in databases.
Moreover, they come directly with Python bindings, so you don't have to worry about binding everything yourself. It's already done for you.
The XTypes are defined as templates. An exemplary template can be found here. Please have a look in Templates.md on how to write your own template.
To use XTypes as the basis of your project you have to do the following:
-
Install this project see Installation Instructions
-
Setup your project directory. You can do this using
xtypes_generator create_xtypes_project
. -
Write the CMakeLists.txt file for your project. And add:
find_package(xtypes_generator REQUIRED) xtypes_project()
Further info here
-
Define your types using template files like doc/template.yaml
-
Run cmake once in the build directory:
cd $YOUR_PROJECT mkdir build cd build cmake ..
Now all files are generated for you.
-
Copy the skeleton files for your XTypes from build/auto_generated_files/skeleton_files to your source directory, e.g.:
cd $YOUR_PROJECT cp -rn build/auto_generated_files/skeleton_files/src/* src/
If need to make adaptations you can copy the header skeleton files as well. You only need to have the files in your include/ src/ directories you want to override.
-
Fill those files with your source code.
-
Do a full build and install and you will have C++ Library and python module ready to go.
cd $YOUR_PROJECT mkdir build cd build cmake .. make install
Please make sure you have the following dependencies installed
- CMake >= 3.10
- nlohmann_json >= 3.10.5
- pybind11 >=2.9.1
- pybind11_json >=0.2.12
- Python >=3.6 <4
- python-yaml
- Clone this repository
- Build and install via:
cd xtypes_generator
mkdir build
cd build
cmake ..
make install
- Add this repository to your autoproj setup.
- Then run in your autoproj workspace:
aup xtypes_generator
amake xtypes_generator
We define a new CMake macro called xtypes_project
to customize the execution you can use the following arguments, but normally you should be fine using just xtypes_project()
.
Flags:
DEACTIVATE_PYTHON_BINDINGS
: If you don't want to build the Python bindings to your code
Arguments:
SOURCE_DIRECTORY
: The directory which contains include and src dirs.
Default:${CMAKE_CURRENT_SOURCE_DIR}
TEMPLATE_DIRECTORY
: The template directory.
Default:${CMAKE_CURRENT_SOURCE_DIR}/templates/
PYBIND_DIRECTORY
: The directory from where to include any further custom pybind files.
Default:${CMAKE_CURRENT_SOURCE_DIR}/pybind/
AUTO_GEN_DIRECTORY
: The directory where to put the generated files.
Default:${CMAKE_BINARY_DIR}/auto_generated_files
SKELETON_DIRECTORY
: The directory where to write the skeleton files.
Default:${AUTO_GEN_DIRECTORY}/skeleton_files/
COLLECTED_DIRECTORY
: The directory where to put the collected files.
Default:${CMAKE_BINARY_DIR}/build_files
NAMESPACE
: The namespace to use.
Default:${PROJECT_NAME}
PYTHON_EXECUTABLE
: The python executable to build python bindings for.
Default: The currently available python.
This project comes with several scripts/tools you can access via xtypes_generator
command in your terminal.
See xtypes_generator -h
and xtypes_generator COMMAND -h
for more info on those tools.
This tool sets up a new directory and the parameters for your new XTypes project.
You can pass the necessary info either by the command line arguments or run it with the -i
option to be asked interactively.
ATTENTION: The now following tools are mainly used internally. Prefer to use the CMake macro unless you know what you are doing.
Used for code generation from template yaml-files of the XTypes. Generates C++ base classes, user-customizable skeleton-files and the python bindings.
For usage details see: xtypes_generator -h
Generates C++ and pybind files for the Registry class.
For usage details see: xtypes_registry_generator -h
These tools are mainly used internally and deliver file listing and management support when building xtype representations with the xtypes_generator.
For details see:
xtypes_files_get -h
xtypes_files_copy -h
xtypes_files_get_and_copy -h
To create the Doxygen documentation, simply do:
cd xtypes_generator/build
cmake ..
make doc