diff options
-rw-r--r-- | examples/core/core.pro | 4 | ||||
-rw-r--r-- | mkspecs/mkspecs.pro | 3 | ||||
-rw-r--r-- | qtivi.pro | 1 | ||||
-rw-r--r-- | src/ivicore/configure.json | 78 | ||||
-rw-r--r-- | src/ivicore/configure.pri | 55 | ||||
-rw-r--r-- | src/src.pro | 3 | ||||
-rw-r--r-- | src/tools/ivigenerator/qface_internal_build.pri | 34 | ||||
-rw-r--r-- | src/tools/tools.pro | 5 |
8 files changed, 146 insertions, 37 deletions
diff --git a/examples/core/core.pro b/examples/core/core.pro index a8ebdd1..14dc55e 100644 --- a/examples/core/core.pro +++ b/examples/core/core.pro @@ -1,2 +1,4 @@ TEMPLATE = subdirs -SUBDIRS = qface-ivi-climate + +QT_FOR_CONFIG += ivicore +qtConfig(ivigenerator): SUBDIRS = qface-ivi-climate diff --git a/mkspecs/mkspecs.pro b/mkspecs/mkspecs.pro index 95262a0..a778415 100644 --- a/mkspecs/mkspecs.pro +++ b/mkspecs/mkspecs.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += features +QT_FOR_CONFIG += ivicore +qtConfig(ivigenerator): SUBDIRS += features @@ -16,5 +16,6 @@ MIN_MINOR = 8 # b/c we need the new Qt configuration system load(qt_parts) SUBDIRS += mkspecs +mkspecs.depends = sub_src OTHER_FILES += sync.profile diff --git a/src/ivicore/configure.json b/src/ivicore/configure.json index 3a494e2..be05fbb 100644 --- a/src/ivicore/configure.json +++ b/src/ivicore/configure.json @@ -2,9 +2,81 @@ "module": "ivicore", "testDir": "../../config.tests", - "features": {}, + "tests": { + "python3": { + "label": "Python3", + "type": "python3", + "files": [ "python3" ] + }, + "pip": { + "label": "pip", + "type": "python3_package", + "package": "pip" + }, + "virtualenv": { + "label": "virtualenv", + "type": "python3_package", + "package": "virtualenv" + } - "report": [], + }, - "summary": [] + "features": { + "python3": { + "label": "python3", + "condition": "tests.python3", + "output": [ + "privateFeature", + { "type": "varAssign", "name": "QMAKE_PYTHON3_LOCATION", "value": "tests.python3.value" } + ] + }, + "python3-pip": { + "label": "pip", + "condition": "features.python3 && tests.pip", + "output": [ "privateFeature" ] + }, + "python3-virtualenv": { + "label": "virtualenv", + "condition": "features.python3 && tests.virtualenv", + "output": [ "privateFeature" ] + }, + "ivigenerator": { + "label": "IVI Generator", + "condition": [ + "features.python3", + "features.python3-pip", + "features.python3-virtualenv" + ], + "output": [ "publicFeature" ] + } + }, + + "report": [ + { + "type": "warning", + "condition": "!features.ivigenerator", + "message": "Cannot build the IVI Generator because its dependencies are not satisfied. +The IVI Generator provides tooling to generate source code out of IDL files. +Make sure that python3 and its 'pip' and 'virtualenv' packages are installed." + } + ], + + "summary": [ + { + "section": "Qt IVI Core", + "entries": [ + { + "section": "Python3", + "entries": [ + { + "type": "python3" + }, + "python3-virtualenv", + "python3-pip" + ] + }, + "ivigenerator" + ] + } + ] } diff --git a/src/ivicore/configure.pri b/src/ivicore/configure.pri new file mode 100644 index 0000000..3556977 --- /dev/null +++ b/src/ivicore/configure.pri @@ -0,0 +1,55 @@ + +defineTest(qtConfTest_python3) { + + PYTHON3_PATH = $$(PYTHON3_PATH) + PYTHON3_NAMES = "python3" "python" + for (python3_exe_name, PYTHON3_NAMES) { + equals(QMAKE_HOST.os, Windows): python3_exe_name = $${python3_exe_name}.exe + + python3_exe = $$qtConfFindInPath($$python3_exe_name, $$PYTHON3_PATH) + isEmpty(python3_exe): \ + next(); + + qtRunLoggedCommand("$$python3_exe -c \"import platform; print(platform.python_version_tuple()[0])\"", py_major_version)|next() + equals(py_major_version, 3) { + qtRunLoggedCommand("$$python3_exe -c \"import platform; print(platform.python_version())\"", python_version)|next() + break() + } + } + + !isEmpty(python3_exe):exists($$python3_exe):!isEmpty(python_version) { + qtLog("Using: $$python3_exe") + qtLog("Version: $$py_major_version") + + $${1}.value = $$python3_exe + export($${1}.value) + $${1}.version = $$python_version + export($${1}.version) + $${1}.cache += value + $${1}.cache += version + export($${1}.cache) + return(true) + } + return(false) +} + +defineTest(qtConfTest_python3_package) { + python3_exe = $$eval($${currentConfig}.tests.python3.value) + package = $$eval($${1}.package) + + qtRunLoggedCommand("$$python3_exe -c \"import $${package}\"", package_exists)|return(false) + + return(true) +} + +defineTest(qtConfReport_python3) { + !$$eval($${currentConfig}.features.python3.available) { + qtConfReportPadded($${1}Executable, "no") + return() + } + + path = $$eval($${currentConfig}.tests.python3.value) + version = $$eval($${currentConfig}.tests.python3.version) + qtConfReportPadded("$${1}Executable", $$path) + qtConfReportPadded("$${1}Version", $$version) +} diff --git a/src/src.pro b/src/src.pro index c2236a9..dd37da5 100644 --- a/src/src.pro +++ b/src/src.pro @@ -14,10 +14,11 @@ QT_FOR_CONFIG += geniviextras-private doc \ tools - ivivehiclefunctions.depends = ivicore tools + ivivehiclefunctions.depends = ivicore ivimedia.depends = ivicore plugins.depends = ivivehiclefunctions ivimedia imports.depends = ivivehiclefunctions ivimedia + tools.depends = ivicore } qtConfig(dlt): SUBDIRS += geniviextras diff --git a/src/tools/ivigenerator/qface_internal_build.pri b/src/tools/ivigenerator/qface_internal_build.pri index 1fd226b..7c66e02 100644 --- a/src/tools/ivigenerator/qface_internal_build.pri +++ b/src/tools/ivigenerator/qface_internal_build.pri @@ -5,40 +5,14 @@ debug_and_release:build_pass:CONFIG(release, debug|release) { return(); } -!exists($$QFACE_SOURCE_DIR): error("Couldn't find $$QFACE_SOURCE_DIR: Please make sure all submodules are initialized") +!exists($$QFACE_SOURCE_DIR/setup.py): error("Couldn't find $$QFACE_SOURCE_DIR: Please make sure all submodules are initialized") -message("Checking for a valid python & pip installation") - -PYTHON3_PATH = $$(PYTHON3_PATH) -PYTHON3_NAMES = "python3" "python" -for (python3_exe, PYTHON3_NAMES) { - !isEmpty(PYTHON3_PATH): python3_exe = $$shell_path($$PYTHON3_PATH/$$python3_exe) - win32: python3_exe = $${python3_exe}.exe - message("Checking for python executable: $$python3_exe") - py_major_version = $$system("$$python3_exe -c \"import platform; print(platform.python_version_tuple()[0])\"") - equals(py_major_version, 3) { - PYTHON3_EXE = $$python3_exe - break() - } -} - -isEmpty(PYTHON3_EXE) { - error("Didn't find a valid python3 installation in PATH or PYTHON3_PATH $$escape_expand(\n)Please make sure it is setup accordingly.") -} - -message("Checking for pip installation") -pip_version = $$system("$$PYTHON3_EXE -m pip --version") -isEmpty(pip_version) { - error("Didn't find pip with your python installation at: $$PYTHON3_EXE $$escape_expand(\n)Please make sure it is installed.") -} - -VIRTUALENV_EXE = "$$PYTHON3_EXE -m virtualenv" -!isEmpty(PIP3_PATH): VIRTUALENV_EXE = $$shell_path($$PIP3_PATH/virtualenv) -!isEmpty(PIP3_PATH):win32: VIRTUALENV_EXE = $${VIRTUALENV_EXE}.exe +include($$shadowed($$PWD/../../ivicore/qtivicore-config.pri)) +VIRTUALENV_EXE = $$QMAKE_PYTHON3_LOCATION -m virtualenv # virtualenv is always using the default interpreter, which is python2 on many systems" # by adding -p we enforce that the python3 interpreter is used and make sure python3 is installed in the virtualenv -VIRTUALENV_EXE += " -p $$PYTHON3_EXE" +VIRTUALENV_EXE += " -p $$QMAKE_PYTHON3_LOCATION" # Use a Python virtualenv for installing qface, so we don't pollute the user environment qtivi_qface_virtualenv.target = qtivi_qface_virtualenv diff --git a/src/tools/tools.pro b/src/tools/tools.pro index 9990860..449f3a8 100644 --- a/src/tools/tools.pro +++ b/src/tools/tools.pro @@ -1,2 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = ivigenerator + +QT_FOR_CONFIG += ivicore + +qtConfig(ivigenerator): SUBDIRS = ivigenerator |