summaryrefslogtreecommitdiffstats
path: root/conanfile.py
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2022-01-05 08:22:38 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-21 12:59:49 +0000
commit6b0fe01bafd008b15d8bab9fd31c3d1771e3e584 (patch)
tree2823f1d67ffe20573fd822b318c2e0070c9c19a1 /conanfile.py
parent4e6e57114c53bf7cb6eff74fa9f5ba1fa71257db (diff)
Conan: use settings.build_type if not set by Qt options for the build
To make the Qt conan package consumption more seamless for consumers who use e.g. conan-center packages we should try to make sure that "the default conan build profiles" people are using should work with Qt conan packages as well. This means that we should support the use case that when consumers are not explicitly defining Qt specific build options, e.g. -o debug_and_release=True And the consumer build profiles/settings may contain e.g. [settings] ... build_type=RelWithDebInfo In qtbase conan recipe this should translate to correct 'Options' specific to Qt's configure(.bat). This change introduces a fallback in case Qt specific options are not being passed. It sets the Qt specific options based on the settings.build_type. Task-number: QTBUG-99571 Change-Id: I961570a100fadc03b8c423dcf0064ccc4be7ae6e Reviewed-by: Toni Saario <toni.saario@qt.io> (cherry picked from commit b9055da1738bc59cba7692ae34910c90e0859f67) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'conanfile.py')
-rw-r--r--conanfile.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/conanfile.py b/conanfile.py
index f6f8151eeb..3a521cdc1d 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -504,9 +504,25 @@ class QtBase(ConanFile):
elif debug == True:
_set_build_type("Debug")
else:
- # set default that mirror the configure(.bat) default values
- self.options.release = True
- _set_build_type("Release")
+ # As a fallback set the build type for Qt configure based on the 'build_type'
+ # defined in the conan build settings
+ build_type = self.settings.get_safe("build_type")
+ if build_type in [None, "None"]:
+ # set default that mirror the configure(.bat) default values
+ self.options.release = True
+ self.settings.build_type = "Release"
+ elif build_type == "Release":
+ self.options.release = True
+ elif build_type == "Debug":
+ self.options.debug = True
+ elif build_type == "RelWithDebInfo":
+ self.options.release = True
+ self.options.force_debug_info = True
+ elif build_type == "MinSizeRel":
+ self.options.release = True
+ self.options.optimize_size = True
+ else:
+ raise QtConanError("Unknown build_type: {0}".format(self.settings.build_type))
def build(self):
self.python_requires["qt-conan-common"].module.build_env_wrap(self, _build_qtbase)