mirror of
https://github.com/ivabus/pantry
synced 2024-11-22 16:35:07 +03:00
+libgeos (#1598)
This commit is contained in:
parent
b9c40602ba
commit
f3c17d61a5
1 changed files with 58 additions and 0 deletions
58
projects/libgeos.org/package.yml
Normal file
58
projects/libgeos.org/package.yml
Normal file
|
@ -0,0 +1,58 @@
|
|||
distributable:
|
||||
url: https://github.com/libgeos/geos/releases/download/{{version}}/geos-{{version}}.tar.bz2
|
||||
strip-components: 1
|
||||
|
||||
versions:
|
||||
github: libgeos/geos/releases/tags
|
||||
|
||||
build:
|
||||
dependencies:
|
||||
tea.xyz/gx/cc: c99
|
||||
tea.xyz/gx/make: '*'
|
||||
cmake.org: '*'
|
||||
working-directory: build
|
||||
script: |
|
||||
cmake .. $ARGS
|
||||
make --jobs {{ hw.concurrency }}
|
||||
make install
|
||||
env:
|
||||
ARGS:
|
||||
- -DCMAKE_BUILD_TYPE=Release
|
||||
- -DCMAKE_INSTALL_PREFIX={{prefix}}
|
||||
|
||||
|
||||
provides:
|
||||
- bin/geosop
|
||||
- bin/geos-config
|
||||
|
||||
test:
|
||||
dependencies:
|
||||
tea.xyz/gx/cc: c99
|
||||
fixture: |
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <geos_c.h>
|
||||
static void geos_message_handler(const char* fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vprintf (fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
int main() {
|
||||
initGEOS(geos_message_handler, geos_message_handler);
|
||||
const char* wkt_a = "POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))";
|
||||
const char* wkt_b = "POLYGON((5 5, 15 5, 15 15, 5 15, 5 5))";
|
||||
GEOSWKTReader* reader = GEOSWKTReader_create();
|
||||
GEOSGeometry* geom_a = GEOSWKTReader_read(reader, wkt_a);
|
||||
GEOSGeometry* geom_b = GEOSWKTReader_read(reader, wkt_b);
|
||||
GEOSGeometry* inter = GEOSIntersection(geom_a, geom_b);
|
||||
GEOSWKTWriter* writer = GEOSWKTWriter_create();
|
||||
GEOSWKTWriter_setTrim(writer, 1);
|
||||
char* wkt_inter = GEOSWKTWriter_write(writer, inter);
|
||||
printf("Intersection(A, B): %s\\n", wkt_inter);
|
||||
return 0;
|
||||
}
|
||||
script: |
|
||||
mv $FIXTURE test.c
|
||||
cc test.c -lgeos_c
|
||||
./a.out
|
Loading…
Reference in a new issue