-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Allow forcing assertions (#1182)
In the CI, we currently run the examples in Release only, which adds the `-DNDEBUG` flag and consequently disables `assert`. We can't run these in the CI with Debug, since that implies `-O0` and runs forever. This PR adds a new CMake option `ACTS_FORCE_ASSERTIONS` which defaults to `OFF`. If enabled, this will prepend a system include directory `cmake/assert_include` to all compilation units, which contains a wrapper around `cassert`, `Eigen/{Core,Dense,Geometry}` which enables `assert` (and `eigen_assert`) regardless of `NDEBUG`. I verified that this would have triggered the assertion from #1180 for example. The CI jobs are configured to run with `ACTS_FORCE_ASSERTIONS=ON`.
- Loading branch information
1 parent
988e2ca
commit 40d6e79
Showing
7 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define eigen_assert(x) assert(x) | ||
#include_next "Eigen/Core" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define eigen_assert(x) assert(x) | ||
#include_next "Eigen/Dense" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define eigen_assert(x) assert(x) | ||
#include_next "Eigen/Geometry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#if defined(NDEBUG) | ||
#define _HAD_NDEBUG | ||
#undef NDEBUG | ||
#endif | ||
#include_next <cassert> | ||
#if defined(_HAD_NDEBUG) | ||
#undef _HAD_NDEBUG | ||
#define NDEBUG | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters