summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: e6571c660cfcc0ef50ceccf4dbc9e97225680e8a (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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
############################################
#                                          #
#  Improvements and feedbacks are welcome  #
#                                          #
#  This file is released under GPL >= 3    #
#                                          #
############################################


cmake_minimum_required( VERSION 2.8 )


#### general package setup

project( libart-lgpl )
set( VERSION R14.1.0 )
set( LIBART_VERSION 2.3.21 )

string( REPLACE "." ";" LIBART_VERSION_LIST ${LIBART_VERSION} )
list( GET LIBART_VERSION_LIST 0 LIBART_MAJOR_VERSION )
list( GET LIBART_VERSION_LIST 1 LIBART_MINOR_VERSION )
list( GET LIBART_VERSION_LIST 2 LIBART_MICRO_VERSION )


#### include essential cmake modules

include( CheckFunctionExists    )
include( CheckSymbolExists      )
include( CheckIncludeFile       )
include( CheckLibraryExists     )
include( CheckCSourceCompiles   )


#### include our cmake modules

set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )


##### setup install paths

include( TDESetupPaths )
tde_setup_paths( )
enable_testing( )


##### optional stuff

option( WITH_ALL_OPTIONS "Enable all optional support" OFF                                          )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )


##### user requested modules

option( BUILD_ALL "Build all" ON                     )
option( BUILD_DOC "Build documentation" ${BUILD_ALL} )


##### configure checks

include( ConfigureChecks.cmake )


###### global compiler settings

add_definitions( -DHAVE_CONFIG_H -DLIBART_COMPILATION )

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )


##### write configure files

configure_file( config.h.cmake config.h @ONLY )
configure_file( art_config.h.cmake art_config.h @ONLY )
configure_file( libart-features.h.cmake libart-features.h @ONLY )


include_directories(
  ${CMAKE_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
)


##### art_lgpl_2

set( _SRCS art_affine.c art_alphagamma.c
           art_bpath.c art_gray_svp.c
           art_misc.c art_pixbuf.c
           art_rect.c art_rect_svp.c
           art_rect_uta.c art_render.c
           art_render_gradient.c art_render_mask.c
           art_render_svp.c art_rgb.c
           art_rgb_affine.c art_rgb_affine_private.c
           art_rgb_bitmap_affine.c art_rgb_pixbuf_affine.c
           art_rgb_rgba_affine.c art_rgb_a_affine.c
           art_rgba.c art_rgb_svp.c
           art_svp.c art_svp_intersect.c
           art_svp_ops.c art_svp_point.c
           art_svp_render_aa.c art_svp_vpath.c
           art_svp_vpath_stroke.c art_svp_wind.c
           art_uta.c art_uta_ops.c
           art_uta_rect.c art_uta_vpath.c
           art_uta_svp.c art_vpath.c
           art_vpath_bpath.c art_vpath_dash.c
           art_vpath_svp.c libart-features.c
)

## shared

tde_add_library( art_lgpl_2 SHARED

  SOURCES
        ${_SRCS}
  LINK
      m

  VERSION ${LIBART_VERSION}

  DESTINATION ${LIB_INSTALL_DIR}
)

## static

tde_add_library( art_lgpl_2 STATIC_PIC

  SOURCES
        ${_SRCS}
  LINK
      m

  VERSION ${LIBART_VERSION}

  DESTINATION ${LIB_INSTALL_DIR}
)


## tests

tde_add_check_executable( testart
    SOURCES
        testart.c

    LINK
        art_lgpl_2-shared
        m
)
add_test(
    NAME testart-testpat
    COMMAND testart testpat
)
#-- the testart-gradient often ends at sigsegv
#add_test(
#    NAME testart-gradient
#    COMMAND testart gradient
#)
add_test(
    NAME testart-dash
    COMMAND testart dash
)
add_test(
    NAME testart-dist
    COMMAND testart dist
)
add_test(
    NAME testart-intersect
    COMMAND testart intersect
)


tde_add_check_executable( testuta
    SOURCES
        testuta.c

    LINK
        art_lgpl_2-shared
        m

    TEST
)


##### Headers

set( _headers art_affine.h art_alphagamma.h
              art_bpath.h
              art_filterlevel.h art_gray_svp.h
              art_misc.h art_pathcode.h art_pixbuf.h
              art_point.h art_rect.h art_rect_svp.h
              art_rect_uta.h art_render.h
              art_render_gradient.h art_render_mask.h
              art_render_svp.h art_rgb.h
              art_rgb_affine.h art_rgb_bitmap_affine.h
              art_rgb_pixbuf_affine.h art_rgb_rgba_affine.h
              art_rgb_a_affine.h art_rgb_svp.h
              art_rgba.h art_svp.h
              art_svp_intersect.h art_svp_ops.h
              art_svp_point.h art_svp_render_aa.h
              art_svp_vpath.h art_svp_vpath_stroke.h
              art_svp_wind.h art_uta.h
              art_uta_ops.h art_uta_rect.h
              art_uta_vpath.h art_uta_svp.h
              art_vpath.h art_vpath_bpath.h
              art_vpath_dash.h art_vpath_svp.h
              libart.h
              ${CMAKE_CURRENT_BINARY_DIR}/art_config.h
              ${CMAKE_CURRENT_BINARY_DIR}/libart-features.h
)

install(
    FILES ${_headers}
    DESTINATION ${INCLUDE_INSTALL_DIR}/libart-2.0/libart_lgpl
)


#### pkg-config

set( prefix ${CMAKE_INSTALL_PREFIX} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" exec_prefix ${EXEC_INSTALL_PREFIX} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" includedir ${INCLUDE_INSTALL_DIR}  )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" libdir ${LIB_INSTALL_DIR}          )

configure_file( libart-2.0.pc.cmake  libart-2.0.pc  @ONLY )

install(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/libart-2.0.pc
    DESTINATION ${PKGCONFIG_INSTALL_DIR}
)

install(
    PROGRAMS libart2-config
    DESTINATION ${BIN_INSTALL_DIR}
)


##### man page

tde_conditional_add_subdirectory( BUILD_DOC doc )