summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--test/cplusplus.cpp16
-rw-r--r--test/main.c4
-rw-r--r--test/srcs.mk2
-rw-r--r--test/test.h11
5 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e7e89b3..ebf3547 100644
--- a/Makefile
+++ b/Makefile
@@ -118,6 +118,7 @@ APP_OBJS := $(OBJS) $(patsubst %.c,$(BUILD)/src/%.o,$(APP_SRCS)) $(MOD_OBJS)
LIB_OBJS := $(OBJS) $(MOD_OBJS)
TEST_OBJS := $(patsubst %.c,$(BUILD)/test/%.o,$(filter %.c,$(TEST_SRCS)))
+TEST_OBJS += $(patsubst %.cpp,$(BUILD)/test/%.o,$(filter %.cpp,$(TEST_SRCS)))
ifneq ($(LIBREM_PATH),)
LIBS += -L$(LIBREM_PATH)
@@ -192,6 +193,10 @@ $(BUILD)/%.o: %.c $(BUILD) Makefile $(APP_MK)
@echo " CC $@"
@$(CC) $(CFLAGS) -c $< -o $@ $(DFLAGS)
+$(BUILD)/%.o: %.cpp $(BUILD) Makefile $(APP_MK)
+ @echo " CXX $@"
+ @$(CXX) $(CXXFLAGS) -c $< -o $@ $(DFLAGS)
+
$(BUILD)/%.o: %.m $(BUILD) Makefile $(APP_MK)
@echo " OC $@"
@$(CC) $(CFLAGS) $(OBJCFLAGS) -c $< -o $@ $(DFLAGS)
diff --git a/test/cplusplus.cpp b/test/cplusplus.cpp
new file mode 100644
index 0000000..b6ddaa9
--- /dev/null
+++ b/test/cplusplus.cpp
@@ -0,0 +1,16 @@
+/**
+ * @file test/cplusplus.cpp Baresip selftest -- C++ compatibility
+ *
+ * Copyright (C) 2010 - 2015 Creytiv.com
+ */
+#include <re.h>
+#include <rem.h>
+#include <baresip.h>
+#include "test.h"
+
+
+int test_cplusplus(void)
+{
+ re_printf("c++ ok\n");
+ return 0;
+}
diff --git a/test/main.c b/test/main.c
index c32cd4b..11cc1b2 100644
--- a/test/main.c
+++ b/test/main.c
@@ -28,6 +28,10 @@ static int run_tests(void)
if (err)
return err;
+ err = test_cplusplus();
+ if (err)
+ return err;
+
return 0;
}
diff --git a/test/srcs.mk b/test/srcs.mk
index df16f8b..4115fdb 100644
--- a/test/srcs.mk
+++ b/test/srcs.mk
@@ -10,4 +10,6 @@ TEST_SRCS += ua.c
TEST_SRCS += sip_server.c
TEST_SRCS += test.c
+TEST_SRCS += cplusplus.c
+
TEST_SRCS += main.c
diff --git a/test/test.h b/test/test.h
index 20807b6..c2caa6a 100644
--- a/test/test.h
+++ b/test/test.h
@@ -56,3 +56,14 @@ int test_cmd(void);
int test_ua_alloc(void);
int test_uag_find_param(void);
int test_ua_register(void);
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int test_cplusplus(void);
+
+#ifdef __cplusplus
+}
+#endif