2016-10-17 06:50:25 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
Import("env")
|
|
|
|
Import("env_modules")
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-08-07 15:13:15 +00:00
|
|
|
env_regex = env_modules.Clone()
|
2016-10-15 10:39:28 +00:00
|
|
|
|
2020-12-17 15:01:36 +00:00
|
|
|
# Thirdparty source files
|
|
|
|
|
|
|
|
thirdparty_obj = []
|
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
if env["builtin_pcre2"]:
|
|
|
|
thirdparty_dir = "#thirdparty/pcre2/src/"
|
2020-06-11 06:45:05 +00:00
|
|
|
thirdparty_flags = ["PCRE2_STATIC", "HAVE_CONFIG_H", "SUPPORT_UNICODE"]
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
if env["builtin_pcre2_with_jit"]:
|
|
|
|
thirdparty_flags.append("SUPPORT_JIT")
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2017-08-07 15:13:15 +00:00
|
|
|
thirdparty_sources = [
|
|
|
|
"pcre2_auto_possess.c",
|
|
|
|
"pcre2_chartables.c",
|
2024-03-11 02:15:07 +00:00
|
|
|
"pcre2_chkdint.c",
|
2017-08-07 15:13:15 +00:00
|
|
|
"pcre2_compile.c",
|
|
|
|
"pcre2_config.c",
|
|
|
|
"pcre2_context.c",
|
2018-05-24 06:13:24 +00:00
|
|
|
"pcre2_convert.c",
|
2017-08-07 15:13:15 +00:00
|
|
|
"pcre2_dfa_match.c",
|
|
|
|
"pcre2_error.c",
|
2018-05-24 06:13:24 +00:00
|
|
|
"pcre2_extuni.c",
|
2017-08-07 15:13:15 +00:00
|
|
|
"pcre2_find_bracket.c",
|
|
|
|
"pcre2_jit_compile.c",
|
2020-03-30 06:28:32 +00:00
|
|
|
# "pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c.
|
2017-08-07 15:13:15 +00:00
|
|
|
"pcre2_maketables.c",
|
|
|
|
"pcre2_match.c",
|
|
|
|
"pcre2_match_data.c",
|
|
|
|
"pcre2_newline.c",
|
|
|
|
"pcre2_ord2utf.c",
|
|
|
|
"pcre2_pattern_info.c",
|
2019-07-11 08:27:11 +00:00
|
|
|
"pcre2_script_run.c",
|
2017-08-07 15:13:15 +00:00
|
|
|
"pcre2_serialize.c",
|
|
|
|
"pcre2_string_utils.c",
|
|
|
|
"pcre2_study.c",
|
|
|
|
"pcre2_substitute.c",
|
|
|
|
"pcre2_substring.c",
|
|
|
|
"pcre2_tables.c",
|
|
|
|
"pcre2_ucd.c",
|
|
|
|
"pcre2_valid_utf.c",
|
|
|
|
"pcre2_xclass.c",
|
|
|
|
]
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2017-08-07 15:13:15 +00:00
|
|
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2019-04-30 11:12:02 +00:00
|
|
|
env_regex.Prepend(CPPPATH=[thirdparty_dir])
|
2019-07-03 07:16:20 +00:00
|
|
|
env_regex.Append(CPPDEFINES=thirdparty_flags)
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2017-08-07 15:13:15 +00:00
|
|
|
def pcre2_builtin(width):
|
2018-09-28 11:29:52 +00:00
|
|
|
env_pcre2 = env_regex.Clone()
|
|
|
|
env_pcre2.disable_warnings()
|
2017-08-07 15:13:15 +00:00
|
|
|
env_pcre2["OBJSUFFIX"] = "_" + width + env_pcre2["OBJSUFFIX"]
|
2019-07-03 07:16:20 +00:00
|
|
|
env_pcre2.Append(CPPDEFINES=[("PCRE2_CODE_UNIT_WIDTH", width)])
|
2020-12-17 15:01:36 +00:00
|
|
|
env_pcre2.add_source_files(thirdparty_obj, thirdparty_sources)
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2017-08-07 15:13:15 +00:00
|
|
|
pcre2_builtin("16")
|
|
|
|
pcre2_builtin("32")
|
2022-09-27 11:45:02 +00:00
|
|
|
env.modules_sources += thirdparty_obj
|
2018-09-28 11:29:52 +00:00
|
|
|
|
2020-12-17 15:01:36 +00:00
|
|
|
|
|
|
|
# Godot source files
|
|
|
|
|
|
|
|
module_obj = []
|
|
|
|
|
2019-07-03 07:16:20 +00:00
|
|
|
env_regex.Append(CPPDEFINES=[("PCRE2_CODE_UNIT_WIDTH", 0)])
|
2020-12-17 15:01:36 +00:00
|
|
|
env_regex.add_source_files(module_obj, "*.cpp")
|
|
|
|
env.modules_sources += module_obj
|
|
|
|
|
|
|
|
# Needed to force rebuilding the module files when the thirdparty library is updated.
|
|
|
|
env.Depends(module_obj, thirdparty_obj)
|