summaryrefslogtreecommitdiff
path: root/qbs/modules/sqlite_sources/sqlite-sources.qbs
blob: 323057754fbe1e04768fb7170023f88e3dfb0cea (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
Module {
    property bool buildSharedLib: true

    readonly property string libsDir: path + "/../../../src/libs"
    readonly property string sqliteDir3rdParty: libsDir + "/3rdparty/sqlite"
    readonly property string sqliteDir: libsDir + "/sqlite"
    readonly property string includeDir: sqliteDir

    Depends { name: "cpp" }

    cpp.defines: {
        var defines = ["SQLITE_CUSTOM_INCLUDE=config.h", "SQLITE_CORE"];
        if (buildSharedLib)
            defines.push("SQLITE_LIBRARY");
        else
            defines.push("SQLITE_STATIC_LIBRARY");
        if (qbs.targetOS.contains("linux"))
            defines.push("_POSIX_C_SOURCE=200809L", "_GNU_SOURCE");
        else if (qbs.targetOS.contains("macos"))
            defines.push("_BSD_SOURCE");
        return defines;
    }

    cpp.dynamicLibraries: base.concat((qbs.targetOS.contains("unix") && !qbs.targetOS.contains("bsd"))
                                      ? ["dl", "pthread"] : [])
    cpp.includePaths: base.concat([sqliteDir3rdParty, sqliteDir])
    cpp.optimization: "fast"

    Group {
        name: "wrapper sources"
        prefix: sqlite_sources.sqliteDir + '/'
        files: [
            "*.h",
            "*.cpp"
        ]
    }

    Group {
        name: "sqlite sources"
        prefix: sqlite_sources.sqliteDir3rdParty + '/'
        cpp.warningLevel: "none"
        files: [
            "carray.c",
            "config.h",
            "sqlite3.c",
            "sqlite3.h",
            "sqlite.h",
            "sqlite3ext.h",
        ]
    }
}