changeset 2690:6cf5b6f1c0bc

Merge pull request #65 from residuum/master Test case for json-c
author mabrand <mabrand@mabrand.nl>
date Sun, 12 Aug 2012 06:20:36 -0700
parents bff0238b5717 (current diff) 010e74541aca (diff)
children 3abd2de6c2d7
files
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	Sun Aug 12 06:20:36 2012 -0700
@@ -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	Sun Aug 12 06:18:43 2012 -0700
+++ b/src/json-c.mk	Sun Aug 12 06:20:36 2012 -0700
@@ -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