summaryrefslogtreecommitdiffstats
path: root/test/ext/Makefile
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2017-06-12 06:49:33 +0200
committerNeale Ranns <nranns@cisco.com>2017-09-19 20:06:08 +0000
commitdc15be2ca7c51772b00e4c5548934a35aa7e4add (patch)
treeba4b707b73d21d3875264248a3affa93249816d3 /test/ext/Makefile
parent9d063047eb1a3738cb0fc9ebebb55793d155bb20 (diff)
Add C++ API
Change-Id: Iff634f22d43470e2dc028387b3816257fd7b4156 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/ext/Makefile')
-rw-r--r--test/ext/Makefile26
1 files changed, 20 insertions, 6 deletions
diff --git a/test/ext/Makefile b/test/ext/Makefile
index 4a45fef6782..a188427a62f 100644
--- a/test/ext/Makefile
+++ b/test/ext/Makefile
@@ -1,17 +1,31 @@
BINDIR = $(BR)/vapi_test/
-BIN = $(addprefix $(BINDIR), vapi_test)
+CBIN = $(addprefix $(BINDIR), vapi_c_test)
+CPPBIN = $(addprefix $(BINDIR), vapi_cpp_test)
+
LIBS = -L$(VPP_TEST_BUILD_DIR)/vpp/.libs/ -L$(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/ -lvppinfra -lvlibmemoryclient -lsvm -lpthread -lcheck -lsubunit -lrt -lm -lvapiclient
-CFLAGS = -ggdb -O0 -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi -I$(WS_ROOT)/src/vpp-api/vapi/
+CFLAGS = -std=gnu99 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
+CPPFLAGS = -std=c++11 -g -Wall -pthread -I$(WS_ROOT)/src -I$(VPP_TEST_INSTALL_PATH)/vpp/include -I$(BINDIR)
-all: $(BIN)
+all: $(CBIN) $(CPPBIN)
$(BINDIR):
mkdir -p $(BINDIR)
-SRC = vapi_test.c
+CSRC = vapi_c_test.c
+
+fake.api.vapi.h: fake.api.json $(BINDIR) $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py
+ $(WS_ROOT)/src/vpp-api/vapi/vapi_c_gen.py --prefix $(BINDIR) $<
+
+fake.api.vapi.hpp: fake.api.json $(BINDIR) $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py
+ $(WS_ROOT)/src/vpp-api/vapi/vapi_cpp_gen.py --prefix $(BINDIR) $<
+
+$(CBIN): $(CSRC) $(BINDIR) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so fake.api.vapi.h
+ $(CC) -o $@ $(CFLAGS) $(CSRC) $(LIBS)
+
+CPPSRC = vapi_cpp_test.cpp
-$(BIN): $(SRC) $(BINDIR) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so
- gcc -ggdb -o $@ $(SRC) $(CFLAGS) $(LIBS)
+$(CPPBIN): $(CPPSRC) $(BINDIR) $(VPP_TEST_BUILD_DIR)/vpp/vpp-api/vapi/.libs/libvapiclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvppinfra.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libvlibmemoryclient.so $(VPP_TEST_BUILD_DIR)/vpp/.libs/libsvm.so fake.api.vapi.hpp
+ $(CXX) -o $@ $(CPPFLAGS) $(CPPSRC) $(LIBS)
clean:
rm -rf $(BINDIR)