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
|
2020-04-30 11:34:24 +00:00
|
|
|
import os
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2020-04-30 11:34:24 +00:00
|
|
|
from special_case_helper import SpecialCaseHandler
|
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,
|
CMake: Handle finding of OpenSSL headers correctly
In Coin when provisioning for Android, we download and configure
the OpenSSL package, but don't actually build it. This means that
find_package(OpenSSL) can find the headers, but not the library,
and thus the package is marked as not found.
Previously the openssl_headers feature used the result of finding
the OpenSSL package, which led to it being disabled in the above
described Android case.
Introduce 2 new find scripts FindWrapOpenSSL and
FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL,
and checks if the headers were found, regardless of the OpenSSL_FOUND
value, which can be used for implementing the openssl_headers feature.
FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the
OpenSSL target if available.
The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android.
Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will
always be prepended to the Android sysroot, causing the package not
to be found.
Adjust the mapping in helper.py to use the targets created by these
find scripts. This also replaces the openssl/nolink target.
Adjust the projects and tests to use the new target names.
Adjust the compile tests for dtls and oscp to use the
WrapOpenSSLHeaders target, so that the features can be enabled even
if the library is dlopen-ed (like on Android).
Task-number: QTBUG-83371
Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-04-07 15:54:49 +00:00
|
|
|
get_compile_test_dependent_library_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
|
|
|
)
|
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.
|
2020-11-30 15:54:17 +00:00
|
|
|
"aesni": "TEST_subarch_aesni",
|
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": "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",
|
2020-11-30 15:54:17 +00:00
|
|
|
"rdrnd": "TEST_subarch_rdrnd",
|
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
|
|
|
"rtm": "TEST_subarch_rtm",
|
2020-11-30 15:54:17 +00:00
|
|
|
"shani": "TEST_subarch_shani",
|
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
|
|
|
"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",
|
|
|
|
"openssl11": '(OPENSSL_VERSION VERSION_GREATER_EQUAL "1.1.0")',
|
|
|
|
"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",
|
2020-04-15 11:57:13 +00:00
|
|
|
"3rdparty-hunspell": "VKB_HAVE_3RDPARTY_HUNSPELL",
|
|
|
|
"t9write-alphabetic": "VKB_HAVE_T9WRITE_ALPHA",
|
|
|
|
"t9write-cjk": "VKB_HAVE_T9WRITE_CJK",
|
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
|
2020-04-22 19:01:32 +00:00
|
|
|
find_package_kwargs["module"] = ctx["module"]
|
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
|
|
|
|
|
|
|
cm_fh.write(generate_find_package_info(newlib, **find_package_kwargs))
|
2018-10-24 13:20:27 +00:00
|
|
|
|
2020-04-22 19:01:32 +00:00
|
|
|
if "use" in data["libraries"][lib]:
|
|
|
|
use_entry = data["libraries"][lib]["use"]
|
|
|
|
if isinstance(use_entry, str):
|
|
|
|
print(f"1use: {use_entry}")
|
|
|
|
cm_fh.write(f"qt_add_qmake_lib_dependency({newlib.soName} {use_entry})\n")
|
|
|
|
else:
|
|
|
|
for use in use_entry:
|
|
|
|
print(f"2use: {use}")
|
|
|
|
indentation = ""
|
|
|
|
has_condition = False
|
|
|
|
if "condition" in use:
|
|
|
|
has_condition = True
|
|
|
|
indentation = " "
|
2020-07-30 13:50:22 +00:00
|
|
|
condition = map_condition(use["condition"])
|
2020-04-22 19:01:32 +00:00
|
|
|
cm_fh.write(f"if({condition})\n")
|
2020-07-30 13:50:22 +00:00
|
|
|
cm_fh.write(
|
|
|
|
f"{indentation}qt_add_qmake_lib_dependency({newlib.soName} {use['lib']})\n"
|
|
|
|
)
|
2020-04-22 19:01:32 +00:00
|
|
|
if has_condition:
|
|
|
|
cm_fh.write("endif()\n")
|
|
|
|
|
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)
|
|
|
|
|
2020-04-17 15:54:50 +00:00
|
|
|
mapped_features = {"gbm": "gbm_FOUND"}
|
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)
|
2020-08-28 12:47:46 +00:00
|
|
|
# Turn foo != 156 into (NOT foo EQUAL 156)
|
|
|
|
condition = re.sub(r"([^ ]+)\s*!=\s*([0-9]?)", "(! \\1 EQUAL \\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",
|
|
|
|
"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",
|
|
|
|
}
|
|
|
|
|
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-04-02 08:33:04 +00:00
|
|
|
def get_library_usage_for_compile_test(library):
|
|
|
|
result = {}
|
|
|
|
mapped_library = find_3rd_party_library_mapping(library)
|
|
|
|
if not mapped_library:
|
|
|
|
result["fixme"] = f"# FIXME: use: unmapped library: {library}\n"
|
|
|
|
return result
|
|
|
|
|
|
|
|
if mapped_library.test_library_overwrite:
|
|
|
|
target_name = mapped_library.test_library_overwrite
|
|
|
|
else:
|
|
|
|
target_name = mapped_library.targetName
|
|
|
|
result["target_name"] = target_name
|
|
|
|
result["package_name"] = mapped_library.packageName
|
|
|
|
result["extra"] = mapped_library.extra
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
# Handles config.test/foo/foo.pro projects.
|
|
|
|
def write_standalone_compile_test(cm_fh, ctx, data, config_test_name, is_library_test):
|
|
|
|
rel_test_project_path = f"{ctx['test_dir']}/{config_test_name}"
|
|
|
|
if posixpath.exists(f"{ctx['project_dir']}/{rel_test_project_path}/CMakeLists.txt"):
|
|
|
|
label = ""
|
|
|
|
libraries = []
|
|
|
|
packages = []
|
|
|
|
|
|
|
|
if "label" in data:
|
|
|
|
label = data["label"]
|
|
|
|
|
|
|
|
if is_library_test and config_test_name in data["libraries"]:
|
|
|
|
if "label" in data["libraries"][config_test_name]:
|
|
|
|
label = data["libraries"][config_test_name]["label"]
|
|
|
|
|
|
|
|
# If a library entry in configure.json has a test, and
|
|
|
|
# the test uses a config.tests standalone project, we
|
|
|
|
# need to get the package and target info for the
|
|
|
|
# library, and pass it to the test so compiling and
|
|
|
|
# linking succeeds.
|
|
|
|
library_usage = get_library_usage_for_compile_test(config_test_name)
|
|
|
|
if "target_name" in library_usage:
|
|
|
|
libraries.append(library_usage["target_name"])
|
|
|
|
if "package_name" in library_usage:
|
|
|
|
find_package_arguments = []
|
|
|
|
find_package_arguments.append(library_usage["package_name"])
|
|
|
|
if "extra" in library_usage:
|
|
|
|
find_package_arguments.extend(library_usage["extra"])
|
|
|
|
package_line = "PACKAGE " + " ".join(find_package_arguments)
|
|
|
|
packages.append(package_line)
|
|
|
|
|
|
|
|
cm_fh.write(
|
|
|
|
f"""
|
|
|
|
qt_config_compile_test("{config_test_name}"
|
|
|
|
LABEL "{label}"
|
|
|
|
PROJECT_PATH "${{CMAKE_CURRENT_SOURCE_DIR}}/{rel_test_project_path}"
|
|
|
|
"""
|
|
|
|
)
|
|
|
|
if libraries:
|
|
|
|
libraries_string = " ".join(libraries)
|
|
|
|
cm_fh.write(f" LIBRARIES {libraries_string}\n")
|
|
|
|
if packages:
|
|
|
|
packages_string = " ".join(packages)
|
|
|
|
cm_fh.write(f" PACKAGES {packages_string}")
|
2020-07-30 13:56:37 +00:00
|
|
|
cm_fh.write(")\n")
|
2020-04-02 08:33:04 +00:00
|
|
|
|
|
|
|
|
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):
|
2020-04-02 08:33:04 +00:00
|
|
|
write_standalone_compile_test(cm_fh, ctx, data, details, is_library_test)
|
2020-03-04 12:44:24 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
def resolve_head(detail):
|
2021-02-12 15:40:33 +00:00
|
|
|
head = detail.get("head")
|
2020-03-04 12:44:24 +00:00
|
|
|
if isinstance(head, list):
|
|
|
|
head = "\n".join(head)
|
2021-09-08 13:53:29 +00:00
|
|
|
return head + "\n" if head else ""
|
2020-03-04 12:44:24 +00:00
|
|
|
|
|
|
|
head = ""
|
|
|
|
if inherit_details:
|
|
|
|
head += resolve_head(inherit_details)
|
|
|
|
head += resolve_head(details)
|
|
|
|
|
2021-02-12 15:40:33 +00:00
|
|
|
sourceCode = head
|
2020-03-04 12:44:24 +00:00
|
|
|
|
|
|
|
def resolve_include(detail, keyword):
|
|
|
|
include = detail.get(keyword, "")
|
|
|
|
if isinstance(include, list):
|
2021-02-12 15:40:33 +00:00
|
|
|
include = "#include <" + ">\n#include <".join(include) + ">\n"
|
2020-03-04 12:44:24 +00:00
|
|
|
elif include:
|
2021-02-12 15:40:33 +00:00
|
|
|
include = f"#include <{include}>\n"
|
2020-03-04 12:44:24 +00:00
|
|
|
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")
|
|
|
|
|
2021-02-12 15:40:33 +00:00
|
|
|
sourceCode += include
|
2020-03-04 12:44:24 +00:00
|
|
|
|
|
|
|
def resolve_tail(detail):
|
2021-02-12 15:40:33 +00:00
|
|
|
tail = detail.get("tail")
|
2020-03-04 12:44:24 +00:00
|
|
|
if isinstance(tail, list):
|
|
|
|
tail = "\n".join(tail)
|
2021-09-08 13:53:29 +00:00
|
|
|
return tail + "\n" if tail else ""
|
2020-03-04 12:44:24 +00:00
|
|
|
|
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)
|
|
|
|
|
2021-02-12 15:40:33 +00:00
|
|
|
sourceCode += tail
|
2020-03-04 12:44:24 +00:00
|
|
|
|
2021-09-08 13:53:29 +00:00
|
|
|
if sourceCode: # blank line before main
|
|
|
|
sourceCode += "\n"
|
2021-02-12 11:31:17 +00:00
|
|
|
sourceCode += "int main(void)\n"
|
2020-03-04 12:44:24 +00:00
|
|
|
sourceCode += "{\n"
|
|
|
|
sourceCode += " /* BEGIN TEST: */\n"
|
|
|
|
|
|
|
|
def resolve_main(detail):
|
2021-02-12 15:40:33 +00:00
|
|
|
main = detail.get("main")
|
2020-03-04 12:44:24 +00:00
|
|
|
if isinstance(main, list):
|
|
|
|
main = "\n".join(main)
|
2021-09-08 13:53:29 +00:00
|
|
|
return main + "\n" if main else ""
|
2020-03-04 12:44:24 +00:00
|
|
|
|
|
|
|
main = ""
|
|
|
|
if inherit_details:
|
|
|
|
main += resolve_main(inherit_details)
|
|
|
|
main += resolve_main(details)
|
|
|
|
|
2021-02-12 15:40:33 +00:00
|
|
|
sourceCode += main
|
2020-03-04 12:44:24 +00:00
|
|
|
|
|
|
|
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"
|
2021-02-09 12:12:09 +00:00
|
|
|
elif details["qmake"] == "CONFIG += c++11 c++14 c++17 c++20":
|
2020-03-04 12:44:24 +00:00
|
|
|
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
|
|
|
|
|
CMake: Handle finding of OpenSSL headers correctly
In Coin when provisioning for Android, we download and configure
the OpenSSL package, but don't actually build it. This means that
find_package(OpenSSL) can find the headers, but not the library,
and thus the package is marked as not found.
Previously the openssl_headers feature used the result of finding
the OpenSSL package, which led to it being disabled in the above
described Android case.
Introduce 2 new find scripts FindWrapOpenSSL and
FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL,
and checks if the headers were found, regardless of the OpenSSL_FOUND
value, which can be used for implementing the openssl_headers feature.
FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the
OpenSSL target if available.
The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android.
Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will
always be prepended to the Android sysroot, causing the package not
to be found.
Adjust the mapping in helper.py to use the targets created by these
find scripts. This also replaces the openssl/nolink target.
Adjust the projects and tests to use the new target names.
Adjust the compile tests for dtls and oscp to use the
WrapOpenSSLHeaders target, so that the features can be enabled even
if the library is dlopen-ed (like on Android).
Task-number: QTBUG-83371
Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2020-04-07 15:54:49 +00:00
|
|
|
adjusted_library = get_compile_test_dependent_library_mapping(name, library)
|
|
|
|
library_usage = get_library_usage_for_compile_test(adjusted_library)
|
2020-04-02 08:33:04 +00:00
|
|
|
if "fixme" in library_usage:
|
|
|
|
qmakeFixme += library_usage["fixme"]
|
2020-03-04 12:44:24 +00:00
|
|
|
continue
|
|
|
|
else:
|
2020-04-02 08:33:04 +00:00
|
|
|
library_list.append(library_usage["target_name"])
|
2020-03-04 12:44:24 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
# }
|
|
|
|
# },
|
2020-08-19 14:49:13 +00:00
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
2020-08-19 14:49:13 +00:00
|
|
|
def write_compiler_supports_flag_test(
|
|
|
|
ctx, name, details, data, cm_fh, manual_library_list=None, is_library_test=False
|
|
|
|
):
|
|
|
|
cm_fh.write(f"qt_config_compiler_supports_flag_test({featureName(name)}\n")
|
|
|
|
cm_fh.write(lineify("LABEL", data.get("label", "")))
|
|
|
|
cm_fh.write(lineify("FLAG", data.get("flag", "")))
|
|
|
|
cm_fh.write(")\n\n")
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
2020-08-21 10:59:24 +00:00
|
|
|
def write_linker_supports_flag_test(
|
|
|
|
ctx, name, details, data, cm_fh, manual_library_list=None, is_library_test=False
|
|
|
|
):
|
|
|
|
cm_fh.write(f"qt_config_linker_supports_flag_test({featureName(name)}\n")
|
|
|
|
cm_fh.write(lineify("LABEL", data.get("label", "")))
|
|
|
|
cm_fh.write(lineify("FLAG", data.get("flag", "")))
|
|
|
|
cm_fh.write(")\n\n")
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
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",
|
|
|
|
"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
|
|
|
|
2020-08-19 14:49:13 +00:00
|
|
|
if data["type"] == "compilerSupportsFlag":
|
|
|
|
knownTests.add(test)
|
|
|
|
|
|
|
|
if "test" in data:
|
|
|
|
details = data["test"]
|
|
|
|
else:
|
|
|
|
details = test
|
|
|
|
|
|
|
|
write_compiler_supports_flag_test(ctx, test, details, data, cm_fh)
|
|
|
|
|
2020-08-21 10:59:24 +00:00
|
|
|
if data["type"] == "linkerSupportsFlag":
|
|
|
|
knownTests.add(test)
|
|
|
|
|
|
|
|
if "test" in data:
|
|
|
|
details = data["test"]
|
|
|
|
else:
|
|
|
|
details = test
|
|
|
|
|
|
|
|
write_linker_supports_flag_test(ctx, test, details, data, cm_fh)
|
|
|
|
|
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")
|
|
|
|
|
2020-06-26 18:45:11 +00:00
|
|
|
elif data["type"] == "machineTuple":
|
|
|
|
knownTests.add(test)
|
|
|
|
|
|
|
|
label = data["label"]
|
|
|
|
|
|
|
|
cm_fh.write(f"# {test}\n")
|
|
|
|
cm_fh.write(f'qt_config_compile_test_machine_tuple("{label}")\n')
|
|
|
|
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,
|
2020-07-30 13:50:22 +00:00
|
|
|
"ccache": {"autoDetect": "1", "condition": "QT_USE_CCACHE"},
|
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
|
|
|
"compiler-flags": None,
|
2020-04-16 20:33:14 +00:00
|
|
|
"cross_compile": {"condition": "CMAKE_CROSSCOMPILING"},
|
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": {
|
2020-08-21 13:16:31 +00:00
|
|
|
"autoDetect": "ON",
|
2020-11-11 17:13:56 +00:00
|
|
|
"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"},
|
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"
|
|
|
|
},
|
2020-07-30 13:50:22 +00:00
|
|
|
"gc_binaries": {"condition": "NOT QT_FEATURE_shared"},
|
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
|
|
|
"gcc-sysroot": None,
|
|
|
|
"gcov": None,
|
|
|
|
"GNUmake": None,
|
|
|
|
"host-dbus": None,
|
|
|
|
"iconv": {
|
2020-06-25 10:08:48 +00:00
|
|
|
"condition": "NOT QT_FEATURE_icu AND QT_FEATURE_textcodec AND NOT WIN32 AND NOT QNX AND NOT ANDROID AND NOT APPLE AND WrapIconv_FOUND",
|
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,
|
2020-08-27 12:11:00 +00:00
|
|
|
"ltcg": {
|
|
|
|
"autoDetect": "ON",
|
|
|
|
"cmakePrelude": """set(__qt_ltcg_detected FALSE)
|
|
|
|
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
|
|
|
set(__qt_ltcg_detected TRUE)
|
|
|
|
else()
|
|
|
|
foreach(config ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
|
2020-11-05 10:14:17 +00:00
|
|
|
string(TOUPPER "${config}" __qt_uc_config)
|
|
|
|
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION_${__qt_uc_config})
|
2020-08-27 12:11:00 +00:00
|
|
|
set(__qt_ltcg_detected TRUE)
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2020-11-05 10:14:17 +00:00
|
|
|
unset(__qt_uc_config)
|
2020-08-27 12:11:00 +00:00
|
|
|
endif()""",
|
2020-11-11 17:13:56 +00:00
|
|
|
"condition": "__qt_ltcg_detected",
|
2020-08-27 12:11: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
|
|
|
"msvc_mp": None,
|
2020-03-16 12:36:47 +00:00
|
|
|
"simulator_and_device": {"condition": "UIKIT AND NOT QT_UIKIT_SDK"},
|
2020-04-16 05:08:06 +00:00
|
|
|
"pkg-config": {"condition": "PKG_CONFIG_FOUND"},
|
2020-04-06 07:42:01 +00:00
|
|
|
"precompile_header": {"condition": "BUILD_WITH_PCH"},
|
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
|
|
|
"profile": None,
|
|
|
|
"qmakeargs": None,
|
|
|
|
"qpa_default_platform": None, # Not a bool!
|
2020-11-11 17:13:56 +00:00
|
|
|
"qreal": {
|
|
|
|
"condition": 'DEFINED QT_COORD_TYPE AND NOT QT_COORD_TYPE STREQUAL "double"',
|
2020-08-18 08:59:03 +00:00
|
|
|
"output": [
|
2021-09-08 13:53:29 +00:00
|
|
|
{
|
|
|
|
"type": "define",
|
|
|
|
"name": "QT_COORD_TYPE",
|
|
|
|
"value": "${QT_COORD_TYPE}",
|
|
|
|
},
|
2020-08-18 08:59:03 +00:00
|
|
|
{
|
|
|
|
"type": "define",
|
|
|
|
"name": "QT_COORD_TYPE_STRING",
|
2020-11-11 17:13:56 +00:00
|
|
|
"value": '\\"${QT_COORD_TYPE}\\"',
|
2020-08-18 08:59:03 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-09-08 13:53:29 +00:00
|
|
|
"reduce_exports": {
|
|
|
|
"condition": "NOT MSVC",
|
|
|
|
},
|
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
|
|
|
"release": None,
|
|
|
|
"release_tools": None,
|
2020-03-31 07:39:50 +00:00
|
|
|
"rpath": {
|
|
|
|
"autoDetect": "1",
|
CMake: Handle automatic rpath embedding correctly
Instead of using CMAKE_INSTALL_RPATH to embed an absolute path
to prefix/libdir into all targets, use the more sophisticated aproach
that qmake does.
For certain targets (modules, plugins, tools) use relative rpaths.
Otherwise embed absolute paths (examples, regular binaries).
Installed tests currently have no rpaths.
On certain platforms rpaths are not used (Windows, Android,
iOS / uikit).
Frameworks, app bundles and shallow bundles should also be handled
correctly.
Additional rpaths can be provided via QT_EXTRA_RPATHS variable
(similar to the -R option that configure takes).
Automatic embedding can be disabled either via QT_FEATURE_rpath=OFF
or QT_DISABLE_RPATH=ON.
Note that installed examples are not relocatable at the moment (due
to always having an absolute path rpath), so this is a missing feature
compared to qmake. This is due to missing information on where
examples will be installed, so a relative rpath can not be computed.
By default a Qt installation is relocatable, so there is no need to
pass -DQT_EXTRA_RPATHS=. like Coin used to do with qmake e.g. -R .
Relative rpaths will have the appropriate 'relative base' prefixed
to them (e.g $ORIGIN on linux and @loader_path on darwin platforms).
There is currently no support for other platforms that might have a
different 'relative base' than the ones mentioned above.
Any extra rpaths are saved to BuildInternalsExtra which are re-used
when building other repositories.
configurejson2cmake modified to include correct conditions for the
rpath feature.
It's very likely that we will need a new qt_add_internal_app()
function for gui apps that are to be installed to prefix/bin.
For example for Assistant from qttools. Currently such apps
use qt_add_executable().
The distinction is necessary to make sure that relative rpaths are
embedded into apps, but not executables (which tests are part of).
Amends e835a6853b9c0fb7af32798ed8965de3adf0e15b
Task-number: QTBUG-83497
Change-Id: I3510f63c0a59489741116cc8ec3ef6a0a7704f25
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-15 16:48:26 +00:00
|
|
|
"condition": "BUILD_SHARED_LIBS AND UNIX AND NOT WIN32 AND NOT ANDROID",
|
2020-03-31 07:39:50 +00:00
|
|
|
},
|
2020-03-31 12:12:01 +00:00
|
|
|
"shared": {
|
|
|
|
"condition": "BUILD_SHARED_LIBS",
|
|
|
|
"output": [
|
|
|
|
"publicFeature",
|
|
|
|
"publicQtConfig",
|
|
|
|
"publicConfig",
|
|
|
|
{
|
|
|
|
"type": "define",
|
|
|
|
"name": "QT_STATIC",
|
|
|
|
"prerequisite": "!defined(QT_SHARED) && !defined(QT_STATIC)",
|
2020-04-06 07:42:01 +00:00
|
|
|
"negative": True,
|
|
|
|
},
|
|
|
|
],
|
2020-03-31 12:12:01 +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
|
|
|
"silent": None,
|
2020-03-24 15:29:54 +00:00
|
|
|
"sql-sqlite": {"condition": "QT_FEATURE_datestring"},
|
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
|
|
|
"stl": None, # Do we really need to test for this in 2018?!
|
|
|
|
"strip": None,
|
|
|
|
"verifyspec": None, # qmake specific...
|
|
|
|
"warnings_are_errors": None, # FIXME: Do we need these?
|
|
|
|
"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", "")))
|
2020-08-27 12:11:00 +00:00
|
|
|
cmakePrelude = mapping.get("cmakePrelude", None)
|
|
|
|
cmakeEpilogue = mapping.get("cmakeEpilogue", None)
|
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
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
if outputType in [
|
|
|
|
"varAssign",
|
|
|
|
"varAppend",
|
|
|
|
"varRemove",
|
|
|
|
"useBFDLinker",
|
|
|
|
"useGoldLinker",
|
|
|
|
"useLLDLinker",
|
|
|
|
]:
|
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="",
|
2020-08-27 12:11:00 +00:00
|
|
|
cmakePrelude=None,
|
|
|
|
cmakeEpilogue=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
|
|
|
):
|
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
|
|
|
|
2020-08-27 12:11:00 +00:00
|
|
|
if cmakePrelude is not None:
|
|
|
|
cm_fh.write(cmakePrelude)
|
|
|
|
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
|
|
|
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
|
|
|
|
2020-08-27 12:11:00 +00:00
|
|
|
if cmakeEpilogue is not None:
|
|
|
|
cm_fh.write(cmakeEpilogue)
|
|
|
|
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 = {}
|
2020-11-11 17:13:56 +00:00
|
|
|
featureCalls[feature] = {
|
|
|
|
"name": feature,
|
|
|
|
"labelAppend": "",
|
|
|
|
"autoDetect": autoDetect,
|
|
|
|
"cmakePrelude": cmakePrelude,
|
|
|
|
"cmakeEpilogue": cmakeEpilogue,
|
|
|
|
}
|
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")}"')
|
2020-03-31 12:12:01 +00:00
|
|
|
if outputArgs.get("prerequisite") is not None:
|
|
|
|
cm_fh.write(f' PREREQUISITE "{outputArgs.get("prerequisite")}"')
|
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-07-30 13:56:37 +00:00
|
|
|
cm_fh.write("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-26 16:28:20 +00:00
|
|
|
elif "type" in entry and entry["type"] == "buildParts":
|
|
|
|
message = entry["message"]
|
|
|
|
cm_fh.write(f'qt_configure_add_summary_build_parts("{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}.")
|
|
|
|
|
|
|
|
|
CMake: Handle automatic rpath embedding correctly
Instead of using CMAKE_INSTALL_RPATH to embed an absolute path
to prefix/libdir into all targets, use the more sophisticated aproach
that qmake does.
For certain targets (modules, plugins, tools) use relative rpaths.
Otherwise embed absolute paths (examples, regular binaries).
Installed tests currently have no rpaths.
On certain platforms rpaths are not used (Windows, Android,
iOS / uikit).
Frameworks, app bundles and shallow bundles should also be handled
correctly.
Additional rpaths can be provided via QT_EXTRA_RPATHS variable
(similar to the -R option that configure takes).
Automatic embedding can be disabled either via QT_FEATURE_rpath=OFF
or QT_DISABLE_RPATH=ON.
Note that installed examples are not relocatable at the moment (due
to always having an absolute path rpath), so this is a missing feature
compared to qmake. This is due to missing information on where
examples will be installed, so a relative rpath can not be computed.
By default a Qt installation is relocatable, so there is no need to
pass -DQT_EXTRA_RPATHS=. like Coin used to do with qmake e.g. -R .
Relative rpaths will have the appropriate 'relative base' prefixed
to them (e.g $ORIGIN on linux and @loader_path on darwin platforms).
There is currently no support for other platforms that might have a
different 'relative base' than the ones mentioned above.
Any extra rpaths are saved to BuildInternalsExtra which are re-used
when building other repositories.
configurejson2cmake modified to include correct conditions for the
rpath feature.
It's very likely that we will need a new qt_add_internal_app()
function for gui apps that are to be installed to prefix/bin.
For example for Assistant from qttools. Currently such apps
use qt_add_executable().
The distinction is necessary to make sure that relative rpaths are
embedded into apps, but not executables (which tests are part of).
Amends e835a6853b9c0fb7af32798ed8965de3adf0e15b
Task-number: QTBUG-83497
Change-Id: I3510f63c0a59489741116cc8ec3ef6a0a7704f25
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-15 16:48:26 +00:00
|
|
|
report_condition_mapping = {
|
|
|
|
"(features.rpath || features.rpath_dir) && !features.shared": "(features.rpath || QT_EXTRA_RPATHS) && !features.shared",
|
2020-07-30 13:50:22 +00:00
|
|
|
"(features.rpath || features.rpath_dir) && var.QMAKE_LFLAGS_RPATH == ''": None,
|
CMake: Handle automatic rpath embedding correctly
Instead of using CMAKE_INSTALL_RPATH to embed an absolute path
to prefix/libdir into all targets, use the more sophisticated aproach
that qmake does.
For certain targets (modules, plugins, tools) use relative rpaths.
Otherwise embed absolute paths (examples, regular binaries).
Installed tests currently have no rpaths.
On certain platforms rpaths are not used (Windows, Android,
iOS / uikit).
Frameworks, app bundles and shallow bundles should also be handled
correctly.
Additional rpaths can be provided via QT_EXTRA_RPATHS variable
(similar to the -R option that configure takes).
Automatic embedding can be disabled either via QT_FEATURE_rpath=OFF
or QT_DISABLE_RPATH=ON.
Note that installed examples are not relocatable at the moment (due
to always having an absolute path rpath), so this is a missing feature
compared to qmake. This is due to missing information on where
examples will be installed, so a relative rpath can not be computed.
By default a Qt installation is relocatable, so there is no need to
pass -DQT_EXTRA_RPATHS=. like Coin used to do with qmake e.g. -R .
Relative rpaths will have the appropriate 'relative base' prefixed
to them (e.g $ORIGIN on linux and @loader_path on darwin platforms).
There is currently no support for other platforms that might have a
different 'relative base' than the ones mentioned above.
Any extra rpaths are saved to BuildInternalsExtra which are re-used
when building other repositories.
configurejson2cmake modified to include correct conditions for the
rpath feature.
It's very likely that we will need a new qt_add_internal_app()
function for gui apps that are to be installed to prefix/bin.
For example for Assistant from qttools. Currently such apps
use qt_add_executable().
The distinction is necessary to make sure that relative rpaths are
embedded into apps, but not executables (which tests are part of).
Amends e835a6853b9c0fb7af32798ed8965de3adf0e15b
Task-number: QTBUG-83497
Change-Id: I3510f63c0a59489741116cc8ec3ef6a0a7704f25
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-15 16:48:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-02 17:06:46 +00:00
|
|
|
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
|
CMake: Handle automatic rpath embedding correctly
Instead of using CMAKE_INSTALL_RPATH to embed an absolute path
to prefix/libdir into all targets, use the more sophisticated aproach
that qmake does.
For certain targets (modules, plugins, tools) use relative rpaths.
Otherwise embed absolute paths (examples, regular binaries).
Installed tests currently have no rpaths.
On certain platforms rpaths are not used (Windows, Android,
iOS / uikit).
Frameworks, app bundles and shallow bundles should also be handled
correctly.
Additional rpaths can be provided via QT_EXTRA_RPATHS variable
(similar to the -R option that configure takes).
Automatic embedding can be disabled either via QT_FEATURE_rpath=OFF
or QT_DISABLE_RPATH=ON.
Note that installed examples are not relocatable at the moment (due
to always having an absolute path rpath), so this is a missing feature
compared to qmake. This is due to missing information on where
examples will be installed, so a relative rpath can not be computed.
By default a Qt installation is relocatable, so there is no need to
pass -DQT_EXTRA_RPATHS=. like Coin used to do with qmake e.g. -R .
Relative rpaths will have the appropriate 'relative base' prefixed
to them (e.g $ORIGIN on linux and @loader_path on darwin platforms).
There is currently no support for other platforms that might have a
different 'relative base' than the ones mentioned above.
Any extra rpaths are saved to BuildInternalsExtra which are re-used
when building other repositories.
configurejson2cmake modified to include correct conditions for the
rpath feature.
It's very likely that we will need a new qt_add_internal_app()
function for gui apps that are to be installed to prefix/bin.
For example for Assistant from qttools. Currently such apps
use qt_add_executable().
The distinction is necessary to make sure that relative rpaths are
embedded into apps, but not executables (which tests are part of).
Amends e835a6853b9c0fb7af32798ed8965de3adf0e15b
Task-number: QTBUG-83497
Change-Id: I3510f63c0a59489741116cc8ec3ef6a0a7704f25
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-04-15 16:48:26 +00:00
|
|
|
|
|
|
|
if isinstance(condition, str) and condition in report_condition_mapping:
|
|
|
|
new_condition = report_condition_mapping[condition]
|
|
|
|
if new_condition is None:
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
condition = new_condition
|
2020-03-02 17:06:46 +00:00
|
|
|
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}.")
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
2020-07-08 09:35:43 +00:00
|
|
|
def parseCommandLineCustomHandler(ctx, data, cm_fh):
|
|
|
|
cm_fh.write(f"qt_commandline_custom({data})\n")
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
2020-07-08 09:35:43 +00:00
|
|
|
def parseCommandLineOptions(ctx, data, cm_fh):
|
|
|
|
for key in data:
|
|
|
|
args = [key]
|
|
|
|
option = data[key]
|
|
|
|
if isinstance(option, str):
|
|
|
|
args += ["TYPE", option]
|
|
|
|
else:
|
|
|
|
if "type" in option:
|
|
|
|
args += ["TYPE", option["type"]]
|
|
|
|
if "name" in option:
|
|
|
|
args += ["NAME", option["name"]]
|
|
|
|
if "value" in option:
|
|
|
|
args += ["VALUE", option["value"]]
|
|
|
|
if "values" in option:
|
|
|
|
values = option["values"]
|
|
|
|
if isinstance(values, list):
|
2020-11-11 17:13:56 +00:00
|
|
|
args += ["VALUES", " ".join(option["values"])]
|
2020-07-08 09:35:43 +00:00
|
|
|
else:
|
|
|
|
args += ["MAPPING"]
|
|
|
|
for lhs in values:
|
|
|
|
args += [lhs, values[lhs]]
|
|
|
|
|
|
|
|
cm_fh.write(f"qt_commandline_option({' '.join(args)})\n")
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
2020-07-08 09:35:43 +00:00
|
|
|
def parseCommandLinePrefixes(ctx, data, cm_fh):
|
|
|
|
for key in data:
|
|
|
|
cm_fh.write(f"qt_commandline_prefix({key} {data[key]})\n")
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
2020-07-08 09:35:43 +00:00
|
|
|
def processCommandLine(ctx, data, cm_fh):
|
|
|
|
print(" commandline:")
|
|
|
|
|
|
|
|
if "subconfigs" in data:
|
|
|
|
for subconf in data["subconfigs"]:
|
|
|
|
cm_fh.write(f"qt_commandline_subconfig({subconf})\n")
|
|
|
|
|
|
|
|
if "commandline" not in data:
|
|
|
|
return
|
|
|
|
|
|
|
|
commandLine = data["commandline"]
|
|
|
|
if "custom" in commandLine:
|
|
|
|
print(" custom:")
|
|
|
|
parseCommandLineCustomHandler(ctx, commandLine["custom"], cm_fh)
|
|
|
|
if "options" in commandLine:
|
|
|
|
print(" options:")
|
|
|
|
parseCommandLineOptions(ctx, commandLine["options"], cm_fh)
|
|
|
|
if "prefix" in commandLine:
|
|
|
|
print(" prefix:")
|
|
|
|
parseCommandLinePrefixes(ctx, commandLine["prefix"], cm_fh)
|
|
|
|
if "assignments" in commandLine:
|
2021-11-01 09:59:53 +00:00
|
|
|
print(" assignments are ignored")
|
2020-03-02 17:06:46 +00:00
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
|
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)
|
|
|
|
|
2020-07-30 13:50:22 +00:00
|
|
|
|
2020-07-08 08:32:03 +00:00
|
|
|
class special_cased_file:
|
2020-11-10 08:31:47 +00:00
|
|
|
def __init__(self, base_dir: str, file_name: str, skip_special_case_preservation: bool):
|
2020-07-08 08:32:03 +00:00
|
|
|
self.base_dir = base_dir
|
|
|
|
self.file_path = posixpath.join(base_dir, file_name)
|
|
|
|
self.gen_file_path = self.file_path + ".gen"
|
2020-11-10 08:31:47 +00:00
|
|
|
self.preserve_special_cases = not skip_special_case_preservation
|
2020-07-08 08:32:03 +00:00
|
|
|
|
|
|
|
def __enter__(self):
|
|
|
|
self.file = open(self.gen_file_path, "w")
|
2020-11-10 08:31:47 +00:00
|
|
|
if self.preserve_special_cases:
|
|
|
|
self.sc_handler = SpecialCaseHandler(
|
|
|
|
os.path.abspath(self.file_path),
|
|
|
|
os.path.abspath(self.gen_file_path),
|
|
|
|
os.path.abspath(self.base_dir),
|
|
|
|
debug=False,
|
|
|
|
)
|
2020-07-08 08:32:03 +00:00
|
|
|
return self.file
|
|
|
|
|
|
|
|
def __exit__(self, type, value, trace_back):
|
|
|
|
self.file.close()
|
2021-02-12 15:33:55 +00:00
|
|
|
if self.preserve_special_cases:
|
|
|
|
self.sc_handler.handle_special_cases()
|
|
|
|
os.replace(self.gen_file_path, self.file_path)
|
2020-07-30 13:50:22 +00:00
|
|
|
|
2021-09-08 13:53:29 +00:00
|
|
|
|
2020-11-10 08:31:47 +00:00
|
|
|
def processJson(path, ctx, data, skip_special_case_preservation=False):
|
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)
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
with special_cased_file(path, "qt_cmdline.cmake", skip_special_case_preservation) as cm_fh:
|
2020-07-08 09:35:43 +00:00
|
|
|
processCommandLine(ctx, data, cm_fh)
|
|
|
|
|
2020-11-11 17:13:56 +00:00
|
|
|
with special_cased_file(path, "configure.cmake", skip_special_case_preservation) 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
|
|
|
|
2020-07-30 13:50:22 +00:00
|
|
|
|
2018-10-24 13:20:27 +00:00
|
|
|
def main():
|
2020-11-10 08:31:47 +00:00
|
|
|
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]
|
2021-09-08 13:53:29 +00:00
|
|
|
skip_special_case_preservation = "-s" in sys.argv[2:]
|
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)
|
2020-11-11 17:13:56 +00:00
|
|
|
processJson(directory, {}, data, skip_special_case_preservation=skip_special_case_preservation)
|
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()
|