summaryrefslogtreecommitdiffstats
path: root/conanfile.py
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2022-01-05 08:22:38 +0200
committerIikka Eklund <iikka.eklund@qt.io>2022-01-21 13:49:35 +0200
commitb9055da1738bc59cba7692ae34910c90e0859f67 (patch)
tree7be7dfdd7116cf3833d5520a9b5e140a6905741e /conanfile.py
parent8775528e9a998c7b91b68c7e10e9aaf97838ae3c (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. Pick-to: 6.2 6.3 Task-number: QTBUG-99571 Change-Id: I961570a100fadc03b8c423dcf0064ccc4be7ae6e Reviewed-by: Toni Saario <toni.saario@qt.io>
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)