epan/dissectors/packet-dcerpc.* move ndr_pointer stuff to dcerpc_info and avoid globa...
[metze/wireshark/wip.git] / CMakeLists.txt
index 0ae90549b92d4819b125d636d331bdb4681d3363..dd9b78c395404a1596fc290af6a474b1cad00dc9 100644 (file)
@@ -59,22 +59,6 @@ set(PROJECT_MAJOR_VERSION 4)
 set(PROJECT_MINOR_VERSION 3)
 set(PROJECT_PATCH_VERSION 0)
 set(PROJECT_BUILD_VERSION 0)
-# ABI version for plugins. It must be incremented by one for
-# every odd minor release number.
-# start at 1 (arbitrary).
-# release 4.3.X (unstable) = ABI version 1 (start)
-# release 4.4.X (stable)   = ABI version 1 (stable release, freeze ABI 1)
-# release 4.5.X (unstable) = ABI version 2 (increment for new unstable release, ABI break)
-# release 4.6.X (stable)   = ABI version 2 (stable release, freeze ABI 2)
-# release 4.7.X (unstable) = ABI version 3 (increment for new unstable release, ABI break)
-# release 5.0.X (stable)   = ABI version 3 (stable release, freeze ABI 3)
-# etc.
-set(PROJECT_ABI_VERSION_EPAN    1)
-set(PROJECT_ABI_VERSION_WIRETAP 1)
-# Codecs API/ABI is much more narrow and stable than the other two so this
-# may not need to be incremented every X.Y release.
-set(PROJECT_ABI_VERSION_CODEC   1)
-
 set(PROJECT_VERSION_EXTENSION "")
 
 if(DEFINED ENV{WIRESHARK_VERSION_EXTRA})
@@ -85,8 +69,8 @@ set(PROJECT_VERSION "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT
 
 set(LOG_PROJECT_NAME ${_log_project_name})
 set(LOG_PROJECT_MAJOR_VERSION 0)
-set(LOG_PROJECT_MINOR_VERSION 8)
-set(LOG_PROJECT_PATCH_VERSION 3)
+set(LOG_PROJECT_MINOR_VERSION 9)
+set(LOG_PROJECT_PATCH_VERSION 0)
 set(LOG_PROJECT_VERSION "${LOG_PROJECT_MAJOR_VERSION}.${LOG_PROJECT_MINOR_VERSION}.${LOG_PROJECT_PATCH_VERSION}${PROJECT_VERSION_EXTENSION}")
 
 include( CMakeOptions.txt )
@@ -305,12 +289,6 @@ if(WIN32 AND NOT USE_MSYSTEM)
        set(CMAKE_INSTALL_INCLUDEDIR "include")
        set(CMAKE_INSTALL_DATADIR ".")
        set(CMAKE_INSTALL_DOCDIR ".")
-else()
-       # By default INSTALL_DATADIR is set to INSTALL_DATAROOTDIR, set the
-       # proper value here.
-       set(CMAKE_INSTALL_DATADIR "share/${PROJECT_NAME}"
-               CACHE PATH "Read-only architecture-independent data"
-       )
 endif()
 include(GNUInstallDirs)
 
@@ -319,9 +297,9 @@ set(PROJECT_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}")
 # Make sure our executables can load our libraries if we install into
 # a non-default directory on Unix-like systems other than macOS.
 # https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
-set(LIBRARY_INSTALL_RPATH "")
-set(EXECUTABLE_INSTALL_RPATH "")
-set(EXTCAP_INSTALL_RPATH "")
+set(LIBRARY_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}")
+set(EXECUTABLE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}")
+set(EXTCAP_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}")
 if(NOT (WIN32 OR APPLE OR USE_STATIC))
        # Try to set a RPATH for installed binaries if the library directory is
        # not already included in the default search list.
@@ -1217,6 +1195,10 @@ find_package(GCRYPT "1.8.0" REQUIRED)
 # C Asynchronous resolver
 reset_find_package(CARES)
 find_package(CARES "1.13.0" REQUIRED)
+if (CARES_VERSION VERSION_GREATER_EQUAL "1.28.0")
+       # Suppress deprecation warnings.
+       add_compile_definitions(CARES_NO_DEPRECATED)
+endif ()
 find_package(LEX REQUIRED)
 find_package(Perl)
 find_package(PCRE2 REQUIRED)
@@ -1231,7 +1213,7 @@ if(BUILD_sshdump OR BUILD_ciscodump OR BUILD_wifidump)
 else()
        set(ENABLE_LIBSSH OFF)
 endif()
-ws_find_package(LIBSSH ENABLE_LIBSSH HAVE_LIBSSH "0.6")
+ws_find_package(LIBSSH ENABLE_LIBSSH HAVE_LIBSSH "0.8.5")
 
 ws_find_package(PCAP ENABLE_PCAP HAVE_LIBPCAP)
 ws_find_package(AIRPCAP ENABLE_AIRPCAP HAVE_AIRPCAP)
@@ -1264,6 +1246,7 @@ if(BUILD_wireshark OR BUILD_logray)
                                Widgets
                                Concurrent
                                Core5Compat
+                               DBus
                        OPTIONAL_COMPONENTS
                                Multimedia
                )
