# -*- mode: python -*-

Import("env")

env = env.Clone()

env.Append(CPPDEFINES=[
    ('PCRE2_CODE_UNIT_WIDTH', 8),
    'HAVE_CONFIG_H',
], )

# Directories that include generated config.h for various platforms
#
# Generated via
# AutoTools (non-Windows)
#  ./configure --disable-jit --with-match-limit-recursion=4000 --with-link-size=2 -enable-newline-is-lf --with-match-limit=200000 --with-parens-nest-limit=250 --enable-shared=no

# CMake (Windows)
#  -DPCRE_SUPPORT_PCREGREP_JIT:BOOL="0" -DPCRE_BUILD_TESTS:BOOL="0"
#  -DPCRE_POSIX_MALLOC_THRESHOLD:STRING="10" -DPCRE_MATCH_LIMIT_RECURSION:STRING="4000"
#  -DPCRE_NO_RECURSE:BOOL="1" -DPCRE_LINK_SIZE:STRING="2" -DPCRE_NEWLINE:STRING="LF"
#  -DPCRE_SUPPORT_UNICODE_PROPERTIES:BOOL="1" -DPCREGREP_BUFSIZE:STRING="20480"
#  -DPCRE_MATCH_LIMIT:STRING="200000" -DPCRE_PARENS_NEST_LIMIT:STRING="250"
#  -DPCRE_SUPPORT_UTF:BOOL="1"
#
if env.TargetOSIs('windows'):
    env.Append(CPPPATH=["build_windows"])
else:
    env.Append(CPPPATH=["build_posix"])

env.Library(
    target="pcre2",
    source=[
        "src/pcre2_auto_possess.c",
        "src/pcre2_chartables.c",
        "src/pcre2_compile.c",
        "src/pcre2_config.c",
        "src/pcre2_context.c",
        "src/pcre2_convert.c",
        "src/pcre2_dfa_match.c",
        "src/pcre2_error.c",
        "src/pcre2_extuni.c",
        "src/pcre2_find_bracket.c",
        "src/pcre2_jit_compile.c",
        "src/pcre2_maketables.c",
        "src/pcre2_match.c",
        "src/pcre2_match_data.c",
        "src/pcre2_newline.c",
        "src/pcre2_ord2utf.c",
        "src/pcre2_pattern_info.c",
        "src/pcre2_script_run.c",
        "src/pcre2_serialize.c",
        "src/pcre2_string_utils.c",
        "src/pcre2_study.c",
        "src/pcre2_xclass.c",
        "src/pcre2_substitute.c",
        "src/pcre2_substring.c",
        "src/pcre2_tables.c",
        "src/pcre2_ucd.c",
        "src/pcre2_ucptables.c",
        "src/pcre2_valid_utf.c",
    ],
)
