2016-10-17 14:50:25 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
Import('env')
|
2017-08-07 23:13:15 +08:00
|
|
|
Import('env_modules')
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-08-07 23:13:15 +08:00
|
|
|
env_regex = env_modules.Clone()
|
2016-10-15 18:39:28 +08:00
|
|
|
|
2017-09-25 12:22:58 +08:00
|
|
|
if env['builtin_pcre2']:
|
2017-10-23 00:51:39 +08:00
|
|
|
jit_blacklist = ['javascript', 'uwp']
|
2018-09-28 19:29:52 +08:00
|
|
|
|
2017-09-01 18:33:04 +08:00
|
|
|
thirdparty_dir = '#thirdparty/pcre2/src/'
|
|
|
|
thirdparty_flags = ['-DPCRE2_STATIC', '-DHAVE_CONFIG_H']
|
2018-09-28 19:29:52 +08:00
|
|
|
|
2017-09-01 18:33:04 +08:00
|
|
|
if 'platform' in env and env['platform'] not in jit_blacklist:
|
|
|
|
thirdparty_flags.append('-DSUPPORT_JIT')
|
2018-09-28 19:29:52 +08:00
|
|
|
|
2017-08-07 23:13:15 +08:00
|
|
|
thirdparty_sources = [
|
|
|
|
"pcre2_auto_possess.c",
|
|
|
|
"pcre2_chartables.c",
|
|
|
|
"pcre2_compile.c",
|
|
|
|
"pcre2_config.c",
|
|
|
|
"pcre2_context.c",
|
2018-05-24 14:13:24 +08:00
|
|
|
"pcre2_convert.c",
|
2017-08-07 23:13:15 +08:00
|
|
|
"pcre2_dfa_match.c",
|
|
|
|
"pcre2_error.c",
|
2018-05-24 14:13:24 +08:00
|
|
|
"pcre2_extuni.c",
|
2017-08-07 23:13:15 +08:00
|
|
|
"pcre2_find_bracket.c",
|
|
|
|
"pcre2_jit_compile.c",
|
2018-05-24 14:13:24 +08:00
|
|
|
#"pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c.
|
2017-08-07 23:13:15 +08:00
|
|
|
"pcre2_maketables.c",
|
|
|
|
"pcre2_match.c",
|
|
|
|
"pcre2_match_data.c",
|
|
|
|
"pcre2_newline.c",
|
|
|
|
"pcre2_ord2utf.c",
|
|
|
|
"pcre2_pattern_info.c",
|
|
|
|
"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 19:29:52 +08:00
|
|
|
|
2017-08-07 23:13:15 +08:00
|
|
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
2018-09-28 19:29:52 +08:00
|
|
|
|
2019-04-30 19:12:02 +08:00
|
|
|
env_regex.Prepend(CPPPATH=[thirdparty_dir])
|
2017-08-07 23:13:15 +08:00
|
|
|
env_regex.Append(CPPFLAGS=thirdparty_flags)
|
2018-09-28 19:29:52 +08:00
|
|
|
|
2017-08-07 23:13:15 +08:00
|
|
|
def pcre2_builtin(width):
|
2018-09-28 19:29:52 +08:00
|
|
|
env_pcre2 = env_regex.Clone()
|
|
|
|
env_pcre2.disable_warnings()
|
2017-08-07 23:13:15 +08:00
|
|
|
env_pcre2["OBJSUFFIX"] = "_" + width + env_pcre2["OBJSUFFIX"]
|
|
|
|
env_pcre2.add_source_files(env.modules_sources, thirdparty_sources)
|
|
|
|
env_pcre2.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=" + width])
|
2018-09-28 19:29:52 +08:00
|
|
|
|
2017-08-07 23:13:15 +08:00
|
|
|
pcre2_builtin("16")
|
|
|
|
pcre2_builtin("32")
|
2018-09-28 19:29:52 +08:00
|
|
|
|
|
|
|
env_regex.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=0"])
|
|
|
|
env_regex.add_source_files(env.modules_sources, "*.cpp")
|