| 1 |
|
| 2 |
from misc.utility.scons_hints import * |
| 3 |
|
| 4 |
Import("env") |
| 5 |
Import("env_modules") |
| 6 |
|
| 7 |
env_regex = env_modules.Clone() |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
thirdparty_obj = [] |
| 12 |
|
| 13 |
if env["builtin_pcre2"]: |
| 14 |
thirdparty_dir = "#thirdparty/pcre2/src/" |
| 15 |
thirdparty_flags = ["PCRE2_STATIC", "HAVE_CONFIG_H", "SUPPORT_UNICODE"] |
| 16 |
|
| 17 |
if env["builtin_pcre2_with_jit"]: |
| 18 |
thirdparty_flags.append("SUPPORT_JIT") |
| 19 |
|
| 20 |
thirdparty_sources = [ |
| 21 |
"pcre2_auto_possess.c", |
| 22 |
"pcre2_chartables.c", |
| 23 |
"pcre2_chkdint.c", |
| 24 |
"pcre2_compile.c", |
| 25 |
"pcre2_compile_cgroup.c", |
| 26 |
"pcre2_compile_class.c", |
| 27 |
"pcre2_config.c", |
| 28 |
"pcre2_context.c", |
| 29 |
"pcre2_convert.c", |
| 30 |
"pcre2_dfa_match.c", |
| 31 |
"pcre2_error.c", |
| 32 |
"pcre2_extuni.c", |
| 33 |
"pcre2_find_bracket.c", |
| 34 |
"pcre2_jit_compile.c", |
| 35 |
"pcre2_maketables.c", |
| 36 |
"pcre2_match.c", |
| 37 |
"pcre2_match_data.c", |
| 38 |
"pcre2_match_next.c", |
| 39 |
"pcre2_newline.c", |
| 40 |
"pcre2_ord2utf.c", |
| 41 |
"pcre2_pattern_info.c", |
| 42 |
"pcre2_script_run.c", |
| 43 |
"pcre2_serialize.c", |
| 44 |
"pcre2_string_utils.c", |
| 45 |
"pcre2_study.c", |
| 46 |
"pcre2_substitute.c", |
| 47 |
"pcre2_substring.c", |
| 48 |
"pcre2_tables.c", |
| 49 |
"pcre2_ucd.c", |
| 50 |
"pcre2_valid_utf.c", |
| 51 |
"pcre2_xclass.c", |
| 52 |
] |
| 53 |
|
| 54 |
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] |
| 55 |
|
| 56 |
env_regex.Prepend(CPPPATH=[thirdparty_dir]) |
| 57 |
env_regex.Append(CPPDEFINES=thirdparty_flags) |
| 58 |
|
| 59 |
def pcre2_builtin(width): |
| 60 |
env_pcre2 = env_regex.Clone() |
| 61 |
env_pcre2.disable_warnings() |
| 62 |
env_pcre2["OBJSUFFIX"] = "_" + width + env_pcre2["OBJSUFFIX"] |
| 63 |
env_pcre2.Append(CPPDEFINES=[("PCRE2_CODE_UNIT_WIDTH", width)]) |
| 64 |
env_pcre2.add_source_files(thirdparty_obj, thirdparty_sources) |
| 65 |
|
| 66 |
pcre2_builtin("16") |
| 67 |
pcre2_builtin("32") |
| 68 |
env.modules_sources += thirdparty_obj |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
module_obj = [] |
| 74 |
|
| 75 |
env_regex.Append(CPPDEFINES=[("PCRE2_CODE_UNIT_WIDTH", 0)]) |
| 76 |
env_regex.add_source_files(module_obj, "*.cpp") |
| 77 |
env.modules_sources += module_obj |
| 78 |
|
| 79 |
|
| 80 |
env.Depends(module_obj, thirdparty_obj) |