@@ -1297,6 +1280,10 @@ if(BUILD_wireshark OR BUILD_logray)
                if(WIN32)
                        list(APPEND QT5_PACKAGELIST Qt5WinExtras)
                endif()
+               if(NOT WIN32 AND NOT APPLE)
+                       # DBus is a core component of Qt6, but was an add-on in Qt5.
+                       list(APPEND QT5_OPTIONAL_PACKAGELIST Qt5DBus)
+               endif()
                foreach(_qt5_package IN LISTS QT5_PACKAGELIST)
                        find_package(${_qt5_package} REQUIRED ${QT5_FIND_PACKAGE_OPTIONS})
                        list(APPEND QT5_LIBRARIES ${${_qt5_package}_LIBRARIES})
@@ -1335,6 +1322,9 @@ if(BUILD_wireshark OR BUILD_logray)
        if(Qt6Multimedia_FOUND OR Qt5Multimedia_FOUND)
                set(QT_MULTIMEDIA_LIB 1)
        endif()
+       if(Qt6DBus_FOUND OR Qt5DBus_FOUND)
+               set(QT_DBUS_LIB 1)
+       endif()
        if(NOT DEFINED MOC_OPTIONS)
                # Squelch moc verbose "nothing to do" output
                set(MOC_OPTIONS -nn)
@@ -1382,9 +1372,9 @@ ws_find_package(NGHTTP3 ENABLE_NGHTTP3 HAVE_NGHTTP3)
 # Embedded Lua interpreter
 if(FETCH_lua)
        # Download and build lua
-       include(${CMAKE_SOURCE_DIR}/cmake/external/lua52/Lua52.cmake)
+       include(${CMAKE_SOURCE_DIR}/cmake/external/lua53/Lua53.cmake)
 else()
-       set(LUA_FIND_VERSIONS "5.2;5.1" CACHE STRING "Lua versions valid for the build (as a list)")
+       set(LUA_FIND_VERSIONS "5.4;5.3" CACHE STRING "Lua versions valid for the build (as a list)")
        ws_find_package(Lua ENABLE_LUA HAVE_LUA)
 endif()
 
@@ -1515,13 +1505,13 @@ if (QT_FOUND)
                # https://doc.qt.io/qt-5.11/supported-platforms-and-configurations.html
                # https://doc.qt.io/qt-5.15/supported-platforms.html
                # https://doc-snapshots.qt.io/qt6-dev/supported-platforms.html
-               if(Qt${qtver}Widgets_VERSION VERSION_GREATER_EQUAL "6.5.0")
+               if(Qt${qtver}Widgets_VERSION VERSION_GREATER_EQUAL "6.5.0" AND MIN_MACOS_VERSION VERSION_LESS "11.0")
                        set(MIN_MACOS_VERSION 11.0)
-               elseif(Qt${qtver}Widgets_VERSION VERSION_GREATER_EQUAL "6.0.0")
+               elseif(Qt${qtver}Widgets_VERSION VERSION_GREATER_EQUAL "6.0.0" AND MIN_MACOS_VERSION VERSION_LESS "10.14")
                        set(MIN_MACOS_VERSION 10.14)
-               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.14.0")
+               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.14.0" AND MIN_MACOS_VERSION VERSION_LESS "10.13")
                        set(MIN_MACOS_VERSION 10.13)
-               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.12.0")
+               elseif(Qt5Widgets_VERSION VERSION_GREATER_EQUAL "5.12.0" AND MIN_MACOS_VERSION VERSION_LESS "10.12")
                        set(MIN_MACOS_VERSION 10.12)
                endif()
                if(CMAKE_OSX_DEPLOYMENT_TARGET AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS MIN_MACOS_VERSION)
