SCsub 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env python
  2. Import('env')
  3. Import('env_modules')
  4. env_regex = env_modules.Clone()
  5. if env['builtin_pcre2']:
  6. jit_blacklist = ['javascript', 'uwp']
  7. thirdparty_dir = '#thirdparty/pcre2/src/'
  8. thirdparty_flags = ['-DPCRE2_STATIC', '-DHAVE_CONFIG_H']
  9. if 'platform' in env and env['platform'] not in jit_blacklist:
  10. thirdparty_flags.append('-DSUPPORT_JIT')
  11. thirdparty_sources = [
  12. "pcre2_auto_possess.c",
  13. "pcre2_chartables.c",
  14. "pcre2_compile.c",
  15. "pcre2_config.c",
  16. "pcre2_context.c",
  17. "pcre2_convert.c",
  18. "pcre2_dfa_match.c",
  19. "pcre2_error.c",
  20. "pcre2_extuni.c",
  21. "pcre2_find_bracket.c",
  22. "pcre2_jit_compile.c",
  23. #"pcre2_jit_match.c", "pcre2_jit_misc.c", # these files are included in pcre2_jit_compile.c.
  24. "pcre2_maketables.c",
  25. "pcre2_match.c",
  26. "pcre2_match_data.c",
  27. "pcre2_newline.c",
  28. "pcre2_ord2utf.c",
  29. "pcre2_pattern_info.c",
  30. "pcre2_script_run.c",
  31. "pcre2_serialize.c",
  32. "pcre2_string_utils.c",
  33. "pcre2_study.c",
  34. "pcre2_substitute.c",
  35. "pcre2_substring.c",
  36. "pcre2_tables.c",
  37. "pcre2_ucd.c",
  38. "pcre2_valid_utf.c",
  39. "pcre2_xclass.c",
  40. ]
  41. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  42. env_regex.Append(CPPPATH=[thirdparty_dir])
  43. env_regex.Append(CPPFLAGS=thirdparty_flags)
  44. def pcre2_builtin(width):
  45. env_pcre2 = env_regex.Clone()
  46. env_pcre2.disable_warnings()
  47. env_pcre2["OBJSUFFIX"] = "_" + width + env_pcre2["OBJSUFFIX"]
  48. env_pcre2.add_source_files(env.modules_sources, thirdparty_sources)
  49. env_pcre2.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=" + width])
  50. pcre2_builtin("16")
  51. pcre2_builtin("32")
  52. env_regex.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=0"])
  53. env_regex.add_source_files(env.modules_sources, "*.cpp")