7.2.6. How to Build a Library and Link it in a foxBMS 2 Project
Sometimes source code can not be shared between parties. For these cases the foxBMS 2 project provides a mechanism to ship a minimal development project to the other party. This allows the partner to build a static library. This library and the accompanying headers can then be shared with the partner and be included in the application.
The following example describes the workflow. In this scenario Partner A develops on foxBMS 2 while Partner B should only provide a library to Partner A.
7.2.6.1. Bootstrapping a minimal development Project
Partner A bootstraps a minimal development project. This minimal project is named
library-project.tar.gz..\fox.ps1 waf configure .\fox.ps1 waf bootstrap_library_project
./fox.sh waf configure ./fox.sh waf bootstrap_library_project
./fox.sh waf configure ./fox.sh waf bootstrap_library_project
Partner A shares the archive
library-project.tar.gzwith Partner B.
7.2.6.2. Building a Library
Partner B installs a TI Code Composer Studio as described in Install TI Code Composer Studio.
Partner B installs a Python environment as described in Software Installation.
Partner B builds a library by adding sources etc. to the minimal project as needed and builds the library.
Partner B extract the archive
Partner B builds the library
.\fox.ps1 waf configure .\fox.ps1 waf build
./fox.sh waf configure ./fox.sh waf build
./fox.sh waf configure ./fox.sh waf build
Partner B shares the library and accompanying headers with Partner A.
7.2.6.3. Including the Library
Partner A copies the provided library and headers to a suitable location.
Partner A updates the include path for headers and search path for libraries in the build configuration by updating
INCLUDESandSTLIBPATH.Partner A adds a configuration step that make the library available for linking by using
conf.check_cc(stlib=<lib-name>", uselib_store="<reference>").Partner A can now use functions etc. from the library by including the headers and linking against the library by adding
<reference>to theuseparameter in the build step that requires the library.Partner A configures and builds the application as usual.
.\fox.ps1 waf configure .\fox.ps1 waf build_app_ti_arm_cgt
./fox.sh waf configure ./fox.sh waf build_app_ti_arm_cgt
./fox.sh waf configure ./fox.sh waf build_app_ti_arm_cgt
If the build is successful, the external library is correctly linked into the foxBMS 2 application.
A working minimal example of a library and its integration into the project can
be found in tests/variants/lib-build.