SCsub 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env python
  2. Import('env')
  3. Import('env_modules')
  4. env_regex = env_modules.Clone()
  5. env_regex.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=0"])
  6. env_regex.add_source_files(env.modules_sources, "*.cpp")
  7. if env['builtin_pcre2']:
  8. jit_blacklist = ['javascript', 'uwp']
  9. thirdparty_dir = '#thirdparty/pcre2/src/'
  10. thirdparty_flags = ['-DPCRE2_STATIC', '-DHAVE_CONFIG_H']
  11. if 'platform' in env and env['platform'] not in jit_blacklist:
  12. thirdparty_flags.append('-DSUPPORT_JIT')
  13. thirdparty_sources = [
  14. "pcre2_auto_possess.c",
  15. "pcre2_chartables.c",
  16. "pcre2_compile.c",
  17. "pcre2_config.c",
  18. "pcre2_context.c",
  19. "pcre2_dfa_match.c",
  20. "pcre2_error.c",
  21. "pcre2_find_bracket.c",
  22. "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_serialize.c",
  30. "pcre2_string_utils.c",
  31. "pcre2_study.c",
  32. "pcre2_substitute.c",
  33. "pcre2_substring.c",
  34. "pcre2_tables.c",
  35. "pcre2_ucd.c",
  36. "pcre2_valid_utf.c",
  37. "pcre2_xclass.c",
  38. ]
  39. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  40. env_regex.Append(CPPPATH=[thirdparty_dir])
  41. env_regex.Append(CPPFLAGS=thirdparty_flags)
  42. def pcre2_builtin(width):
  43. env_pcre2 = env_modules.Clone()
  44. env_pcre2["OBJSUFFIX"] = "_" + width + env_pcre2["OBJSUFFIX"]
  45. env_pcre2.Append(CPPPATH=[thirdparty_dir])
  46. env_pcre2.add_source_files(env.modules_sources, thirdparty_sources)
  47. env_pcre2.Append(CPPFLAGS=thirdparty_flags)
  48. env_pcre2.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=" + width])
  49. pcre2_builtin("16")
  50. pcre2_builtin("32")