# `mangle` function is defined in src/scripts/cmake/Utils.cmake
  mangle(${CMAKE_CURRENT_BINARY_DIR}/pythonastgen.c  # an C file output containing python code
         ${CMAKE_CURRENT_SOURCE_DIR} # the input directory folder where python files are located
         RECURSIVE 1
         WILDCARD *.py
         SINGLE
         PREFIX esbmc_pythonastgen_
         MACRO ESBMC_FLAIL
         ACC_HEADERS_INTO ${CMAKE_CURRENT_BINARY_DIR}/pythonastgen.h
         LIST_DIRECTORIES FALSE
  )

add_library(pythonfrontend STATIC
            python_language.cpp
            python_converter.cpp
            converter/converter_binop.cpp
            converter/converter_class.cpp
            converter/converter_compare.cpp
            converter/converter_dunder.cpp
            converter/converter_expr.cpp
            converter/converter_funcall.cpp
            converter/converter_funcdef.cpp
            converter/converter_stmt.cpp
            converter/converter_symbols.cpp
            converter/converter_types.cpp
            converter/converter_unop.cpp
            converter/converter_util.cpp
            python_class.cpp
            python_class_builder.cpp
            python_consteval.cpp
            python_dict_handler.cpp
            python_exception_handler.cpp
            python_lambda.cpp
            python_list.cpp
            python_math.cpp
            python_set.cpp
            python_typechecking.cpp
            pythonastgen.c
            module_manager.cpp
            module_locator.cpp
            python_annotation/annotation_intrinsics.cpp
            python_annotation/annotation_parser.cpp
            python_annotation/annotation_utils.cpp
            symbol_id.cpp
            type_handler.cpp
            cmath_lowering_policy.cpp
            complex_handler.cpp
            complex_handler_utils.cpp
            function_call/builtins.cpp
            function_call/expr.cpp
            function_call/str_conv.cpp
            numpy_call_expr.cpp
            function_call/builder.cpp
            string/string_builder.cpp
            string/string_handler.cpp
            string/string_method_handler.cpp
            string/string_handler_utils.cpp
            exception_utils.cpp
            string/char_utils.cpp
            math_guard_utils.cpp
            parse_float.cpp
            tuple_handler.cpp
            convert_float_literal.cpp)

target_include_directories(pythonfrontend
    PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
    PRIVATE ${CMAKE_BINARY_DIR}/src/python-frontend
    PUBLIC ${CMAKE_SOURCE_DIR}/src
    PUBLIC ${Boost_INCLUDE_DIRS}
)

target_link_libraries(pythonfrontend PUBLIC nlohmann_json::nlohmann_json PRIVATE fmt::fmt bigint)
