Move merge.{h,c} into wiretap: these modules use wiretap to merge files.
[metze/wireshark/wip.git] / CMakeLists.txt
index b2e133780d77f54fb62d8b1b796896a5f448df35..29f65b6e2b076f43bfb840c0d57c383e37d578b9 100644 (file)
@@ -87,6 +87,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
 INCLUDE(UseLemon)
 INCLUDE(UseMakeDissectorReg)
 INCLUDE(UseMakeTapReg)
+INCLUDE(UseAsn2Wrs)
 
 # Under linux the release mode (CMAKE_BUILD_TYPE=release) defines NDEBUG
 
@@ -123,56 +124,57 @@ set(WIRESHARK_C_FLAGS
        -Wendif-labels
        -Wpointer-arith
        -Warray-bounds
-       -Wcast-align
        -Wformat-security
-       -fexcess-precision=fast
+       -Wshorten-64-to-32
+       -Wvla
+       -Waddress
+       -Warray-bounds
+       -Wattributes
+       -Wdiv-by-zero
+       -Wignored-qualifiers
+       -Wno-overlength-strings
+       -Wwrite-strings
+       -Wno-long-long
 )
+if (NOT APPLE)
+       set(WIRESHARK_C_FLAGS ${WIRESHARK_C_FLAGS}
+           -fexcess-precision=fast
+           -Wpragmas)
+endif()
 
 set(WIRESHARK_C_ONLY_FLAGS
        # The following are C only, not C++
        -Wc++-compat
        -Wdeclaration-after-statement
+       -Wshadow
        -Wno-pointer-sign
        -Wold-style-definition
        -Wshadow
+       -Wstrict-prototypes
 )
+if (NOT APPLE)
+       set(WIRESHARK_C_ONLY_FLAGS ${WIRESHARK_C_ONLY_FLAGS}
+           -Wlogical-op
+           -Wjump-misses-init)
+endif()
 
 set(WIRESHARK_EXTRA_C_FLAGS
        -pedantic
        -Woverflow
-       -Wlogical-op
-       -Wno-overlength-strings
        -fstrict-overflow -Wstrict-overflow=4
        -Wunreachable-code
        -Wunsafe-loop-optimizations
-       -Wno-long-long
+       -Wcast-align
        -Wcast-qual
-       -Waddress
-       -Warray-bounds
-       -Wattributes
-       -Wdiv-by-zero
        -Wformat-security
-       -Wignored-qualifiers
-       -Wpragmas
        -Wredundant-decls
-       -Wvla
-       # packet-ncp2222.inc prevents this from going into all warnings
-       -Wwrite-strings
        # All the registration functions block these for now.
        -Wmissing-declarations
-       # Problem with packet-afs.c
-       -Wshadow
-       # More cleanup needed for this on LP64
-       -Wshorten-64-to-32
-
 )
 
 set(WIRESHARK_EXTRA_C_ONLY_FLAGS
        # The following are C only, not C++
        -Wbad-function-cast
-       -Wjump-misses-init
-       # GLib blocks this for now.
-       -Wstrict-prototypes
        # All the registration functions block these for now.
        -Wmissing-prototypes
 )
@@ -229,7 +231,7 @@ else()
        unset(WERROR)
 endif()
 
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER MATCHES ".*clang")
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER MATCHES ".*clang" OR APPLE)
        set (C_UNUSED "__attribute__((unused))" )
 else()
        set (C_UNUSED "" )
@@ -278,6 +280,7 @@ set(GLIB2_MIN_VERSION 2.14.0)
 set(GTHREAD2_REQUIRED)
 set(PCAP_REQUIRED)
 set(M_REQUIRED)
+set(PythonInterp_FIND_VERSION 2)
 
 set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
 
@@ -299,8 +302,14 @@ endif()
 
 # Build the Qt GUI?
 if(BUILD_qtshark)
