-
Notifications
You must be signed in to change notification settings - Fork 955
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
Upgrade CMake #2142
Comments
I can tell you Android NDK uses 3.10.2, so no objections on that side. |
This could definitely be a plus. |
@andrewfb , @richardeakin: Ok, so, would 3.10 be fine for you? |
Is it strictly necessary to change the CMAKE_MINIMUM_VERSION in order to start using the newer features? You could add a cmake version guard such as this around the use of the optional features:
This would allow use of the newer features for those who have the latest cmake, without breaking the build for folks who have older cmake. Otherwise there would always be a lag behind cmake features - i.e. if you settle on 3.10, then you're unable to use any features newer than that. |
For one, I see little use in using the new features if I have to keep the old code around - just makes the code harder to understand and maintain. Second cmake_minimum_required not only checks the cmake version it also makes sure that newer versions behave as close as possible to the minimum cmake version specified by setting all kinds of policies. In turn, newer cmake versions start to spew out warnings when cmake_minimum_required is too old and hence is forced to behave in a way that might be suprising to the user. In short: I don't think there is much to be gained by selectively using new cmake features on the one hand, but trying to stay compatible with extremely old versions of cmake on the other hand, if the end goal is simply to build cinder with a consistent set of options. |
Makes sense, thanks for the clarification! |
Can we establish what the actual minimum version we need to support is going to be? I would suggest dropping support for older versions we are unlikely to need to support. Considering most people are building with either Clang or VCC, there's not that many legacy use cases. |
You won't get any arguments from me. I've always been an early adopter. Also, I'd guess that once such a PR would actually get merged (and appear in a release version of cinder), we are easily ahead 3 versions of cmake compared to what was recent when I opened this issue. |
Well, for me, as I'm trying to modernize the Android side of things, it would certainly make my job easier if we settled on 3.10 or thereabouts. Ideally it should be possible to build it out of the box with Android Studio NDK, generally messing about with CMake versions is the path to suffering. |
My two cents would be to consider CMake 3.10.2 as the minimum which is the default for Ubuntu 18.04. I don't really see a problem with this and even if an older version is required in some edge cases ( e.g SBC's ), CMake can be installed pretty easily from source or through a package manager. |
I do agree it's probably not the end of the world if certain platforms require building CMake from source, but it's probably worth avoiding that if we can. Here's what I believe are the baselines: Technically we're still supporting 16.04, but with the release of Ubuntu 20.04 I don't personally have a problem deprecating <18.04. Are there specifically features in CMake 3.10 that we'd benefit from relative to 3.5? |
From the top of my head: The |
For me, the main reason to upgrade is that the Android build system ships with two versions of CMake - one forked from 3.6 and (I believe) the standard verion of 3.10.2. As you can probably imagine, using the standardized 3.10.2 version tends to make things run a lot smoother, because it's integrated with gradle. Otherwise, one can end up with lots of build script customization using shell scripts, custom gradle plugins, etc. There were lots of unusual tooling decisions in earlier Android NDK versions, but a lot if it has been standardized now since the NDK 21 LTS release. So for Android at least, unless legacy support is needed, I'd recommend using 3.10.2, just because it works out of the box with the SDK. |
@MikeGitb yes we're standardized on C++17 on MSW and C++14 elsewhere. And this seems like a fair trade-off to me. <=Ubuntu 16.04 looks like the only platform that would be affected if we standardize on 3.10.2 - let's do it. |
@andrewfb : sounds good - I can't promise I'll work on that in the near future (next couple of weeks are pretty full) but at least now we have a concrete target to work and test against. |
I've just begun, but if you have any insights I'd be happy to incorporate them into my branch? |
From the top of my head, I'd remove the whole c++ standard selection machinery and maybe add cxx_std_14/17 (linux/windows) to the public compilation requirements (I'm having somewhat ambivalent feelings towards them, but that's a different story). There might be other cleanup possible, now that VS2019 is the only supported VS-version. Other than that I haven't really been looking into this for quite some time and I've never developed anything for android or MacOS/iOS so I don't know anything about that area. IIRC, there are a few other cmake-related PRs in flight that you might want to take a look at, but they might be outdated by now. |
I should mention that I'm by no means a cmake expert. |
Great, please do! - I'll get started on cleaning things up on my side. |
In preparation of further refactorings. See cinder#2142
There are a few updates I'd like to make to the cmake files, in order to make it easier for the user (and or a package management system) to control the cinder build via typical cmake configuration options. Two examples being the control of the used c++ standard for which CMAKE provides the
CMAKE_CXX_STANDARD
variable since cmake 3.1 or the hardcoded usage of MT (#2116)I think that would also be a good time to upgrade the minimal required cmake version, as 2.8 is really old and a lot of things have become easier since then.
I wanted to ask, what an acceptable baseline would be. To give a short overview:
VS2019 currently ships with 3.15, Ubuntu 18.04 with cmake 3.10, Ubuntu16.04 with 3.5. Travis uses 3.12. I have no idea about macos, but generally it is very easy to install a newer version of cmake on any system.
Depending on whether Ubuntu 16.04 is still a common target, I'd recommend 3.5 or 3.10 (among other things, cmake 3.8 adds the cxx_std_14 / 17 target properties which are "nice to have" but not critical).
The text was updated successfully, but these errors were encountered: