Make CMake module libs STATIC#1630
Merged
andrew-platt merged 1 commit intoOpenFAST:devfrom Jun 20, 2023
Merged
Conversation
In the past, the only way to build openfastlib as a shared library was to set -DBUILD_SHARED=ON. This library is now always built as shared but many users still set BUILD_SHARED which causes all module libraries to be created as shared which means that all must be dynamically loaded at run time. This commit changes the CMakeLists.txt files to build all module libs as STATIC regardless of BUILD_SHARED. This means that all module libraries will be statically linked into openfast, openfastlib and FAST.Farm which should improve performance and reduce complexity
andrew-platt
approved these changes
Jun 16, 2023
Collaborator
|
Should we get rid of the |
Collaborator
Author
|
@andrew-platt , |
Collaborator
Author
|
I've decided to leave this PR as is and revisit removing the |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Feature or improvement description
This PR changes the CMakeLists.txt files in each module so that the module libraries are built as STATIC even if CMake is configured with
-DBUILD_SHARED_LIBS=ON. Interface libraries (C-Bindings) andopenfastlibare always built as shared libraries so this change will not affect downstream users. This option is part of CMake: BUILD_SHARED_LIBSImpacted areas of the software
CMakeLists.txt files of all modules
Additional supporting information
This change arose from a problem installing WEIS which built OpenFAST with
-DBUILD_SHARED_LIBS=ON. At one point, the only way to buildopenfastlibas a shared library was to set-DBUILD_SHARED_LIBS=ON. This library is currently always built as shared but many users still setBUILD_SHARED_LIBS=ONwhich causes all module libraries to be created as shared libraries so they are dynamically loaded at run time. This commit changes the CMakeLists.txt files to build all module libs asSTATICregardless of howBUILD_SHARED_LIBSis set. As a result, all module libraries will be statically linked intoopenfast,openfastlibandFAST.Farmwhich should improve performance and reduce complexity. This also prevents a problem with building the Simulink MEX file which wouldn't work ifBUILD_SHARED_LIBS=ON.