pantry/projects/github.com/DaveGamble/cJSON/package.yml
2023-02-11 05:52:24 -05:00

47 lines
No EOL
994 B
YAML

distributable:
url: https://github.com/DaveGamble/cJSON/archive/v1.7.15.tar.gz
strip-components: 1
versions:
github: DaveGamble/cJSON
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
cmake.org: ^3
working-directory: build
script: |
cmake .. $ARGS
make --jobs {{ hw.concurrency }} install
env:
ARGS:
- -DENABLE_CJSON_UTILS=On
- -DENABLE_CJSON_TEST=Off
- -DBUILD_SHARED_AND_STATIC_LIBS=On
- -DCMAKE_INSTALL_PREFIX="{{ prefix }}"
- -DCMAKE_BUILD_TYPE=Release
test:
dependencies:
tea.xyz/gx/cc: c99
script: |
mv $FIXTURE $FIXTURE.c
cc $FIXTURE.c -lcjson
./a.out
fixture: |
#include <cjson/cJSON.h>
int main()
{
char *s = "{\"key\":\"value\"}";
cJSON *json = cJSON_Parse(s);
if (!json) {
return 1;
}
cJSON *item = cJSON_GetObjectItem(json, "key");
if (!item) {
return 1;
}
cJSON_Delete(json);
return 0;
}