ssh.qbs 5.18 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 32
        "sshdirecttcpiptunnel.h", "sshdirecttcpiptunnel_p.h", "sshdirecttcpiptunnel.cpp",
        "ssherrors.h",
        "sshexception_p.h",
        "sshincomingpacket_p.h", "sshincomingpacket.cpp",
        "sshkeycreationdialog.cpp", "sshkeycreationdialog.h", "sshkeycreationdialog.ui",
33
        "sshkeyexchange.cpp", "sshkeyexchange_p.h",
Orgad Shaneh's avatar
Orgad Shaneh committed
34 35
        "sshkeygenerator.cpp", "sshkeygenerator.h",
        "sshkeypasswordretriever.cpp",
36 37 38 39
        "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
40
        "sshpseudoterminal.h",
41 42 43
        "sshremoteprocess.cpp", "sshremoteprocess.h", "sshremoteprocess_p.h",
        "sshremoteprocessrunner.cpp", "sshremoteprocessrunner.h",
        "sshsendfacility.cpp", "sshsendfacility_p.h",
44 45
    ].concat(botanFiles)

46 47 48 49 50 51 52
    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
    }
53 54
    property var botanLibs: {
        var result = [];
55 56
        if (useSystemBotan)
            result.push("botan-1.10")
Joerg Bornemann's avatar
Joerg Bornemann committed
57
        if (qbs.targetOS.contains("windows"))
58
            result.push("advapi32", "user32")
Joerg Bornemann's avatar
Joerg Bornemann committed
59
        else if (qbs.targetOS.contains("linux"))
Joerg Bornemann's avatar
Joerg Bornemann committed
60
            result.push("rt", "dl");
Joerg Bornemann's avatar
Joerg Bornemann committed
61
        else if (qbs.targetOS.contains("osx"))
Joerg Bornemann's avatar
Joerg Bornemann committed
62
            result.push("dl");
Joerg Bornemann's avatar
Joerg Bornemann committed
63
        else if (qbs.targetOS.contains("unix"))
Joerg Bornemann's avatar
Joerg Bornemann committed
64
            result.push("rt");
65 66
        return result
    }
67
    property var botanDefines: {
68
        var result = [];
69
        if (useSystemBotan) {
70
            result.push("USE_SYSTEM_BOTAN")
71
        } else {
72
            result.push("BOTAN_DLL=")
73 74 75 76
            if (qbs.toolchain === "msvc")
                result.push("BOTAN_BUILD_COMPILER_IS_MSVC", "BOTAN_TARGET_OS_HAS_GMTIME_S")
            if (qbs.toolchain === "gcc" || qbs.toolchain === "mingw")
                result.push("BOTAN_BUILD_COMPILER_IS_GCC")
Joerg Bornemann's avatar
Joerg Bornemann committed
77
            if (qbs.targetOS.contains("linux"))
78 79 80 81 82 83 84
                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
85
            if (qbs.targetOS.contains("osx"))
86 87 88 89
                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
90
            if (qbs.targetOS.contains("windows"))
91 92 93 94 95 96
                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")
        }
97 98 99 100 101 102 103 104
        return result
    }
    property var botanFiles: {
        var result = ["../3rdparty/botan/botan.h"];
        if (!useSystemBotan)
            result.push("../3rdparty/botan/botan.cpp")
        return result
    }
105 106 107 108 109 110 111 112 113 114

    // For Botan.
    Properties {
        condition: qbs.toolchain === "mingw"
        cpp.cxxFlags: [
            "-fpermissive",
            "-finline-functions",
            "-Wno-long-long"
        ]
    }
115

116
    Export {
Christian Kandeler's avatar
Christian Kandeler committed
117 118
        Depends { name: "Qt"; submodules: ["widgets", "network"] }
    }
119
}