mdnssd.qbs 3.37 KB
Newer Older
1
import qbs.base 1.0
Joerg Bornemann's avatar
Joerg Bornemann committed
2
import qbs.fileinfo 1.0 as FileInfo
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
import "../QtcTool.qbs" as QtcTool

QtcTool {
    name: "mdnssd"

    cpp.defines: [ "PID_FILE=\"/tmp/mdnsd.pid\"", "MDNS_UDS_SERVERPATH=\"/tmp/mdnsd\"",
        "MDNS_DEBUGMSGS=0", "HAVE_IPV6" ]
    cpp.includePaths: [ ".",  buildDirectory ]

    Depends { name: "cpp" }

    files: [
        "uds_daemon.c", "uds_daemon.h",
        "uDNS.c", "uDNS.h",
        "mDNSDebug.c", "mDNSDebug.h",
        "GenLinkedList.c", "GenLinkedList.h",
        "dnssd_ipc.c", "dnssd_ipc.h",
        "DNSDigest.c",
        "DNSCommon.c",
        "mDNSUNP.h",
        "mDNSEmbeddedAPI.h",
        "DNSCommon.h",
        "DebugServices.h",
        "dns_sd.h",
        "mDNS.c",
    ]

    Group {
        condition: qbs.targetOS === "linux"
        files: [
            "mDNSPosix.c",  "mDNSPosix.h",
            "PlatformCommon.c", "PlatformCommon.h",
            "PosixDaemon.c",
            "mDNSUNP.c"
        ]
    }

    Properties {
        condition: qbs.targetOS === "linux"
Joerg Bornemann's avatar
Joerg Bornemann committed
42
43
44
45
        cpp.defines: outer.concat([
            "_GNU_SOURCE", "NOT_HAVE_SA_LEN",
            "USES_NETLINK", "HAVE_LINUX", "TARGET_OS_LINUX"
        ])
46
47
48
49
    }

    Properties {
        condition: qbs.targetOS === "macx"
Joerg Bornemann's avatar
Joerg Bornemann committed
50
51
52
53
        cpp.defines: outer.concat([
            "__MAC_OS_X_VERSION_MIN_REQUIRED=__MAC_OS_X_VERSION_10_4",
            "__APPLE_USE_RFC_2292"
        ])
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    }

    Group {
        condition: qbs.targetOS === "windows"
        files: [
            "Firewall.h", "Firewall.cpp",
            "mDNSWin32.h", "mDNSWin32.c",
            "Poll.h", "Poll.c",
            "Secret.h", "Secret.c",
            "Service.h", "Service.c",
            "DebugServices.c",
            "LegacyNATTraversal.c",
            "resource.h",
            "RegNames.h",
            "CommonServices.h",
            "main.c",
            "EventLog.mc",
            "Service.rc"
        ]
    }

    Properties {
        condition: qbs.targetOS === "windows"
Joerg Bornemann's avatar
Joerg Bornemann committed
77
78
79
        cpp.defines: outer.concat([
            "WIN32",
            "_WIN32_WINNT=0x0501", "NDEBUG", "MDNS_DEBUGMSGS=0", "TARGET_OS_WIN32",
80
81
82
            "WIN32_LEAN_AND_MEAN", "USE_TCP_LOOPBACK", "PLATFORM_NO_STRSEP",
            "PLATFORM_NO_EPIPE", "PLATFORM_NO_RLIMIT", "UNICODE", "_UNICODE",
            "_CRT_SECURE_NO_DEPRECATE", "_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1",
Joerg Bornemann's avatar
Joerg Bornemann committed
83
84
            "_LEGACY_NAT_TRAVERSAL_"
        ])
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
        cpp.dynamicLibraries: [ "ws2_32.lib", "advapi32.lib", "ole32.lib", "oleaut32.lib",
            "iphlpapi.lib", "netapi32.lib", "user32.lib", "powrprof.lib", "shell32.lib" ]
    }

    Properties {
        condition: qbs.toolchain === 'mingw' || qbs.toolchain === 'gcc'
        cpp.cFlags: [ "-Wno-unused-but-set-variable", "-Wno-strict-aliasing" ]
        cpp.cxxFlags: [ "-Wno-unused-but-set-variable" ]
    }

    FileTagger {
        pattern: "*.mc"
        fileTags: "mc"
    }

    Rule {
        inputs: "mc"
        Artifact {
Joerg Bornemann's avatar
Joerg Bornemann committed
103
            fileName: product.name + "/" + input.baseName + ".h"
104
105
            fileTags: "hpp"
        }
Joerg Bornemann's avatar
Joerg Bornemann committed
106
107
108
109
        Artifact {
            fileName: product.name + "/" + input.baseName + ".rc"
            fileTags: "mc_result"
        }
110
        prepare: {
Joerg Bornemann's avatar
Joerg Bornemann committed
111
112
113
114
            var cmd = new Command("mc", input.fileName);
            cmd.workingDirectory = FileInfo.path(outputs["mc_result"][0].fileName);
            cmd.description = "mc " + FileInfo.fileName(input.fileName);
            return cmd;
115
116
117
        }
    }
}
Joerg Bornemann's avatar
Joerg Bornemann committed
118