mirror of
https://github.com/ivabus/pantry
synced 2024-11-15 04:55:08 +03:00
43 lines
908 B
YAML
43 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;
|
|
}
|