File: CMakeLists.txt

package info (click to toggle)
raptor2 2.0.14-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 18,384 kB
  • ctags: 4,734
  • sloc: ansic: 36,918; sh: 11,996; xml: 6,686; makefile: 2,825; yacc: 2,435; perl: 1,121; lex: 1,050
file content (355 lines) | stat: -rw-r--r-- 9,936 bytes parent folder | download
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# raptor/CMakeLists.txt
#
# This file allows building Raptor2 with the CMake configuration tool.
# Download CMake in source or binary form from http://www.cmake.org/
#
# Original listfile by Daniel Richard G. <skunk@iSKUNK.ORG>
# This file is in the public domain.
#

SET(RAPTOR_VERSION_MAJOR	2)
SET(RAPTOR_VERSION_MINOR	0)
SET(RAPTOR_VERSION_RELEASE	14)
SET(RAPTOR_MIN_VERSION_DECIMAL	20014)

SET(VERSION "${RAPTOR_VERSION_MAJOR}.${RAPTOR_VERSION_MINOR}.${RAPTOR_VERSION_RELEASE}")
MATH(EXPR RAPTOR_VERSION_DECIMAL "${RAPTOR_VERSION_MAJOR} * 10000 + ${RAPTOR_VERSION_MINOR} * 100 + ${RAPTOR_VERSION_RELEASE}")

PROJECT(Raptor2 C)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)

SET(CMAKE_INCLUDE_CURRENT_DIR 1)

################################################################

# Third-party libraries

FIND_PACKAGE(CURL)
FIND_PACKAGE(LibXml2)
FIND_PACKAGE(LibXslt)
#FIND_PACKAGE(YAJL)

INCLUDE_DIRECTORIES(
	${CURL_INCLUDE_DIRS}
	${EXPAT_INCLUDE_DIRS}
	${LIBXML2_INCLUDE_DIR}
	${LIBXSLT_INCLUDE_DIR}
)

################################################################

# Configuration checks

INCLUDE(CheckIncludeFile)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckTypeSize)
INCLUDE(CheckStructHasMember)
INCLUDE(CheckCSourceCompiles)

