changeset 2678:010e74541aca

Test application for json-c. Squashed commit of the following: commit 1ad29ec164b9f07781f68fbe39276428105e3d8e Author: Thomas Mayer <thomas@residuum.org> Date: Fri Aug 10 20:51:42 2012 +0200 Test for json-c actually outputs something instead of just return 0 or 1. commit 2650c38c79a627f25c7dda9e89dd1acaca8d3663 Author: Thomas Mayer <thomas@residuum.org> Date: Sat Aug 4 16:46:28 2012 +0200 Test case for json-c.
author Thomas Mayer <thomas@residuum.org>
date Fri, 10 Aug 2012 21:05:20 +0200
parents 6522e8f7a7f2
children 6cf5b6f1c0bc
files src/json-c-test.c src/json-c.mk
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/json-c-test.c	Fri Aug 10 21:05:20 2012 +0200
@@ -0,0 +1,23 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+#include <json/json.h>
+#include <stdio.h> 
+
+int main(int argc, char *argv[])
+{
+    json_object *jobj;
+
+    (void)argc;
+    (void)argv;
+
+    jobj = json_object_new_object();
+    if (!jobj) {
+        return 1;
+    }
+    json_object_object_add(jobj, "key", json_object_new_string("value"));
+    printf("%s", json_object_to_json_string(jobj));
+    return 0;
+}
--- a/src/json-c.mk	Thu Jul 26 12:10:30 2012 +0200
+++ b/src/json-c.mk	Fri Aug 10 21:05:20 2012 +0200
@@ -25,4 +25,9 @@
         --disable-shared
         CFLAGS=-Wno-error
     $(MAKE) -C '$(1)' -j '$(JOBS)' install
+	
+    '$(TARGET)-gcc' \
+        -W -Wall -Werror -ansi -pedantic \
+        '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-json-c.exe' \
+        `'$(TARGET)-pkg-config' json --cflags --libs`
 endef