-
Notifications
You must be signed in to change notification settings - Fork 283
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
CMake: do release build by default #911
Conversation
@wpoely86 hmm, do you think this is backwards compatible? Is it possible that some applications are unaware of this configure option, and that it'll break builds? |
@@ -83,6 +84,10 @@ def configure_step(self, srcdir=None, builddir=None): | |||
srcdir = default_srcdir | |||
|
|||
options = ['-DCMAKE_INSTALL_PREFIX=%s' % self.installdir] | |||
|
|||
if self.cfg.get('releasebuild', True): | |||
options.append("-DCMAKE_BUILD_TYPE=Release") |
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.
what if -DCMAKE_BUILD_TYPE
is already specified?
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.
The last one will win (which means the one specified by someone else)
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.
wouldn't it be nicer to check whether -DCMAKE_BUILD_TYPE
is already specified via self.cfg['configopts']
?
if self.cfg.get('releasebuild', True) and '-DDCMAKE_BUILD_TYPE' not in self.cfg['configopts']:
options.append("-DCMAKE_BUILD_TYPE=Release")
in that case, you can even drop the releasebuild
parameter?
also, it would be nicer to support build_type = 'Release'
instead anyway?
It's part of CMake for as long as I know of. It's not application specific. |
Easyblocks unit test suite PASSed (see https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1962/console for more details). This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
Easyblocks unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1963/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
Easyblocks unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1964/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
Easyblocks unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1965/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
Easyblocks unit test suite FAILed. See https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1966/console for more details. Please fix the reported issues by pushing additional commits to the branch corresponding with this pull request; contact @boegel if you're not sure what to do. |
|
||
super(CMakeMake, self).__init__(*args, **kwargs) | ||
|
||
if self.cfg['buildtype'] not in CMAKE_BUILD_TARGETS: |
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.
use self.cfg.get('buildtype', None)
@boegel ready |
Easyblocks unit test suite PASSed (see https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1967/console for more details). This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
@@ -40,6 +40,7 @@ | |||
from easybuild.tools.environment import setvar | |||
from easybuild.tools.run import run_cmd | |||
|
|||
CMAKE_BUILD_TARGETS = ['Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'] |
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.
add a docs URL for this?
|
||
if self.cfg['buildtype'] not in CMAKE_BUILD_TARGETS: | ||
raise EasyBuildError("The specified build type for CMake is not known. Accepted values: " \ | ||
+ ', '.join(CMAKE_BUILD_TARGETS)) |
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.
please use this to avoid the \
:
raise EasyBuildError("The specified build type for CMake is not known. Accepted values: %s",
', '.join(CMAKE_BUILD_TARGETS))
Easyblocks unit test suite PASSed (see https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1968/console for more details). This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
Easyblocks unit test suite PASSed (see https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1969/console for more details). This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
Easyblocks unit test suite PASSed (see https://jenkins1.ugent.be/job/easybuild-easyblocks-pr-builder/1970/console for more details). This pull request is now ready for review/testing. Please try and find someone who can tackle this; contact @boegel if you're not sure what to do. |
@@ -51,9 +53,20 @@ def extra_options(extra_vars=None): | |||
extra_vars.update({ | |||
'srcdir': [None, "Source directory location to provide to cmake command", CUSTOM], | |||
'separate_build_dir': [False, "Perform build in a separate directory", CUSTOM], | |||
'buildtype': [CMAKE_BUILD_TYPES[0], "Build type for CMake. Accepted values: " + ', '.join(CMAKE_BUILD_TYPES), |
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 don't like this approach, we might miss the impact of reordering the CMAKE_BUILD_TYPES
alphabetically
I prefer using CMAKE_BUILD_TYPE_RELEASE
...
Current solution LGTM (except the erroneous bamtools inclusion). It is minimal and does "The Right Thing" by default |
@Flamefire It does make sense, but the question remains whether a change like this is going to have fallout. Perhaps there are creative ways where using |
The default build type (empty string) is a valid one but means only a baseline. All optimizations are usually not turned on, so the compiler will be running without any While I understand your concern I don't think it will be a problem in practice. Most (if not all) CMake projects are built on CI with So bottom line: IMO this should have been merged already ;-) if @wpoely86 is no longer active, you could cherry-pick the changes and make the final adjustments or I could open a PR and mention @wpoely86 in the commit message |
"Most (if not all) CMake projects are built on CI with -DCMAKE_BUILD_TYPE=Release and/or -DCMAKE_BUILD_TYPE=Debug" This is, sadly, not true. Way to many projects using CMake doesn't have a clue about CMAKE_BUILD_TYPE, nor about proper optimization flags. And there is one thing that always trumps performance... correctness of results. I.e., using Release by default is likely to break a lot of codes that we have in the tree. Just to make things clear. I'm all for performance, as long as the results are correct. I've just seen too much code that breaks if you just look at it... |
I guess a check is due then. An easy way I'd imagine: Could EB be used to download and extract all sources and break further processing just before calling At the least: Could we add this option with empty default? Then ECs/EBs can add it where they know
Can you say which and how/why? Counter-example: Caffee is very much aware of it and expects it to be either Release or Debug. |
My pet project for broken code was (until I got enough patches accepted upstream) VASP. Now it's just half bad. Not using CMake though, but that wasn't my main point on that part. I don't have any specifics at the moment, been too busy installing software on user requests and making EB better. But you can probably take any bioinformatics code as an example. Or Amber... And yes, there are lots of really good codes out there, like GROMACS, and for instance the blas/lapack/scalapack code. (And yes I've found more than one bug in them over the years causing them to break when increasing optimization) And when it comes to correctness, I, personally, would not trust even code that by default uses Release, to deliver correct results... Anyway, this is a discussion that could go on for ages, there is always new code coming out, both broken by design and good examnples. |
Well, EB adds For current usage in EB:
IMO Release should be the default just as |
@boegel please review