Skip to content

Commit 12da12a

Browse files
visryeesian
authored andcommitted
rewrap using new Clang.jl (#61)
* rewrap using new Clang.jl And include the used `wrap_geos.jl`, such that we can more easily wrap it again in the future. As far as I can tell this is breaking, but not too badly, mainly because of some `const` that are now wrapped as a `@cenum`. This also adds the CEnum dependency, Clang.jl uses this instead of the normal julia `@enum` for C compatibility. * simplify Travis yaml This should work according to https://docs.travis-ci.com/user/languages/julia/
1 parent 8a9b17b commit 12da12a

File tree

11 files changed

+1045
-710
lines changed

11 files changed

+1045
-710
lines changed

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,4 @@ matrix:
1010
- julia: nightly
1111
notifications:
1212
email: false
13-
script:
14-
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
15-
- julia -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("LibGEOS"); Pkg.test("LibGEOS"; coverage=true)'
16-
after_success:
17-
- julia -e 'using Pkg; cd(Pkg.dir("LibGEOS")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder()); Codecov.submit(Codecov.process_folder())';
13+
coveralls: true

Project.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name = "LibGEOS"
2+
uuid = "a90b1aa1-3769-5649-ba7e-abc5a9d163eb"
3+
4+
[deps]
5+
BinaryProvider = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
6+
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
7+
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
8+
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
9+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
10+
11+
[compat]
12+
BinaryProvider = "≥ 0.5.3"
13+
GeoInterface = "≥ 0.4.0"
14+
julia = "≥ 0.7.0"

REQUIRE

Lines changed: 0 additions & 3 deletions
This file was deleted.

gen/wrap_geos.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#=
2+
Run this file to regenerate `geos_c.jl` and `geos_common.jl`.
3+
4+
It expects a GEOS install in the deps folder, run `build LibGEOS` in Pkg mode
5+
if these are not in place.
6+
7+
The wrapped GEOS version and provided GEOS version should be kept in sync.
8+
So when updating the GEOSBuilder provided version, also rerun this wrapper.
9+
This way we ensure that the provided library has the same functions available
10+
as the wrapped one. Furthermore this makes sure constants in `geos_common.jl`
11+
like `GEOS_VERSION`, which are just strings, are correct.
12+
=#
13+
14+
using Clang
15+
16+
includedir = normpath(joinpath(@__DIR__, "..", "deps", "usr", "include"))
17+
headerfiles = [joinpath(includedir, "geos_c.h")]
18+
19+
wc = init(; headers = headerfiles,
20+
output_file = joinpath(@__DIR__, "geos_c.jl"),
21+
common_file = joinpath(@__DIR__, "geos_common.jl"),
22+
clang_includes = [includedir, CLANG_INCLUDE],
23+
clang_args = ["-I", includedir],
24+
header_wrapped = (root, current) -> root == current,
25+
header_library = x -> "libgeos",
26+
clang_diagnostics = true,
27+
)
28+
29+
run(wc)

src/LibGEOS.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module LibGEOS
99

1010
using GeoInterface
1111
using Libdl
12+
using CEnum
1213

1314
export Point, MultiPoint, LineString, MultiLineString, LinearRing, Polygon, MultiPolygon, GeometryCollection,
1415
parseWKT, geomFromWKT, geomToWKT, readgeom, writegeom,
@@ -23,6 +24,7 @@ module LibGEOS
2324
isEmpty, isSimple, isRing, hasZ, isClosed, isValid, interiorRings, exteriorRing,
2425
numPoints, startPoint, endPoint, area, geomLength, distance, hausdorffdistance, nearestPoints
2526

27+
include("geos_common.jl")
2628
include("geos_c.jl")
2729

2830
mutable struct GEOSError <: Exception

src/deprecated.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
@Base.deprecate parseWKT(geom::String) readgeom(geom)
22
@Base.deprecate geomFromWKT(geom::String) _readgeom(geom)
33
@Base.deprecate geomToWKT(geom::Ptr{GEOSGeometry}) writegeom(geom)
4+
5+
@Base.deprecate_binding CAP_ROUND GEOSBUF_CAP_ROUND
6+
@Base.deprecate_binding CAP_FLAT GEOSBUF_CAP_FLAT
7+
@Base.deprecate_binding CAP_SQUARE GEOSBUF_CAP_SQUARE
8+
@Base.deprecate_binding JOIN_ROUND GEOSBUF_JOIN_ROUND
9+
@Base.deprecate_binding JOIN_MITRE GEOSBUF_JOIN_MITRE
10+
@Base.deprecate_binding JOIN_BEVEL GEOSBUF_JOIN_BEVEL

0 commit comments

Comments
 (0)