mlc-ai / relax

Apache License 2.0
149 stars 75 forks source link

[Relax][VM] Add additional flags for picojson #288

Closed junrushao closed 1 year ago

junrushao commented 1 year ago

This commits adds __STDC_FORMAT_MACROS when including picojson in C++. This should fix a recent build issue as below:

In file included from src/runtime/relax_vm/ndarray_cache_support.cc:40:
3rdparty/picojson/picojson.h: In member function 'std::string picojson::value::to_str() const':
3rdparty/picojson/picojson.h:494:37: error: expected ')' before 'PRId64'
  494 |       SNPRINTF(buf, sizeof(buf), "%" PRId64, u_.int64_);
      |               ~                     ^~~~~~~
      |                                     )
3rdparty/picojson/picojson.h:81:1: note: 'PRId64' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?
   80 | #include <errno.h>
  +++ |+#include <cinttypes>
   81 | #include <inttypes.h>