Hardio uses PID as its package management system. This section will explain how to configure your projet to use hardio with PID.

How to configure a project that uses hardio

When creating a project that uses hardio, you will only have to depend on the correct Iocard implementation and on each device you are using.

CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
set(WORKSPACE_DIR ${CMAKE_SOURCE_DIR}/../.. CACHE PATH "root of the packages workspace directory")
list(APPEND CMAKE_MODULE_PATH ${WORKSPACE_DIR}/share/cmake/system) # using generic scripts/modules of the workspace
include(Package_Definition NO_POLICY_SCOPE)

PROJECT(upboardexample)

PID_Package(	AUTHOR 		Clément Rebut
                ADDRESS git@gite.lirmm.fr:hardio/examples/upboardexample.git

                 YEAR 		2019
                LICENSE 	CeCILL
                DESCRIPTION	This package centralise all drivers use example for the upboard
                VERSION 0.1.0
        )

check_PID_Platform(CONFIGURATION posix)

########### Core lib implementation ##################
PID_Dependency(hardiocore)
PID_Dependency(hardioup)

################ Driver libs ########################
PID_Dependency(hardio_bno055)

PID_Dependency(hardio_waterdetect)

PID_Dependency(hardio_ms5837)

PID_Dependency(hardio_powerswitch)

################ External libs ######################
PID_Dependency(eigen)

#now finding packages

build_PID_Package()

This is the main configuration file for the examples on the Upboard. You can notice that the dependency to hardiocore and hardioup are in the file, as well as the dependencies for all the sensors that are used in the package.

Now let’s talk about how one would declare a component in such a package.

PID_Component(APPLICATION
	      NAME ms5837-test
	      DIRECTORY ms5837
	      CXX_STANDARD 17
	      INTERNAL LINKS ${posix_LINK_OPTIONS}
              DEPEND hardio_ms5837/ms5837
              hardioup/hardioup
              hardiocore/hardiocore)

When declaring a component, you need to make it depend on the sensors it uses and the IoCard it uses if an iocard is used.

How to configure a projet to implement a new Iocard

The only dependency when implementing a new Iocard is hardiocore.

CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
set(WORKSPACE_DIR ${CMAKE_SOURCE_DIR}/../.. CACHE PATH "root of the packages workspace directory")
list(APPEND CMAKE_MODULE_PATH ${WORKSPACE_DIR}/share/cmake/system) # using generic scripts/modules of the workspace
include(Package_Definition NO_POLICY_SCOPE)

PROJECT(hardioup)

PID_Package(	AUTHOR 		Clément Rebut
                ADDRESS git@gite.lirmm.fr:hardio/cards/hardioup.git

                 YEAR 		2019
                LICENSE 	CeCILL
                DESCRIPTION 	This is the implementation of hardiocore for upboard
                VERSION 0.1.0
        )

check_PID_Platform(CONFIGURATION posix)

PID_Dependency(hardiocore)

PID_Dependency(mraa)

#now finding packages

build_PID_Package()

Here you can see that appart from the external library mraa, the only dependency is hardiocore.

When declaring a component, the only needed dependency is also hardiocore

PID_Component(SHARED_LIB
		      NAME hardioup
		      DIRECTORY hardioup
		      CXX_STANDARD 17
		      INTERNAL LINKS ${posix_LINK_OPTIONS}
		      EXPORT hardiocore/hardiocore
                      mraa/libmraa)

How to configure a project to create a new device

When creating a new device, you will depend on hardiocore and any external library that is needed for the device.

CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)
set(WORKSPACE_DIR ${CMAKE_SOURCE_DIR}/../.. CACHE PATH "root of the packages workspace directory")
list(APPEND CMAKE_MODULE_PATH ${WORKSPACE_DIR}/share/cmake/system) # using generic scripts/modules of the workspace
include(Package_Definition NO_POLICY_SCOPE)

PROJECT(waterdetect)

PID_Package(	AUTHOR 		Charles Villard
                ADDRESS git@gite.lirmm.fr:hardio/devices/waterdetect.git

                 YEAR 		2018
                LICENSE 	CeCILL
                DESCRIPTION 	This is the driver of the water entry detection
                VERSION 0.1.0
        )

#now finding packages
PID_Dependency(hardiocore)

build_PID_Package()

In this file, the only dependency is hardiocore.

When declaring a component, you have to depend on hardiocore and all necessary external libraries that the device needs.

PID_Component(SHARED_LIB
                      NAME waterdetect
		      DIRECTORY waterdetect
		      CXX_STANDARD 17
              EXPORT hardiocore/hardiocore
                     )