Add libssh2 to SCons build

This commit is contained in:
Twarit Waikar
2021-10-11 23:05:52 +05:30
parent f73f6fb4b5
commit 0967424cb0
6 changed files with 95 additions and 10 deletions

3
.gitmodules vendored
View File

@@ -5,3 +5,6 @@
[submodule "libgit2"]
path = thirdparty/git2/libgit2
url = https://github.com/libgit2/libgit2
[submodule "thirdparty/ssh2/libssh2"]
path = thirdparty/ssh2/libssh2
url = https://github.com/libssh2/libssh2

View File

@@ -41,7 +41,7 @@ if env["platform"] == "osx":
elif env["platform"] in ("x11", "linux"):
env["target_path"] += "x11/"
cpp_library += ".linux"
env.Append(LIBS=["ssl", "crypto", "ssh2", "pcre"])
env.Append(LIBS=["ssl"])
if env["target"] in ("debug", "d"):
env.Append(CCFLAGS = ["-fPIC", "-g3","-Og", "-std=c++17"])
@@ -56,7 +56,7 @@ elif env["platform"] == "windows":
env.Append(ENV = os.environ)
env.Append(CCFLAGS = ["-DWIN32", "-D_WIN32", "-D_WINDOWS", "-W3", "-GR", "-D_CRT_SECURE_NO_WARNINGS", "/std:c++17"])
env.Append(LIBS=["Advapi32", "Winhttp", "Rpcrt4", "crypt32", "OLE32"])
env.Append(LIBS=["Advapi32", "Winhttp", "Rpcrt4", "crypt32", "OLE32", "user32"])
if env["target"] in ("debug", "d"):
env.Append(CCFLAGS = ["-EHsc", "-D_DEBUG", "-MDd", "/DEBUG"])
env["PDB"] = env["target_name"] + ".pdb"
@@ -73,11 +73,11 @@ if env["platform"] == "osx":
else:
cpp_library += "." + str(bits)
env.Append(CPPPATH=[".", "src/"])
env.Append(CPPPATH=[godot_headers_path, cpp_bindings_path + "include/", cpp_bindings_path + "include/core/", cpp_bindings_path + "include/gen/"])
env.Append(CPPPATH=["../thirdparty/git2/libgit2/include/"])
env.Append(LIBPATH=[cpp_bindings_path + "bin/", "../thirdparty/bin/"])
env.Append(LIBS=[cpp_library, "git2"])
env.Append(CPPPATH = [".", "src/"])
env.Append(CPPPATH = [godot_headers_path, cpp_bindings_path + "include/", cpp_bindings_path + "include/core/", cpp_bindings_path + "include/gen/"])
env.Append(CPPPATH = ["../thirdparty/git2/libgit2/include/"])
env.Append(LIBPATH = [cpp_bindings_path + "bin/", "../thirdparty/bin/"])
env.Append(LIBS = [cpp_library, "git2", "ssh2"])
library = env.SharedLibrary(
target = env["target_path"] + env["target_name"],

1
thirdparty/SCsub vendored
View File

@@ -1,3 +1,4 @@
#!/usr/bin/env python
SConscript("ssh2/SCsub")
SConscript("git2/SCsub")

10
thirdparty/git2/SCsub vendored
View File

@@ -42,14 +42,15 @@ env_git.Prepend(
"libgit2/deps/http-parser/",
"libgit2/deps/pcre/",
"libgit2/deps/zlib/",
"../ssh2/libssh2/include/",
]
)
env_git.Prepend(
CPPDEFINES=[
"GIT_THREADS",
#"GIT_SSH",
#"GIT_SSH_MEMORY_CREDENTIALS",
"GIT_SSH",
"GIT_SSH_MEMORY_CREDENTIALS",
"LIBGIT2_NO_FEATURES_H",
"GIT_SHA1_COLLISIONDETECT",
"GIT_HTTPS",
@@ -83,6 +84,8 @@ if env_git["platform"] == "windows":
"PCREGREP_BUFSIZE",
("MAX_NAME_SIZE", "32"),
("MAX_NAME_COUNT", "10000"),
"HAVE_WINCNG",
"LIBSSH2_WINCNG"
]
)
@@ -116,5 +119,6 @@ if env_git["platform"] in ["x11", "osx"]:
]
)
env_git["PDB"] = "git2.pdb"
env.Append(LIBPATH=["../bin/"])
env_git.StaticLibrary(target = "../bin/" + "git2", source = libgit2_sources)

76
thirdparty/ssh2/SCsub vendored Normal file
View File

@@ -0,0 +1,76 @@
#!/usr/bin/env python
# Adopted from https://github.com/nodegit/nodegit/blob/4561dcb7c120474a4553baa27e4c4c2f4be23a2b/vendor/libgit2.gyp
Import("env")
env_ssh2 = env.Clone()
# Thirdparty source files.
libssh2_sources = [
"libssh2/src/agent.c",
"libssh2/src/bcrypt_pbkdf.c",
"libssh2/src/blowfish.c",
"libssh2/src/crypt.c",
"libssh2/src/keepalive.c",
"libssh2/src/libgcrypt.c",
"libssh2/src/openssl.c",
"libssh2/src/publickey.c",
"libssh2/src/sftp.c",
"libssh2/src/version.c",
"libssh2/src/channel.c",
"libssh2/src/global.c",
"libssh2/src/kex.c",
"libssh2/src/mac.c",
"libssh2/src/packet.c",
"libssh2/src/scp.c",
"libssh2/src/transport.c",
"libssh2/src/comp.c",
"libssh2/src/hostkey.c",
"libssh2/src/knownhost.c",
"libssh2/src/misc.c",
"libssh2/src/pem.c",
"libssh2/src/session.c",
"libssh2/src/userauth.c",
]
env_ssh2.Prepend(
CPPPATH=[
"libssh2/include/"
"libssh2/src/"
]
)
env_ssh2.Prepend(
CPPDEFINES=[
]
)
if env_ssh2["platform"] == "windows":
env_ssh2.Append(
CPPPATH=[
"libssh2/include/",
"libssh2/win32/"
]
)
libssh2_sources += [ "libssh2/src/agent_win.c", "libssh2/src/wincng.c"]
env_ssh2.Append(
CPPDEFINES=[
"LIBSSH2_WINCNG",
"HAVE_WINCNG"
]
)
env_ssh2.Append(LIBS = ["crypt32", "user32"])
if env_ssh2["platform"] == "osx":
env_ssh2.Append(
CPPPATH=[
"libssh2/os400/"
]
)
libssh2_sources += ["libssh2/os400/" + "*.c"]
env_ssh2.Append(
CPPDEFINES=[]
)
env_ssh2.StaticLibrary(target = "../bin/" + "ssh2", source = libssh2_sources)

1
thirdparty/ssh2/libssh2 vendored Submodule

Submodule thirdparty/ssh2/libssh2 added at 635caa9078