%%-*- mode: erlang -*-
{eunit_opts, [verbose]}.

{xref_checks, [undefined_function_calls]}.

{erl_opts, [warnings_as_errors, debug_info]}.

{plugins, [pc]}.

{provider_hooks, [{post, [{compile, {pc, compile}},
                          {clean, {pc, clean}}]
                  }]
}.

{so_name, "eleveldb.so"}.
{port_sources, ["c_src/*.cc"]}.
{artifacts, ["priv/eleveldb.so"]}.

%% Make sure to set -fPIC when compiling leveldb
{port_env,
 [{"CFLAGS", "$CFLAGS -Wall -O3 -fPIC"},
  {"CXXFLAGS", "$CXXFLAGS -Wall -O3 -fPIC"},
  {"DRV_CFLAGS", "$DRV_CFLAGS -O3 -Wall -I c_src/leveldb/include -I c_src/leveldb -I c_src/system/include"},
  {"DRV_LDFLAGS", "$DRV_LDFLAGS c_src/leveldb/libleveldb.a c_src/system/lib/libsnappy.a -lstdc++"}
 ]}.

{pre_hooks, [{compile, "c_src/build_deps.sh get-deps"},
             {compile, "c_src/build_deps.sh"}]}.

{post_hooks, [{clean, "c_src/build_deps.sh clean"}]}.

{profiles, [{test, [{deps, [{cuttlefish, ".*", {git, "git://github.com/basho/cuttlefish.git", {tag, "2.0.1"}}}]}]}]}.