CHECK_INCLUDE_FILE(errno.h	HAVE_ERRNO_H)
CHECK_INCLUDE_FILE(fcntl.h	HAVE_FCNTL_H)
CHECK_INCLUDE_FILE(getopt.h	HAVE_GETOPT_H)
CHECK_INCLUDE_FILE(limits.h	HAVE_LIMITS_H)
CHECK_INCLUDE_FILE(math.h	HAVE_MATH_H)
CHECK_INCLUDE_FILE(setjmp.h	HAVE_SETJMP_H)
CHECK_INCLUDE_FILE(stddef.h	HAVE_STDDEF_H)
CHECK_INCLUDE_FILE(stdlib.h	HAVE_STDLIB_H)
CHECK_INCLUDE_FILE(string.h	HAVE_STRING_H)
CHECK_INCLUDE_FILE(unistd.h	HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(sys/param.h	HAVE_SYS_PARAM_H)
CHECK_INCLUDE_FILE(sys/stat.h	HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/stat.h	HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/time.h	HAVE_SYS_TIME_H)

CHECK_INCLUDE_FILES("sys/time.h;time.h" TIME_WITH_SYS_TIME)

CHECK_FUNCTION_EXISTS(access		HAVE_ACCESS)
CHECK_FUNCTION_EXISTS(_access		HAVE__ACCESS)
CHECK_FUNCTION_EXISTS(getopt		HAVE_GETOPT)
CHECK_FUNCTION_EXISTS(getopt_long	HAVE_GETOPT_LONG)
CHECK_FUNCTION_EXISTS(gettimeofday	HAVE_GETTIMEOFDAY)
CHECK_FUNCTION_EXISTS(isascii		HAVE_ISASCII)
CHECK_FUNCTION_EXISTS(setjmp		HAVE_SETJMP)
CHECK_FUNCTION_EXISTS(snprintf		HAVE_SNPRINTF)
CHECK_FUNCTION_EXISTS(_snprintf		HAVE__SNPRINTF)
CHECK_FUNCTION_EXISTS(stat		HAVE_STAT)
CHECK_FUNCTION_EXISTS(strcasecmp	HAVE_STRCASECMP)
CHECK_FUNCTION_EXISTS(stricmp		HAVE_STRICMP)
CHECK_FUNCTION_EXISTS(_stricmp		HAVE__STRICMP)
CHECK_FUNCTION_EXISTS(strtok_r		HAVE_STRTOK_R)
CHECK_FUNCTION_EXISTS(vasprintf		HAVE_VASPRINTF)
CHECK_FUNCTION_EXISTS(vsnprintf		HAVE_VSNPRINTF)
CHECK_FUNCTION_EXISTS(_vsnprintf	HAVE__VSNPRINTF)

CHECK_TYPE_SIZE("unsigned char"		SIZEOF_UNSIGNED_CHAR)
CHECK_TYPE_SIZE("unsigned short"	SIZEOF_UNSIGNED_SHORT)
CHECK_TYPE_SIZE("unsigned int"		SIZEOF_UNSIGNED_INT)
CHECK_TYPE_SIZE("unsigned long"		SIZEOF_UNSIGNED_LONG)
CHECK_TYPE_SIZE("unsigned long long"	SIZEOF_UNSIGNED_LONG_LONG)

IF(LIBXML2_FOUND)

	SET(CMAKE_REQUIRED_INCLUDES  ${LIBXML2_INCLUDE_DIR})
	SET(CMAKE_REQUIRED_LIBRARIES ${LIBXML2_LIBRARIES})

	CHECK_FUNCTION_EXISTS(xmlCtxtUseOptions     HAVE_XMLCTXTUSEOPTIONS)
	CHECK_FUNCTION_EXISTS(xmlSAX2InternalSubset HAVE_XMLSAX2INTERNALSUBSET)

	CHECK_STRUCT_HAS_MEMBER(
		xmlEntity
		name_length
		libxml/parser.h
		RAPTOR_LIBXML_ENTITY_NAME_LENGTH
	)

	CHECK_STRUCT_HAS_MEMBER(
		xmlEntity
		etype
		libxml/parser.h
		RAPTOR_LIBXML_ENTITY_ETYPE
	)

	CHECK_STRUCT_HAS_MEMBER(
		xmlSAXHandler
		initialized
		libxml/parser.h
		RAPTOR_LIBXML_XMLSAXHANDLER_INITIALIZED
	)

	CHECK_STRUCT_HAS_MEMBER(
		xmlSAXHandler
		externalSubset
		libxml/parser.h
		RAPTOR_LIBXML_XMLSAXHANDLER_EXTERNALSUBSET
	)

	CHECK_C_SOURCE_COMPILES("
#include <libxml/parser.h>
int main(void){ xmlParserOption foo; foo = XML_PARSE_NONET; return 0; }"
		RAPTOR_LIBXML_XML_PARSE_NONET
	)

	CHECK_C_SOURCE_COMPILES("
#include <libxml/HTMLparser.h>
int main(void){ htmlParserOption foo; foo = HTML_PARSE_NONET; return 0; }"
		RAPTOR_LIBXML_HTML_PARSE_NONET
	)

	SET(CMAKE_REQUIRED_INCLUDES)
	SET(CMAKE_REQUIRED_LIBRARIES)

ENDIF(LIBXML2_FOUND)

################################################################

# User-configurable options
#
# (Note: The CMake GUI displays these in alphabetical order, regardless of
# the order we use here)

SET(BUILD_SHARED_LIBS OFF CACHE BOOL
	"Build shared libraries instead of static ones.")

IF(BUILD_SHARED_LIBS)
	SET(RAPTOR_STATIC FALSE)
ELSE(BUILD_SHARED_LIBS)
	SET(RAPTOR_STATIC TRUE)
ENDIF(BUILD_SHARED_LIBS)

SET(RAPTOR_XML_INIT none)
IF(LIBXML2_FOUND)
	SET(RAPTOR_XML_INIT libxml)
ENDIF(LIBXML2_FOUND)

SET(RAPTOR_XML ${RAPTOR_XML_INIT} CACHE STRING
	"Which XML library to use (any of \"libxml\", \"none\").")

SET(RAPTOR_XML_DEFINE RAPTOR_XML_NONE)
IF(RAPTOR_XML STREQUAL "libxml")
	SET(RAPTOR_XML_DEFINE RAPTOR_XML_LIBXML)
ENDIF(RAPTOR_XML STREQUAL "libxml")

SET(RAPTOR_WWW_INIT none)
IF(LIBXML2_FOUND)
	SET(RAPTOR_WWW_INIT xml)
ENDIF(LIBXML2_FOUND)
IF(CURL_FOUND)
	SET(RAPTOR_WWW_INIT curl)
ENDIF(CURL_FOUND)

SET(RAPTOR_WWW ${RAPTOR_WWW_INIT} CACHE STRING
	"Which WWW library to use (any of \"curl\", \"xml\", \"none\").")

SET(RAPTOR_WWW_DEFINE RAPTOR_WWW_NONE)
IF(RAPTOR_WWW STREQUAL "curl")
	SET(RAPTOR_WWW_DEFINE RAPTOR_WWW_LIBCURL)
ELSEIF(RAPTOR_WWW STREQUAL "xml")
	SET(RAPTOR_WWW_DEFINE RAPTOR_WWW_LIBXML)
ENDIF(RAPTOR_WWW STREQUAL "curl")

SET(RAPTOR_XML_1_1 FALSE CACHE BOOL
	"Use XML version 1.1 name checking.")

SET(HAVE_RAPTOR_PARSE_DATE 1)
SET(RAPTOR_PARSEDATE 1)

SET(RAPTOR_PARSER_RDFXML_INIT FALSE)
IF(LIBXML2_FOUND)
	SET(RAPTOR_PARSER_RDFXML_INIT TRUE)
ENDIF(LIBXML2_FOUND)

SET(RAPTOR_PARSER_GRDDL_INIT FALSE)
IF(LIBXML2_FOUND AND LIBXSLT_FOUND)
	SET(RAPTOR_PARSER_GRDDL_INIT TRUE)
ENDIF(LIBXML2_FOUND AND LIBXSLT_FOUND)

SET(RAPTOR_PARSER_RDFXML ${RAPTOR_PARSER_RDFXML_INIT}
	CACHE BOOL "Build RDF/XML parser.")
SET(RAPTOR_PARSER_NTRIPLES TRUE
	CACHE BOOL "Build N-Triples parser.")
SET(RAPTOR_PARSER_TURTLE TRUE
	CACHE BOOL "Build Turtle parser.")
SET(RAPTOR_PARSER_TRIG TRUE
	CACHE BOOL "Build TRiG parser.")
SET(RAPTOR_PARSER_RSS ${LIBXML2_FOUND}
	CACHE BOOL "Build RSS Tag Soup parser.")
SET(RAPTOR_PARSER_GRDDL ${RAPTOR_PARSER_GRDDL_INIT}
	CACHE BOOL "Build GRDDL parser.")
SET(RAPTOR_PARSER_GUESS TRUE
	CACHE BOOL "Build guess parser.")
SET(RAPTOR_PARSER_RDFA ${LIBXML2_FOUND}
	CACHE BOOL "Build RDFA parser.")
SET(RAPTOR_PARSER_JSON ${YAJL_FOUND}
	CACHE BOOL "Build JSON parser.")
SET(RAPTOR_PARSER_NQUADS TRUE
	CACHE BOOL "Build N-Quads parser.")

SET(RAPTOR_SERIALIZER_RDFXML TRUE
	CACHE BOOL "Build RDF/XML serializer.")
SET(RAPTOR_SERIALIZER_NTRIPLES TRUE
	CACHE BOOL "Build N-Triples serializer.")
SET(RAPTOR_SERIALIZER_RDFXML_ABBREV TRUE
	CACHE BOOL "Build RDF/XML-abbreviated serializer.")
SET(RAPTOR_SERIALIZER_TURTLE TRUE
	CACHE BOOL "Build Turtle serializer.")
SET(RAPTOR_SERIALIZER_RSS_1_0 TRUE
	CACHE BOOL "Build RSS 1.0 serializer.")
SET(RAPTOR_SERIALIZER_ATOM TRUE
	CACHE BOOL "Build Atom 1.0 serializer.")
SET(RAPTOR_SERIALIZER_DOT TRUE
	CACHE BOOL "Build GraphViz DOT serializer.")
SET(RAPTOR_SERIALIZER_HTML TRUE
	CACHE BOOL "Build HTML Table serializer.")
SET(RAPTOR_SERIALIZER_JSON TRUE
	CACHE BOOL "Build JSON serializer.")
SET(RAPTOR_SERIALIZER_NQUADS TRUE
	CACHE BOOL "Build N-Quads serializer.")

################################################################

CONFIGURE_FILE(
	src/raptor_config_cmake.h.in
	src/raptor_config.h
	@ONLY
)

ADD_DEFINITIONS(-DHAVE_CONFIG_H)

CONFIGURE_FILE(
	src/raptor2.h.in
	src/raptor2.h
	@ONLY
)

# On Windows, the test/utility programs usually have DLL dependencies that
# make them cumbersome to invoke within IDE environments, so we enable the
# test suite only when makefiles are being used.
#
# Note that a partial solution is described at
#
#	http://www.cmake.org/pipermail/cmake/2009-May/029464.html
#
# but we don't have a good way of knowing where the third-party DLLs are.
#
IF(CMAKE_GENERATOR MATCHES "Makefiles")
	ENABLE_TESTING()
ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")

SUBDIRS(src)
SUBDIRS(utils)

################################################################

FIND_PROGRAM(JING jing)
IF(NOT JING STREQUAL "JING-NOTFOUND")
	SET(HAVE_JING TRUE)
ENDIF(NOT JING STREQUAL "JING-NOTFOUND")

SET(RAPPER  ${CMAKE_BINARY_DIR}/utils/rapper)
SET(RDFDIFF ${CMAKE_BINARY_DIR}/utils/rdfdiff)

MACRO(RAPPER_TEST NAME_PREFIX COMMAND OUTPUT REFERENCE)
	FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test-${NAME_PREFIX}.cmake "
EXECUTE_PROCESS(
	COMMAND ${COMMAND}
	TIMEOUT 10
	OUTPUT_FILE ${OUTPUT}.raw
	ERROR_QUIET
)

# http://public.kitware.com/Bug/view.php?id=13007

CONFIGURE_FILE(
	${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}.raw
	${OUTPUT}
	@ONLY
	NEWLINE_STYLE UNIX
)
")
	ADD_TEST("${NAME_PREFIX}:run" ${CMAKE_COMMAND} -P test-${NAME_PREFIX}.cmake)
	ADD_TEST("${NAME_PREFIX}:cmp" ${CMAKE_COMMAND} -E compare_files ${REFERENCE} ${OUTPUT})
ENDMACRO(RAPPER_TEST NAME_PREFIX COMMAND OUTPUT REFERENCE)

MACRO(RAPPER_RDFDIFF_TEST NAME RAPPER_COMMAND RAPPER_OUTPUT RDFDIFF_COMMAND)
	FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test-${NAME}.cmake "
SET(rdfdiff_status -1)

EXECUTE_PROCESS(
	COMMAND ${RAPPER_COMMAND}
	TIMEOUT 10
	OUTPUT_FILE ${RAPPER_OUTPUT}
	ERROR_QUIET
	RESULT_VARIABLE rapper_status
)

IF(rapper_status EQUAL 0 OR rapper_status EQUAL 2)
	EXECUTE_PROCESS(
		COMMAND ${RDFDIFF_COMMAND}
		TIMEOUT 10
		OUTPUT_QUIET
		ERROR_QUIET
		RESULT_VARIABLE rdfdiff_status
	)
ENDIF(rapper_status EQUAL 0 OR rapper_status EQUAL 2)

IF(NOT rdfdiff_status EQUAL 0)
	MESSAGE(FATAL_ERROR "Test failed.")
ENDIF(NOT rdfdiff_status EQUAL 0)
")

	ADD_TEST(${NAME} ${CMAKE_COMMAND} -P test-${NAME}.cmake)
ENDMACRO(RAPPER_RDFDIFF_TEST NAME RAPPER_COMMAND RAPPER_OUTPUT RDFDIFF_COMMAND)

SUBDIRS(tests/feeds)
SUBDIRS(tests/grddl)
SUBDIRS(tests/json)
SUBDIRS(tests/ntriples)
SUBDIRS(tests/rdfa)
SUBDIRS(tests/rdfa11)
SUBDIRS(tests/rdfxml)
SUBDIRS(tests/trig)
#SUBDIRS(tests/turtle)	# TODO

# end raptor/CMakeLists.txt