summaryrefslogtreecommitdiffstats
path: root/examples/examples.pri
blob: 046d6cd1fa3b5956d12d1d5c4a4108ff0e3fc390 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
android {
    target.path = /libs/$$ANDROID_TARGET_ARCH
} else {
    target.path = $$[QT_INSTALL_EXAMPLES]/datavisualization/$$TARGET
}

win32 {
    CONFIG(debug, release|debug):DESTDIR = $$OUT_PWD/debug
    CONFIG(release, release|debug):DESTDIR = $$OUT_PWD/release
} else {
    DESTDIR = $$OUT_PWD
}

INCLUDEPATH += ../../include

LIBS += -L$$OUT_PWD/../../lib

TEMPLATE = app

QT += datavisualization

!static:android {
    # Add Qt library to be loaded in shared android build
    vis_lib_name = DataVisualization
    vis_src_lib = lib$${vis_lib_name}.so
    vis_lib_dir = $$OUT_PWD/../../lib/$$vis_src_lib
    ANDROID_EXTRA_LIBS = $$vis_lib_dir
}

contains(TARGET, qml.*) {
    uri = QtDataVisualization
    lib_name = datavisualizationqml2

    uri_replaced = $$replace(uri, \\., $$QMAKE_DIR_SEP)
    make_qmldir_path = $$DESTDIR/$$uri_replaced
    !exists($$make_qmldir_path) {
        make_qmldir_target = \"$$replace(make_qmldir_path, /, $$QMAKE_DIR_SEP)\"
        system($$QMAKE_MKDIR $$make_qmldir_target)
    }
    copy_qmldir.target = $$make_qmldir_path/qmldir
    copy_qmldir.depends = $$_PRO_FILE_PWD_/../../src/$$lib_name/qmldir
    copy_qmldir_formatted = \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\"
    copy_qmldir.commands = $(COPY_FILE) $$copy_qmldir_formatted
    QMAKE_EXTRA_TARGETS += copy_qmldir
    PRE_TARGETDEPS += $$copy_qmldir.target

    static:contains(QT_CONFIG, static) {
        # Make import scan find our copied qmldir & statically built qml lib
        !win32 {
            LIB_EXTENSION = a
        } else {
            LIB_EXTENSION = lib
        }
        QMLPATHS += $$DESTDIR
        # We need to copy the qmldir & lib already at qmake run stage as import scan is done then
        exists($$copy_qmldir.depends): system($$QMAKE_COPY $$copy_qmldir_formatted)
    } else {
        win32 {
            LIB_EXTENSION = dll
        } else {
            mac|ios {
                LIB_EXTENSION = dylib
            } else {
                LIB_EXTENSION = so
            }
        }
    }

    win32 {
        CONFIG(debug, release|debug) {
            src_dir = /debug
            src_lib = $${lib_name}d.$$LIB_EXTENSION
        }
        CONFIG(release, release|debug){
            src_dir = /release
            src_lib = $${lib_name}.$$LIB_EXTENSION
        }
    } else {
        src_dir =
            mac|ios {
            CONFIG(debug, release|debug) {
                src_lib = lib$${lib_name}_debug.$$LIB_EXTENSION
            }
            CONFIG(release, release|debug){
                src_lib = lib$${lib_name}.$$LIB_EXTENSION
            }
        } else {
            # linux, android
            src_lib = lib$${lib_name}.$$LIB_EXTENSION
        }
    }
    copy_lib.target = $$make_qmldir_path/$$src_lib
    copy_lib.depends = $$OUT_PWD/../../src/$$lib_name$$src_dir/$$src_lib
    copy_lib_formatted = \"$$replace(copy_lib.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_lib.target, /, $$QMAKE_DIR_SEP)\"
    copy_lib.commands = $(COPY_FILE) $$copy_lib_formatted
    QMAKE_EXTRA_TARGETS += copy_lib
    PRE_TARGETDEPS += $$copy_lib.target

    android {
        system($$QMAKE_COPY $$copy_qmldir_formatted)
        android_qmldir.files = $$copy_qmldir.target
        android_qmldir.path = /assets/qml/$$uri_replaced
        INSTALLS += android_qmldir
    }
    android|ios {
        system($$QMAKE_COPY $$copy_lib_formatted)
        android_qmlplugin.files = $$copy_lib.target
        android_qmlplugin.path = $$target.path
        INSTALLS += android_qmlplugin
    }
}