pantry/projects/github.com/DaveGamble/cJSON/package.yml
2023-10-01 20:41:57 -04:00

44 lines
908 B
YAML

distributable:
url: https://github.com/DaveGamble/cJSON/archive/v1.7.15.tar.gz
strip-components: 1
versions:
github: DaveGamble/cJSON
build:
dependencies:
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:
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;
}