summaryrefslogtreecommitdiff
path: root/gn/build/gen.py
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2021-05-11 10:24:35 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-04 10:20:58 +0200
commit5e25b04f055676df117338de22f5bf00601b57a1 (patch)
tree22ed667540e1f9781a6c8fa676a38ab0548e2740 /gn/build/gen.py
parent390674f5de92b951ee0db61f7941a67794984694 (diff)
downloadqtwebengine-chromium-5e25b04f055676df117338de22f5bf00601b57a1.tar.gz
Add support for QT_GN_VERSION
Change-Id: If5ac705f3a4292da915d1f36526ef1fbed3868e6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'gn/build/gen.py')
-rwxr-xr-xgn/build/gen.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/gn/build/gen.py b/gn/build/gen.py
index 724d94c45c1..38d4ec253f4 100755
--- a/gn/build/gen.py
+++ b/gn/build/gen.py
@@ -139,6 +139,8 @@ def main(argv):
help='The path to ar.')
parser.add_option('--isysroot',
help='The path to the macOS SDK sysroot to be used.')
+ parser.add_option('--qt-version',
+ help="The qt version gn is compiled for.")
options, args = parser.parse_args(argv)
if args:
@@ -156,6 +158,9 @@ def main(argv):
if not options.no_last_commit_position:
GenerateLastCommitPosition(host,
os.path.join(out_dir, 'last_commit_position.h'))
+ if options.qt_version:
+ generate_qt_version_header(options.qt_version, os.path.join(out_dir, 'qt_version.h'))
+
WriteGNNinja(os.path.join(out_dir, 'build.ninja'), platform, host, options)
return 0
@@ -843,5 +848,22 @@ def windows_target_build_arch():
if platform.machine().lower() in ['x86_64', 'amd64']: return 'x64'
return 'x86'
+def generate_qt_version_header(qtVersion,header):
+ contents = '''// Generated by build/gen.py.
+
+#ifndef QT_GN_VERSION
+#define QT_GN_VERSION "%s"
+#endif
+''' % (qtVersion)
+
+ old_contents = ''
+ if os.path.isfile(header):
+ with open(header, 'r') as f:
+ old_contents = f.read()
+
+ if old_contents != contents:
+ with open(header, 'w') as f:
+ f.write(contents)
+
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))