Skip to content

Commit

Permalink
Merge branch 'titanlien-cpack'
Browse files Browse the repository at this point in the history
  • Loading branch information
Micah N Gorrell committed May 22, 2017
2 parents 137b77d + 2ce8c12 commit e56a154
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 6 deletions.
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,36 @@ configure_file(

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

SET(MAJOR_VERSION 1)
SET(MINOR_VERSION 0)
SET(PATCH_VERSION 1)
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

INCLUDE (InstallRequiredSystemLibraries)

SET (CPACK_SET_DESTDIR "on")
SET (CPACK_PACKAGING_INSTALL_PREFIX "/tmp")
SET (CPACK_GENERATOR "DEB")

SET (CPACK_DEBIAN_PACKAGE_PRIORITY "extra")
SET (CPACK_DEBIAN_PACKAGE_SECTION "libs")
SET (CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
# autogenerate dependency information
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

SET (CPACK_PACKAGE_DESCRIPTION "Short description")
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Long description")
SET (CPACK_PACKAGE_VENDOR "Titan Lien (digbil)")
SET (CPACK_PACKAGE_CONTACT "[email protected]")
SET (CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
SET (CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
SET (CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")

SET (CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")
SET (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}")

SET (CPACK_COMPONENTS_ALL Libraries ApplicationData)
INCLUDE (CPack)
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

9 changes: 9 additions & 0 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TARGET=validate
TARGET2=example

all:
gcc -o ${TARGET} ${TARGET}.c -lwjelement -lwjreader
gcc -o ${TARGET2} ${TARGET2}.c -lwjelement -lwjreader

clean:
rm ${TARGET} ${TARGET2}
10 changes: 6 additions & 4 deletions example/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ console.log(JSON.stringify(doc));
#include <wjelement.h>
#include <inttypes.h>

WJRType
WJE_GET_TYPE(WJElement parent)
{
return parent->child->next->type;
}

int main(int argc, char **argv) {
WJElement doc = NULL;
Expand Down Expand Up @@ -102,10 +107,7 @@ int main(int argc, char **argv) {
WJECloseDocument(WJEGet(doc, "shiny", NULL));

while((person = _WJEObject(doc, "crew[]", WJE_GET, &person))) {
printf("%s (%s) is %"PRId64"\n",
WJEString(person, "name", WJE_GET, ""),
WJEString(person, "job", WJE_GET, ""),
(2517 - WJEInt64(person, "born", WJE_GET, 0)));
printf("person Type is %c\n", WJE_GET_TYPE(person));
}
while((cameo = WJEGet(doc, "cameo[]", cameo))) {
printf("Cameo: %s\n", WJEString(cameo, NULL, WJE_GET, ""));
Expand Down
12 changes: 12 additions & 0 deletions example/layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "layout",
"headers": {
"msg_id": "DSCS1385112923586"
},
"obj": {
"name": "test",
"status": "draft",
"orientation": "landscape",
"widget": []
}
}
103 changes: 103 additions & 0 deletions example/layout.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"name": "layout schema check",
"type": "object",
"properties": {
"_id": {
"type": "string",
"required": true
},
"name": {
"type": "string",
"required": true
},
"template": {
"type": "string",
},
"orientation": {
"type": "string",
"enum": [
"portrait",
"landscape"
],
"required": true
},
"status": {
"type": "string",
"enum": [
"draft",
"ready"
],
"default": "ready",
"required": true
},
"ts": {
"type": "string",
"required": true
},
"widgets": {
"type": "array",
"required": true,
"items": {
"name": "widget setting",
"type": "object",
"additionalProperties": false,
"properties": {
"widget": {
"type": "string",
"required": true
},
"name": {
"type": "string",
"description": "Must be the widget name( package name )",
"required": true
},
"h": {
"type": "number",
"description": " 0.0 ~ 1.0",
"required": true
},
"w": {
"type": "number",
"description": " 0.0 ~ 1.0",
"required": true
},
"top": {
"type": "number",
"description": " 0.0 ~ 1.0",
"required": true
},
"left": {
"type": "number",
"description": " 0.0 ~ 1.0",
"required": true
},
"_id": {
"type": "string",
"required": true
},
"param": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"required": true
},
"val": {
"required": true
},

"_id": {
"type": "string",
"required": true
}
}
}
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion example/validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static WJElement schema_load(const char *name, void *client,
}
free(path);
}

WJEDump(schema);
return schema;
}

Expand Down
2 changes: 1 addition & 1 deletion include/xpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
typedef int XplBool;

#ifndef WIN32
typedef unsigned long LONG;
typedef long LONG;
#endif

#ifndef FALSE
Expand Down

0 comments on commit e56a154

Please sign in to comment.