summaryrefslogtreecommitdiffstats
path: root/src/2geom/CMakeLists.txt
blob: 80b9e8eaed9164557a9a412d547a7b4193f2329e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# (re-)generate parser file with ragel if it's available
SET(SVG_PARSER_CPP "svg-path-parser.cpp")
SET(SVG_PARSER_RL  "svg-path-parser.rl")
find_program(RAGEL_PROGRAM
   NAMES ragel
   HINTS /usr/bin
         /usr/local/bin
)
if(RAGEL_PROGRAM)
    message(STATUS "Found Ragel in ${RAGEL_PROGRAM}. ${SVG_PARSER_CPP} will be recreated from ${SVG_PARSER_RL}.")
    add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/${SVG_PARSER_CPP}"
                       COMMAND ${RAGEL_PROGRAM} -o "${SVG_PARSER_CPP}" "${SVG_PARSER_RL}"
                       DEPENDS "${SVG_PARSER_RL}"
                       WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
                       COMMENT "Generating ${SVG_PARSER_CPP} with ragel")
else()
    message(STATUS "Ragel NOT found. Using stale ${SVG_PARSER_CPP}.")
endif()


add_library(2geom ${LIB_TYPE}
    # sources
    affine.cpp

    basic-intersection.cpp
    bezier.cpp
    bezier-clipping.cpp
    bezier-curve.cpp
    bezier-utils.cpp

    cairo-path-sink.cpp
    circle.cpp
    concepts.cpp
    conicsec.cpp
    conic_section_clipper_impl.cpp
    convex-hull.cpp
    coord.cpp
    crossing.cpp
    curve.cpp

    d2-sbasis.cpp

    ellipse.cpp
    elliptical-arc.cpp
    elliptical-arc-from-sbasis.cpp

    geom.cpp

    intersection-graph.cpp

    line.cpp

    nearest-time.cpp

    numeric/matrix.cpp

    parallelogram.cpp
    parting-point.cpp
    path-extrema.cpp
    path-intersection.cpp
    path-sink.cpp
    path.cpp
    pathvector.cpp
    piecewise.cpp
    point.cpp
    polynomial.cpp

    rect.cpp
    recursive-bezier-intersection.cpp

    sbasis-2d.cpp
    sbasis-geometric.cpp
    sbasis-math.cpp
    sbasis-poly.cpp
    sbasis-roots.cpp
    sbasis-to-bezier.cpp
    sbasis.cpp
    self-intersect.cpp
    solve-bezier.cpp
    solve-bezier-one-d.cpp
    solve-bezier-parametric.cpp
    svg-path-parser.cpp
    svg-path-writer.cpp
    sweep-bounds.cpp

    transforms.cpp

    utils.cpp

    # headers (for IDE support only)
    # private:
    planar-graph.h

    # public:
    ${2GEOM_INCLUDE_DIR}/2geom/affine.h
    ${2GEOM_INCLUDE_DIR}/2geom/angle.h

    ${2GEOM_INCLUDE_DIR}/2geom/basic-intersection.h
    ${2GEOM_INCLUDE_DIR}/2geom/bezier.h
    ${2GEOM_INCLUDE_DIR}/2geom/bezier-curve.h
    ${2GEOM_INCLUDE_DIR}/2geom/bezier-to-sbasis.h
    ${2GEOM_INCLUDE_DIR}/2geom/bezier-utils.h

    ${2GEOM_INCLUDE_DIR}/2geom/cairo-path-sink.h
    ${2GEOM_INCLUDE_DIR}/2geom/choose.h
    ${2GEOM_INCLUDE_DIR}/2geom/circle.h
    ${2GEOM_INCLUDE_DIR}/2geom/concepts.h
    ${2GEOM_INCLUDE_DIR}/2geom/conicsec.h
    ${2GEOM_INCLUDE_DIR}/2geom/conic_section_clipper.h
    ${2GEOM_INCLUDE_DIR}/2geom/conic_section_clipper_cr.h
    ${2GEOM_INCLUDE_DIR}/2geom/conic_section_clipper_impl.h
    ${2GEOM_INCLUDE_DIR}/2geom/convex-hull.h
    ${2GEOM_INCLUDE_DIR}/2geom/coord.h
    ${2GEOM_INCLUDE_DIR}/2geom/crossing.h
    ${2GEOM_INCLUDE_DIR}/2geom/curve.h
    ${2GEOM_INCLUDE_DIR}/2geom/curves.h

    ${2GEOM_INCLUDE_DIR}/2geom/d2.h

    ${2GEOM_INCLUDE_DIR}/2geom/ellipse.h
    ${2GEOM_INCLUDE_DIR}/2geom/elliptical-arc.h
    ${2GEOM_INCLUDE_DIR}/2geom/exception.h

    ${2GEOM_INCLUDE_DIR}/2geom/forward.h

    ${2GEOM_INCLUDE_DIR}/2geom/geom.h

    ${2GEOM_INCLUDE_DIR}/2geom/intersection.h
    ${2GEOM_INCLUDE_DIR}/2geom/intersection-graph.h

    ${2GEOM_INCLUDE_DIR}/2geom/line.h
    ${2GEOM_INCLUDE_DIR}/2geom/linear.h

    ${2GEOM_INCLUDE_DIR}/2geom/math-utils.h

    ${2GEOM_INCLUDE_DIR}/2geom/nearest-time.h

    ${2GEOM_INCLUDE_DIR}/2geom/ord.h

    ${2GEOM_INCLUDE_DIR}/2geom/parallelogram.h
    ${2GEOM_INCLUDE_DIR}/2geom/path-intersection.h
    ${2GEOM_INCLUDE_DIR}/2geom/path-sink.h
    ${2GEOM_INCLUDE_DIR}/2geom/path.h
    ${2GEOM_INCLUDE_DIR}/2geom/pathvector.h
    ${2GEOM_INCLUDE_DIR}/2geom/piecewise.h
    ${2GEOM_INCLUDE_DIR}/2geom/point.h
    ${2GEOM_INCLUDE_DIR}/2geom/polynomial.h

    ${2GEOM_INCLUDE_DIR}/2geom/ray.h
    ${2GEOM_INCLUDE_DIR}/2geom/rect.h

    ${2GEOM_INCLUDE_DIR}/2geom/sbasis-2d.h
    ${2GEOM_INCLUDE_DIR}/2geom/sbasis-curve.h
    ${2GEOM_INCLUDE_DIR}/2geom/sbasis-geometric.h
    ${2GEOM_INCLUDE_DIR}/2geom/sbasis-math.h
    ${2GEOM_INCLUDE_DIR}/2geom/sbasis-poly.h
    ${2GEOM_INCLUDE_DIR}/2geom/sbasis-to-bezier.h
    ${2GEOM_INCLUDE_DIR}/2geom/sbasis.h
    ${2GEOM_INCLUDE_DIR}/2geom/solver.h
    ${2GEOM_INCLUDE_DIR}/2geom/svg-path-parser.h
    ${2GEOM_INCLUDE_DIR}/2geom/svg-path-writer.h
    ${2GEOM_INCLUDE_DIR}/2geom/sweeper.h
    ${2GEOM_INCLUDE_DIR}/2geom/sweep-bounds.h

    ${2GEOM_INCLUDE_DIR}/2geom/transforms.h

    ${2GEOM_INCLUDE_DIR}/2geom/utils.h
)

