Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

[WIP] cmake structure for ecl#355

Closed
Stifael wants to merge 30 commits intoPX4:masterfrom
Stifael:ModernCmakeStructure
Closed

[WIP] cmake structure for ecl#355
Stifael wants to merge 30 commits intoPX4:masterfrom
Stifael:ModernCmakeStructure

Conversation

@Stifael
Copy link
Copy Markdown
Contributor

@Stifael Stifael commented Nov 14, 2017

This PR is based on this issue. The goal of this PR is to make each library within ecl as independent from other libraries as possible to make it easier for other projects outside of PX4 to incorporate ecl into their project. Moreover, a cmake structure was chosen that agrees with modern cmake suggestion from here and here. Doing so enables better cmake maintainability within and outside of the project.

To build the project do the following:

within ecl:
mkdir build
cd build
cmake ../src
make
make test

The project structure follows a standard cmake structure with having out of source build:

-build
-src
----CMakeLists.txt
----ekflib
----geolib
-----L1lib
-----mathlib
-----tecslib
-----matrixlib
-----tests

where each lib has the following structure following the include name-space construct.
-----namelib
--------CMakeLists.txt
--------include
-------------namelib
----------------name.h
--------src
------------cpp- and h-files

The exception is of course matrixlib, which is a submodule and therefore has its own structure.

In contrast to the suggestion of here, attitude_fw is not a separate library within ecl. The main reason is the strong dependency on PX4 and therefore it makes more sense to add it to PX4 project directly.

In addition, I created a separate library for math function (mathlib), which contains the math functions from px4 mathlib here without the Quaternion and Matrix related files, which is part of matrixlib. The main reason for creating a separate library for math functions is because there are and will be new flight control related SISO math functions which need to live somewhere, but currently it is not clear where to put them. I personally do not think it makes sense to put SISO math functions into matrix, since I still consider it as a library for vector operations.

I also added google-tests, which allows to make use of mock objects.

What still needs to be done:

  • finalize CMakeLists.txt. Currently they are at the bare minimum
  • remove tests and include it within each library. This is easy to do. All it requires is to move the code from the CMakeLists.txt within tests to the top CMakeLists.txt
  • make "validation" a library and verify where it is needed.
  • add matrix correctly to the project. Currently the path to math.hpp has to be included to make it compile, which of course is not how it should be done.
  • start discussion about matrix CMakeLists.txt. It would be much easier for any other project that uses the matrix lib if it were a header only target (add_library(matrix INTERFACE)) with all the matrix specific compilation flags as part of the target interface. That way it is very simple to incorporate matrix lib within other projects and ensuring that all compilation properties are preserved.
  • add python tests
  • write google tests
  • adjust px4 CMakeLists.txt to correctly include ecl

this is a duplicate of the same functionality of matrix is_finite.
Limits: remove reference return
@ChristophTobler
Copy link
Copy Markdown
Contributor

I guess #432 replaced this one... Please reopen if it's not the case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants