• Stars
    star
    363
  • Rank 117,374 (Top 3 %)
  • Language CMake
  • License
    MIT License
  • Created about 10 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An OS-agnostic C++ library template in plain CMake.

📚 How to export C++ library

This repository provides an OS-agnostic C++ library template with plain CMake files with the following features:

Overview

💢 Complexities around C++ library

This project simplifies the process of taking a bunch of C++ classes/functions and exposing them as a CMake package so that third-party code can use it. However, the risk is that new users underestimate the actual complexity of maintaining a C++ library used by many external users!

A complete and proper training on the art and craft of C++ library maintenance is out of the scope of this project, but we feel that we should at least report some useful link to drive the curiosity and the attention of new users to topics relevant to a proper maintenence of a C++ library.

Problems typically overlooked by new C++ library developers:

🏅 CI and badges

Awesomness Github Actions
Awesome GitHub Actions status

Go to the top

🎛 Dependencies

There are no dependencies for this template. However, we make use of the following three files from the YCM project.

  1. AddInstallRPATHSupport
  2. AddUninstallTarget
  3. InstallBasicPackageFiles

These files can be found under ./cmake subdirectory and they are plain CMake code. Check them out, they make your life easier!

If you like the YCM project and it is not a problem to have it as a dependency, updating the template is as simple as follows.

  1. Install YCM
  2. Add find(YCM REQUIRED) in the main CMakeLists.txt, after the project() command.
  3. Delete/Empty the ./cmake folder.

You are now 100% good to go! 🎉

Go to the top

🔨 Build the libraries

If your shell environment supports mkdir, you can just execute the following commands:

git clone https://github.com/robotology/how-to-export-cpp-library.git
cd how-to-export-cpp-library
mkdir build && cd build
cmake ..
cmake --build .

You can also create platform specific input files for a native build system using CMake Generator.

For more detailed example, check the CGold section on Generate native tool files.

Go to the top

✂️ Copy and customize this template

For customizing the CMake/C++ code, check the comments in the main CMakeLists.txt.

To enable Continuous Integration (CI) using Travis (Linux and macOS) and AppVeyor (Windows) follow the documentation of these services to create an account and connect them to your repository.

Once you're done with that, you can easily modify the appveyor.yml and travis.yml to account changes for your project, such as the project name from how-to-export-cpp-library (the name of the git repository) and LibTemplateCMake (the name of the CMake Project/Package) to the one of your repository/project.

Go to the top

🔬 Add a test

This snippet from test/CMakeLists.txt shows the fundamental commands to add a test:

add_executable(test_name_exec test_name_exec_source.cpp)
target_link_libraries(test_name_exec lib-template-cmake)
add_test(NAME test_name COMMAND test_name_exec)

A single test is just a simple C++ executable with an int main() function that returns 0 on success and any value different from 0 upon failure.

For more info on this topic and related CMake commands, check add_test documentation and references therein.

Go to the top

🐛 Run the tests

If you want to run tests, compile the library enabling the BUILD_TESTING CMake option. Once you do that, test will be compiled along with the library and any other executable in the project.

To list the compiled/available tests, run ctest -N in the build directory. To run the tests, use ctest command in the build directory, while to run a single test, us ctest -R test_name. You can add -VV to get a full verbose output during tests.

For more info and options with ctest, check the ctest documentation.

Go to the top

📝 Generate documentation

If the Doxygen tool is installed on your machine, the Doxygen documentation for the project can be generated using the dox target, see doc/CMakeLists.txt for details on the process of documents generation. Once generated, the doxygen documentation can be browsed at build/doc/html/index.html. If the documentation is generated, it will be installed in ${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}/html/. The build and installation directories for the doxygen documentation can be changed using the DOXYGEN_BUILD_DIR and DOXYGEN_INSTALL_DIR CMake variables.

If you are interested on how to host your documentation using gh-pages, robotology/how-to-document-modules contains a detailed (and maintained) example on how to produce and host Doxygen documentation using GitHub gh-pages.

Go to the top

📑 Licensing your library

The project as-is comes with two files:

  1. LICENSE
  2. LICENSE-template

The first file, LICENSE, is the one covering this very template. You have to modify/delete it. ⚠️ Don't use it straightforwardly as it includes our name, not yours!

The second file, LICENSE-template, is an MIT License template that you can use adding the year and copyright holder names in the heading. We provide template of the MIT License as it is the one used for this template, but you can choose one of the many available.

Should you not be sure what to do about it (licensing produces severe headhaces) you can use one of the following website to clear your mind:

Go to the top

💼 Other template and examples

The Awesome CMake repository contains an interesting list of template and examples similar to this one.

Go to the top


If you feel this CMake project template was useful, consider starring the project!
We also created the following shield to provide a nice-looking link to this project (feel free to modify its look-and-feel as you please).
Otherwise, not a big deal! 👍