-       set(PACKAGELIST ${PACKAGELIST} QT)
-       # set(QT_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
+       if(ENABLE_QT5)
+               set(PACKAGELIST ${PACKAGELIST} Qt5Widgets Qt5PrintSupport Qt5LinguistTools)
+               set(QT_VERSION 5)
+       else()
+               set(PACKAGELIST ${PACKAGELIST} Qt4)
+               # set(Qt4_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
+               set(QT_VERSION 4)
+       endif()
 endif()
 
 # SMI SNMP
@@ -361,7 +370,7 @@ if(ENABLE_CAP)
 endif()
 
 if(ENABLE_PYTHON)
-       set(PACKAGELIST ${PACKAGELIST} PYTHON)
+       set(PACKAGELIST ${PACKAGELIST} PythonLibs)
 endif()
 
 set(PACKAGELIST ${PACKAGELIST} YAPP)
@@ -371,26 +380,39 @@ set(PACKAGELIST ${PACKAGELIST} POD)
 
 set(PROGLIST text2pcap mergecap capinfos editcap reordercap dumpcap)
 
+#Sort the package list
+list(SORT PACKAGELIST)
+message(STATUS "Packagelist: ${PACKAGELIST}")
 #Let's loop the package list
 foreach(PACKAGE ${PACKAGELIST})
-       if(${PACKAGE} STREQUAL "QT")
-               set(PACKAGE_NAME "Qt4")
+       if(${PACKAGE} STREQUAL "Qt4")
+               set(PACKAGE_VAR "QT")
+       elseif(${PACKAGE} STREQUAL "PythonInterp")
+               set(PACKAGE_VAR "PYTHON")
+       elseif(${PACKAGE} STREQUAL "PythonLibs")
+               set(PACKAGE_VAR "PYTHON")
        else()
-               set(PACKAGE_NAME ${PACKAGE})
+               set(PACKAGE_VAR ${PACKAGE})
        endif()
        if(${PACKAGE}_OPTIONS)
-               find_package(${PACKAGE_NAME} ${${PACKAGE}_OPTIONS})
+               find_package(${PACKAGE} ${${PACKAGE}_OPTIONS})
        elseif(${PACKAGE}_REQUIRED)
-               find_package(${PACKAGE_NAME} REQUIRED)
+               find_package(${PACKAGE} REQUIRED)
        else()
-               find_package(${PACKAGE_NAME})
+               find_package(${PACKAGE})
        endif()
-       message(${PACKAGE}_FOUND)
-       if (${PACKAGE}_FOUND)
-               set(HAVE_LIB${PACKAGE} 1)
-               include_directories(${${PACKAGE}_INCLUDE_DIRS})
-               message(STATUS "${PACKAGE} includes: ${${PACKAGE}_INCLUDE_DIRS}")
-               message(STATUS "${PACKAGE} libs: ${${PACKAGE}_LIBRARIES}")
+       message(${PACKAGE_VAR}_FOUND)
+       if (${PACKAGE_VAR}_FOUND)
+               set(HAVE_LIB${PACKAGE_VAR} 1)
+               include_directories(${${PACKAGE_VAR}_INCLUDE_DIRS})
+               message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}")
+               message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}")
+               if (${PACKAGE}_DEFINITIONS)
+                       message(STATUS "${PACKAGE} definitions: ${${PACKAGE_VAR}_DEFINITIONS}")
+               endif()
+               if (${PACKAGE_VAR}_EXECUTABLE)
+                       message(STATUS "${PACKAGE} executable: ${${PACKAGE_VAR}_EXECUTABLE}")
+               endif()
        endif()
 endforeach()
 
@@ -434,14 +456,20 @@ endif()
 if(HAVE_LIBZLIB)
        set(HAVE_LIBZ 1)
 endif()
-# QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic:
-if(QT_FOUND)
+if (Qt5Widgets_FOUND)
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
+       if (Qt5_POSITION_INDEPENDENT_CODE)
+               set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+       endif()
+       set (QT_FOUND ON)
+       set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
+# If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
+elseif(QT_FOUND)
        include(${QT_USE_FILE})
        include_directories(${QT_INCLUDE_DIR})
        message(STATUS "QT includes: ${QT_INCLUDE_DIR}")
        message(STATUS "QT libs: ${QT_LIBRARIES}")
 endif()
-
 include(ConfigureChecks.cmake)
 
 #Big or little endian ?
@@ -588,20 +616,9 @@ ADD_CUSTOM_COMMAND(
                ${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
 )
 
-ADD_CUSTOM_COMMAND(
-       OUTPUT  ps.c
-       COMMAND ${PYTHON_EXECUTABLE}
-               ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
-               ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
-               ps.c
-       DEPENDS
-               ${CMAKE_CURRENT_SOURCE_DIR}/tools/rdps.py
-               ${CMAKE_CURRENT_SOURCE_DIR}/print.ps
-)
-
 if(UNIX)
        set(PLATFORM_SRC
-               capture-pcap-util-unix.c capture_unix_ifnames.c
+               capture-pcap-util-unix.c
        )
 endif()
 
@@ -613,7 +630,6 @@ endif()
 
 set(WTAP_PLUGIN_SOURCES
        epan/plugins.c
-       epan/report_err.c
        epan/filesystem.c
 )
 
@@ -628,16 +644,9 @@ set(WIRESHARK_COMMON_SRC
        cfile.c
        cfutils.c
        clopts_common.c
-       disabled_protos.c
-       frame_data_sequence.c
-       packet-range.c
-       print.c
-       ps.c
+       frame_tvbuff.c
        svnversion.h
        sync_pipe_write.c
-       timestats.c
-       tap-megaco-common.c
-       tap-rtp-common.c
        version_info.c
 )
 
@@ -752,13 +761,9 @@ if( (BUILD_wireshark AND GTK_FOUND) OR (BUILD_qtshark AND QT_FOUND) )
                file.c
                fileset.c
                filters.c
-               g711.c
                iface_monitor.c
-               merge.c
                proto_hier_stats.c
                summary.c
-               tempfile.c
-               u3.c
                ws80211_utils.c
                ${SHARK_COMMON_CAPTURE_SRC}
                ${WIRESHARK_COMMON_SRC}
@@ -818,6 +823,7 @@ register_tap_files(tshark-tap-register.c
 
 if(BUILD_tshark)
        set(tshark_LIBS
+               ui
                ${LIBEPAN_LIBS}
                ${APPLE_CORE_FOUNDATION_LIBRARY}
                ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
@@ -825,10 +831,8 @@ if(BUILD_tshark)
        set(tshark_FILES
                capture_opts.c
                capture_sync.c
-               tempfile.c
                tshark-tap-register.c
                tshark.c
-               ui/util.c
                ${TSHARK_TAP_SRC}
                ${SHARK_COMMON_CAPTURE_SRC}
                ${WIRESHARK_COMMON_SRC}
@@ -922,7 +926,6 @@ if(BUILD_mergecap)
        )
        set(mergecap_FILES
                mergecap.c
-               merge.c
                svnversion.h
                ${WTAP_PLUGIN_SOURCES}
        )
@@ -976,7 +979,6 @@ if(BUILD_editcap)
        set(editcap_FILES
                editcap.c
                epan/crypt/md5.c
-               epan/nstime.c
                ${WTAP_PLUGIN_SOURCES}
        )
        add_executable(editcap ${editcap_FILES})
@@ -1013,7 +1015,6 @@ if(BUILD_dumpcap AND PCAP_FOUND)
                pcapio.c
                ringbuffer.c
                sync_pipe_write.c
-               tempfile.c
                version_info.c
                ws80211_utils.c
                ${PLATFORM_SRC}