ssh.qbs 5.32 KB
Newer Older
1 2 3 4 5 6
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary

QtcLibrary {
    name: "QtcSsh"

7
    cpp.defines: base.concat(["QSSH_LIBRARY"]).concat(botanDefines)
8
    cpp.includePaths: botanIncludes
Orgad Shaneh's avatar
Orgad Shaneh committed
9
    cpp.dynamicLibraries: botanLibs
10

Yuchen Deng's avatar
Yuchen Deng committed
11
    Depends { name: "Qt"; submodules: ["widgets", "network" ] }
12 13 14 15

    files: [
        "sftpchannel.h", "sftpchannel_p.h", "sftpchannel.cpp",
        "sftpdefs.cpp", "sftpdefs.h",
Orgad Shaneh's avatar
Orgad Shaneh committed
16
        "sftpfilesystemmodel.cpp", "sftpfilesystemmodel.h",
17 18 19 20
        "sftpincomingpacket.cpp", "sftpincomingpacket_p.h",
        "sftpoperation.cpp", "sftpoperation_p.h",
        "sftpoutgoingpacket.cpp", "sftpoutgoingpacket_p.h",
        "sftppacket.cpp", "sftppacket_p.h",
Orgad Shaneh's avatar
Orgad Shaneh committed
21
        "sshbotanconversions_p.h",
22 23 24 25 26 27
        "sshcapabilities_p.h", "sshcapabilities.cpp",
        "sshchannel.cpp", "sshchannel_p.h",
        "sshchannelmanager.cpp", "sshchannelmanager_p.h",
        "sshconnection.h", "sshconnection_p.h", "sshconnection.cpp",
        "sshconnectionmanager.cpp", "sshconnectionmanager.h",
        "sshcryptofacility.cpp", "sshcryptofacility_p.h",
Orgad Shaneh's avatar
Orgad Shaneh committed
28 29 30 31
        "sshdirecttcpiptunnel.h", "sshdirecttcpiptunnel_p.h", "sshdirecttcpiptunnel.cpp",
        "ssherrors.h",
        "sshexception_p.h",
        "sshincomingpacket_p.h", "sshincomingpacket.cpp",
32
        "sshinit_p.h", "sshinit.cpp",
Orgad Shaneh's avatar
Orgad Shaneh committed
33
        "sshkeycreationdialog.cpp", "sshkeycreationdialog.h", "sshkeycreationdialog.ui",
34
        "sshkeyexchange.cpp", "sshkeyexchange_p.h",
Orgad Shaneh's avatar
Orgad Shaneh committed
35 36
        "sshkeygenerator.cpp", "sshkeygenerator.h",
        "sshkeypasswordretriever.cpp",
37 38 39 40
        "sshkeypasswordretriever_p.h",
        "sshoutgoingpacket.cpp", "sshoutgoingpacket_p.h",
        "sshpacket.cpp", "sshpacket_p.h",
        "sshpacketparser.cpp", "sshpacketparser_p.h",
Orgad Shaneh's avatar
Orgad Shaneh committed
41
        "sshpseudoterminal.h",
42 43 44
        "sshremoteprocess.cpp", "sshremoteprocess.h", "sshremoteprocess_p.h",
        "sshremoteprocessrunner.cpp", "sshremoteprocessrunner.h",
        "sshsendfacility.cpp", "sshsendfacility_p.h",
45 46
    ].concat(botanFiles)

47 48 49 50 51 52 53
    property var useSystemBotan: qbs.getenv("USE_SYSTEM_BOTAN") === "1"
    property var botanIncludes: {
        var result = ["../3rdparty"];
        if (useSystemBotan)
            result.push("/usr/include/botan-1.10")
        return result
    }
54 55
    property var botanLibs: {
        var result = [];
56 57
        if (useSystemBotan)
            result.push("botan-1.10")
Joerg Bornemann's avatar
Joerg Bornemann committed
58
        if (qbs.targetOS.contains("windows"))
59
            result.push("advapi32", "user32")
Joerg Bornemann's avatar
Joerg Bornemann committed
60
        else if (qbs.targetOS.contains("linux"))
Joerg Bornemann's avatar
Joerg Bornemann committed
61
            result.push("rt", "dl");
Joerg Bornemann's avatar
Joerg Bornemann committed
62
        else if (qbs.targetOS.contains("osx"))
Joerg Bornemann's avatar
Joerg Bornemann committed
63
            result.push("dl");
Joerg Bornemann's avatar
Joerg Bornemann committed
64
        else if (qbs.targetOS.contains("unix"))
Joerg Bornemann's avatar
Joerg Bornemann committed
65
            result.push("rt");
66 67
        return result
    }
68
    property var botanDefines: {
69
        var result = [];
70
        if (useSystemBotan) {
71
            result.push("USE_SYSTEM_BOTAN")
72
        } else {
73
            result.push("BOTAN_DLL=")
74
            if (qbs.toolchain.contains("msvc"))
Orgad Shaneh's avatar
Orgad Shaneh committed
75 76 77
                result.push("BOTAN_BUILD_COMPILER_IS_MSVC",
                            "BOTAN_TARGET_OS_HAS_GMTIME_S",
                            "_SCL_SECURE_NO_WARNINGS")
78
            if (qbs.toolchain.contains("gcc") || qbs.toolchain.contains("mingw"))
79
                result.push("BOTAN_BUILD_COMPILER_IS_GCC")
Joerg Bornemann's avatar
Joerg Bornemann committed
80
            if (qbs.targetOS.contains("linux"))
81 82 83 84 85 86 87
                result.push("BOTAN_TARGET_OS_IS_LINUX", "BOTAN_TARGET_OS_HAS_CLOCK_GETTIME",
                            "BOTAN_TARGET_OS_HAS_DLOPEN", " BOTAN_TARGET_OS_HAS_GMTIME_R",
                            "BOTAN_TARGET_OS_HAS_POSIX_MLOCK", "BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE",
                            "BOTAN_HAS_DYNAMIC_LOADER", "BOTAN_TARGET_OS_HAS_GETTIMEOFDAY",
                            "BOTAN_HAS_ALLOC_MMAP", "BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM",
                            "BOTAN_HAS_ENTROPY_SRC_EGD", "BOTAN_HAS_ENTROPY_SRC_FTW",
                            "BOTAN_HAS_ENTROPY_SRC_UNIX", "BOTAN_HAS_MUTEX_PTHREAD", "BOTAN_HAS_PIPE_UNIXFD_IO")
Joerg Bornemann's avatar
Joerg Bornemann committed
88
            if (qbs.targetOS.contains("osx"))
89 90 91 92
                result.push("BOTAN_TARGET_OS_IS_DARWIN", "BOTAN_TARGET_OS_HAS_GETTIMEOFDAY",
                            "BOTAN_HAS_ALLOC_MMAP", "BOTAN_HAS_ENTROPY_SRC_DEV_RANDOM",
                            "BOTAN_HAS_ENTROPY_SRC_EGD", "BOTAN_HAS_ENTROPY_SRC_FTW",
                            "BOTAN_HAS_ENTROPY_SRC_UNIX", "BOTAN_HAS_MUTEX_PTHREAD", "BOTAN_HAS_PIPE_UNIXFD_IO")
Joerg Bornemann's avatar
Joerg Bornemann committed
93
            if (qbs.targetOS.contains("windows"))
94 95 96 97 98 99
                result.push("BOTAN_TARGET_OS_IS_WINDOWS",
                            "BOTAN_TARGET_OS_HAS_LOADLIBRARY", "BOTAN_TARGET_OS_HAS_WIN32_GET_SYSTEMTIME",
                            "BOTAN_TARGET_OS_HAS_WIN32_VIRTUAL_LOCK", "BOTAN_HAS_DYNAMICALLY_LOADED_ENGINE",
                            "BOTAN_HAS_DYNAMIC_LOADER", "BOTAN_HAS_ENTROPY_SRC_CAPI",
                            "BOTAN_HAS_ENTROPY_SRC_WIN32", "BOTAN_HAS_MUTEX_WIN32")
        }
100 101 102 103 104 105 106 107
        return result
    }
    property var botanFiles: {
        var result = ["../3rdparty/botan/botan.h"];
        if (!useSystemBotan)
            result.push("../3rdparty/botan/botan.cpp")
        return result
    }
108 109 110

    // For Botan.
    Properties {
111
        condition: qbs.toolchain.contains("mingw")
112 113 114 115 116 117
        cpp.cxxFlags: [
            "-fpermissive",
            "-finline-functions",
            "-Wno-long-long"
        ]
    }
118

119
    Export {
Christian Kandeler's avatar
Christian Kandeler committed
120 121
        Depends { name: "Qt"; submodules: ["widgets", "network"] }
    }
122
}