summaryrefslogtreecommitdiff
path: root/src/ivicore/configure.pri
blob: 18d22925f3c17bc45ae6ce4addc2328d526640df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
QTIVICORE_ROOT = $$PWD

defineTest(qtConfTest_python3) {

    PYTHON3_PATH = $$(PYTHON3_PATH)
    # include binaries installed from homebrew
    osx: PYTHON3_PATH += /usr/local/bin
    PYTHON3_NAMES = "python3" "python"
    for (python3_exe_name, PYTHON3_NAMES) {
        equals(QMAKE_HOST.os, Windows): python3_exe_name = $${python3_exe_name}.exe

        python3_exe = $$shell_path($$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)
}

defineTest(qtConfTest_qface_submodule) {
    path = $$QTIVICORE_ROOT/../3rdparty/qface/setup.py
    exists($$path): return(true)

    qtLog("The submodule at \"$$path\" is not initialized")

    return(false)
}