Now database support is disable dby default, and can be enabled by passing databases=yes to the engine's build script.

This commit is contained in:
Relintai 2021-08-04 23:27:18 +02:00
parent 0b8dcea37a
commit f31052ff76
2 changed files with 39 additions and 28 deletions

View File

@ -80,6 +80,7 @@ opts.Add(EnumVariable("target", "Compilation target", "debug", ("debug", "releas
opts.Add("folders", "App folders to compile", "")
opts.Add("main_file", "The main file", "")
opts.Add("module_folders", "App module folders to compile", "")
opts.Add("databases", "Whether to have database support", False)
# Compilation environment setup
opts.Add("CXX", "C++ compiler")
@ -110,24 +111,26 @@ scons_ver = env_base._get_major_minor_revision(scons_raw_version)
if scons_ver >= (4, 0, 0):
env_base.Tool("compilation_db")
database_list = []
for x in sorted(glob.glob("database/*")):
if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"):
continue
tmppath = "./" + x
if env_base["databases"]:
env_base.Append(CPPDEFINES=["DATABASES_ENABLED"])
sys.path.insert(0, tmppath)
import detect
for x in sorted(glob.glob("database/*")):
if not os.path.isdir(x) or not os.path.exists(x + "/detect.py"):
continue
tmppath = "./" + x
if detect.is_active() and detect.can_build():
x = x.replace("database/", "") # rest of world
x = x.replace("database\\", "") # win32
database_list += [x]
sys.path.insert(0, tmppath)
import detect
sys.path.remove(tmppath)
sys.modules.pop("detect")
if detect.is_active() and detect.can_build():
x = x.replace("database/", "") # rest of world
x = x.replace("database\\", "") # win32
database_list += [x]
sys.path.remove(tmppath)
sys.modules.pop("detect")
modfol = env_base["module_folders"].split(";")
@ -177,27 +180,28 @@ Export("env")
SConscript("core/SCsub")
for d in database_list:
tmppath = "./database/" + d
sys.path.insert(0, tmppath)
if env_base["databases"]:
for d in database_list:
tmppath = "./database/" + d
sys.path.insert(0, tmppath)
import detect
import detect
env_db = env_base.Clone()
env_db = env_base.Clone()
if scons_ver >= (4, 0, 0):
env_db.Tool("compilation_db")
env_db.Alias("compiledb", env_base.CompilationDatabase())
if scons_ver >= (4, 0, 0):
env_db.Tool("compilation_db")
env_db.Alias("compiledb", env_base.CompilationDatabase())
detect.configure(env_db)
detect.configure(env)
detect.configure(env_db)
detect.configure(env)
Export("env_db")
Export("env_db")
SConscript("database/" + d + "/SCsub")
SConscript("database/" + d + "/SCsub")
sys.path.remove(tmppath)
sys.modules.pop("detect")
sys.path.remove(tmppath)
sys.modules.pop("detect")
for m in module_list:
tmppath = m[1]

View File

@ -62,8 +62,13 @@ def configure(env):
if not err:
env.ParseConfig("pkg-config libcares --cflags --libs")
err = os.system("pkg-config openssl --modversion --silence-errors > /dev/null ")
err = os.system("pkg-config zlib --modversion --silence-errors > /dev/null ")
if not err:
env.ParseConfig("pkg-config zlib --cflags --libs")
err = os.system("pkg-config openssl --modversion --silence-errors > /dev/null ")
if not err:
env.ParseConfig("pkg-config openssl --cflags --libs")
env.Append(CPPDEFINES=["OPENSSL_FOUND"])
@ -75,4 +80,6 @@ def configure(env):
env.Prepend(CPPPATH=["#modules/drogon/trantor/net"])
env.Prepend(CPPPATH=["#modules/drogon/trantor/net/inner"])
env.Prepend(CPPPATH=["#modules/drogon/trantor/utils"])
env.Append(LINKFLAGS=["-ldl"])