how-to-export-cpp-library

More Repositories

1

yarp

YARP - Yet Another Robot Platform
C++
524
star
2

osqp-eigen

Simple Eigen-C++ wrapper for OSQP library
C++
391
star
3

gym-ignition

Framework for developing OpenAI Gym robotics environments simulated with Ignition Gazebo
C++
230
star
4

idyntree

Multibody Dynamics Library designed for Free Floating Robots
C++
175
star
5

human-gazebo

URDF models of humans created to perform human robot interaction experiments.
C++
137
star
6

walking-controllers

Bipedal locomotion software for the humanoid robot platform iCub.
C++
120
star
7

whole-body-controllers

Simulink-based whole body controllers for humanoid robots.
MATLAB
120
star
8

icub-main

The iCub Main Software Repository
C++
110
star
9

human-dynamics-estimation

Software repository for estimating human dynamics
C++
83
star
10

event-driven

neuromorphic sensor integration with YARP and iCub
C++
78
star
11

bayes-filters-lib

A flexible, modern, C++ recursive Bayesian estimation library.
C++
69
star
12

blender-robotics-utils

Set of utilities for exporting/controlling your robot in Blender
Python
62
star
13

ycm-cmake-modules

YCM (YCM CMake modules) is a collection of various useful CMake modules.
CMake
52
star
14

gh-action-nightly-merge

Automatically merge the stable branch into the development one
Shell
50
star
15

robotology-superbuild

CMake/YCM-based superbuild to simplify the build process of robotology projects.
CMake
49
star
16

blockfactory

A tiny framework to wrap algorithms for dataflow programming
C++
42
star
17

simmechanics-to-urdf

Script for converting simmechanics XML files to URDF
Python
34
star
18

gazebo-yarp-plugins

Plugins to interface Gazebo with YARP.
C++
33
star
19

icub-models

Official URDF and SDF models of the iCub humanoid robot.
CMake
33
star
20

walking-teleoperation

Software related to walking and teleoperation.
C++
30
star
21

urdf2casadi-matlab

MATLAB
28
star
22

whole-body-estimators

YARP devices that implement estimators for humanoid robots.
C++
26
star
23

community

Virtual repository hosting Discussions and Questions & Answers
25
star
24

gazebo-fmi

FMI import plugins for the Gazebo Simulator.
CMake
24
star
25

gym-ignition-models

Collection of robot models compatible with gym-ignition
Python
24
star
26

wb-toolbox

Simulink toolbox to rapidly prototype robot controllers
C++
23
star
27

rfsmTools

A set of tools to execute, debug and create rFSM LUA-based state machines
C++
23
star
28

icub-gazebo-grasping-sandbox

A public sandbox for simulating grasping in Gazebo with the iCub humanoid
C++
21
star
29

stereo-vision

Repository containing apps for stereo vision
C++
20
star
30

icub-tech-support

Virtual repository that provides support requests for individual robots
20
star
31

assistive-rehab

Assistive and Rehabilitative Robotics
Jupyter Notebook
20
star
32

unicycle-footstep-planner

Repository for the Unicycle-based FootStep Planner.
C++
20
star
33

find-superquadric

Fit a partial point cloud with a superquadric
C++
19
star
34

wearables

Code moved to https://github.com/robotology/human-dynamics-estimation
C++
19
star
35

icub-tutorials

Tutorials on iCub code
C++
19
star
36

robot-testing-framework

Robot Testing Framework (RTF)
C++
19
star
37

superquadric-lib

C++
16
star
38

cer-sim

Official URDF and SDF models of the R1 humanoid robot.
Python
16
star
39

visual-tracking-control

A C++ visual tracking app of the iCub hand using a 3D model-aided particle filter.
C++
16
star
40

superimpose-mesh-lib

A modern C++ augmented-reality library to superimpose 3D objects on images.
C++
15
star
41

icub-hri

iCub-HRI: A coherent framework for complex HRI scenarios on the iCub
C++
14
star
42

how-to-document-modules

Scripts and templates to help you document your code nicely
C++
14
star
43

robometry

Telemetry suite for logging data from your robot 🤖
C++
14
star
44

icub-models-generator

Resources and programs to generated models (URDF, SDF) of the iCub robot
C++
14
star
45

sdf-modelica

URDF/SDF to to Modelica model converter.
C++
14
star
46

robots-configuration

Contains robots configuration files
CMake
14
star
47

human-sensing

This repository contains software related to human sensing
C++
13
star
48

icub-firmware

iCub Firmware
C
12
star
49

segmentation

Components for image segmentation
C++
12
star
50

icub-basic-demos

A container for basic demos illustrating some iCub capabilities
C++
11
star
51

speech

Apps for speech recognition and speech synthesis
C
11
star
52

skeleton3D

Bridge between 2D Tensorflow-based human pose estimation and 3D estimation from stereovision
PureBasic
10
star
53

