add_library(duktape
  STATIC
    ${LOCAL_LIBRARY}/duktape/src/duktape.c
    ${LOCAL_LIBRARY}/duktape/extras/module-node/duk_module_node.c
)
target_compile_definitions(duktape
  PRIVATE
    DUK_USE_ARRAY_FASTPATH=1
    DUK_USE_ARRAY_PROP_FASTPATH=1
    DUK_USE_BASE64_FASTPATH=1
    DUK_USE_FAST_REFCOUNT_DEFAULT=1
    DUK_USE_HEX_FASTPATH=1
    DUK_USE_IDCHAR_FASTPATH=1
    DUK_USE_JSON_DECNUMBER_FASTPATH=1
    DUK_USE_JSON_DECSTRING_FASTPATH=1
    DUK_USE_JSON_EATWHITE_FASTPATH=1
    DUK_USE_JSON_QUOTESTRING_FASTPATH=1
    DUK_USE_REFERENCE_COUNTING=1
    DUK_USE_SYMBOL_BUILTIN=1
    $<$<CONFIG:Debug>:DUK_USE_INTERRUPT_COUNTER=1>
    $<$<CONFIG:Debug>:DUK_USE_DEBUGGER_DUMPHEAP=1>
    $<$<CONFIG:Debug>:DUK_USE_DEBUGGER_INSPECT=1>
    $<$<CONFIG:Debug>:DUK_USE_DEBUGGER_PAUSE_UNCAUGHT=1>
    $<$<CONFIG:Debug>:DUK_USE_DEBUGGER_SUPPORT=1>
    $<$<CONFIG:Debug>:DUK_USE_DEBUGGER_THROW_NOTIFY=1>
    $<$<NOT:$<CONFIG:Debug>>:DUK_USE_VALSTACK_UNSAFE=1>
)
target_include_directories(duktape
  PUBLIC
    ${LOCAL_LIBRARY}/duktape/src
    ${LOCAL_LIBRARY}/duktape/extras/module-node
)
target_link_libraries(rainbow duktape)
