-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add options to handle static and static runtime builds. #299
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
…evel (#242) (#251) Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
… higher (#264) Signed-off-by: Sébastien LAIGRE <[email protected]>
* Always use stdcxx::optional instead of direct usage of boost::optional (#221) * Use optional::operator() to check that an optional is set or not (#216) Signed-off-by: Sébastien LAIGRE <[email protected]>
…tions (#220) (#268) Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
…#228) (#266) Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]> Signed-off-by: Mathieu BAGUE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]> Signed-off-by: Mathieu BAGUE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]> Signed-off-by: Mathieu BAGUE <[email protected]>
…tions (#281) Signed-off-by: Luma <[email protected]> Signed-off-by: Mathieu BAGUE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
* 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 <[email protected]>
a7d0604
to
20039c8
Compare
20039c8
to
02592f6
Compare
Signed-off-by: Gautier Bureau <[email protected]>
Signed-off-by: Sébastien LAIGRE <[email protected]>
02592f6
to
31918be
Compare
@@ -36,9 +61,28 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE | |||
# set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -D_GLIBCXX_DEBUG") | |||
elseif (MSVC) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
CMakeLists.txt
Outdated
else () | ||
set(Boost_USE_STATIC_LIBS OFF) | ||
set(Boost_USE_STATIC_RUNTIME OFF) | ||
endif () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
CMakeLists.txt
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would raise an error in that case instead of making an arbitrary choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
CMakeLists.txt
Outdated
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
* Make registerExtension public * Add an example to show how to use an XIIDM extension Signed-off-by: Mathieu BAGUE <[email protected]>
Signed-off-by: Gautier Bureau <[email protected]>
31918be
to
7a7da82
Compare
Signed-off-by: Gautier Bureau <[email protected]>
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 [email protected]
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.