Add options to handle static and static runtime builds.#299
Add options to handle static and static runtime builds.#299gautierbureau wants to merge 32 commits into
Conversation
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
… higher (#264) Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr> Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr> Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
…tions (#281) Signed-off-by: Luma <zamarrenolm@aia.es> Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
* Add Bus::getP() and Bus::getQ() * Add Network::getCountries() * Rename HvdcLine::*NominalVoltage into HvdcLine::*NominalV * Rename getNominalVoltage into getNominalV and setNominalVoltage into setNominalV Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
20039c8 to
02592f6
Compare
Signed-off-by: Gautier Bureau <gautier.bureau@gmail.com>
Signed-off-by: Sébastien LAIGRE <slaigre@silicom.fr>
02592f6 to
31918be
Compare
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4250 /wd4251 /wd4267 /wd4275") | ||
| if (NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS) | ||
| if (MSVC_STATIC_RUNTIME_LIBRARY) | ||
| set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") |
There was a problem hiding this comment.
This variable has been added in cmake v3.15 (https://cmake.org/cmake/help/git-stage/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html). Is there an equivalent for older version?
| else () | ||
| set(Boost_USE_STATIC_LIBS OFF) | ||
| set(Boost_USE_STATIC_RUNTIME OFF) | ||
| endif () |
There was a problem hiding this comment.
I propose to set Boost_USE_STATIC_RUNTIME according to the value of MSVC_STATIC_RUNTIME_LIBRARY even if BOOST_STATIC_LIBS is not set.
set(Boost_USE_STATIC_LIBS ${BOOST_STATIC_LIBS})
set(Boost_USE_STATIC_RUNTIME ${MSVC_STATIC_RUNTIME_LIBRARY})
| option(BUILD_SHARED_LIBS "Enable/disable build of shared libraries." ON) | ||
| option(BUILD_SHARED_EXTENSIONS "Enable/disable build of shared extensions." ON) | ||
| option(BUILD_STATIC_LIBS "Enable/disable build of static libraries." ON) | ||
| option(BUILD_STATIC_EXTENSIONS "Enable/disable build of static extensions." ON) |
There was a problem hiding this comment.
It's arguable, but I think we should not allow people to mix static and dynamic libraries. I propose to keep only BUILD_SHARED_LIBS and BUILD_STATIC_LIBS. I wonder if we should add an option for each extension library
| if (BOOST_STATIC_LIBS AND BUILD_SHARED_LIBS) | ||
| set(BOOST_STATIC_LIBS OFF) | ||
| message(WARNING "BOOST_STATIC_LIBS disabled if you want to build shared libraries. Use this option with BUILD_SHARED_LIBS=OFF") | ||
| endif () |
There was a problem hiding this comment.
I would raise an error in that case instead of making an arbitrary choice.
|
|
||
| if (BUILD_TESTS AND NOT BUILD_SHARED_LIBS) | ||
| message(FATAL_ERROR "BUILD_TESTS is ON but BUILD_SHARED_LIBS is OFF, you should turn ON BUILD_SHARED_LIBS or turn off BUILD_TESTS.") | ||
| endif () |
There was a problem hiding this comment.
Maybe we have to do something similar for the examples. Maybe we can find a way to link the examples and the tests to the IIDM library, using a postfix for example (empty or -static).
Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
* Make registerExtension public * Add an example to show how to use an XIIDM extension Signed-off-by: Mathieu BAGUE <mathieu.bague@rte-france.com>
Signed-off-by: Gautier Bureau <gautier.bureau@gmail.com>
31918be to
7a7da82
Compare
Signed-off-by: Gautier Bureau <gautier.bureau@gmail.com>
7a7da82 to
3b81bdc
Compare
|
Following a discussion with @mathbagu this PR will be put on hold indefinitely. Some conclusions on the proposed solution and future work that could be bone:
|
|
Kudos, SonarCloud Quality Gate passed!
|
Signed-off-by: Gautier Bureau gautier.bureau@gmail.com
Please check if the PR fulfills these requirements (please use
'[x]'to check the checkboxes, or submit the PR and then click the checkboxes)What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Enables to build only static/shared versions of the library and use static runtime on windows
What is the current behavior? (You can also link to an open issue here)
Static and shared versions are always built
What is the new behavior (if this is a feature change)?
Choose a specific version static/shared or both. Use a static boost library. Use static runtime on windows.