-
Notifications
You must be signed in to change notification settings - Fork 9
/
SCsub
91 lines (55 loc) · 2.03 KB
/
SCsub
1
2
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env python
#SCsub
import os
from tools import helpers, openssl, boost
##### ENVIROMENT #####
Import('env')
mysql_env = env.Clone()
# You don't have to compile third-party libraries each time you compile the module.
# With the "recompile" option you can recompile just Openssl or just Boost, both of them or none of them.
opts = Variables(["customs.py"], ARGUMENTS)
opts.Add(EnumVariable("recompile_sql", "Recompile third party library", "all", ("all", "openssl", "boost", "none")))
opts.Update(mysql_env)
##### FLAGS #####
# Enable Boost separate compilation mode
#mysql_env.Append(CPPDEFINES=["BOOST_MYSQL_SEPARATE_COMPILATION"])
# Build with exceptions!
#if env["disable_exceptions"]:
# if env.msvc and ("_HAS_EXCEPTIONS", 0) in mysql_env["CPPDEFINES"]:
# mysql_env["CPPDEFINES"].remove(("_HAS_EXCEPTIONS", 0))
# mysql_env.AppendUnique(CPPFLAGS=["/EHsc"])
# elif not env.msvc and "-fno-exceptions" in mysql_env["CPPFLAGS"]:
# mysql_env["CPPFLAGS"].remove("-fno-exceptions")
mysql_env.Append(CPPFLAGS=[
'-fexceptions',
'-std=c++20',
])
target_bits = "64" if env["arch"] in ["x86_64", "arm64", "rv64", "ppc64"] else "32"
##### PATHS #####
# Use absolut paths to avoid problem between platforms.
# dep_path = os.path.join(os.getcwd(), "3party")
openssl_path = openssl.get_openssl_install_path(mysql_env)
openssl_include_path = openssl_path + "/include"
openssl_lib_path = openssl_path + "/lib64"
boost_path = boost.get_boost_install_path(mysql_env)
boost_include_path = boost_path + "/include"
boost_lib_path = boost_path + "/stage/lib"
##### THIRDPARTY COMPILATION #####
# Update and compile thirdparty.
helpers.apply_config(mysql_env)
##### GODOT MODULE #####
# INCLUDE:
mysql_env.Prepend(CPPPATH=[
openssl_include_path,
boost_include_path,
# openssl_path
])
# LIB
env.Prepend(LIBPATH=[
openssl_lib_path,
boost_lib_path,
# openssl_path
])
mysql_env.add_source_files(env.modules_sources, "*.cpp")
mysql_env.add_source_files(env.modules_sources, "scr/**.cpp")
env.Prepend(LIBS=["libboost_thread", "libcrypto", "libssl"])