2018-10-24 13:20:27 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#############################################################################
|
|
|
|
##
|
|
|
|
## Copyright (C) 2018 The Qt Company Ltd.
|
|
|
|
## Contact: https://www.qt.io/licensing/
|
|
|
|
##
|
|
|
|
## This file is part of the plugins of the Qt Toolkit.
|
|
|
|
##
|
|
|
|
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
|
|
|
## Commercial License Usage
|
|
|
|
## Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
## accordance with the commercial license agreement provided with the
|
|
|
|
## Software or, alternatively, in accordance with the terms contained in
|
|
|
|
## a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
## and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
## information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
##
|
|
|
|
## GNU General Public License Usage
|
|
|
|
## Alternatively, this file may be used under the terms of the GNU
|
|
|
|
## General Public License version 3 as published by the Free Software
|
|
|
|
## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
## included in the packaging of this file. Please review the following
|
|
|
|
## information to ensure the GNU General Public License requirements will
|
|
|
|
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
##
|
|
|
|
## $QT_END_LICENSE$
|
|
|
|
##
|
|
|
|
#############################################################################
|
|
|
|
|
2019-05-24 15:29:21 +00:00
|
|
|
import json_parser
|
2019-09-11 08:13:06 +00:00
|
|
|
import posixpath
|
2018-10-24 13:20:27 +00:00
|
|
|
import re
|
|
|
|
import sys
|
2019-10-08 13:36:05 +00:00
|
|
|
from typing import Optional, Set
|
2019-08-26 14:15:56 +00:00
|
|
|
from textwrap import dedent
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
from helper import (
|
|
|
|
map_qt_library,
|
|
|
|
featureName,
|
|
|
|
map_platform,
|
|
|
|
find_3rd_party_library_mapping,
|
|
|
|
generate_find_package_info,
|
|
|
|
)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
knownTests = set() # type: Set[str]
|
|
|
|
|
|
|
|
|
|
|
|
class LibraryMapping:
|
|
|
|
def __init__(self, package: str, resultVariable: str, appendFoundSuffix: bool = True) -> None:
|
|
|
|
self.package = package
|
|
|
|
self.resultVariable = resultVariable
|
|
|
|
self.appendFoundSuffix = appendFoundSuffix
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
|
2019-10-08 13:36:05 +00:00
|
|
|
def map_tests(test: str) -> Optional[str]:
|
2018-10-24 13:20:27 +00:00
|
|
|
testmap = {
|
2019-10-17 08:49:44 +00:00
|
|
|
"c99": "c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES",
|
|
|
|
"c11": "c_std_11 IN_LIST CMAKE_C_COMPILE_FEATURES",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"x86SimdAlways": "ON", # FIXME: Make this actually do a compile test.
|
|
|
|
"aesni": "TEST_subarch_aes",
|
|
|
|
"avx": "TEST_subarch_avx",
|
|
|
|
"avx2": "TEST_subarch_avx2",
|
|
|
|
"avx512f": "TEST_subarch_avx512f",
|
|
|
|
"avx512cd": "TEST_subarch_avx512cd",
|
|
|
|
"avx512dq": "TEST_subarch_avx512dq",
|
|
|
|
"avx512bw": "TEST_subarch_avx512bw",
|
|
|
|
"avx512er": "TEST_subarch_avx512er",
|
|
|
|
"avx512pf": "TEST_subarch_avx512pf",
|
|
|
|
"avx512vl": "TEST_subarch_avx512vl",
|
|
|
|
"avx512ifma": "TEST_subarch_avx512ifma",
|
|
|
|
"avx512vbmi": "TEST_subarch_avx512vbmi",
|
|
|
|
"avx512vbmi2": "TEST_subarch_avx512vbmi2",
|
|
|
|
"avx512vpopcntdq": "TEST_subarch_avx512vpopcntdq",
|
|
|
|
"avx5124fmaps": "TEST_subarch_avx5124fmaps",
|
|
|
|
"avx5124vnniw": "TEST_subarch_avx5124vnniw",
|
|
|
|
"bmi": "TEST_subarch_bmi",
|
|
|
|
"bmi2": "TEST_subarch_bmi2",
|
|
|
|
"cx16": "TEST_subarch_cx16",
|
|
|
|
"f16c": "TEST_subarch_f16c",
|
|
|
|
"fma": "TEST_subarch_fma",
|
|
|
|
"fma4": "TEST_subarch_fma4",
|
|
|
|
"fsgsbase": "TEST_subarch_fsgsbase",
|
|
|
|
"gfni": "TEST_subarch_gfni",
|
|
|
|
"ibt": "TEST_subarch_ibt",
|
|
|
|
"libclang": "TEST_libclang",
|
|
|
|
"lwp": "TEST_subarch_lwp",
|
|
|
|
"lzcnt": "TEST_subarch_lzcnt",
|
|
|
|
"mmx": "TEST_subarch_mmx",
|
|
|
|
"movbe": "TEST_subarch_movbe",
|
|
|
|
"mpx": "TEST_subarch_mpx",
|
|
|
|
"no-sahf": "TEST_subarch_no_shaf",
|
|
|
|
"pclmul": "TEST_subarch_pclmul",
|
|
|
|
"popcnt": "TEST_subarch_popcnt",
|
|
|
|
"prefetchwt1": "TEST_subarch_prefetchwt1",
|
|
|
|
"prfchw": "TEST_subarch_prfchw",
|
|
|
|
"pdpid": "TEST_subarch_rdpid",
|
|
|
|
"rdpid": "TEST_subarch_rdpid",
|
|
|
|
"rdseed": "TEST_subarch_rdseed",
|
|
|
|
"rdrnd": "TEST_subarch_rdseed", # FIXME: Is this the right thing?
|
|
|
|
"rtm": "TEST_subarch_rtm",
|
|
|
|
"shani": "TEST_subarch_sha",
|
|
|
|
"shstk": "TEST_subarch_shstk",
|
|
|
|
"sse2": "TEST_subarch_sse2",
|
|
|
|
"sse3": "TEST_subarch_sse3",
|
|
|
|
"ssse3": "TEST_subarch_ssse3",
|
|
|
|
"sse4a": "TEST_subarch_sse4a",
|
|
|
|
"sse4_1": "TEST_subarch_sse4_1",
|
|
|
|
"sse4_2": "TEST_subarch_sse4_2",
|
|
|
|
"tbm": "TEST_subarch_tbm",
|
|
|
|
"xop": "TEST_subarch_xop",
|
|
|
|
"neon": "TEST_subarch_neon",
|
|
|
|
"iwmmxt": "TEST_subarch_iwmmxt",
|
|
|
|
"crc32": "TEST_subarch_crc32",
|
|
|
|
"vis": "TEST_subarch_vis",
|
|
|
|
"vis2": "TEST_subarch_vis2",
|
|
|
|
"vis3": "TEST_subarch_vis3",
|
|
|
|
"dsp": "TEST_subarch_dsp",
|
|
|
|
"dspr2": "TEST_subarch_dspr2",
|
|
|
|
"altivec": "TEST_subarch_altivec",
|
|
|
|
"spe": "TEST_subarch_spe",
|
|
|
|
"vsx": "TEST_subarch_vsx",
|
|
|
|
"posix-iconv": "TEST_posix_iconv",
|
|
|
|
"sun-iconv": "TEST_sun_iconv",
|
|
|
|
"openssl11": '(OPENSSL_VERSION VERSION_GREATER_EQUAL "1.1.0")',
|
|
|
|
"reduce_exports": "CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY",
|
|
|
|
"libinput_axis_api": "ON",
|
2019-02-12 08:57:53 +00:00
|
|
|
"xlib": "X11_FOUND",
|
2019-09-21 18:09:36 +00:00
|
|
|
"wayland-scanner": "WaylandScanner_FOUND",
|
2018-10-24 13:20:27 +00:00
|
|
|
}
|
|
|
|
if test in testmap:
|
|
|
|
return testmap.get(test, None)
|
|
|
|
if test in knownTests:
|
2019-09-20 09:34:16 +00:00
|
|
|
return f"TEST_{featureName(test)}"
|
2018-10-24 13:20:27 +00:00
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
def cm(ctx, *output):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
txt = ctx["output"]
|
|
|
|
if txt != "" and not txt.endswith("\n"):
|
|
|
|
txt += "\n"
|
|
|
|
txt += "\n".join(output)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
ctx["output"] = txt
|
2018-10-24 13:20:27 +00:00
|
|
|
return ctx
|
|
|
|
|
|
|
|
|
2019-10-08 13:07:41 +00:00
|
|
|
def readJsonFromDir(path: str) -> str:
|
|
|
|
path = posixpath.join(path, "configure.json")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2019-09-20 09:34:16 +00:00
|
|
|
print(f"Reading {path}...")
|
2019-09-11 08:13:06 +00:00
|
|
|
assert posixpath.exists(path)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2019-05-24 15:29:21 +00:00
|
|
|
parser = json_parser.QMakeSpecificJSONParser()
|
|
|
|
return parser.parse(path)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
def processFiles(ctx, data):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(" files:")
|
|
|
|
if "files" in data:
|
|
|
|
for (k, v) in data["files"].items():
|
2018-10-24 13:20:27 +00:00
|
|
|
ctx[k] = v
|
|
|
|
return ctx
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
def parseLib(ctx, lib, data, cm_fh, cmake_find_packages_set):
|
2019-05-06 10:26:31 +00:00
|
|
|
newlib = find_3rd_party_library_mapping(lib)
|
2019-05-03 13:02:32 +00:00
|
|
|
if not newlib:
|
2019-09-20 09:34:16 +00:00
|
|
|
print(f' XXXX Unknown library "{lib}".')
|
2019-05-03 13:02:32 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if newlib.packageName is None:
|
2019-09-20 09:34:16 +00:00
|
|
|
print(f' **** Skipping library "{lib}" -- was masked.')
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
2019-09-20 09:34:16 +00:00
|
|
|
print(f" mapped library {lib} to {newlib.targetName}.")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
# Avoid duplicate find_package calls.
|
2019-05-03 13:02:32 +00:00
|
|
|
if newlib.targetName in cmake_find_packages_set:
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
2019-05-17 12:22:57 +00:00
|
|
|
# If certain libraries are used within a feature, but the feature
|
|
|
|
# is only emitted conditionally with a simple condition (like
|
|
|
|
# 'on Windows' or 'on Linux'), we should enclose the find_package
|
|
|
|
# call for the library into the same condition.
|
|
|
|
emit_if = newlib.emit_if
|
|
|
|
|
|
|
|
# Only look through features if a custom emit_if wasn't provided.
|
|
|
|
if not emit_if:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
for feature in data["features"]:
|
|
|
|
feature_data = data["features"][feature]
|
|
|
|
if (
|
|
|
|
"condition" in feature_data
|
2019-09-20 09:34:16 +00:00
|
|
|
and f"libs.{lib}" in feature_data["condition"]
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
and "emitIf" in feature_data
|
|
|
|
and "config." in feature_data["emitIf"]
|
|
|
|
):
|
|
|
|
emit_if = feature_data["emitIf"]
|
2019-05-17 12:22:57 +00:00
|
|
|
break
|
|
|
|
|
|
|
|
if emit_if:
|
|
|
|
emit_if = map_condition(emit_if)
|
|
|
|
|
2019-05-03 13:02:32 +00:00
|
|
|
cmake_find_packages_set.add(newlib.targetName)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
CMake: Allow building bundled 3rd party libraries in qtbase
A few things are needed to accomplish that:
- the python scripts do not ignore certain system_foo features anymore
(it is a hardcoded list for now just to be safe)
- configurejson2cmake now outputs
qt_find_package(WrapSystemFoo) calls for bundled libraries
(see below)
- the harfbuzz .pro file is modified to accommodate pro2cmake
not being able to correctly parse some conditional scopes
- the freetype .pro file is modified to make sure linking of the
library succeeds without duplicate symbol errors, which qmake
doesn't encounter due to magical exclusion of cpp files that are
included in other cpp files (presumably for include moc_foo.cpp
support)
- feature evaluation for Core, Gui, Network now happens in the
qtbase/src directory, so that bundled libraries can be conditionally
built
- for each bundled library there are now two FindWrap scripts:
- FindWrapSystemFoo which finds an installed library in the system
- FindWrapFoo which either uses the system installed library or
the built bundled one depending on a condition
- projects that intend to use bundled libraries need to link against
WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets
(this is handled by pro2cmake).
Unfortunately manually added qt_find_package(WrapFoo) calls might
still be needed as is the case for WrapFreetype and others.
- a new cmake/QtFindWrapHelper.cmake file is added that provides
a macro to simplify creation of WrapFoo targets that link against
a bundled or system library. The implementation is fairly ugly
due to CMake macro constraints, but it was deemed better than
copy-pasting a bunch of almost identical code across all
FindWrapFoo.cmake files.
- a qtzlib header-only module is now created when using bundled
zlib, to provide public syncqt created headers for consumers
that need them. These are projects that have
'QT_PRIVATE += zlib-private' in their .pro files
(e.g. qtimageformats, qtlocation, qt3d, etc.)
This is unfortunately needed due to QtNetwork using zlib
types in its private C++ API.
The change includes support for building the following bundled
libraries:
- zlib
- libpng
- libjpeg
- Freetype
- Harfbuzz-ng
- PCRE2
The following 3rd party libraries are still using an old
implementation within the CMake build system, and should be migrated
to the new one in the near future:
- double-conversion
- Old harfbuzz
The are a few libraries that are not yet ported:
- system-sqlite
- systemxcb
- maybe others
Among other things, this change allows building qtbase on Windows
without requiring vcpkg.
Task-number: QTBUG-82167
Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-02-14 13:53:28 +00:00
|
|
|
find_package_kwargs = {"emit_if": emit_if}
|
|
|
|
if newlib.is_bundled_with_qt:
|
|
|
|
# If a library is bundled with Qt, it has 2 FindFoo.cmake
|
|
|
|
# modules: WrapFoo and WrapSystemFoo.
|
|
|
|
# FindWrapSystemFoo.cmake will try to find the 'Foo' library in
|
|
|
|
# the usual CMake locations, and will create a
|
|
|
|
# WrapSystemFoo::WrapSystemFoo target pointing to the library.
|
|
|
|
#
|
|
|
|
# FindWrapFoo.cmake will create a WrapFoo::WrapFoo target which
|
|
|
|
# will link either against the WrapSystemFoo or QtBundledFoo
|
|
|
|
# target depending on certain feature values.
|
|
|
|
#
|
|
|
|
# Because the following qt_find_package call is for
|
|
|
|
# configure.cmake consumption, we make the assumption that
|
|
|
|
# configure.cmake is interested in finding the system library
|
|
|
|
# for the purpose of enabling or disabling a system_foo feature.
|
|
|
|
find_package_kwargs["use_system_package_name"] = True
|
|
|
|
|
|
|
|
cm_fh.write(generate_find_package_info(newlib, **find_package_kwargs))
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2020-03-04 12:44:24 +00:00
|
|
|
run_library_test = False
|
|
|
|
mapped_library = find_3rd_party_library_mapping(lib)
|
|
|
|
if mapped_library:
|
|
|
|
run_library_test = mapped_library.run_library_test
|
|
|
|
|
|
|
|
if run_library_test and "test" in data["libraries"][lib]:
|
|
|
|
test = data["libraries"][lib]["test"]
|
2020-03-11 18:14:35 +00:00
|
|
|
write_compile_test(
|
|
|
|
ctx, lib, test, data, cm_fh, manual_library_list=[lib], is_library_test=True
|
|
|
|
)
|
2020-03-04 12:44:24 +00:00
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
def lineify(label, value, quote=True):
|
|
|
|
if value:
|
|
|
|
if quote:
|
2019-09-20 09:34:16 +00:00
|
|
|
escaped_value = value.replace('"', '\\"')
|
|
|
|
return f' {label} "{escaped_value}"\n'
|
|
|
|
return f" {label} {value}\n"
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
return ""
|
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
def map_condition(condition):
|
|
|
|
# Handle NOT:
|
|
|
|
if isinstance(condition, list):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
condition = "(" + ") AND (".join(condition) + ")"
|
2018-10-24 13:20:27 +00:00
|
|
|
if isinstance(condition, bool):
|
|
|
|
if condition:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
return "ON"
|
2018-10-24 13:20:27 +00:00
|
|
|
else:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
return "OFF"
|
2018-10-24 13:20:27 +00:00
|
|
|
assert isinstance(condition, str)
|
|
|
|
|
CMake: Allow building bundled 3rd party libraries in qtbase
A few things are needed to accomplish that:
- the python scripts do not ignore certain system_foo features anymore
(it is a hardcoded list for now just to be safe)
- configurejson2cmake now outputs
qt_find_package(WrapSystemFoo) calls for bundled libraries
(see below)
- the harfbuzz .pro file is modified to accommodate pro2cmake
not being able to correctly parse some conditional scopes
- the freetype .pro file is modified to make sure linking of the
library succeeds without duplicate symbol errors, which qmake
doesn't encounter due to magical exclusion of cpp files that are
included in other cpp files (presumably for include moc_foo.cpp
support)
- feature evaluation for Core, Gui, Network now happens in the
qtbase/src directory, so that bundled libraries can be conditionally
built
- for each bundled library there are now two FindWrap scripts:
- FindWrapSystemFoo which finds an installed library in the system
- FindWrapFoo which either uses the system installed library or
the built bundled one depending on a condition
- projects that intend to use bundled libraries need to link against
WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets
(this is handled by pro2cmake).
Unfortunately manually added qt_find_package(WrapFoo) calls might
still be needed as is the case for WrapFreetype and others.
- a new cmake/QtFindWrapHelper.cmake file is added that provides
a macro to simplify creation of WrapFoo targets that link against
a bundled or system library. The implementation is fairly ugly
due to CMake macro constraints, but it was deemed better than
copy-pasting a bunch of almost identical code across all
FindWrapFoo.cmake files.
- a qtzlib header-only module is now created when using bundled
zlib, to provide public syncqt created headers for consumers
that need them. These are projects that have
'QT_PRIVATE += zlib-private' in their .pro files
(e.g. qtimageformats, qtlocation, qt3d, etc.)
This is unfortunately needed due to QtNetwork using zlib
types in its private C++ API.
The change includes support for building the following bundled
libraries:
- zlib
- libpng
- libjpeg
- Freetype
- Harfbuzz-ng
- PCRE2
The following 3rd party libraries are still using an old
implementation within the CMake build system, and should be migrated
to the new one in the near future:
- double-conversion
- Old harfbuzz
The are a few libraries that are not yet ported:
- system-sqlite
- systemxcb
- maybe others
Among other things, this change allows building qtbase on Windows
without requiring vcpkg.
Task-number: QTBUG-82167
Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-02-14 13:53:28 +00:00
|
|
|
mapped_features = {"gbm": "gbm_FOUND", "system-xcb": "ON"}
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
# Turn foo != "bar" into (NOT foo STREQUAL 'bar')
|
2020-03-02 17:06:46 +00:00
|
|
|
condition = re.sub(r"([^ ]+)\s*!=\s*('.*?')", "(! \\1 == \\2)", condition)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
condition = condition.replace("!", "NOT ")
|
|
|
|
condition = condition.replace("&&", " AND ")
|
|
|
|
condition = condition.replace("||", " OR ")
|
|
|
|
condition = condition.replace("==", " STREQUAL ")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
# explicitly handle input.sdk == '':
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
condition = re.sub(r"input\.sdk\s*==\s*''", "NOT INPUT_SDK", condition)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
last_pos = 0
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
mapped_condition = ""
|
2018-10-24 13:20:27 +00:00
|
|
|
has_failed = False
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
for match in re.finditer(r"([a-zA-Z0-9_]+)\.([a-zA-Z0-9_+-]+)", condition):
|
2018-10-24 13:20:27 +00:00
|
|
|
substitution = None
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
# appendFoundSuffix = True
|
|
|
|
if match.group(1) == "libs":
|
2019-05-06 10:26:31 +00:00
|
|
|
libmapping = find_3rd_party_library_mapping(match.group(2))
|
2019-05-03 13:02:32 +00:00
|
|
|
|
|
|
|
if libmapping and libmapping.packageName:
|
|
|
|
substitution = libmapping.packageName
|
|
|
|
if libmapping.resultVariable:
|
|
|
|
substitution = libmapping.resultVariable
|
|
|
|
if libmapping.appendFoundSuffix:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
substitution += "_FOUND"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
CMake: Allow building bundled 3rd party libraries in qtbase
A few things are needed to accomplish that:
- the python scripts do not ignore certain system_foo features anymore
(it is a hardcoded list for now just to be safe)
- configurejson2cmake now outputs
qt_find_package(WrapSystemFoo) calls for bundled libraries
(see below)
- the harfbuzz .pro file is modified to accommodate pro2cmake
not being able to correctly parse some conditional scopes
- the freetype .pro file is modified to make sure linking of the
library succeeds without duplicate symbol errors, which qmake
doesn't encounter due to magical exclusion of cpp files that are
included in other cpp files (presumably for include moc_foo.cpp
support)
- feature evaluation for Core, Gui, Network now happens in the
qtbase/src directory, so that bundled libraries can be conditionally
built
- for each bundled library there are now two FindWrap scripts:
- FindWrapSystemFoo which finds an installed library in the system
- FindWrapFoo which either uses the system installed library or
the built bundled one depending on a condition
- projects that intend to use bundled libraries need to link against
WrapFoo::WrapFoo instead of WrapSystemFoo::WrapSystemFoo targets
(this is handled by pro2cmake).
Unfortunately manually added qt_find_package(WrapFoo) calls might
still be needed as is the case for WrapFreetype and others.
- a new cmake/QtFindWrapHelper.cmake file is added that provides
a macro to simplify creation of WrapFoo targets that link against
a bundled or system library. The implementation is fairly ugly
due to CMake macro constraints, but it was deemed better than
copy-pasting a bunch of almost identical code across all
FindWrapFoo.cmake files.
- a qtzlib header-only module is now created when using bundled
zlib, to provide public syncqt created headers for consumers
that need them. These are projects that have
'QT_PRIVATE += zlib-private' in their .pro files
(e.g. qtimageformats, qtlocation, qt3d, etc.)
This is unfortunately needed due to QtNetwork using zlib
types in its private C++ API.
The change includes support for building the following bundled
libraries:
- zlib
- libpng
- libjpeg
- Freetype
- Harfbuzz-ng
- PCRE2
The following 3rd party libraries are still using an old
implementation within the CMake build system, and should be migrated
to the new one in the near future:
- double-conversion
- Old harfbuzz
The are a few libraries that are not yet ported:
- system-sqlite
- systemxcb
- maybe others
Among other things, this change allows building qtbase on Windows
without requiring vcpkg.
Task-number: QTBUG-82167
Change-Id: I35ecea0d832f66c1943c82e618de4a51440971a5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-02-14 13:53:28 +00:00
|
|
|
# Assume that feature conditions are interested whether
|
|
|
|
# a system library is found, rather than the bundled one
|
|
|
|
# which we always know we can build.
|
|
|
|
if libmapping.is_bundled_with_qt:
|
|
|
|
substitution = substitution.replace("Wrap", "WrapSystem")
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "features":
|
2018-10-24 13:20:27 +00:00
|
|
|
feature = match.group(2)
|
|
|
|
if feature in mapped_features:
|
|
|
|
substitution = mapped_features.get(feature)
|
|
|
|
else:
|
2019-09-20 09:34:16 +00:00
|
|
|
substitution = f"QT_FEATURE_{featureName(match.group(2))}"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "subarch":
|
2019-09-20 09:34:16 +00:00
|
|
|
substitution = f"TEST_arch_{'${TEST_architecture_arch}'}_subarch_{match.group(2)}"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "call":
|
|
|
|
if match.group(2) == "crossCompile":
|
|
|
|
substitution = "CMAKE_CROSSCOMPILING"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "tests":
|
2018-10-24 13:20:27 +00:00
|
|
|
substitution = map_tests(match.group(2))
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "input":
|
2019-09-20 09:34:16 +00:00
|
|
|
substitution = f"INPUT_{featureName(match.group(2))}"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "config":
|
2019-05-06 10:26:31 +00:00
|
|
|
substitution = map_platform(match.group(2))
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "module":
|
2019-09-20 09:34:16 +00:00
|
|
|
substitution = f"TARGET {map_qt_library(match.group(2))}"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif match.group(1) == "arch":
|
|
|
|
if match.group(2) == "i386":
|
2018-10-24 13:20:27 +00:00
|
|
|
# FIXME: Does this make sense?
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
substitution = "(TEST_architecture_arch STREQUAL i386)"
|
|
|
|
elif match.group(2) == "x86_64":
|
|
|
|
substitution = "(TEST_architecture_arch STREQUAL x86_64)"
|
|
|
|
elif match.group(2) == "arm":
|
2018-10-24 13:20:27 +00:00
|
|
|
# FIXME: Does this make sense?
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
substitution = "(TEST_architecture_arch STREQUAL arm)"
|
|
|
|
elif match.group(2) == "arm64":
|
2018-10-24 13:20:27 +00:00
|
|
|
# FIXME: Does this make sense?
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
substitution = "(TEST_architecture_arch STREQUAL arm64)"
|
|
|
|
elif match.group(2) == "mips":
|
2018-10-24 13:20:27 +00:00
|
|
|
# FIXME: Does this make sense?
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
substitution = "(TEST_architecture_arch STREQUAL mips)"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
if substitution is None:
|
2019-09-20 09:34:16 +00:00
|
|
|
print(f' XXXX Unknown condition "{match.group(0)}"')
|
2018-10-24 13:20:27 +00:00
|
|
|
has_failed = True
|
|
|
|
else:
|
2019-10-10 14:32:19 +00:00
|
|
|
mapped_condition += condition[last_pos : match.start(1)] + substitution
|
2018-10-24 13:20:27 +00:00
|
|
|
last_pos = match.end(2)
|
|
|
|
|
|
|
|
mapped_condition += condition[last_pos:]
|
|
|
|
|
|
|
|
# Space out '(' and ')':
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
mapped_condition = mapped_condition.replace("(", " ( ")
|
|
|
|
mapped_condition = mapped_condition.replace(")", " ) ")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
# Prettify:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
condition = re.sub("\\s+", " ", mapped_condition)
|
2018-10-24 13:20:27 +00:00
|
|
|
condition = condition.strip()
|
|
|
|
|
2019-12-10 12:16:02 +00:00
|
|
|
# Special case for WrapLibClang in qttools
|
|
|
|
condition = condition.replace("TEST_libclang.has_clangcpp", "TEST_libclang")
|
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
if has_failed:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
condition += " OR FIXME"
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
return condition
|
|
|
|
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
def parseInput(ctx, sinput, data, cm_fh):
|
2018-10-24 13:20:27 +00:00
|
|
|
skip_inputs = {
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"prefix",
|
|
|
|
"hostprefix",
|
|
|
|
"extprefix",
|
|
|
|
"archdatadir",
|
|
|
|
"bindir",
|
|
|
|
"datadir",
|
|
|
|
"docdir",
|
|
|
|
"examplesdir",
|
|
|
|
"external-hostbindir",
|
|
|
|
"headerdir",
|
|
|
|
"hostbindir",
|
|
|
|
"hostdatadir",
|
|
|
|
"hostlibdir",
|
|
|
|
"importdir",
|
|
|
|
"libdir",
|
|
|
|
"libexecdir",
|
|
|
|
"plugindir",
|
|
|
|
"qmldir",
|
|
|
|
"settingsdir",
|
|
|
|
"sysconfdir",
|
|
|
|
"testsdir",
|
|
|
|
"translationdir",
|
|
|
|
"android-arch",
|
|
|
|
"android-ndk",
|
|
|
|
"android-ndk-host",
|
|
|
|
"android-ndk-platform",
|
|
|
|
"android-sdk",
|
|
|
|
"android-toolchain-version",
|
|
|
|
"android-style-assets",
|
2018-10-24 13:20:27 +00:00
|
|
|
"appstore-compliant",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"avx",
|
|
|
|
"avx2",
|
|
|
|
"avx512",
|
|
|
|
"c++std",
|
|
|
|
"ccache",
|
|
|
|
"commercial",
|
|
|
|
"compile-examples",
|
|
|
|
"confirm-license",
|
2018-10-24 13:20:27 +00:00
|
|
|
"dbus",
|
|
|
|
"dbus-runtime",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"debug",
|
|
|
|
"debug-and-release",
|
2018-10-24 13:20:27 +00:00
|
|
|
"developer-build",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"device",
|
|
|
|
"device-option",
|
2018-10-24 13:20:27 +00:00
|
|
|
"f16c",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"force-asserts",
|
|
|
|
"force-debug-info",
|
|
|
|
"force-pkg-config",
|
2018-10-24 13:20:27 +00:00
|
|
|
"framework",
|
|
|
|
"gc-binaries",
|
|
|
|
"gdb-index",
|
|
|
|
"gcc-sysroot",
|
|
|
|
"gcov",
|
|
|
|
"gnumake",
|
|
|
|
"gui",
|
|
|
|
"headersclean",
|
|
|
|
"incredibuild-xge",
|
|
|
|
"libudev",
|
|
|
|
"ltcg",
|
|
|
|
"make",
|
|
|
|
"make-tool",
|
|
|
|
"mips_dsp",
|
|
|
|
"mips_dspr2",
|
|
|
|
"mp",
|
|
|
|
"nomake",
|
|
|
|
"opensource",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"optimize-debug",
|
|
|
|
"optimize-size",
|
|
|
|
"optimized-qmake",
|
|
|
|
"optimized-tools",
|
2018-10-24 13:20:27 +00:00
|
|
|
"pch",
|
|
|
|
"pkg-config",
|
|
|
|
"platform",
|
|
|
|
"plugin-manifests",
|
|
|
|
"profile",
|
|
|
|
"qreal",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"reduce-exports",
|
|
|
|
"reduce-relocations",
|
2018-10-24 13:20:27 +00:00
|
|
|
"release",
|
|
|
|
"rpath",
|
|
|
|
"sanitize",
|
|
|
|
"sdk",
|
|
|
|
"separate-debug-info",
|
|
|
|
"shared",
|
|
|
|
"silent",
|
|
|
|
"qdbus",
|
|
|
|
"sse2",
|
|
|
|
"sse3",
|
|
|
|
"sse4.1",
|
|
|
|
"sse4.2",
|
|
|
|
"ssse3",
|
|
|
|
"static",
|
|
|
|
"static-runtime",
|
|
|
|
"strip",
|
|
|
|
"syncqt",
|
|
|
|
"sysroot",
|
|
|
|
"testcocoon",
|
|
|
|
"use-gold-linker",
|
|
|
|
"warnings-are-errors",
|
|
|
|
"Werror",
|
|
|
|
"widgets",
|
|
|
|
"xplatform",
|
|
|
|
"zlib",
|
|
|
|
"eventfd",
|
|
|
|
"glib",
|
|
|
|
"icu",
|
|
|
|
"inotify",
|
|
|
|
"journald",
|
|
|
|
"pcre",
|
|
|
|
"posix-ipc",
|
|
|
|
"pps",
|
|
|
|
"slog2",
|
|
|
|
"syslog",
|
|
|
|
"sqlite",
|
|
|
|
}
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if sinput in skip_inputs:
|
|
|
|
print(f" **** Skipping input {sinput}: masked.")
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
dtype = data
|
2018-10-24 13:20:27 +00:00
|
|
|
if isinstance(data, dict):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
dtype = data["type"]
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if dtype == "boolean":
|
|
|
|
print(f" **** Skipping boolean input {sinput}: masked.")
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if dtype == "enum":
|
|
|
|
values_line = " ".join(data["values"])
|
|
|
|
cm_fh.write(f"# input {sinput}\n")
|
|
|
|
cm_fh.write(f'set(INPUT_{featureName(sinput)} "undefined" CACHE STRING "")\n')
|
|
|
|
cm_fh.write(
|
|
|
|
f"set_property(CACHE INPUT_{featureName(sinput)} PROPERTY STRINGS undefined {values_line})\n\n"
|
|
|
|
)
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(f" XXXX UNHANDLED INPUT TYPE {dtype} in input description")
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
|
2020-03-11 18:14:35 +00:00
|
|
|
def write_compile_test(
|
|
|
|
ctx, name, details, data, cm_fh, manual_library_list=None, is_library_test=False
|
|
|
|
):
|
2020-03-04 12:44:24 +00:00
|
|
|
|
2020-03-11 18:14:35 +00:00
|
|
|
if manual_library_list is None:
|
2020-03-04 12:44:24 +00:00
|
|
|
manual_library_list = []
|
|
|
|
|
|
|
|
inherited_test_name = details["inherit"] if "inherit" in details else None
|
|
|
|
inherit_details = None
|
|
|
|
if inherited_test_name and is_library_test:
|
|
|
|
inherit_details = data["libraries"][inherited_test_name]["test"]
|
|
|
|
if not inherit_details:
|
2020-03-11 18:14:35 +00:00
|
|
|
print(f" XXXX Failed to locate inherited library test {inherited_test_name}")
|
2020-03-04 12:44:24 +00:00
|
|
|
|
|
|
|
if isinstance(details, str):
|
|
|
|
rel_test_project_path = f"{ctx['test_dir']}/{details}"
|
|
|
|
if posixpath.exists(f"{ctx['project_dir']}/{rel_test_project_path}/CMakeLists.txt"):
|
|
|
|
cm_fh.write(
|
|
|
|
f"""
|
|
|
|
qt_config_compile_test("{details}"
|
|
|
|
LABEL "{data['label']}"
|
|
|
|
PROJECT_PATH "${{CMAKE_CURRENT_SOURCE_DIR}}/{rel_test_project_path}")
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
return
|
|
|
|
|
|
|
|
def resolve_head(detail):
|
|
|
|
head = detail.get("head", "")
|
|
|
|
if isinstance(head, list):
|
|
|
|
head = "\n".join(head)
|
|
|
|
return head
|
|
|
|
|
|
|
|
head = ""
|
|
|
|
if inherit_details:
|
|
|
|
head += resolve_head(inherit_details)
|
|
|
|
head += resolve_head(details)
|
|
|
|
|
|
|
|
sourceCode = head + "\n"
|
|
|
|
|
|
|
|
def resolve_include(detail, keyword):
|
|
|
|
include = detail.get(keyword, "")
|
|
|
|
if isinstance(include, list):
|
|
|
|
include = "#include <" + ">\n#include <".join(include) + ">"
|
|
|
|
elif include:
|
|
|
|
include = f"#include <{include}>"
|
|
|
|
return include
|
|
|
|
|
2020-03-11 18:14:35 +00:00
|
|
|
include = ""
|
2020-03-04 12:44:24 +00:00
|
|
|
if is_library_test:
|
|
|
|
if inherit_details:
|
|
|
|
inherited_lib_data = data["libraries"][inherited_test_name]
|
|
|
|
include += resolve_include(inherited_lib_data, "headers")
|
|
|
|
this_lib_data = data["libraries"][name]
|
|
|
|
include += resolve_include(this_lib_data, "headers")
|
|
|
|
else:
|
|
|
|
if inherit_details:
|
|
|
|
include += resolve_include(inherit_details, "include")
|
|
|
|
include += resolve_include(details, "include")
|
|
|
|
|
|
|
|
sourceCode += include + "\n"
|
|
|
|
|
|
|
|
def resolve_tail(detail):
|
|
|
|
tail = detail.get("tail", "")
|
|
|
|
if isinstance(tail, list):
|
|
|
|
tail = "\n".join(tail)
|
|
|
|
return tail
|
|
|
|
|
2020-03-11 18:14:35 +00:00
|
|
|
tail = ""
|
2020-03-04 12:44:24 +00:00
|
|
|
if inherit_details:
|
|
|
|
tail += resolve_tail(inherit_details)
|
|
|
|
tail += resolve_tail(details)
|
|
|
|
|
|
|
|
sourceCode += tail + "\n"
|
|
|
|
|
|
|
|
sourceCode += "int main(int argc, char **argv)\n"
|
|
|
|
sourceCode += "{\n"
|
|
|
|
sourceCode += " (void)argc; (void)argv;\n"
|
|
|
|
sourceCode += " /* BEGIN TEST: */\n"
|
|
|
|
|
|
|
|
def resolve_main(detail):
|
|
|
|
main = detail.get("main", "")
|
|
|
|
if isinstance(main, list):
|
|
|
|
main = "\n".join(main)
|
|
|
|
return main
|
|
|
|
|
|
|
|
main = ""
|
|
|
|
if inherit_details:
|
|
|
|
main += resolve_main(inherit_details)
|
|
|
|
main += resolve_main(details)
|
|
|
|
|
|
|
|
sourceCode += main + "\n"
|
|
|
|
|
|
|
|
sourceCode += " /* END TEST: */\n"
|
|
|
|
sourceCode += " return 0;\n"
|
|
|
|
sourceCode += "}\n"
|
|
|
|
|
|
|
|
sourceCode = sourceCode.replace('"', '\\"')
|
|
|
|
|
|
|
|
librariesCmakeName = ""
|
|
|
|
languageStandard = ""
|
|
|
|
compileOptions = ""
|
|
|
|
qmakeFixme = ""
|
|
|
|
|
|
|
|
cm_fh.write(f"# {name}\n")
|
|
|
|
|
|
|
|
if "qmake" in details: # We don't really have many so we can just enumerate them all
|
|
|
|
if details["qmake"] == "unix:LIBS += -lpthread":
|
|
|
|
librariesCmakeName = format(featureName(name)) + "_TEST_LIBRARIES"
|
|
|
|
cm_fh.write("if (UNIX)\n")
|
|
|
|
cm_fh.write(" set(" + librariesCmakeName + " pthread)\n")
|
|
|
|
cm_fh.write("endif()\n")
|
|
|
|
elif details["qmake"] == "linux: LIBS += -lpthread -lrt":
|
|
|
|
librariesCmakeName = format(featureName(name)) + "_TEST_LIBRARIES"
|
|
|
|
cm_fh.write("if (LINUX)\n")
|
|
|
|
cm_fh.write(" set(" + librariesCmakeName + " pthread rt)\n")
|
|
|
|
cm_fh.write("endif()\n")
|
|
|
|
elif details["qmake"] == "!winrt: LIBS += runtimeobject.lib":
|
|
|
|
librariesCmakeName = format(featureName(name)) + "_TEST_LIBRARIES"
|
|
|
|
cm_fh.write("if (NOT WINRT)\n")
|
|
|
|
cm_fh.write(" set(" + librariesCmakeName + " runtimeobject)\n")
|
|
|
|
cm_fh.write("endif()\n")
|
|
|
|
elif details["qmake"] == "CONFIG += c++11":
|
|
|
|
# do nothing we're always in c++11 mode
|
|
|
|
pass
|
|
|
|
elif details["qmake"] == "CONFIG += c++11 c++14":
|
|
|
|
languageStandard = "CXX_STANDARD 14"
|
|
|
|
elif details["qmake"] == "CONFIG += c++11 c++14 c++17":
|
|
|
|
languageStandard = "CXX_STANDARD 17"
|
|
|
|
elif details["qmake"] == "CONFIG += c++11 c++14 c++17 c++2a":
|
|
|
|
languageStandard = "CXX_STANDARD 20"
|
|
|
|
elif details["qmake"] == "QMAKE_CXXFLAGS += -fstack-protector-strong":
|
|
|
|
compileOptions = details["qmake"][18:]
|
|
|
|
else:
|
|
|
|
qmakeFixme = f"# FIXME: qmake: {details['qmake']}\n"
|
|
|
|
|
|
|
|
library_list = []
|
|
|
|
test_libraries = manual_library_list
|
|
|
|
|
|
|
|
if "use" in data:
|
|
|
|
test_libraries += data["use"].split(" ")
|
|
|
|
|
|
|
|
for library in test_libraries:
|
|
|
|
if len(library) == 0:
|
|
|
|
continue
|
|
|
|
|
|
|
|
mapped_library = find_3rd_party_library_mapping(library)
|
|
|
|
if not mapped_library:
|
|
|
|
qmakeFixme += f"# FIXME: use: unmapped library: {library}\n"
|
|
|
|
continue
|
|
|
|
if mapped_library.test_library_overwrite:
|
|
|
|
library_list.append(mapped_library.test_library_overwrite)
|
|
|
|
else:
|
|
|
|
library_list.append(mapped_library.targetName)
|
|
|
|
|
|
|
|
cm_fh.write(f"qt_config_compile_test({featureName(name)}\n")
|
|
|
|
cm_fh.write(lineify("LABEL", data.get("label", "")))
|
|
|
|
if librariesCmakeName != "" or len(library_list) != 0:
|
|
|
|
cm_fh.write(" LIBRARIES\n")
|
|
|
|
if librariesCmakeName != "":
|
|
|
|
cm_fh.write(lineify("", "${" + librariesCmakeName + "}"))
|
|
|
|
if len(library_list) != 0:
|
|
|
|
cm_fh.write(" ")
|
|
|
|
cm_fh.write("\n ".join(library_list))
|
|
|
|
cm_fh.write("\n")
|
|
|
|
if compileOptions != "":
|
|
|
|
cm_fh.write(f" COMPILE_OPTIONS {compileOptions}\n")
|
|
|
|
cm_fh.write(" CODE\n")
|
|
|
|
cm_fh.write('"' + sourceCode + '"')
|
|
|
|
if qmakeFixme != "":
|
|
|
|
cm_fh.write(qmakeFixme)
|
|
|
|
if languageStandard != "":
|
|
|
|
cm_fh.write(f"\n {languageStandard}\n")
|
|
|
|
cm_fh.write(")\n\n")
|
|
|
|
|
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
# "tests": {
|
|
|
|
# "cxx11_future": {
|
|
|
|
# "label": "C++11 <future>",
|
|
|
|
# "type": "compile",
|
|
|
|
# "test": {
|
|
|
|
# "include": "future",
|
|
|
|
# "main": [
|
|
|
|
# "std::future<int> f = std::async([]() { return 42; });",
|
|
|
|
# "(void)f.get();"
|
|
|
|
# ],
|
|
|
|
# "qmake": "unix:LIBS += -lpthread"
|
|
|
|
# }
|
|
|
|
# },
|
|
|
|
def parseTest(ctx, test, data, cm_fh):
|
|
|
|
skip_tests = {
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"c11",
|
|
|
|
"c99",
|
|
|
|
"gc_binaries",
|
|
|
|
"posix-iconv",
|
|
|
|
"sun-iconv",
|
|
|
|
"precomile_header",
|
|
|
|
"reduce_exports",
|
|
|
|
"gc_binaries",
|
|
|
|
"libinput_axis_api",
|
|
|
|
"wayland-scanner",
|
|
|
|
"xlib",
|
2018-10-24 13:20:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if test in skip_tests:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(f" **** Skipping features {test}: masked.")
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
if data["type"] == "compile":
|
|
|
|
knownTests.add(test)
|
|
|
|
|
2020-03-02 09:55:51 +00:00
|
|
|
if "test" in data:
|
|
|
|
details = data["test"]
|
|
|
|
else:
|
|
|
|
details = test
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2020-03-04 12:44:24 +00:00
|
|
|
write_compile_test(ctx, test, details, data, cm_fh)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2019-08-26 14:15:56 +00:00
|
|
|
elif data["type"] == "libclang":
|
|
|
|
knownTests.add(test)
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(f"# {test}\n")
|
2019-08-26 14:15:56 +00:00
|
|
|
lib_clang_lib = find_3rd_party_library_mapping("libclang")
|
|
|
|
cm_fh.write(generate_find_package_info(lib_clang_lib))
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(
|
|
|
|
dedent(
|
|
|
|
"""
|
2019-08-26 14:15:56 +00:00
|
|
|
if(TARGET WrapLibClang::WrapLibClang)
|
|
|
|
set(TEST_libclang "ON" CACHE BOOL "Required libclang version found." FORCE)
|
|
|
|
endif()
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
)
|
2019-08-26 14:15:56 +00:00
|
|
|
cm_fh.write("\n")
|
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
elif data["type"] == "x86Simd":
|
|
|
|
knownTests.add(test)
|
|
|
|
|
|
|
|
label = data["label"]
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(f"# {test}\n")
|
|
|
|
cm_fh.write(f'qt_config_compile_test_x86simd({test} "{label}")\n')
|
2018-10-24 13:20:27 +00:00
|
|
|
cm_fh.write("\n")
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
# "features": {
|
|
|
|
# "android-style-assets": {
|
|
|
|
# "label": "Android Style Assets",
|
|
|
|
# "condition": "config.android",
|
|
|
|
# "output": [ "privateFeature" ],
|
|
|
|
# "comment": "This belongs into gui, but the license check needs it here already."
|
|
|
|
# },
|
2018-10-24 13:20:27 +00:00
|
|
|
else:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(f" XXXX UNHANDLED TEST TYPE {data['type']} in test description")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
2020-03-02 17:06:46 +00:00
|
|
|
def get_feature_mapping():
|
2018-11-06 10:18:25 +00:00
|
|
|
# This is *before* the feature name gets normalized! So keep - and + chars, etc.
|
|
|
|
feature_mapping = {
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"alloc_h": None, # handled by alloc target
|
|
|
|
"alloc_malloc_h": None,
|
|
|
|
"alloc_stdlib_h": None,
|
|
|
|
"build_all": None,
|
|
|
|
"c11": None,
|
|
|
|
"c89": None,
|
|
|
|
"c99": None,
|
|
|
|
"ccache": None,
|
|
|
|
"compiler-flags": None,
|
|
|
|
"cross_compile": None,
|
2020-02-26 12:23:05 +00:00
|
|
|
"debug_and_release": {
|
2020-03-11 18:14:35 +00:00
|
|
|
"autoDetect": "1", # Setting this to None has weird effects...
|
|
|
|
"condition": "QT_GENERATOR_IS_MULTI_CONFIG",
|
|
|
|
},
|
|
|
|
"debug": {
|
|
|
|
"condition": "CMAKE_BUILD_TYPE STREQUAL Debug OR Debug IN_LIST CMAKE_CONFIGURATION_TYPES"
|
2020-02-26 12:23:05 +00:00
|
|
|
},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"dlopen": {"condition": "UNIX"},
|
|
|
|
"enable_gdb_index": None,
|
|
|
|
"enable_new_dtags": None,
|
2020-02-26 12:38:23 +00:00
|
|
|
"force_debug_info": {
|
|
|
|
"autoDetect": "CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo OR RelWithDebInfo IN_LIST CMAKE_CONFIGURATION_TYPES"
|
|
|
|
},
|
2020-03-11 18:14:35 +00:00
|
|
|
"framework": {
|
|
|
|
"condition": "APPLE AND BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE STREQUAL Debug"
|
|
|
|
},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"gc_binaries": None,
|
|
|
|
"gcc-sysroot": None,
|
|
|
|
"gcov": None,
|
|
|
|
"gnu-libiconv": {
|
|
|
|
"condition": "NOT WIN32 AND NOT QNX AND NOT ANDROID AND NOT APPLE AND TEST_posix_iconv AND NOT TEST_iconv_needlib",
|
|
|
|
"enable": "TEST_posix_iconv AND NOT TEST_iconv_needlib",
|
|
|
|
"disable": "NOT TEST_posix_iconv OR TEST_iconv_needlib",
|
2018-11-06 13:20:19 +00:00
|
|
|
},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"GNUmake": None,
|
|
|
|
"host-dbus": None,
|
|
|
|
"iconv": {
|
|
|
|
"condition": "NOT QT_FEATURE_icu AND QT_FEATURE_textcodec AND ( TEST_posix_iconv OR TEST_sun_iconv )"
|
2019-02-11 12:27:00 +00:00
|
|
|
},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"incredibuild_xge": None,
|
|
|
|
"jpeg": {"condition": "QT_FEATURE_imageformatplugin AND JPEG_FOUND"},
|
|
|
|
"ltcg": None,
|
|
|
|
"msvc_mp": None,
|
|
|
|
"optimize_debug": None,
|
|
|
|
"optimize_size": None,
|
2019-04-16 14:32:08 +00:00
|
|
|
# special case to enable implicit feature on WIN32, until ANGLE is ported
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"opengl-desktop": {"autoDetect": ""},
|
2019-04-16 14:32:08 +00:00
|
|
|
# special case to disable implicit feature on WIN32, until ANGLE is ported
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"opengl-dynamic": {"autoDetect": "OFF"},
|
|
|
|
"opengles2": { # special case to disable implicit feature on WIN32, until ANGLE is ported
|
|
|
|
"condition": "NOT WIN32 AND ( NOT APPLE_WATCHOS AND NOT QT_FEATURE_opengl_desktop AND GLESv2_FOUND )"
|
2019-04-16 14:32:08 +00:00
|
|
|
},
|
2019-04-08 15:23:57 +00:00
|
|
|
"simulator_and_device": {"condition": "APPLE_UIKIT AND NOT QT_UIKIT_SDK"},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"pkg-config": None,
|
|
|
|
"posix_fallocate": None, # Only needed for sqlite, which we do not want to build
|
|
|
|
"posix-libiconv": {
|
|
|
|
"condition": "NOT WIN32 AND NOT QNX AND NOT ANDROID AND NOT APPLE AND TEST_posix_iconv AND TEST_iconv_needlib",
|
|
|
|
"enable": "TEST_posix_iconv AND TEST_iconv_needlib",
|
|
|
|
"disable": "NOT TEST_posix_iconv OR NOT TEST_iconv_needlib",
|
2019-03-21 18:17:41 +00:00
|
|
|
},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"precompile_header": None,
|
|
|
|
"profile": None,
|
|
|
|
"qmakeargs": None,
|
|
|
|
"qpa_default_platform": None, # Not a bool!
|
|
|
|
"release": None,
|
|
|
|
"release_tools": None,
|
|
|
|
"rpath_dir": None, # rpath related
|
|
|
|
"rpath": None,
|
|
|
|
"sanitize_address": None, # sanitizer
|
|
|
|
"sanitize_memory": None,
|
|
|
|
"sanitizer": None,
|
|
|
|
"sanitize_thread": None,
|
|
|
|
"sanitize_undefined": None,
|
2020-02-26 12:08:10 +00:00
|
|
|
"shared": {"condition": "BUILD_SHARED_LIBS"},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"silent": None,
|
|
|
|
"sql-sqlite": {"condition": "QT_FEATURE_datestring AND SQLite3_FOUND"},
|
|
|
|
"static": None,
|
|
|
|
"static_runtime": None,
|
|
|
|
"stl": None, # Do we really need to test for this in 2018?!
|
|
|
|
"strip": None,
|
|
|
|
"sun-libiconv": {
|
|
|
|
"condition": "NOT WIN32 AND NOT QNX AND NOT ANDROID AND NOT APPLE AND TEST_sun_iconv",
|
|
|
|
"enable": "TEST_sun_iconv",
|
|
|
|
"disable": "NOT TEST_sun_iconv",
|
2018-11-06 13:20:19 +00:00
|
|
|
},
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"system-sqlite": None,
|
|
|
|
"system-xcb": None,
|
|
|
|
"tiff": {"condition": "QT_FEATURE_imageformatplugin AND TIFF_FOUND"},
|
|
|
|
"use_gold_linker": None,
|
|
|
|
"verifyspec": None, # qmake specific...
|
|
|
|
"warnings_are_errors": None, # FIXME: Do we need these?
|
|
|
|
"webp": {"condition": "QT_FEATURE_imageformatplugin AND WrapWebP_FOUND"},
|
|
|
|
"xkbcommon-system": None, # another system library, just named a bit different from the rest
|
2018-10-24 13:20:27 +00:00
|
|
|
}
|
2020-03-02 17:06:46 +00:00
|
|
|
return feature_mapping
|
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2020-03-02 17:06:46 +00:00
|
|
|
def parseFeature(ctx, feature, data, cm_fh):
|
|
|
|
feature_mapping = get_feature_mapping()
|
2018-11-06 10:18:25 +00:00
|
|
|
mapping = feature_mapping.get(feature, {})
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2018-11-06 10:18:25 +00:00
|
|
|
if mapping is None:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(f" **** Skipping features {feature}: masked.")
|
2018-11-06 10:18:25 +00:00
|
|
|
return
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
handled = {
|
|
|
|
"autoDetect",
|
|
|
|
"comment",
|
|
|
|
"condition",
|
|
|
|
"description",
|
|
|
|
"disable",
|
|
|
|
"emitIf",
|
|
|
|
"enable",
|
|
|
|
"label",
|
|
|
|
"output",
|
|
|
|
"purpose",
|
|
|
|
"section",
|
|
|
|
}
|
|
|
|
label = mapping.get("label", data.get("label", ""))
|
|
|
|
purpose = mapping.get("purpose", data.get("purpose", data.get("description", label)))
|
|
|
|
autoDetect = map_condition(mapping.get("autoDetect", data.get("autoDetect", "")))
|
|
|
|
condition = map_condition(mapping.get("condition", data.get("condition", "")))
|
|
|
|
output = mapping.get("output", data.get("output", []))
|
|
|
|
comment = mapping.get("comment", data.get("comment", ""))
|
|
|
|
section = mapping.get("section", data.get("section", ""))
|
|
|
|
enable = map_condition(mapping.get("enable", data.get("enable", "")))
|
|
|
|
disable = map_condition(mapping.get("disable", data.get("disable", "")))
|
|
|
|
emitIf = map_condition(mapping.get("emitIf", data.get("emitIf", "")))
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
for k in [k for k in data.keys() if k not in handled]:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(f" XXXX UNHANDLED KEY {k} in feature description")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
if not output:
|
|
|
|
# feature that is only used in the conditions of other features
|
|
|
|
output = ["internalFeature"]
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
publicFeature = False # #define QT_FEATURE_featurename in public header
|
|
|
|
privateFeature = False # #define QT_FEATURE_featurename in private header
|
|
|
|
negativeFeature = False # #define QT_NO_featurename in public header
|
|
|
|
internalFeature = False # No custom or QT_FEATURE_ defines
|
|
|
|
publicDefine = False # #define MY_CUSTOM_DEFINE in public header
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
publicConfig = False # add to CONFIG in public pri file
|
|
|
|
privateConfig = False # add to CONFIG in private pri file
|
|
|
|
publicQtConfig = False # add to QT_CONFIG in public pri file
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
for o in output:
|
|
|
|
outputType = o
|
|
|
|
if isinstance(o, dict):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
outputType = o["type"]
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
if outputType in ["varAssign", "varAppend", "varRemove"]:
|
2018-10-24 13:20:27 +00:00
|
|
|
continue
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif outputType == "define":
|
2019-03-14 12:16:13 +00:00
|
|
|
publicDefine = True
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif outputType == "feature":
|
2019-03-14 12:16:13 +00:00
|
|
|
negativeFeature = True
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif outputType == "publicFeature":
|
2019-03-14 12:16:13 +00:00
|
|
|
publicFeature = True
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif outputType == "privateFeature":
|
2019-03-14 12:16:13 +00:00
|
|
|
privateFeature = True
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
elif outputType == "internalFeature":
|
2018-10-24 13:20:27 +00:00
|
|
|
internalFeature = True
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
elif outputType == "publicConfig":
|
|
|
|
publicConfig = True
|
|
|
|
elif outputType == "privateConfig":
|
|
|
|
privateConfig = True
|
|
|
|
elif outputType == "publicQtConfig":
|
|
|
|
publicQtConfig = True
|
2018-10-24 13:20:27 +00:00
|
|
|
else:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(f" XXXX UNHANDLED OUTPUT TYPE {outputType} in feature {feature}.")
|
2018-10-24 13:20:27 +00:00
|
|
|
continue
|
|
|
|
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
if not any(
|
|
|
|
[
|
|
|
|
publicFeature,
|
|
|
|
privateFeature,
|
|
|
|
internalFeature,
|
|
|
|
publicDefine,
|
|
|
|
negativeFeature,
|
|
|
|
publicConfig,
|
|
|
|
privateConfig,
|
|
|
|
publicQtConfig,
|
|
|
|
]
|
|
|
|
):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(f" **** Skipping feature {feature}: Not relevant for C++.")
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
normalized_feature_name = featureName(feature)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
def writeFeature(
|
|
|
|
name,
|
|
|
|
publicFeature=False,
|
|
|
|
privateFeature=False,
|
|
|
|
labelAppend="",
|
|
|
|
superFeature=None,
|
|
|
|
autoDetect="",
|
|
|
|
):
|
2019-03-14 12:16:13 +00:00
|
|
|
if comment:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(f"# {comment}\n")
|
2019-03-14 12:16:13 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(f'qt_feature("{name}"')
|
2019-03-14 12:16:13 +00:00
|
|
|
if publicFeature:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(" PUBLIC")
|
2019-03-14 12:16:13 +00:00
|
|
|
if privateFeature:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(" PRIVATE")
|
|
|
|
cm_fh.write("\n")
|
2019-03-14 12:16:13 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(lineify("SECTION", section))
|
|
|
|
cm_fh.write(lineify("LABEL", label + labelAppend))
|
2019-03-14 12:16:13 +00:00
|
|
|
if purpose != label:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(lineify("PURPOSE", purpose))
|
|
|
|
cm_fh.write(lineify("AUTODETECT", autoDetect, quote=False))
|
2019-07-17 14:10:31 +00:00
|
|
|
if superFeature:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
feature_condition = f"QT_FEATURE_{superFeature}"
|
2019-07-17 14:10:31 +00:00
|
|
|
else:
|
|
|
|
feature_condition = condition
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(lineify("CONDITION", feature_condition, quote=False))
|
|
|
|
cm_fh.write(lineify("ENABLE", enable, quote=False))
|
|
|
|
cm_fh.write(lineify("DISABLE", disable, quote=False))
|
|
|
|
cm_fh.write(lineify("EMIT_IF", emitIf, quote=False))
|
|
|
|
cm_fh.write(")\n")
|
2019-03-14 12:16:13 +00:00
|
|
|
|
|
|
|
# Write qt_feature() calls before any qt_feature_definition() calls
|
|
|
|
|
|
|
|
# Default internal feature case.
|
|
|
|
featureCalls = {}
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
featureCalls[feature] = {"name": feature, "labelAppend": "", "autoDetect": autoDetect}
|
2019-03-14 12:16:13 +00:00
|
|
|
|
|
|
|
# Go over all outputs to compute the number of features that have to be declared
|
|
|
|
for o in output:
|
|
|
|
outputType = o
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
name = feature
|
2019-03-14 12:16:13 +00:00
|
|
|
|
|
|
|
# The label append is to provide a unique label for features that have more than one output
|
|
|
|
# with different names.
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
labelAppend = ""
|
2019-03-14 12:16:13 +00:00
|
|
|
|
|
|
|
if isinstance(o, dict):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
outputType = o["type"]
|
|
|
|
if "name" in o:
|
|
|
|
name = o["name"]
|
|
|
|
labelAppend = f": {o['name']}"
|
2019-03-14 12:16:13 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if outputType not in ["feature", "publicFeature", "privateFeature"]:
|
2019-03-14 12:16:13 +00:00
|
|
|
continue
|
|
|
|
if name not in featureCalls:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
featureCalls[name] = {"name": name, "labelAppend": labelAppend}
|
2019-03-14 12:16:13 +00:00
|
|
|
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
if name != feature:
|
|
|
|
featureCalls[name]["superFeature"] = normalized_feature_name
|
2019-07-17 14:10:31 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if outputType in ["feature", "publicFeature"]:
|
|
|
|
featureCalls[name]["publicFeature"] = True
|
|
|
|
elif outputType == "privateFeature":
|
|
|
|
featureCalls[name]["privateFeature"] = True
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
elif outputType == "publicConfig":
|
|
|
|
featureCalls[name]["publicConfig"] = True
|
|
|
|
elif outputType == "privateConfig":
|
|
|
|
featureCalls[name]["privateConfig"] = True
|
|
|
|
elif outputType == "publicQtConfig":
|
|
|
|
featureCalls[name]["publicQtConfig"] = True
|
2019-03-14 12:16:13 +00:00
|
|
|
|
|
|
|
# Write the qt_feature() calls from the computed feature map
|
|
|
|
for _, args in featureCalls.items():
|
|
|
|
writeFeature(**args)
|
|
|
|
|
|
|
|
# Write qt_feature_definition() calls
|
2018-10-24 13:20:27 +00:00
|
|
|
for o in output:
|
|
|
|
outputType = o
|
|
|
|
outputArgs = {}
|
|
|
|
if isinstance(o, dict):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
outputType = o["type"]
|
2018-10-24 13:20:27 +00:00
|
|
|
outputArgs = o
|
|
|
|
|
2019-03-14 12:16:13 +00:00
|
|
|
# Map negative feature to define:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if outputType == "feature":
|
|
|
|
outputType = "define"
|
|
|
|
outputArgs = {
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
"name": f"QT_NO_{normalized_feature_name.upper()}",
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
"negative": True,
|
|
|
|
"value": 1,
|
|
|
|
"type": "define",
|
|
|
|
}
|
|
|
|
|
|
|
|
if outputType != "define":
|
2018-10-24 13:20:27 +00:00
|
|
|
continue
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if outputArgs.get("name") is None:
|
|
|
|
print(f" XXXX DEFINE output without name in feature {feature}.")
|
2018-10-24 13:20:27 +00:00
|
|
|
continue
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
out_name = outputArgs.get("name")
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
cm_fh.write(f'qt_feature_definition("{feature}" "{out_name}"')
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if outputArgs.get("negative", False):
|
|
|
|
cm_fh.write(" NEGATE")
|
|
|
|
if outputArgs.get("value") is not None:
|
2019-09-20 09:34:16 +00:00
|
|
|
cm_fh.write(f' VALUE "{outputArgs.get("value")}"')
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
cm_fh.write(")\n")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Export non-private and non-public features and CONFIG values
Before we only exported features that had outputType PUBLIC or PRIVATE
on the various "QT_ENABLED_PUBLIC_FEATURES" target properties.
Now we also export features that have output type privateConfig,
publicConfig and publicQtConfig.
The new properties names are:
- QT_QMAKE_PUBLIC_CONFIG for outputType == publicConfig
- QT_QMAKE_PRIVATE_CONFIG for outputType == privateConfig
- QT_QMAKE_PUBLIC_QT_CONFIG for outputType == publicQtConfig
These need to be exported for 2 reasons:
- other modules that need to check the config values
- in preparation for generating proper qmake .prl and .pri
information for each module
Note that the config values are now considered actual features
when doing condition evaluation. So if there exists a feature "ssse3"
with outputType privateConfig, its enabled state can be checked via
QT_FEATURE_ssse3 in consuming modules (but not in the declaring
module).
These config values are also placed in the respective
QT_ENABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES properties
when exporting a target, so the properties will now contain both
features and config values.
In order to make this work, feature name normalization has to happen
at CMake time, rather than done by the python script.
This means that features like "developer-build" need to retain the
dash in the qt_feature(), qt_feature_definition() and
qt_feature_config() calls, rather than generating "developer_build"
as the script did before.
The normalization is done at CMake time. Feature conditions,
CMake code, and -DFEATURE_foo=bar options passed on the command line
should still use the underscore version, but the original name is used
for the QT_QMAKE_PUBLIC_CONFIG properties.
Note that "c++11" like features are normalized to "cxx11".
Implementation wise, the configurejson2cmake script is adjusted to
parse these new output types.
Also QtBuild and QtFeature are adjusted to save the config values
in properties, and re-export them from GlobalConfig to Core.
Task-number: QTBUG-75666
Task-number: QTBUG-78178
Change-Id: Ibd4b152e372bdf2d09ed117644f2f2ac53ec5e75
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-28 13:15:50 +00:00
|
|
|
# Write qt_feature_config() calls
|
|
|
|
for o in output:
|
|
|
|
outputType = o
|
|
|
|
name = feature
|
|
|
|
modified_name = name
|
|
|
|
|
|
|
|
outputArgs = {}
|
|
|
|
if isinstance(o, dict):
|
|
|
|
outputType = o["type"]
|
|
|
|
outputArgs = o
|
|
|
|
if "name" in o:
|
|
|
|
modified_name = o["name"]
|
|
|
|
|
|
|
|
if outputType not in ["publicConfig", "privateConfig", "publicQtConfig"]:
|
|
|
|
continue
|
|
|
|
|
|
|
|
config_type = ""
|
|
|
|
if outputType == "publicConfig":
|
|
|
|
config_type = "QMAKE_PUBLIC_CONFIG"
|
|
|
|
elif outputType == "privateConfig":
|
|
|
|
config_type = "QMAKE_PRIVATE_CONFIG"
|
|
|
|
elif outputType == "publicQtConfig":
|
|
|
|
config_type = "QMAKE_PUBLIC_QT_CONFIG"
|
|
|
|
|
|
|
|
if not config_type:
|
|
|
|
print(" XXXX config output without type in feature {}.".format(feature))
|
|
|
|
continue
|
|
|
|
|
|
|
|
cm_fh.write('qt_feature_config("{}" {}'.format(name, config_type))
|
|
|
|
if outputArgs.get("negative", False):
|
|
|
|
cm_fh.write("\n NEGATE")
|
|
|
|
if modified_name != name:
|
|
|
|
cm_fh.write("\n")
|
|
|
|
cm_fh.write(lineify("NAME", modified_name, quote=True))
|
|
|
|
|
|
|
|
cm_fh.write(")\n")
|
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2020-03-02 17:06:46 +00:00
|
|
|
def processSummaryHelper(ctx, entries, cm_fh):
|
|
|
|
for entry in entries:
|
|
|
|
if isinstance(entry, str):
|
|
|
|
name = entry
|
|
|
|
cm_fh.write(f'qt_configure_add_summary_entry(ARGS "{name}")\n')
|
2020-03-11 18:14:35 +00:00
|
|
|
elif "type" in entry and entry["type"] in [
|
|
|
|
"feature",
|
|
|
|
"firstAvailableFeature",
|
|
|
|
"featureList",
|
|
|
|
]:
|
2020-03-02 17:06:46 +00:00
|
|
|
function_args = []
|
|
|
|
entry_type = entry["type"]
|
|
|
|
|
|
|
|
if entry_type in ["firstAvailableFeature", "featureList"]:
|
|
|
|
feature_mapping = get_feature_mapping()
|
|
|
|
unhandled_feature = False
|
|
|
|
for feature_name, value in feature_mapping.items():
|
|
|
|
# Skip entries that mention a feature which is
|
|
|
|
# skipped by configurejson2cmake in the feature
|
|
|
|
# mapping. This is not ideal, but prevents errors at
|
|
|
|
# CMake configuration time.
|
|
|
|
if not value and f"{feature_name}" in entry["args"]:
|
|
|
|
unhandled_feature = True
|
|
|
|
break
|
|
|
|
|
|
|
|
if unhandled_feature:
|
|
|
|
print(f" XXXX UNHANDLED FEATURE in SUMMARY TYPE {entry}.")
|
|
|
|
continue
|
|
|
|
|
|
|
|
if entry_type != "feature":
|
|
|
|
function_args.append(lineify("TYPE", entry_type))
|
|
|
|
if "args" in entry:
|
|
|
|
args = entry["args"]
|
|
|
|
function_args.append(lineify("ARGS", args))
|
|
|
|
if "message" in entry:
|
|
|
|
message = entry["message"]
|
|
|
|
function_args.append(lineify("MESSAGE", message))
|
|
|
|
if "condition" in entry:
|
|
|
|
condition = map_condition(entry["condition"])
|
|
|
|
function_args.append(lineify("CONDITION", condition, quote=False))
|
|
|
|
entry_args_string = "".join(function_args)
|
2020-03-11 18:14:35 +00:00
|
|
|
cm_fh.write(f"qt_configure_add_summary_entry(\n{entry_args_string})\n")
|
2020-03-02 17:06:46 +00:00
|
|
|
elif "type" in entry and entry["type"] == "buildTypeAndConfig":
|
2020-03-11 18:14:35 +00:00
|
|
|
cm_fh.write(f"qt_configure_add_summary_build_type_and_config()\n")
|
2020-03-02 17:06:46 +00:00
|
|
|
elif "type" in entry and entry["type"] == "buildMode":
|
|
|
|
message = entry["message"]
|
2020-03-11 18:14:35 +00:00
|
|
|
cm_fh.write(f"qt_configure_add_summary_build_mode({message})\n")
|
2020-03-02 17:06:46 +00:00
|
|
|
elif "section" in entry:
|
|
|
|
section = entry["section"]
|
|
|
|
cm_fh.write(f'qt_configure_add_summary_section(NAME "{section}")\n')
|
|
|
|
processSummaryHelper(ctx, entry["entries"], cm_fh)
|
|
|
|
cm_fh.write(f'qt_configure_end_summary_section() # end of "{section}" section\n')
|
|
|
|
else:
|
|
|
|
print(f" XXXX UNHANDLED SUMMARY TYPE {entry}.")
|
|
|
|
|
|
|
|
|
|
|
|
def processReportHelper(ctx, entries, cm_fh):
|
|
|
|
feature_mapping = get_feature_mapping()
|
|
|
|
|
|
|
|
for entry in entries:
|
|
|
|
if isinstance(entry, dict):
|
|
|
|
entry_args = []
|
|
|
|
if "type" not in entry:
|
|
|
|
print(f" XXXX UNHANDLED REPORT TYPE missing type in {entry}.")
|
|
|
|
continue
|
|
|
|
|
|
|
|
report_type = entry["type"]
|
|
|
|
if report_type not in ["note", "warning", "error"]:
|
|
|
|
print(f" XXXX UNHANDLED REPORT TYPE unknown type in {entry}.")
|
|
|
|
continue
|
|
|
|
|
|
|
|
report_type = report_type.upper()
|
|
|
|
entry_args.append(lineify("TYPE", report_type, quote=False))
|
|
|
|
message = entry["message"]
|
|
|
|
|
|
|
|
# Replace semicolons, qt_parse_all_arguments can't handle
|
|
|
|
# them due to an escaping bug in CMake regarding escaping
|
|
|
|
# macro arguments.
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/issues/19972
|
|
|
|
message = message.replace(";", ",")
|
|
|
|
|
|
|
|
entry_args.append(lineify("MESSAGE", message))
|
|
|
|
# Need to overhaul everything to fix conditions.
|
|
|
|
if "condition" in entry:
|
|
|
|
condition = entry["condition"]
|
|
|
|
|
|
|
|
unhandled_condition = False
|
|
|
|
for feature_name, value in feature_mapping.items():
|
|
|
|
# Skip reports that mention a feature which is
|
|
|
|
# skipped by configurejson2cmake in the feature
|
|
|
|
# mapping. This is not ideal, but prevents errors at
|
|
|
|
# CMake configuration time.
|
|
|
|
if not value and f"features.{feature_name}" in condition:
|
|
|
|
unhandled_condition = True
|
|
|
|
break
|
|
|
|
|
|
|
|
if unhandled_condition:
|
|
|
|
print(f" XXXX UNHANDLED CONDITION in REPORT TYPE {entry}.")
|
|
|
|
continue
|
|
|
|
condition = map_condition(condition)
|
|
|
|
entry_args.append(lineify("CONDITION", condition, quote=False))
|
|
|
|
entry_args_string = "".join(entry_args)
|
2020-03-11 18:14:35 +00:00
|
|
|
cm_fh.write(f"qt_configure_add_report_entry(\n{entry_args_string})\n")
|
2020-03-02 17:06:46 +00:00
|
|
|
else:
|
|
|
|
print(f" XXXX UNHANDLED REPORT TYPE {entry}.")
|
|
|
|
|
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
def processInputs(ctx, data, cm_fh):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(" inputs:")
|
|
|
|
if "commandline" not in data:
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
commandLine = data["commandline"]
|
2018-10-24 13:20:27 +00:00
|
|
|
if "options" not in commandLine:
|
|
|
|
return
|
|
|
|
|
2019-10-08 13:07:41 +00:00
|
|
|
for input_option in commandLine["options"]:
|
|
|
|
parseInput(ctx, input_option, commandLine["options"][input_option], cm_fh)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
def processTests(ctx, data, cm_fh):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(" tests:")
|
|
|
|
if "tests" not in data:
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
for test in data["tests"]:
|
|
|
|
parseTest(ctx, test, data["tests"][test], cm_fh)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
def processFeatures(ctx, data, cm_fh):
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(" features:")
|
|
|
|
if "features" not in data:
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
for feature in data["features"]:
|
|
|
|
parseFeature(ctx, feature, data["features"][feature], cm_fh)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
def processLibraries(ctx, data, cm_fh):
|
|
|
|
cmake_find_packages_set = set()
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print(" libraries:")
|
|
|
|
if "libraries" not in data:
|
2018-10-24 13:20:27 +00:00
|
|
|
return
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
for lib in data["libraries"]:
|
2019-05-17 12:22:57 +00:00
|
|
|
parseLib(ctx, lib, data, cm_fh, cmake_find_packages_set)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
2020-03-02 17:06:46 +00:00
|
|
|
def processReports(ctx, data, cm_fh):
|
|
|
|
if "summary" in data:
|
|
|
|
print(" summary:")
|
|
|
|
processSummaryHelper(ctx, data["summary"], cm_fh)
|
|
|
|
if "report" in data:
|
|
|
|
print(" report:")
|
|
|
|
processReportHelper(ctx, data["report"], cm_fh)
|
|
|
|
if "earlyReport" in data:
|
|
|
|
print(" earlyReport:")
|
|
|
|
processReportHelper(ctx, data["earlyReport"], cm_fh)
|
|
|
|
|
|
|
|
|
2019-10-08 13:07:41 +00:00
|
|
|
def processSubconfigs(path, ctx, data):
|
2018-10-24 13:20:27 +00:00
|
|
|
assert ctx is not None
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if "subconfigs" in data:
|
|
|
|
for subconf in data["subconfigs"]:
|
2019-10-08 13:07:41 +00:00
|
|
|
subconfDir = posixpath.join(path, subconf)
|
2018-10-24 13:20:27 +00:00
|
|
|
subconfData = readJsonFromDir(subconfDir)
|
|
|
|
subconfCtx = ctx
|
|
|
|
processJson(subconfDir, subconfCtx, subconfData)
|
|
|
|
|
|
|
|
|
2019-10-08 13:07:41 +00:00
|
|
|
def processJson(path, ctx, data):
|
2020-03-02 09:58:34 +00:00
|
|
|
ctx["project_dir"] = path
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
ctx["module"] = data.get("module", "global")
|
2020-03-02 09:58:34 +00:00
|
|
|
ctx["test_dir"] = data.get("testDir", "config.tests")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
ctx = processFiles(ctx, data)
|
|
|
|
|
2019-10-08 13:07:41 +00:00
|
|
|
with open(posixpath.join(path, "configure.cmake"), "w") as cm_fh:
|
2018-10-24 13:20:27 +00:00
|
|
|
cm_fh.write("\n\n#### Inputs\n\n")
|
|
|
|
|
|
|
|
processInputs(ctx, data, cm_fh)
|
|
|
|
|
|
|
|
cm_fh.write("\n\n#### Libraries\n\n")
|
|
|
|
|
|
|
|
processLibraries(ctx, data, cm_fh)
|
|
|
|
|
|
|
|
cm_fh.write("\n\n#### Tests\n\n")
|
|
|
|
|
|
|
|
processTests(ctx, data, cm_fh)
|
|
|
|
|
|
|
|
cm_fh.write("\n\n#### Features\n\n")
|
|
|
|
|
|
|
|
processFeatures(ctx, data, cm_fh)
|
|
|
|
|
2020-03-02 17:06:46 +00:00
|
|
|
processReports(ctx, data, cm_fh)
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if ctx.get("module") == "global":
|
|
|
|
cm_fh.write(
|
|
|
|
'\nqt_extra_definition("QT_VERSION_STR" "\\"${PROJECT_VERSION}\\"" PUBLIC)\n'
|
|
|
|
)
|
2018-10-24 13:20:27 +00:00
|
|
|
cm_fh.write('qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC)\n')
|
|
|
|
cm_fh.write('qt_extra_definition("QT_VERSION_MINOR" ${PROJECT_VERSION_MINOR} PUBLIC)\n')
|
|
|
|
cm_fh.write('qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC)\n')
|
|
|
|
|
|
|
|
# do this late:
|
2019-10-08 13:07:41 +00:00
|
|
|
processSubconfigs(path, ctx, data)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
if len(sys.argv) != 2:
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
print("This scripts needs one directory to process!")
|
|
|
|
quit(1)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
directory = sys.argv[1]
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2019-09-20 09:34:16 +00:00
|
|
|
print(f"Processing: {directory}.")
|
2018-10-24 13:20:27 +00:00
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
data = readJsonFromDir(directory)
|
|
|
|
processJson(directory, {}, data)
|
2018-10-24 13:20:27 +00:00
|
|
|
|
|
|
|
|
Improve styling of util/cmake scripts
flake8 was used to evaluate the file, with a couple of exeptions:
E501,E266,W503
black was used to reformat the code automatically
The changes were:
* Added a README that explains how to use pipenv and pip,
* Remove unnecessary return statements,
* Remove '\' from the end of the lines,
* Use f-strings (>= 3.6) since we are requiring Python 3.7,
* Commenting unused variables,
* Adding assert when Python >= 3.7 is not being used,
* Wrapping long lines to 100 (Qt Style),
* Re-factoring some lines,
* Re-ordering imports,
* Naming `except` for sympy (SympifyError, TypeError)
Change-Id: Ie05f754e7d8ee4bf427117c58e0eb1b903202933
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-16 22:11:17 +00:00
|
|
|
if __name__ == "__main__":
|
2018-10-24 13:20:27 +00:00
|
|
|
main()
|