[BugFix] Modernize CMake, remove object libraries, build Simulink MEX #1555
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is ready to be merged.
Related issue, if one exists
This PR addresses issue #1551 where compilation fails on an M1 mac.
Impacted areas of the software
CMakeLists.txt
filesautomated-dev-tests.yml
- updated to Ubuntu 22.04 and gcc-12Additional supporting information
This PR, #1535, and #1530 address issues created by PR #1010 which used CMake object libraries to statically link the Simulink MEX file. These object libraries created a lot of complexity in the build system and made the module dependencies confusing. This PR removes the object libraries and uses CMake's
matlab_add_mex
function (https://cmake.org/cmake/help/latest/module/FindMatlab.html#command:matlab_add_mex) to build the MEX file directly, instead of relying oncreate_FAST_SFunc.m
. The MEX file links againstopenfast_prelib
and recompiles parts ofopenfast_postlib
withCOMPILE_SIMULINK
defined. This these libraries are statically linked, it should solve the problems that PR #1010 were originally trying to solve. It also makes the process of build the MEX file easier when using CMake.create_FAST_SFunc.m
should still be used when building with Visual Studio on Windows.Various other improvements were made to the CMake build system:
target_include_directories
to specify includes per targettarget_compile_definitions
to reduce the scope of preprocessor definesFindMatlab.cmake
since it's included in CMakeTest results, if applicable
All tests are passing when compiled with
gfortran
andifort