@@ -1603,11 +1593,34 @@ include( UseCheckAPI )
 # If you change the nesting level be sure to check also the INSTALL_RPATH
 # target property.
 if(WIN32 AND NOT USE_MSYSTEM)
-       set(EXTCAP_INSTALL_LIBDIR "extcap" CACHE INTERNAL "The extcap dir")
+       set(EXTCAP_INSTALL_LIBDIR "extcap/${PROJECT_NAME}" CACHE INTERNAL "The Wireshark extcap dir")
+       if (BUILD_logray)
+               set(LOG_EXTCAP_INSTALL_LIBDIR "extcap/${LOG_PROJECT_NAME}" CACHE INTERNAL "The Logray extcap dir")
+       endif()
 else()
-       set(EXTCAP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/extcap" CACHE INTERNAL "The extcap dir")
+       set(EXTCAP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/extcap" CACHE INTERNAL "The Wireshark extcap dir")
+       if (BUILD_logray)
+               set(LOG_EXTCAP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${LOG_PROJECT_NAME}/extcap" CACHE INTERNAL "The Logray extcap dir")
+       endif()
+endif()
+
+if(APPLE)
+       #
+       # As https://developer.apple.com/library/archive/technotes/tn2206/_index.html
+       # says,
+       #
+       # "Note that a location where code is expected to reside cannot generally
+       # contain directories full of nested code, because those directories tend
+       # to be interpreted as bundles. So this occasional practice is not
+       # recommended and not officially supported. If you do do this, do not use
+       # periods in the directory names. The code signing machinery interprets
+       # directories with periods in their names as code bundles and will reject
+       # them if they don't conform to the expected code bundle layout."
+       #
+       set(PLUGIN_PATH_ID "${PROJECT_MAJOR_VERSION}-${PROJECT_MINOR_VERSION}")
+else()
+       set(PLUGIN_PATH_ID "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}")
 endif()
-set(EXTCAP_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${EXTCAP_INSTALL_LIBDIR}")
 
 # Directory where plugins and Lua dissectors can be found.
 if(WIN32 AND NOT USE_MSYSTEM)
@@ -1616,6 +1629,8 @@ else()
        set(PLUGIN_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/plugins" CACHE INTERNAL "The plugin dir")
 endif()
 set(PLUGIN_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_INSTALL_LIBDIR}")
+set(PLUGIN_INSTALL_VERSION_LIBDIR "${PLUGIN_INSTALL_LIBDIR}/${PLUGIN_PATH_ID}")
+set(PLUGIN_VERSION_DIR "plugins/${PLUGIN_PATH_ID}")
 
 add_subdirectory( capture )
 add_subdirectory( doc )
@@ -1712,7 +1727,7 @@ if(ENABLE_PLUGINS)
                plugins/epan/wimaxmacphy
                plugins/epan/dfilter/ipaddr
                plugins/wiretap/usbdump
-               plugins/codecs/g711
+               plugins/codecs/G711
                plugins/codecs/l16_mono
                ${CUSTOM_PLUGIN_SRC_DIR}
        )
@@ -1724,13 +1739,13 @@ if(ENABLE_PLUGINS)
        endif()
        if(SPANDSP_FOUND)
                list(APPEND PLUGIN_SRC_DIRS
-                       plugins/codecs/g722
-                       plugins/codecs/g726
+                       plugins/codecs/G722
+                       plugins/codecs/G726
                )
        endif()
        if(BCG729_FOUND)
                list(APPEND PLUGIN_SRC_DIRS
-                       plugins/codecs/g729
+                       plugins/codecs/G729
                )
        endif()
        if(AMRNB_FOUND)
@@ -1740,7 +1755,7 @@ if(ENABLE_PLUGINS)
        endif()
        if(ILBC_FOUND)
                list(APPEND PLUGIN_SRC_DIRS
-                       plugins/codecs/ilbc
+                       plugins/codecs/iLBC
                )
        endif()
        if(OPUS_FOUND)
@@ -1768,22 +1783,22 @@ endif()
 
 if(ENABLE_APPLICATION_BUNDLE)
        if(CMAKE_CFG_INTDIR STREQUAL ".")
-               set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark")
+               set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark/${PLUGIN_PATH_ID}")
        else()
                # Xcode
-               set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/PlugIns/wireshark")
+               set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Wireshark.app/Contents/PlugIns/wireshark/${PLUGIN_PATH_ID}")
        endif()
        if(CMAKE_CFG_INTDIR STREQUAL ".")
-               set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/Logray.app/Contents/PlugIns/logray")
+               set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/Logray.app/Contents/PlugIns/logray/${PLUGIN_PATH_ID}")
        else()
                # Xcode
-               set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Logray.app/Contents/PlugIns/logray")
+               set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/Logray.app/Contents/PlugIns/logray/${PLUGIN_PATH_ID}")
        endif()
 elseif(MSVC AND NOT CMAKE_CFG_INTDIR STREQUAL ".")
-       set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/plugins")
+       set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$<CONFIG>/${PLUGIN_VERSION_DIR}")
        set(_logray_plugin_dir ${_plugin_dir})
 else()
-       set(_plugin_dir "${DATAFILE_DIR}/plugins")
+       set(_plugin_dir "${DATAFILE_DIR}/${PLUGIN_VERSION_DIR}")
        set(_logray_plugin_dir ${_plugin_dir})
 endif()
 set (PLUGIN_DIR ${_plugin_dir} CACHE INTERNAL "Build time plugin location.")
@@ -1904,7 +1919,7 @@ set_package_properties(LZ4 PROPERTIES
 set_package_properties(SNAPPY PROPERTIES
        DESCRIPTION "A fast compressor/decompressor from Google"
        URL "https://google.github.io/snappy/"
-       PURPOSE "Snappy decompression in CQL and Kafka dissectors"
+       PURPOSE "Snappy decompression in Couchbase, CQL, Kafka and Mongo dissectors"
 )
 set_package_properties(ZSTD PROPERTIES
        DESCRIPTION "A compressor/decompressor from Facebook providing better compression than Snappy at a cost of speed"
@@ -1988,9 +2003,6 @@ if(WIN32)
        set(PLATFORM_UI_SRC
                ui/win32/file_dlg_win32.cpp
        )
-       set(PLATFORM_UI_RC_FILES
-               resources/file_dlg_win32.rc
-       )
 elseif(APPLE)
        set(PLATFORM_UI_SRC
                ui/macosx/cocoa_bridge.mm
@@ -2038,7 +2050,8 @@ set(TSHARK_TAP_SRC
 
 )
 
-# Installed into ${DATAFILE_DIR}
+# Copied into ${DATAFILE_DIR} at build time and ${CMAKE_INSTALL_DATADIR}/wireshark
+# at install time.
 set(INSTALL_DIRS
        resources/share/wireshark/profiles
        resources/protocols/diameter
@@ -2048,7 +2061,8 @@ set(INSTALL_DIRS
        resources/protocols/wimaxasncp
 )
 
-# Installed into ${DATAFILE_DIR}
+# Copied into ${DATAFILE_DIR} at build time and ${CMAKE_INSTALL_DATADIR}/wireshark
+# at install time.
 set(INSTALL_FILES
        resources/share/wireshark/cfilters
        resources/share/wireshark/colorfilters
@@ -2386,21 +2400,26 @@ foreach(_install_file ${INSTALL_FILES} ${DOC_FILES})
        list(APPEND copy_data_files_depends "${_output_file}")
 endforeach()
 
-if (BUILD_logray AND ENABLE_APPLICATION_BUNDLE)
-       foreach(_install_file ${LOG_INSTALL_FILES})
-               get_filename_component(_install_file_src "${_install_file}" ABSOLUTE)
-               get_filename_component(_install_basename "${_install_file}" NAME)
-               set(_output_file "${LOG_DATAFILE_DIR}/${_install_basename}")
-               add_custom_command(OUTPUT "${_output_file}"
-                       COMMAND ${CMAKE_COMMAND} -E copy_if_different
-                               "${_install_file_src}"
-                               "${_output_file}"
-                       DEPENDS
-                               docs
-                               "${_install_file}"
-               )
-               list(APPEND copy_data_files_depends "${_output_file}")
-       endforeach()
+if (BUILD_logray)
+       if (ENABLE_APPLICATION_BUNDLE)
+               foreach(_install_file ${LOG_INSTALL_FILES})
+                       get_filename_component(_install_file_src "${_install_file}" ABSOLUTE)
+                       get_filename_component(_install_basename "${_install_file}" NAME)
+                       set(_output_file "${LOG_DATAFILE_DIR}/${_install_basename}")
+                       add_custom_command(OUTPUT "${_output_file}"
+                               COMMAND ${CMAKE_COMMAND} -E copy_if_different
+                                       "${_install_file_src}"
+                                       "${_output_file}"
+                               DEPENDS
+                                       docs
+                                       "${_install_file}"
+                       )
+                       list(APPEND copy_data_files_depends "${_output_file}")
+               endforeach()
+       else()
+               # XXX The default profile (colorfilters, dfilters) is at the
+               # top-level resources directory for both Wireshark and Logray.
+       endif()
 endif()
 
 set(_protocol_data_dir ${CMAKE_SOURCE_DIR}/resources/protocols)
@@ -3000,7 +3019,6 @@ if(BUILD_tshark)
                ${APPLE_CORE_FOUNDATION_LIBRARY}
                ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
                ${WIN_WS2_32_LIBRARY}
-               ${M_LIBRARIES}
        )
        set(tshark_FILES
                $<TARGET_OBJECTS:capture_opts>
@@ -3074,7 +3092,6 @@ if(BUILD_sharkd)
                ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
                ${WIN_WS2_32_LIBRARY}
                ${SPEEXDSP_LIBRARIES}
-               ${M_LIBRARIES}
                ${GCRYPT_LIBRARIES}
        )
        set(sharkd_FILES
@@ -3270,7 +3287,6 @@ if(BUILD_dumpcap AND PCAP_FOUND)
                ${APPLE_CORE_FOUNDATION_LIBRARY}
                ${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
                ${WIN_WS2_32_LIBRARY}
-               ${M_LIBRARIES}
        )
        if(UNIX)
                list(APPEND CAPUTILS_SRC
@@ -3365,7 +3381,6 @@ if(WIN32)
 
        if(MAKENSIS_EXECUTABLE)
                add_subdirectory( packaging/nsis EXCLUDE_FROM_ALL )
-               ADD_NSIS_UNINSTALLER_TARGETS()
                ADD_NSIS_PACKAGE_TARGETS()
        endif()
 
@@ -3947,9 +3962,22 @@ install(
                GROUP_READ
                WORLD_READ
        DESTINATION
-               ${CMAKE_INSTALL_DATADIR}
+               ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
 )
 
+if (BUILD_logray)
+       install(
+               FILES
+                       ${LOG_INSTALL_FILES}
+               PERMISSIONS
+                       OWNER_WRITE OWNER_READ
+                       GROUP_READ
+                       WORLD_READ
+               DESTINATION
+                       ${CMAKE_INSTALL_DATADIR}/${LOG_PROJECT_NAME}
+       )
+endif()
+
 install(
        FILES
                ${DOC_FILES}
@@ -4052,7 +4080,7 @@ install(
        DIRECTORY
                ${INSTALL_DIRS}
        DESTINATION
-               ${CMAKE_INSTALL_DATADIR}
+               ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
        FILE_PERMISSIONS
                OWNER_WRITE OWNER_READ
                GROUP_READ
@@ -4066,6 +4094,26 @@ install(
        PATTERN "Makefile.*" EXCLUDE
 )
 
+if (BUILD_logray)
+       install(
+               DIRECTORY
+                       ${LOG_INSTALL_DIRS}
+               DESTINATION
+                       ${CMAKE_INSTALL_DATADIR}/${LOG_PROJECT_NAME}
+               FILE_PERMISSIONS
+                       OWNER_WRITE OWNER_READ
+                       GROUP_READ
+                       WORLD_READ
+               DIRECTORY_PERMISSIONS
+                       OWNER_EXECUTE OWNER_WRITE OWNER_READ
+                       GROUP_EXECUTE GROUP_READ
+                       WORLD_EXECUTE WORLD_READ
+               PATTERN ".git" EXCLUDE
+               PATTERN ".svn" EXCLUDE
+               PATTERN "Makefile.*" EXCLUDE
+       )
+endif()
+
 if(WIN32 AND NOT USE_MSYSTEM)
        # Note: CMake export mechanism misbehaves with a '.' in the
        # path (incorrect relative path computation).
@@ -4082,7 +4130,7 @@ configure_package_config_file(WiresharkConfig.cmake.in
        PATH_VARS
                CMAKE_INSTALL_LIBDIR
                CMAKE_INSTALL_INCLUDEDIR
-               PLUGIN_INSTALL_LIBDIR
+               PLUGIN_INSTALL_VERSION_LIBDIR
                EXTCAP_INSTALL_LIBDIR
 )