# make lib for 2geom
target_include_directories(2geom
    PUBLIC
        ${GLIB_INCLUDE_DIRS}
        ${GSL_INCLUDE_DIRS}
        ${CAIRO_INCLUDE_DIRS}
        ${DoubleConversion_INCLUDE_DIRS}
        $<BUILD_INTERFACE:${2GEOM_INCLUDE_DIR}>
        $<BUILD_INTERFACE:${2GEOM_INCLUDE_DIR}/2geom>
        $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/2geom-${2GEOM_VERSION}>
    )

target_link_libraries(2geom
    PUBLIC
        ${GLIB_LIBRARIES}
        ${GSL_LIBRARIES}
        ${CAIRO_LIBRARIES}
        ${DoubleConversion_LIBRARIES}
    )

set_target_properties(2geom PROPERTIES SOVERSION "${2GEOM_ABI_VERSION}")

install(TARGETS 2geom
    EXPORT 2geom_targets
    RUNTIME
      DESTINATION ${CMAKE_INSTALL_BINDIR}
      COMPONENT "lib2geom${2GEOM_VERSION}"
    LIBRARY
      DESTINATION ${CMAKE_INSTALL_LIBDIR}
      COMPONENT "lib2geom${2GEOM_VERSION}"
      NAMELINK_COMPONENT "lib2geom_dev"
    ARCHIVE
      DESTINATION ${CMAKE_INSTALL_LIBDIR}
      COMPONENT "lib2geom${2GEOM_VERSION}"
)

add_library(2Geom::2geom ALIAS 2geom)