Remove epan win32 x86 assembly
[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(wmem)
35 if (HAVE_LIBLUA)
36         add_subdirectory(wslua)
37 endif()
38
39 include_directories(
40         ${CMAKE_CURRENT_BINARY_DIR}
41         ${CMAKE_CURRENT_SOURCE_DIR}
42 )
43
44 add_custom_command(
45         OUTPUT ps.c
46         COMMAND ${PYTHON_EXECUTABLE}
47                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
48                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
49                 ps.c
50         DEPENDS
51                 ${CMAKE_SOURCE_DIR}/tools/rdps.py
52                 ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
53 )
54
55 set(LIBWIRESHARK_PUBLIC_HEADERS
56         addr_and_mask.h
57         addr_resolv.h
58         address.h
59         address_types.h
60         afn.h
61         aftypes.h
62         app_mem_usage.h
63         arcnet_pids.h
64         arptypes.h
65         asn1.h
66         ax25_pids.h
67         bridged_pids.h
68         capture_dissectors.h
69         charsets.h
70         chdlctypes.h
71         circuit.h
72         color_filters.h
73         column.h
74         column-info.h
75         column-utils.h
76         conversation.h
77         conversation_debug.h
78         conversation_table.h
79         conv_id.h
80         crc10-tvb.h
81         crc16-tvb.h
82         crc32-tvb.h
83         crc6-tvb.h
84         crc8-tvb.h
85         decode_as.h
86         diam_dict.h
87         disabled_protos.h
88         dissector_filters.h
89         dtd.h
90         dtd_parse.h
91         dvb_chartbl.h
92         dwarf.h
93         eap.h
94         eapol_keydes_types.h
95         epan.h
96         epan_dissect.h
97         etypes.h
98         ex-opt.h
99         except.h
100         exceptions.h
101         expert.h
102         export_object.h
103         exported_pdu.h
104         plugin_if.h
105         filter_expressions.h
106         follow.h
107         frame_data.h
108         frame_data_sequence.h
109         funnel.h
110         garrayfix.h
111         geoip_db.h
112         golay.h
113         guid-utils.h
114         iana_charsets.h
115         iax2_codec_type.h
116         in_cksum.h
117         ip_opts.h
118         ipproto.h
119         ipv4.h
120         ipv6.h
121         lapd_sapi.h
122         llcsaps.h
123         media_params.h
124         next_tvb.h
125         nlpid.h
126         oids.h
127         osi-utils.h
128         oui.h
129         packet.h
130         packet_info.h
131         params.h
132         ppptypes.h
133         print.h
134         print_stream.h
135         prefs.h
136         prefs-int.h
137         proto.h
138         proto_data.h
139         ps.h
140         ptvcursor.h
141         range.h
142         reassemble.h
143         reedsolomon.h
144         req_resp_hdrs.h
145         rtd_table.h
146         rtp_pt.h
147         sctpppids.h
148         show_exception.h
149         slow_protocol_subtypes.h
150         sminmpec.h
151         srt_table.h
152         stat_tap_ui.h
153         stat_groups.h
154         stats_tree.h
155         stats_tree_priv.h
156         stream.h
157         strutil.h
158         t35.h
159         tap.h
160         tap-voip.h
161         timestamp.h
162         timestats.h
163         tfs.h
164         time_fmt.h
165         to_str.h
166         tvbparse.h
167         tvbuff.h
168         tvbuff-int.h
169         uat.h
170         uat-int.h
171         unit_strings.h
172         value_string.h
173         x264_prt_id.h
174         xdlc.h
175 )
176
177 set(LIBWIRESHARK_FILES
178         addr_and_mask.c
179         addr_resolv.c
180         address_types.c
181         afn.c
182         aftypes.c
183         app_mem_usage.c
184         asn1.c
185         capture_dissectors.c
186         charsets.c
187         circuit.c
188         color_filters.c
189         column.c
190         column-utils.c
191         conversation.c
192         conversation_table.c
193         crc10-tvb.c
194         crc16-tvb.c
195         crc32-tvb.c
196         crc6-tvb.c
197         crc8-tvb.c
198         decode_as.c
199         disabled_protos.c
200         dissector_filters.c
201         dvb_chartbl.c
202         dwarf.c
203         epan.c
204         ex-opt.c
205         except.c
206         expert.c
207         export_object.c
208         exported_pdu.c
209         plugin_if.c
210         filter_expressions.c
211         follow.c
212         frame_data.c
213         frame_data_sequence.c
214         funnel.c
215         geoip_db.c
216         golay.c
217         guid-utils.c
218         iana_charsets.c
219         in_cksum.c
220         ipproto.c
221         media_params.c
222         next_tvb.c
223         oids.c
224         osi-utils.c
225         packet.c
226         print.c
227         print_stream.c
228         prefs.c
229         proto.c
230         proto_data.c
231         ps.c
232         range.c
233         reassemble.c
234         reedsolomon.c
235         req_resp_hdrs.c
236         rtd_table.c
237         sequence_analysis.c
238         show_exception.c
239         srt_table.c
240         stat_tap_ui.c
241         stats_tree.c
242         strutil.c
243         stream.c
244         t35.c
245         tap.c
246         timestamp.c
247         timestats.c
248         tfs.c
249         to_str.c
250         tvbparse.c
251         tvbuff.c
252         tvbuff_base64.c
253         tvbuff_composite.c
254         tvbuff_real.c
255         tvbuff_subset.c
256         tvbuff_zlib.c
257         uat.c
258         value_string.c
259         unit_strings.c
260         xdlc.c
261         ${CMAKE_SOURCE_DIR}/version_info.c
262 )
263
264 set(LIBWIRESHARK_CLEAN_FILES
265         ${LIBWIRESHARK_FILES}
266 )
267
268 add_lex_files(LEX_FILES GENERATED_FILES
269         diam_dict.l
270         dtd_parse.l
271         dtd_preparse.l
272         radius_dict.l
273         uat_load.l
274 )
275
276 add_lemon_files(LEMON_FILES GENERATED_FILES
277         dtd_grammar.lemon
278 )
279
280 set(epan_LIBS
281         wiretap
282         wsutil
283         ${CARES_LIBRARIES}
284         ${GCRYPT_LIBRARIES}
285         ${GEOIP_LIBRARIES}
286         ${GLIB2_LIBRARIES}
287         ${GNUTLS_LIBRARIES}
288         ${KERBEROS_LIBRARIES}
289         ${LUA_LIBRARIES}
290         ${LZ4_LIBRARIES}
291         ${M_LIBRARIES}
292         ${NGHTTP2_LIBRARIES}
293         ${PCAP_LIBRARIES}
294         ${SMI_LIBRARIES}
295         ${SNAPPY_LIBRARIES}
296         ${WIN_PSAPI_LIBRARY}
297         ${LIBXML2_LIBRARIES}
298 )
299
300 set(CLEAN_FILES
301         ${LIBWIRESHARK_CLEAN_FILES}
302 )
303
304 set_source_files_properties(
305         ${CLEAN_FILES}
306         PROPERTIES
307         COMPILE_FLAGS "${WERROR_COMMON_FLAGS}"
308 )
309
310 # Cannot use $<$<BOOL:${HAVE_LIBLUA}>:$<TARGET_OBJECTS:wslua>> as that breaks
311 # with CMake 3.0 (CMake 3.1 is OK)
312 if(HAVE_LIBLUA)
313         set(wslua_sources $<TARGET_OBJECTS:wslua>)
314 else()
315         set(wslua_sources)
316 endif()
317 add_library(epan ${LINK_MODE_LIB}
318         ${LIBWIRESHARK_FILES}
319         ${GENERATED_FILES}
320         $<TARGET_OBJECTS:crypt>
321         $<TARGET_OBJECTS:dfilter>
322         $<TARGET_OBJECTS:dissectors>
323         $<TARGET_OBJECTS:dissectors-corba>
324         $<TARGET_OBJECTS:ftypes>
325         $<TARGET_OBJECTS:wmem>
326         ${wslua_sources}
327         ${CMAKE_BINARY_DIR}/image/libwireshark.rc
328 )
329
330 add_dependencies(epan version)
331
332 set(FULL_SO_VERSION "0.0.0")
333
334 set_target_properties(epan PROPERTIES
335         COMPILE_DEFINITIONS "WS_BUILD_DLL"
336         LINK_FLAGS "${WS_LINK_FLAGS}"
337         VERSION ${FULL_SO_VERSION} SOVERSION 0
338 )
339
340 if(ENABLE_APPLICATION_BUNDLE)
341         set_target_properties(epan PROPERTIES
342                 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/Frameworks
343         )
344 endif()
345
346 ABICHECK(libwireshark)
347
348 set(TOP_LEVEL_HEADERS ${CMAKE_BINARY_DIR}/config.h ${CMAKE_SOURCE_DIR}/register.h)
349 file(GLOB CRYPT_HEADERS crypt/*.h)
350 file(GLOB DFILTER_HEADERS dfilter/*.h ../tools/lemon/cppmagic.h)
351 file(GLOB D_HEADERS dissectors/*.h)
352 file(GLOB FTYPES_HEADERS ftypes/*.h)
353 file(GLOB WMEM_HEADERS wmem/*.h)
354
355 add_custom_command(OUTPUT libwireshark.abi.tar.gz
356         COMMAND ${CMAKE_COMMAND} -E remove_directory ${ABICHECK_TMPDIR}
357         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}
358         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/epan
359         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/crypt
360         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dfilter
361         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/dissectors
362         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/ftypes
363         COMMAND ${CMAKE_COMMAND} -E make_directory ${ABICHECK_TMPDIR}/wmem
364         COMMAND ${ABI_COPY_COMMAND} ${TOP_LEVEL_HEADERS} ${ABICHECK_TMPDIR} ${ABI_COPY_FLAGS}
365         COMMAND ${ABI_COPY_COMMAND} ${ABICHECK_HEADERS} ${ABICHECK_TMPDIR}/epan ${ABI_COPY_FLAGS}
366         COMMAND ${ABI_COPY_COMMAND} ${CRYPT_HEADERS} ${ABICHECK_TMPDIR}/crypt ${ABI_COPY_FLAGS}
367         COMMAND ${ABI_COPY_COMMAND} ${DFILTER_HEADERS} ${ABICHECK_TMPDIR}/dfilter ${ABI_COPY_FLAGS}
368         COMMAND ${ABI_COPY_COMMAND} ${D_HEADERS} ${ABICHECK_TMPDIR}/dissectors ${ABI_COPY_FLAGS}
369         COMMAND ${ABI_COPY_COMMAND} ${FTYPES_HEADERS} ${ABICHECK_TMPDIR}/ftypes ${ABI_COPY_FLAGS}
370         COMMAND ${ABI_COPY_COMMAND} ${WMEM_HEADERS} ${ABICHECK_TMPDIR}/wmem ${ABI_COPY_FLAGS}
371         COMMAND rm -f ${ABICHECK_TMPDIR}/dissectors/x11-extension-implementation.h
372                 ${ABICHECK_TMPDIR}/dissectors/packet-rtps.h
373                 ${ABICHECK_TMPDIR}/dissectors/x11-glx-render-enum.h
374                 ${ABICHECK_TMPDIR}/dissectors/x11-register-info.h
375                 ${ABICHECK_TMPDIR}/dissectors/packet-idmp.h
376         COMMAND ${ABICHECK_COMMAND}
377         COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps/libwireshark/libwireshark_* ${CMAKE_CURRENT_BINARY_DIR}/libwireshark.abi.tar.gz
378         COMMAND rm -rf ${ABICHECK_TMPDIR} ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps
379 #       COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/abi_dumps ${ABICHECK_TMPDIR}/config.h
380 #               ${ABICHECK_TMPDIR}/epan/* ${ABICHECK_TMPDIR}/crypt/*
381 #               ${ABICHECK_TMPDIR}/dfilter/* ${ABICHECK_TMPDIR}/dissectors/*
382 #               ${ABICHECK_TMPDIR}/ftypes/* ${ABICHECK_TMPDIR}/wmem/*
383         DEPENDS ${HEADERS}
384                 ${CRYPT_HEADERS} ${DFILTER_HEADERS} ${D_HEADERS}
385                 ${FTYPES_HEADERS} ${WMEM_HEADERS} epan)
386
387 # By default the name for a library with target name epan will be libepan,
388 # but Ethereal is now named Wireshark
389 set_target_properties(epan PROPERTIES
390         OUTPUT_NAME "wireshark"
391         PREFIX "lib"
392         FOLDER "DLLs"
393 )
394
395 target_link_libraries(epan ${epan_LIBS})
396
397 add_dependencies(epan lemon)
398
399 if(NOT ${ENABLE_STATIC})
400         install(TARGETS epan
401                 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
402                 RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
403                 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
404         )
405 endif()
406
407 if(NOT WIN32)
408         install(FILES ${LIBWIRESHARK_PUBLIC_HEADERS}
409                 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${CPACK_PACKAGE_NAME}/epan"
410         )
411 endif()
412
413 add_executable(exntest EXCLUDE_FROM_ALL exntest.c except.c)
414 target_link_libraries(exntest ${GLIB2_LIBRARIES})
415 set_target_properties(exntest PROPERTIES
416         FOLDER "Tests"
417         COMPILE_DEFINITIONS "WS_BUILD_DLL"
418 )
419
420 add_executable(oids_test EXCLUDE_FROM_ALL oids_test.c)
421 target_link_libraries(oids_test epan ${ZLIB_LIBRARIES})
422 set_target_properties(oids_test PROPERTIES
423         FOLDER "Tests"
424         COMPILE_DEFINITIONS "WS_BUILD_DLL"
425 )
426
427 add_executable(reassemble_test EXCLUDE_FROM_ALL reassemble_test.c)
428 target_link_libraries(reassemble_test epan)
429 set_target_properties(reassemble_test PROPERTIES
430         FOLDER "Tests"
431 )
432
433 add_executable(tvbtest EXCLUDE_FROM_ALL tvbtest.c)
434 target_link_libraries(tvbtest epan)
435 set_target_properties(tvbtest PROPERTIES
436         FOLDER "Tests"
437         COMPILE_DEFINITIONS "WS_BUILD_DLL"
438 )
439
440 CHECKAPI(
441         NAME
442           epan
443         SWITCHES
444           -g termoutput -build
445         SOURCES
446           ${LIBWIRESHARK_FILES}
447 )
448
449 #
450 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html
451 #
452 # Local variables:
453 # c-basic-offset: 8
454 # tab-width: 8
455 # indent-tabs-mode: t
456 # End:
457 #
458 # vi: set shiftwidth=8 tabstop=8 noexpandtab:
459 # :indentSize=8:tabSize=8:noTabs=false:
460 #