Move Gateway Control Protocol (Context Tracking) into packet-h248.h
[metze/wireshark/wip.git] / epan / CMakeLists.txt
1 # CMakeLists.txt
2 #
3 # Wireshark - Network traffic analyzer
4 # By Gerald Combs <gerald@wireshark.org>
5 # Copyright 1998 Gerald Combs
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21
22 include(UseABICheck)
23
24 if (HAVE_HFI_SECTION_INIT)
25         add_definitions(
26                 -DHAVE_HFI_SECTION_INIT
27         )
28 endif()
29
30 add_subdirectory(crypt)
31 add_subdirectory(dfilter)
32 add_subdirectory(dissectors)
33 add_subdirectory(ftypes)
34 add_subdirectory(nghttp2)
35 add_subdirectory(wmem)
36 if (HAVE_LIBLUA)
37         add_subdirectory(wslua)
38 endif()
39
40 include_directories(
41         ${CMAKE_CURRENT_BINARY_DIR}
42         ${CMAKE_CURRENT_SOURCE_DIR}
43 )
44
45 set(COMPRESS_FILES
46         compress/lzxpress.c
47 )
48 source_group(compress FILES ${COMPRESS_FILES})
49
50 set(LIBWIRESHARK_ASM_FILES
51         asm_utils.c
52 # todo
53 #       !IFDEF NASM
54 #       asm_utils_win32_x86.obj: asm_utils_win32_x86.asm
55 #               $(NASM) -f $(WIRESHARK_TARGET_PLATFORM) -o $@ $?
56 #       !ENDIF
57 #       ...
58 #       !IF defined(NASM) && "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
59 #               asm_utils_win32_x86.obj
60 #       !ELSE
61 #               asm_utils.obj
62 #       !ENDIF
63 )
64
65 add_custom_target(
66         update-sminmpec
67         COMMAND ${PERL_EXECUTABLE}
68                 ${CMAKE_SOURCE_DIR}/tools/make-sminmpec.pl
69         DEPENDS
70                 enterprise-numbers
71                 ${CMAKE_SOURCE_DIR}/tools/make-sminmpec.pl
72 )
73 set_target_properties(update-sminmpec PROPERTIES FOLDER "tools")
74
75 add_custom_command(
76         OUTPUT ps.c
77         COMMAND ${PYTHON_EXECUTABLE}
78                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
79                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
80                 ps.c
81         DEPENDS
82                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
83                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
84 )
85
86 set(LIBWIRESHARK_FILES
87         addr_and_mask.c
88         addr_resolv.c
89         address_types.c
90         afn.c
91         aftypes.c
92         app_mem_usage.c
93         asn1.c
94         capture_dissectors.c
95         charsets.c
96         circuit.c
97         color_filters.c
98         column.c
99         column-utils.c
100         conversation.c
101         conversation_table.c
102         crc10-tvb.c
103         crc16-tvb.c
104         crc32-tvb.c
105         crc6-tvb.c
106         crc8-tvb.c
107         decode_as.c
108         disabled_protos.c
109         dissector_filters.c
110         dvb_chartbl.c
111         dwarf.c
112         epan.c
113         ex-opt.c
114         except.c
115         expert.c
116         exported_pdu.c
117         plugin_if.c
118         filter_expressions.c
119         follow.c
120         frame_data.c
121         frame_data_sequence.c
122         funnel.c
123         g_int64_hash_routines.c
124         geoip_db.c
125         golay.c
126         guid-utils.c
127         iana_charsets.c
128         in_cksum.c
129         ipproto.c
130         ipv4.c
131         next_tvb.c
132         oids.c
133         osi-utils.c
134         oui.c
135         packet-range.c
136         packet.c
137         print.c
138         print_stream.c
139         prefs.c
140         proto.c
141         proto_data.c
142         ps.c
143         range.c
144         reassemble.c
145         reedsolomon.c
146         req_resp_hdrs.c
147         rtd_table.c
148         show_exception.c
149         sminmpec.c
150         srt_table.c
151         stat_tap_ui.c
152         stats_tree.c
153         strutil.c
154         stream.c
155         t35.c
156         tap.c
157         timestamp.c
158         timestats.c
159         tfs.c
160         to_str.c
161         tvbparse.c
162         tvbuff.c
163         tvbuff_base64.c
164         tvbuff_composite.c
165         tvbuff_real.c
166         tvbuff_subset.c
167         tvbuff_zlib.c
168         uat.c
169         value_string.c
170         xdlc.c
171         ${CMAKE_SOURCE_DIR}/ws_version_info.c
172 )
173
174 set(LIBWIRESHARK_CLEAN_FILES
175         ${LIBWIRESHARK_FILES}
176 )
177
178 add_lex_files(LEX_FILES GENERATED_FILES
179         diam_dict.l
180         dtd_parse.l
181         dtd_preparse.l
182         radius_dict.l
183         uat_load.l
184 )
185
186 add_lemon_files(LEMON_FILES GENERATED_FILES
187         dtd_grammar.lemon
188 )
189
190 set(epan_LIBS
191         wiretap
192         wsutil
193         ${GLIB2_LIBRARIES}
194         ${PCAP_LIBRARIES}
195         ${CARES_LIBRARIES}
196         ${KERBEROS_LIBRARIES}
197         ${GEOIP_LIBRARIES}
198         ${GCRYPT_LIBRARIES}
199         ${GNUTLS_LIBRARIES}
200         ${SMI_LIBRARIES}
201         ${M_LIBRARIES}
202         ${LUA_LIBRARIES}
203         ${WIN_PSAPI_LIBRARY}
204 )
205
206 set(CLEAN_FILES
207         ${LIBWIRESHARK_CLEAN_FILES}
208         ${COMPRESS_FILES}
209         ${LIBWIRESHARK_ASM_FILES}
210 )
211
212 if (WERROR_COMMON_FLAGS)
213         set_source_files_properties(
214                 ${CLEAN_FILES}
215                 PROPERTIES
216                 COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
217         )
218 endif()
219
220 # Cannot use $<$<BOOL:${HAVE_LIBLUA}>:$<TARGET_OBJECTS:wslua>> as that breaks
221 # get_target_property(_libwireshark_location epan LOCATION).
222 if(HAVE_LIBLUA)
223         set(wslua_sources $<TARGET_OBJECTS:wslua>)
224 else()
225         set(wslua_sources)
226 endif()
227 add_library(epan ${LINK_MODE_LIB}
228         ${LIBWIRESHARK_FILES}
229         ${GENERATED_FILES}
230         ${COMPRESS_FILES}
231         ${LIBWIRESHARK_ASM_FILES}
232         $<TARGET_OBJECTS:crypt>
233         $<TARGET_OBJECTS:dfilter>
234         $<TARGET_OBJECTS:dissectors>
235         $<TARGET_OBJECTS:ftypes>
236         $<TARGET_OBJECTS:nghttp2>
237         $<TARGET_OBJECTS:wmem>
238         ${wslua_sources}
239         ${CMAKE_BINARY_DIR}/image/libwireshark.rc
240 )
241
242 add_dependencies(epan version)
243
244 set(FULL_SO_VERSION "0.0.0")
245
246 set_target_properties(epan PROPERTIES COMPILE_DEFINITIONS "WS_BUILD_DLL")
247 set_target_properties(epan PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
248 set_target_properties(epan PROPERTIES VERSION ${FULL_SO_VERSION} SOVERSION 0)
249
250 if(ENABLE_APPLICATION_BUNDLE)
251         set_target_properties(epan PROPERTIES
252                 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
253         )
254 endif()
255
256 ABICHECK(libwireshark)
257
258 set(TOP_LEVEL_HEADERS ${CMAKE_BINARY_DIR}/config.h ${CMAKE_SOURCE_DIR}/register.h)
259 file(GLOB CRYPT_HEADERS crypt/*.h)
260 file(GLOB COMPRESS_HEADERS compress/*.h)
261 file(GLOB DFILTER_HEADERS dfilter/*.h ../tools/lemon/cppmagic.h)
262 file(GLOB D_HEADERS dissectors/*.h)
263 file(GLOB FTYPES_HEADERS ftypes/*.h)
264 file(GLOB WMEM_HEADERS wmem/*.h)
265 file(GLOB NGHTTP2_HEADERS nghttp2/*.h)
266
267 add_custom_command(OUTPUT libwireshark.abi.tar.gz
268         COMMAND ${CMAKE_COMMAND} -E remove_directory ${ABICHECK_TMPDIR}
269         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}
270         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/epan
271         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/crypt
272         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/compress
273         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dfilter
274         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dissectors
275         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/ftypes
276         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/wmem
277         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/nghttp2
278         COMMAND ${ABI_COPY_COMMAND} ${TOP_LEVEL_HEADERS} ${ABICHECK_TMPDIR} ${ABI_COPY_FLAGS}
279         COMMAND ${ABI_COPY_COMMAND} ${ABICHECK_HEADERS} ${ABICHECK_TMPDIR}/epan ${ABI_COPY_FLAGS}
280         COMMAND ${ABI_COPY_COMMAND} ${CRYPT_HEADERS} ${ABICHECK_TMPDIR}/crypt ${ABI_COPY_FLAGS}
281         COMMAND ${ABI_COPY_COMMAND} ${COMPRESS_HEADERS} ${ABICHECK_TMPDIR}/compress ${ABI_COPY_FLAGS}
282         COMMAND ${ABI_COPY_COMMAND} ${DFILTER_HEADERS} ${ABICHECK_TMPDIR}/dfilter ${ABI_COPY_FLAGS}
283         COMMAND ${ABI_COPY_COMMAND} ${D_HEADERS} ${ABICHECK_TMPDIR}/dissectors ${ABI_COPY_FLAGS}
284         COMMAND ${ABI_COPY_COMMAND} ${FTYPES_HEADERS} ${ABICHECK_TMPDIR}/ftypes ${ABI_COPY_FLAGS}
285         COMMAND ${ABI_COPY_COMMAND} ${WMEM_HEADERS} ${ABICHECK_TMPDIR}/wmem ${ABI_COPY_FLAGS}
286         COMMAND ${ABI_COPY_COMMAND} ${NGHTTP2_HEADERS} ${ABICHECK_TMPDIR}/nghttp2 ${ABI_COPY_FLAGS}
287         COMMAND rm -f ${ABICHECK_TMPDIR}/dissectors/x11-extension-implementation.h
288                 ${ABICHECK_TMPDIR}/dissectors/packet-rtps.h
289                 ${ABICHECK_TMPDIR}/dissectors/x11-glx-render-enum.h
290                 ${ABICHECK_TMPDIR}/dissectors/x11-register-info.h
291                 ${ABICHECK_TMPDIR}/dissectors/packet-idmp.h
292         COMMAND ${ABICHECK_COMMAND}
293         COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwireshark/libwireshark_* ${CMAKE_CURRENT_BINARY_DIR}/libwireshark.abi.tar.gz
294         COMMAND rm -rf ${ABICHECK_TMPDIR} ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
295 #       COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps ${ABICHECK_TMPDIR}/config.h
296 #               ${ABICHECK_TMPDIR}/epan/* ${ABICHECK_TMPDIR}/crypt/*
297 #               ${ABICHECK_TMPDIR}/epan/* ${ABICHECK_TMPDIR}/compress/*
298 #               ${ABICHECK_TMPDIR}/dfilter/* ${ABICHECK_TMPDIR}/dissectors/*
299 #               ${ABICHECK_TMPDIR}/ftypes/* ${ABICHECK_TMPDIR}/wmem/*
300 #               ${ABICHECK_TMPDIR}/nghttp2/*
301         DEPENDS ${HEADERS}
302                 ${CRYPT_HEADERS} ${COMPRESS_HEADERS} ${DFILTER_HEADERS} ${D_HEADERS}
303                 ${FTYPES_HEADERS} ${WMEM_HEADERS} ${NGHTTP2_HEADERS} epan)
304
305 # By default the name for a library with target name epan will be libepan,
306 # but Ethereal is now named Wireshark
307 set_target_properties(epan PROPERTIES
308         OUTPUT_NAME "wireshark"
309         PREFIX "lib"
310         FOLDER "DLLs"
311 )
312
313 target_link_libraries(epan ${epan_LIBS})
314
315 add_dependencies(epan lemon)
316
317 if(NOT ${ENABLE_STATIC})
318         install(TARGETS epan
319                 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
320                 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
321                 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
322         )
323 endif()
324
325 add_executable(exntest EXCLUDE_FROM_ALL exntest.c except.c)
326 target_link_libraries(exntest ${GLIB2_LIBRARIES})
327 set_target_properties(exntest PROPERTIES
328         FOLDER "Tests"
329         COMPILE_DEFINITIONS "WS_BUILD_DLL"
330 )
331
332 add_executable(oids_test EXCLUDE_FROM_ALL oids_test.c)
333 target_link_libraries(oids_test epan ${ZLIB_LIBRARIES})
334 set_target_properties(oids_test PROPERTIES
335         FOLDER "Tests"
336         COMPILE_DEFINITIONS "WS_BUILD_DLL"
337 )
338
339 add_executable(reassemble_test EXCLUDE_FROM_ALL reassemble_test.c)
340 target_link_libraries(reassemble_test epan)
341 set_target_properties(reassemble_test PROPERTIES
342         FOLDER "Tests"
343 )
344
345 add_executable(tvbtest EXCLUDE_FROM_ALL tvbtest.c)
346 target_link_libraries(tvbtest epan)
347 set_target_properties(tvbtest PROPERTIES
348         FOLDER "Tests"
349         COMPILE_DEFINITIONS "WS_BUILD_DLL"
350 )
351
352 CHECKAPI(
353         NAME
354           epan
355         SWITCHES
356           -g termoutput -build
357         SOURCES
358           ${LIBWIRESHARK_FILES}
359 )
360
361 #
362 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
363 #
364 # Local variables:
365 # c-basic-offset: 8
366 # tab-width: 8
367 # indent-tabs-mode: t
368 # End:
369 #
370 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
371 # :indentSize=8:tabSize=8:noTabs=false:
372 #