mirror of
https://github.com/godotengine/godot-git-plugin.git
synced 2026-01-04 22:09:55 +03:00
Add links flags for linking to ssl on macOS + python cleanup
This commit is contained in:
50
SConstruct
50
SConstruct
@@ -7,42 +7,50 @@ EnsurePythonVersion(3, 5)
|
||||
|
||||
opts = Variables([], ARGUMENTS)
|
||||
|
||||
env = Environment(ENV = os.environ)
|
||||
env = Environment(ENV=os.environ)
|
||||
|
||||
# Define our options
|
||||
opts.Add(EnumVariable("target", "Compilation target", "debug", ["d", "debug", "r", "release"]))
|
||||
opts.Add(EnumVariable("platform", "Compilation platform", "", ["", "windows", "linux", "osx"]))
|
||||
opts.Add(EnumVariable("p", "Compilation target, alias for \"platform\"", "", ["", "windows", "linux", "osx"]))
|
||||
opts.Add(BoolVariable("godot_cpp", "Build godot-cpp by forwarding arguments to it.", "no"))
|
||||
opts.Add(BoolVariable("use_llvm", "Use the LLVM / Clang compiler - only effective when targeting Linux or FreeBSD.", "no"))
|
||||
opts.Add(PathVariable("target_path", "The path where the lib is installed.", "demo/addons/godot-git-plugin/"))
|
||||
opts.Add(PathVariable("target_name", "The library name.", "libgitapi", PathVariable.PathAccept))
|
||||
opts.Add(EnumVariable("target", "Compilation target",
|
||||
"debug", ["d", "debug", "r", "release"]))
|
||||
opts.Add(EnumVariable("platform", "Compilation platform",
|
||||
"", ["", "windows", "linux", "osx"]))
|
||||
opts.Add(EnumVariable("p", "Compilation target, alias for \"platform\"",
|
||||
"", ["", "windows", "linux", "osx"]))
|
||||
opts.Add(BoolVariable(
|
||||
"godot_cpp", "Build godot-cpp by forwarding arguments to it.", "no"))
|
||||
opts.Add(BoolVariable("use_llvm",
|
||||
"Use the LLVM / Clang compiler - only effective when targeting Linux or FreeBSD.", "no"))
|
||||
opts.Add(PathVariable("target_path",
|
||||
"The path where the lib is installed.", "demo/addons/godot-git-plugin/"))
|
||||
opts.Add(PathVariable("target_name", "The library name.",
|
||||
"libgitapi", PathVariable.PathAccept))
|
||||
opts.Add(EnumVariable("bits", "The bit architecture.", "64", ["64"]))
|
||||
opts.Add(EnumVariable("macos_arch", "Target macOS architecture", "universal", ["universal", "x86_64", "arm64"]))
|
||||
opts.Add(EnumVariable("macos_arch", "Target macOS architecture",
|
||||
"universal", ["universal", "x86_64", "arm64"]))
|
||||
# Updates the environment with the option variables.
|
||||
opts.Update(env)
|
||||
|
||||
if env["platform"] == "osx":
|
||||
# Use only clang on osx because we need to do universal builds
|
||||
env["CXX"] = "clang++"
|
||||
env["CC"] = "clang"
|
||||
# Use only clang on osx because we need to do universal builds
|
||||
env["CXX"] = "clang++"
|
||||
env["CC"] = "clang"
|
||||
|
||||
if env["macos_arch"] == "universal":
|
||||
env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
|
||||
env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])
|
||||
else:
|
||||
env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
|
||||
env.Append(CCFLAGS=["-arch", env["macos_arch"]])
|
||||
if env["macos_arch"] == "universal":
|
||||
env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
|
||||
env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])
|
||||
else:
|
||||
env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
|
||||
env.Append(CCFLAGS=["-arch", env["macos_arch"]])
|
||||
|
||||
Export("env")
|
||||
|
||||
SConscript("thirdparty/SCsub")
|
||||
|
||||
if env["godot_cpp"]:
|
||||
if ARGUMENTS.get("use_custom_api_file", False) and ARGUMENTS.get("custom_api_file", "") != "":
|
||||
ARGUMENTS["custom_api_file"] = "../" + ARGUMENTS["custom_api_file"]
|
||||
if ARGUMENTS.get("use_custom_api_file", False) and ARGUMENTS.get("custom_api_file", "") != "":
|
||||
ARGUMENTS["custom_api_file"] = "../" + ARGUMENTS["custom_api_file"]
|
||||
|
||||
SConscript("godot-cpp/SConstruct")
|
||||
SConscript("godot-cpp/SConstruct")
|
||||
|
||||
SConscript("godot-git-plugin/SCsub")
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ if not os.path.isdir(env["target_path"]):
|
||||
if env["platform"] == "osx":
|
||||
env["target_path"] += "osx/"
|
||||
cpp_library += ".osx"
|
||||
env.Append(LIBS=["ssl"])
|
||||
|
||||
env.Prepend(LIBPATH=["/usr/local/opt/openssl@1.1/lib/"])
|
||||
env.Append(LIBS=["ssl", "crypto"])
|
||||
|
||||
if env["target"] in ("debug", "d"):
|
||||
env.Append(CCFLAGS = ["-g","-O2", "-arch", "x86_64", "-arch", "arm64", "-std=c++17"])
|
||||
env.Append(LINKFLAGS = ["-arch", "x86_64", "-arch", "arm64"])
|
||||
env.Append(CCFLAGS=["-g", "-O2", "-std=c++17"])
|
||||
else:
|
||||
env.Append(CCFLAGS = ["-g","-O3", "-arch", "x86_64", "-arch", "arm64", "-std=c++17"])
|
||||
env.Append(LINKFLAGS = ["-arch", "x86_64", "-arch", "arm64"])
|
||||
env.Append(CCFLAGS=["-g", "-O3", "-std=c++17"])
|
||||
|
||||
elif env["platform"] == "linux":
|
||||
env["target_path"] += "linux/"
|
||||
@@ -46,24 +46,26 @@ elif env["platform"] == "linux":
|
||||
env.Append(LIBS=["ssl"])
|
||||
|
||||
if env["target"] in ("debug", "d"):
|
||||
env.Append(CCFLAGS = ["-fPIC", "-g3","-Og", "-std=c++17"])
|
||||
env.Append(CCFLAGS=["-fPIC", "-g3", "-Og", "-std=c++17"])
|
||||
else:
|
||||
env.Append(CCFLAGS = ["-fPIC", "-g","-O3", "-std=c++17"])
|
||||
env.Append(CCFLAGS=["-fPIC", "-g", "-O3", "-std=c++17"])
|
||||
|
||||
elif env["platform"] == "windows":
|
||||
env["target_path"] += "win64/"
|
||||
cpp_library += ".windows"
|
||||
# This makes sure to keep the session environment variables on windows,
|
||||
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
|
||||
env.Append(ENV = os.environ)
|
||||
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", "user32"])
|
||||
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", "user32"])
|
||||
if env["target"] in ("debug", "d"):
|
||||
env.Append(CCFLAGS = ["-EHsc", "-D_DEBUG", "-MDd", "/DEBUG"])
|
||||
env.Append(CCFLAGS=["-EHsc", "-D_DEBUG", "-MDd", "/DEBUG"])
|
||||
env["PDB"] = env["target_name"] + ".pdb"
|
||||
else:
|
||||
env.Append(CCFLAGS = ["-O2", "-EHsc", "-DNDEBUG", "-MD"])
|
||||
env.Append(CCFLAGS=["-O2", "-EHsc", "-DNDEBUG", "-MD"])
|
||||
|
||||
if env["target"] in ("debug", "d"):
|
||||
cpp_library += ".debug"
|
||||
@@ -75,13 +77,14 @@ if env['platform'] == 'osx' and env['macos_arch'] != 'universal':
|
||||
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", "ssh2"])
|
||||
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"],
|
||||
source = Glob("src/*.cpp"))
|
||||
target=env["target_path"] + env["target_name"],
|
||||
source=Glob("src/*.cpp"))
|
||||
Default(library)
|
||||
|
||||
9
thirdparty/git2/SCsub
vendored
9
thirdparty/git2/SCsub
vendored
@@ -91,14 +91,14 @@ if env_git["platform"] == "windows":
|
||||
)
|
||||
|
||||
if env_git["platform"] in ["linux", "osx"]:
|
||||
env_git.Append(CCFLAGS = "-fPIC")
|
||||
env_git.Append(CCFLAGS="-fPIC")
|
||||
libgit2_sources += [
|
||||
"libgit2/deps/ntlmclient/crypt_openssl.c",
|
||||
"libgit2/deps/ntlmclient/unicode_builtin.c"
|
||||
]
|
||||
env_git.Prepend(
|
||||
CPPDEFINES=[
|
||||
"HAVE_DIRENT_H",
|
||||
"HAVE_DIRENT_H",
|
||||
"HAVE_SYS_STAT_H",
|
||||
"HAVE_SYS_TYPES_H",
|
||||
"HAVE_UNISTD_H",
|
||||
@@ -131,7 +131,6 @@ if env_git["platform"] in ["linux", "osx"]:
|
||||
)
|
||||
|
||||
if env_git["platform"] == "osx":
|
||||
env_git.Prepend(CPPPATH = [ "/usr/local/opt/openssl@1.1/include/" ])
|
||||
env_git.Prepend(LIBPATH = [ "/usr/local/opt/openssl@1.1/lib/" ])
|
||||
env_git.Prepend(CPPPATH=["/usr/local/opt/openssl@1.1/include/"])
|
||||
|
||||
env_git.StaticLibrary(target = "../bin/" + "git2", source = libgit2_sources)
|
||||
env_git.StaticLibrary(target="../bin/" + "git2", source=libgit2_sources)
|
||||
|
||||
24
thirdparty/ssh2/SCsub
vendored
24
thirdparty/ssh2/SCsub
vendored
@@ -35,7 +35,7 @@ libssh2_sources = [
|
||||
]
|
||||
|
||||
env_ssh2.Prepend(
|
||||
CPPPATH = [
|
||||
CPPPATH=[
|
||||
"libssh2/include/"
|
||||
"libssh2/src/"
|
||||
]
|
||||
@@ -43,31 +43,31 @@ env_ssh2.Prepend(
|
||||
|
||||
if env_ssh2["platform"] == "windows":
|
||||
env_ssh2.Append(
|
||||
CPPPATH = [
|
||||
CPPPATH=[
|
||||
"libssh2/include/",
|
||||
"libssh2/win32/"
|
||||
]
|
||||
)
|
||||
libssh2_sources += [ "libssh2/src/agent_win.c", "libssh2/src/wincng.c"]
|
||||
libssh2_sources += ["libssh2/src/agent_win.c", "libssh2/src/wincng.c"]
|
||||
env_ssh2.Append(
|
||||
CPPDEFINES = [
|
||||
CPPDEFINES=[
|
||||
"LIBSSH2_WINCNG",
|
||||
"HAVE_WINCNG"
|
||||
]
|
||||
)
|
||||
env_ssh2.Append(LIBS = ["crypt32", "user32"])
|
||||
env_ssh2.Append(LIBS=["crypt32", "user32"])
|
||||
|
||||
if env_ssh2["platform"] in ["linux", "osx"]:
|
||||
env_ssh2.Append(CCFLAGS = "-fPIC")
|
||||
env_ssh2.Append(CCFLAGS="-fPIC")
|
||||
env_ssh2.Append(
|
||||
CPPPATH = [
|
||||
CPPPATH=[
|
||||
".",
|
||||
"libssh2/include/",
|
||||
]
|
||||
)
|
||||
libssh2_sources += ["libssh2/src/openssl.c"]
|
||||
env_ssh2.Append(
|
||||
CPPDEFINES = [
|
||||
CPPDEFINES=[
|
||||
"LIBSSH2_CONFIG_H",
|
||||
"HAVE_SYS_UIO_H",
|
||||
("HAVE_ALLOCA", 1),
|
||||
@@ -106,11 +106,11 @@ if env_ssh2["platform"] in ["linux", "osx"]:
|
||||
|
||||
if env_ssh2["platform"] == "osx":
|
||||
if env_ssh2["macos_arch"] == "universal":
|
||||
env_ssh2.Append(CPPDEFINES = [
|
||||
env_ssh2.Append(CPPDEFINES=[
|
||||
("WORDS_BIGENDIAN", "1"),
|
||||
("AC_APPLE_UNIVERSAL_BUILD", 1)
|
||||
])
|
||||
env_ssh2.Append(CPPPATH = [ "/usr/local/opt/openssl@1.1/include/" ])
|
||||
env_ssh2.Append(LIBPATH = [ "/usr/local/opt/openssl@1.1/lib/" ])
|
||||
env_ssh2.Append(CPPPATH=["/usr/local/opt/openssl@1.1/include/"])
|
||||
env_ssh2.Append(LIBPATH=["/usr/local/opt/openssl@1.1/lib/"])
|
||||
|
||||
env_ssh2.StaticLibrary(target = "../bin/" + "ssh2", source = libssh2_sources)
|
||||
env_ssh2.StaticLibrary(target="../bin/" + "ssh2", source=libssh2_sources)
|
||||
|
||||
Reference in New Issue
Block a user