SCsub 1.9 KB

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