-
Notifications
You must be signed in to change notification settings - Fork 181
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 CMakePresets.json #1380
Add CMakePresets.json #1380
Conversation
Silences CMake 3.27 deprecation message.
@@ -121,12 +121,14 @@ if(WIN32) | |||
option(ECAL_THIRDPARTY_BUILD_CURL "Build CURL with eCAL" ON) | |||
option(ECAL_THIRDPARTY_BUILD_HDF5 "Build HDF5 with eCAL" ON) | |||
cmake_dependent_option(ECAL_THIRDPARTY_BUILD_QWT "Build qwt::qwt with eCAL" ON "HAS_QT" OFF) | |||
option(BUILD_SHARED_LIBS "Build shared libraries; required off on MSVC" OFF) |
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.
Why does it have to be set explicitly? BUILD_SHARD_LIBS
is already a CMake option, defaulting to OFF
on Windows platforms?
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.
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.
And this isn't in the CMakePresets because then you'd need separate Windows and non-Windows presets to handle the mandatory platform-dependent setting. The presets themselves don't handle platform dependent things very well. Its best at setting high-level options which the build system understands and can do what you ask (like handling whether BUILD_SHARED_LIBS needs to be set on your platform or which thirdparty submodules to build from source)
Thanks for this PR! 👍 |
Also silences CMake 3.27 deprecation message.
Also silences CMake 3.27 deprecation message.
Description
Adds CMakePresets.json with the most common user-facing build profiles:
core
: Minimal build. Focuses on building just the core libraries and nothing else.wheel
: Builds the Python wheel.cmake --preset wheel && cmake --build --preset wheel
cli
: Extendscore
to include the CLI/TUI applicationsgui
: Extendscli
to include the QT GUI applications toodocs
: Extendswheel
to also build the Sphinx documentationI did not include a "full" build, testing, or C# presets as I was focusing on the most common feature levels users (from my perspective) would want. These presets should evolve over time to meet end-user, contributor, and developer needs.
With this PR it is much easier to build the different feature levels; especially for users that may not want a complete build.
Additionally, users may write their own "CMakeUserPresets.json" to extend the set of presets with something tailored to their use and preference. ( I, personally, will be using this feature)
Lastly, IDEs, such as Visual Studio, understand CMakePresets and allow for quickly switching between the different presets, aiding development and checking the different feature levels.
Technical notes
The builds default the
CMAKE_BUILD_TYPE
to Release to prevent the combinatorial explosion of having explicit debug/release(/relwithdebinfo/minsizerel) presets.This is only relevant for single-config generators (like "Unix Makefiles" or regular "Ninja") and does not affect "Visual Studio *" or "Ninja Multi-Config" generators.
This PR includes a CMake option to default
BUILD_SHARED_LIBS
toOFF
only on "win32" builds. This setting is always required when building with MSVC due to the current DLL situation.I do not define
BUILD_SHARED_LIBS
on non-win32 builds to match existing behaviour.I bumped the minimum CMake version of CMakeFunctions solely because it was giving a deprecation message about support for CMake < 3.5.
CMake Preset documentation
Related issues
Cherry-pick to
HAS_QT
back toHAS_QT5
. I don't think any other changes would be needed.