himrep

Hierarchical Image Representation
C++
10
star
54

calibration-supervisor

Code for supervising camera calibration using optimized chessboard poses
C++
10
star
55

yarp-devices-ros2

Plugins, devices and network wrappers for Yarp-ROS2 interoperation
C++
10
star
56

cer

Contains SW specific to the R1 robots
C++
10
star
57

yarp.js

JavaScript bindings for YARP!
JavaScript
10
star
58

navigation

Yarp modules and devices for autonomous navigation
C++
9
star
59

gz-sim-yarp-plugins

YARP plugins for Modern Gazebo (gz-sim).
C++
9
star
60

blocktest

Test system for generic robot middlewares
C++
8
star
61

gesture-recognition

This package contains modules that deal with gesture recognition
C++
8
star
62

yarp-device-realsense2

realsense2 device for YARP (https://www.yarp.it/)
C++
7
star
63

robotology-superbuild-dependencies-vcpkg

Pre-compiled vcpkg root with Windows binary dependencies of the robotology-superbuild
PowerShell
7
star
64

point-cloud-read

Module to acquire point clouds from iCub.
C++
6
star
65

icub-tests

Contains tests for iCub robot Tests are written using the robot-testing framework
C++
6
star
66

idyntree-yarp-tools

Tools based on the iDynTree library that depend on YARP.
C++
6
star
67

yarp-matlab-bindings

SWIG-based bindings of YARP for Matlab and Octave, based on the MEX C-API.
C++
6
star
68

icub-firmware-models

Models underlying the iCub Firmware
MATLAB
6
star
69

superquadric-grasp

Framework for grasping object using superquadric models
C++
6
star
70

natural-speech

This repository contains a codebase to build automatic speech recognition (ASR) systems for iCub and run them within YARP. It also proposes new articulatory-based and unsupervised models for ASR.
C
6
star
71

tool-affordances

Repo for Affordance project related stuff
RPC
6
star
72

superquadric-model

Framework for modeling and visualizing objects through superquadrics
C++
6
star
73

robotology-vcpkg-ports

Collection of vcpkg ports available on limited platforms just in binary form.
CMake
6
star
74

funny-things

A collection of "funny" yet useful behaviors for the iCub
Shell
6
star
75

superbuild-example

This is a simple repository that shows how to make a superbuild project.
CMake
5
star
76

online-detection-demo

Fast object detection learning with CNN and kernel based architecture
MATLAB
5
star
77

yarp-device-xsensmt

YARP Device Driver for XSens MT* devices based on the MT Software Suite.
C++
5
star
78

yarp-device-ultrapython

Contains a YARP device driver supporting the UltraPython cameras
C++
5
star
79

cardinal-points-grasp

Simple superquadric-based grasping pose generator for iCub
C++
5
star
80

icub-firmware-shared

Protocols and Other Stuff Used both by iCub Firmware and iCub Software
C
4
star
81

yarp-devices-haptic

Generic YARP driver for Haptic Devices
C++
4
star
82

d4c

Dynamic Force Field Control
C++
4
star
83

yarp-devices-forcetorque

YARP Drivers for various commercial Force Torque sensors.
C++
4
star
84

c4d-icub-plugins

plugins for Cinema4D
C++
4
star
85

attention

Multimodal Attention System for the iCub
C++
4
star
86

yarp-omega3

Simple YARP-based server to send position/force set points to a Force Dimension Omega.3 robot
C++
4
star
87

poeticon

This is the repository of the POETICON++ EU project http://www.poeticon.eu
C++
4
star
88

superquadric-grasp-demo

Object modeling and grasping with superquadrics and visual-servoing
C++
3
star
89

visual-tactile-localization

In-hand object tracking for the iCub humanoid robot.
C++
3
star
90

icub-workspace-estimation

This repository deals with the task of computing the workspace of the iCub given a proper kinematic representation.
MATLAB
3
star
91

iCubWorld

This repository contains the iCubWorld dataset.
3
star
92

icub-firmware-build

iCub Firmware Builds
Assembly
3
star
93

yarp-device-ovrheadset

LibOVR device for YARP (https://www.yarp.it/)
C
3
star
94

vagrant-icub

Vagrant configurations files to create VirtualBox virtual machine with YARP and iCub-main sources and dependancies
Ruby
3
star
95

yarp-device-pylon

Contains a YARP device driver supporting the Basler cameras
C++
2
star
96

yarp-device-argus

Contains a YARP device driver supporting the Framos cameras
C++
2
star
97

iol

Interactive Objects Learning
C++
2
star
98

yarp-device-vicon-bridge

This is a yarp device driver providing data from VICON motion capture systems.
C++
2
star
99

visuomotor-learning

C++
2
star
100

icub-contrib-common

Meta-package to configure contrib modules and libraries
CMake
2
star