aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/external/lua52/0001-Add-an-install-static-target.patch28
-rw-r--r--cmake/external/lua52/Lua52.cmake47
-rw-r--r--cmake/modules/.editorconfig12
-rw-r--r--cmake/modules/FileInstall.cmake33
-rw-r--r--cmake/modules/FindAMRNB.cmake57
-rw-r--r--cmake/modules/FindAsciidoctor.cmake33
-rw-r--r--cmake/modules/FindBCG729.cmake2
-rw-r--r--cmake/modules/FindCARES.cmake19
-rw-r--r--cmake/modules/FindGCRYPT.cmake31
-rw-r--r--cmake/modules/FindGLIB2.cmake12
-rw-r--r--cmake/modules/FindGMODULE2.cmake2
-rw-r--r--cmake/modules/FindGNUTLS.cmake6
-rw-r--r--cmake/modules/FindGTHREAD2.cmake2
-rw-r--r--cmake/modules/FindILBC.cmake6
-rw-r--r--cmake/modules/FindKERBEROS.cmake2
-rw-r--r--cmake/modules/FindLEX.cmake2
-rw-r--r--cmake/modules/FindLIBSSH.cmake3
-rw-r--r--cmake/modules/FindLUA.cmake110
-rw-r--r--cmake/modules/FindLZ4.cmake2
-rw-r--r--cmake/modules/FindLibXml2.cmake4
-rw-r--r--cmake/modules/FindLua.cmake243
-rw-r--r--cmake/modules/FindMaxMindDB.cmake2
-rw-r--r--cmake/modules/FindMinizip.cmake24
-rw-r--r--cmake/modules/FindNGHTTP2.cmake2
-rw-r--r--cmake/modules/FindNGHTTP3.cmake62
-rw-r--r--cmake/modules/FindOPUS.cmake2
-rw-r--r--cmake/modules/FindPCAP.cmake67
-rw-r--r--cmake/modules/FindPCRE2.cmake102
-rw-r--r--cmake/modules/FindPowerShell.cmake4
-rw-r--r--cmake/modules/FindSBC.cmake1
-rw-r--r--cmake/modules/FindSMI.cmake6
-rw-r--r--cmake/modules/FindSNAPPY.cmake2
-rw-r--r--cmake/modules/FindSPANDSP.cmake11
-rw-r--r--cmake/modules/FindSinsp.cmake227
-rw-r--r--cmake/modules/FindSparkle.cmake26
-rw-r--r--cmake/modules/FindSpeexDSP.cmake40
-rw-r--r--cmake/modules/FindWSWinLibs.cmake12
-rw-r--r--cmake/modules/FindWiX.cmake18
-rw-r--r--cmake/modules/FindWinSparkle.cmake12
-rw-r--r--cmake/modules/FindXSLTPROC.cmake27
-rw-r--r--cmake/modules/FindZLIB.cmake10
-rw-r--r--cmake/modules/FindZSTD.cmake2
-rw-r--r--cmake/modules/LocatePythonModule.cmake53
-rw-r--r--cmake/modules/UseAsn2Wrs.cmake23
-rw-r--r--cmake/modules/UseExecutableResources.cmake6
-rw-r--r--cmake/modules/UseLemon.cmake93
-rw-r--r--cmake/modules/UseMakePluginReg.cmake22
-rw-r--r--cmake/modules/UseMakeTaps.cmake2
-rw-r--r--cmake/modules/WiresharkPlugin.cmake32
49 files changed, 1171 insertions, 375 deletions
diff --git a/cmake/external/lua52/0001-Add-an-install-static-target.patch b/cmake/external/lua52/0001-Add-an-install-static-target.patch
new file mode 100644
index 0000000000..0f161925ef
--- /dev/null
+++ b/cmake/external/lua52/0001-Add-an-install-static-target.patch
@@ -0,0 +1,28 @@
+From f9430b91ae6957f9b77e03e3ce1edfbce99b5019 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= <j@v6e.pt>
+Date: Sat, 10 Jun 2023 19:16:51 +0100
+Subject: [PATCH] Add an install-static target
+
+---
+ Makefile | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index b2a62cf..7134775 100644
+--- a/Makefile
++++ b/Makefile
+@@ -64,6 +64,11 @@ install: dummy
+ cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+
++install-static: dummy
++ cd src && $(MKDIR) $(INSTALL_INC) $(INSTALL_LIB)
++ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
++ cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
++
+ uninstall:
+ cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
+ cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
+--
+2.41.0
+
diff --git a/cmake/external/lua52/Lua52.cmake b/cmake/external/lua52/Lua52.cmake
new file mode 100644
index 0000000000..864f2235bc
--- /dev/null
+++ b/cmake/external/lua52/Lua52.cmake
@@ -0,0 +1,47 @@
+#
+find_program(MAKE_EXE NAMES gmake nmake make)
+include(ExternalProject)
+
+message(DEBUG "Compiler: ${CMAKE_C_COMPILER} Ar: ${CMAKE_AR} Ranlib: ${CMAKE_RANLIB}")
+
+set(_staging_dir "${CMAKE_BINARY_DIR}/staging")
+
+if(MINGW)
+ set(_target mingw)
+elseif(APPLE)
+ set(_target macosx)
+elseif(CMAKE_SYSTEM_NAME MATCHES Linux)
+ set(_target linux)
+elseif(UNIX)
+ set(_target posix)
+else()
+ set(_target generic)
+endif()
+
+set(HAVE_LUA TRUE)
+set(LUA_INCLUDE_DIRS "${_staging_dir}/include")
+set(LUA_LIBRARIES "${_staging_dir}/lib/liblua.a")
+set(LUA_FOUND TRUE CACHE INTERNAL "")
+set(Lua_FOUND TRUE CACHE INTERNAL "")
+
+set(_lua52_cflags "-fPIC")
+if(APPLE)
+ set(_lua52_cflags "${lua52_cflags} -isysroot ${CMAKE_OSX_SYSROOT}")
+endif()
+
+#
+# The install patch isn't strictly necessary for Lua but it's cleaner to install
+# external projects to a staging directory first, and the normal install target
+# does not work with MinGW.
+#
+ExternalProject_Add(lua52
+ URL https://gitlab.com/wireshark/wireshark-development-libraries/-/raw/main/public/src/lua/lua-5.2.4.tar.gz
+ URL https://www.lua.org/ftp/lua-5.2.4.tar.gz
+ URL_HASH SHA256=b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b
+ PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/0001-Add-an-install-static-target.patch
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ${MAKE_EXE} MYCFLAGS=${_lua52_cflags} CC=${CMAKE_C_COMPILER} AR=${CMAKE_AR}\ rcu RANLIB=${CMAKE_RANLIB} ${_target}
+ BUILD_IN_SOURCE True
+ BUILD_BYPRODUCTS ${LUA_LIBRARIES}
+ INSTALL_COMMAND ${MAKE_EXE} INSTALL_TOP=${_staging_dir} install-static
+)
diff --git a/cmake/modules/.editorconfig b/cmake/modules/.editorconfig
index 5359b5051d..993ca32026 100644
--- a/cmake/modules/.editorconfig
+++ b/cmake/modules/.editorconfig
@@ -1,3 +1,15 @@
[FindAsciidoctor.cmake]
indent_style = space
indent_size = 4
+
+[FindSinsp.cmake]
+indent_style = space
+indent_size = 2
+
+[FindSMI.cmake]
+indent_style = space
+indent_size = 2
+
+[FindSPANDSP.cmake]
+indent_style = space
+indent_size = 2
diff --git a/cmake/modules/FileInstall.cmake b/cmake/modules/FileInstall.cmake
deleted file mode 100644
index 3358aa2a80..0000000000
--- a/cmake/modules/FileInstall.cmake
+++ /dev/null
@@ -1,33 +0,0 @@
-# FileInstall - Install files and directories separately from the
-# "install" command.
-#
-# Usage:
-# cmake -P /path/to/FileInstall.cmake [source ...] [destination]
-
-# Params are
-# cmake -P /path/to/hhc.cmake "/path/to/hhc.exe" project.hhp
-math(EXPR _dest_idx "${CMAKE_ARGC} - 1")
-set(_destination ${CMAKE_ARGV${_dest_idx}})
-set(_sources)
-
-math(EXPR _last_src "${CMAKE_ARGC} - 2")
-foreach(_src_idx RANGE 3 ${_last_src})
- set(_sources ${_sources} ${CMAKE_ARGV${_src_idx}})
-endforeach(_src_idx)
-
-if (_sources AND _destination)
- message (STATUS "Installing ${_sources} to ${_destination}")
- file (INSTALL ${_sources}
- DESTINATION ${_destination}
- 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
- )
-else()
- message (FATAL_ERROR "Missing arguments. Sources: ${_sources}. Destination: ${_destination}.")
-endif()
diff --git a/cmake/modules/FindAMRNB.cmake b/cmake/modules/FindAMRNB.cmake
new file mode 100644
index 0000000000..f8928ca8e7
--- /dev/null
+++ b/cmake/modules/FindAMRNB.cmake
@@ -0,0 +1,57 @@
+# Find the system's opencore-amrnb includes and library
+#
+# AMRNB_INCLUDE_DIRS - where to find amrnb/decoder.h
+# AMRNB_LIBRARIES - List of libraries when using amrnb
+# AMRNB_FOUND - True if amrnb found
+# AMRNB_DLL_DIR - (Windows) Path to the amrnb DLL
+# AMRNB_DLL - (Windows) Name of the amrnb DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "opencore-amrnb-.*" "AMRNB_HINTS" )
+
+if (NOT USE_REPOSITORY)
+ find_package(PkgConfig)
+ pkg_search_module(PC_AMRNB opencore-amrnb)
+endif()
+
+find_path( AMRNB_INCLUDE_DIR
+ NAMES opencore-amrnb/interf_dec.h
+ HINTS
+ "${PC_AMRNB_INCLUDE_DIRS}"
+ "${AMRNB_HINTS}/include"
+ PATHS /usr/local/include /usr/include
+)
+
+find_library( AMRNB_LIBRARY
+ NAMES opencore-amrnb
+ HINTS
+ "${PC_AMRNB_LIBDIRS}"
+ "${AMRNB_HINTS}/lib"
+ PATHS /usr/local/lib /usr/lib
+)
+
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( AMRNB DEFAULT_MSG AMRNB_LIBRARY AMRNB_INCLUDE_DIR)
+
+if( AMRNB_FOUND )
+ set( AMRNB_INCLUDE_DIRS ${AMRNB_INCLUDE_DIR} )
+ set( AMRNB_LIBRARIES ${AMRNB_LIBRARY} )
+ if (WIN32)
+ set ( AMRNB_DLL_DIR "${AMRNB_HINTS}/bin"
+ CACHE PATH "Path to amrnb DLL"
+ )
+ file( GLOB _amrnb_dll RELATIVE "${AMRNB_DLL_DIR}"
+ "${AMRNB_DLL_DIR}/libamrnb.dll"
+ )
+ set ( AMRNB_DLL ${_amrnb_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "amrnb DLL file name"
+ )
+ mark_as_advanced( AMRNB_DLL_DIR AMRNB_DLL )
+ endif()
+else()
+ set( AMRNB_INCLUDE_DIRS )
+ set( AMRNB_LIBRARIES )
+endif()
+
+mark_as_advanced( AMRNB_LIBRARIES AMRNB_INCLUDE_DIRS )
diff --git a/cmake/modules/FindAsciidoctor.cmake b/cmake/modules/FindAsciidoctor.cmake
index 69150a1f32..fd9db9da11 100644
--- a/cmake/modules/FindAsciidoctor.cmake
+++ b/cmake/modules/FindAsciidoctor.cmake
@@ -8,7 +8,11 @@ INCLUDE(FindChocolatey)
FIND_PROGRAM(ASCIIDOCTOR_EXECUTABLE
NAMES
+ asciidoctorj.cmd
+ asciidoctorj.bat
asciidoctorj
+ asciidoctor.cmd
+ asciidoctor.bat
asciidoctor
asciidoctor.ruby2.1
# XXX Add Asciidoctor.js releases (asciidoctor-linux,
@@ -31,22 +35,17 @@ if(ASCIIDOCTOR_EXECUTABLE)
function(set_asciidoctor_target_properties _target)
set_target_properties(${_target} PROPERTIES
- FOLDER "Docbook"
+ FOLDER "Documentation"
EXCLUDE_FROM_DEFAULT_BUILD True
)
endfunction(set_asciidoctor_target_properties)
- function(set_manpage_target_properties _target)
- set_target_properties(${_target} PROPERTIES
- FOLDER "Docs"
- )
- endfunction(set_manpage_target_properties)
-
set (_asciidoctor_common_args
- # Doesn't work with AsciidoctorJ?
+ # AsciidoctorJ added --failure-level in version 2.5.6
# --failure-level=WARN
# --trace
- --attribute build_dir=${CMAKE_CURRENT_BINARY_DIR}
+ --quiet
+ --attribute build_dir=${CMAKE_BINARY_DIR}/docbook
--require ${CMAKE_SOURCE_DIR}/docbook/asciidoctor-macros/ws_utils.rb
--require ${CMAKE_SOURCE_DIR}/docbook/asciidoctor-macros/commaize-block.rb
--require ${CMAKE_SOURCE_DIR}/docbook/asciidoctor-macros/cveidlink-inline-macro.rb
@@ -79,6 +78,7 @@ if(ASCIIDOCTOR_EXECUTABLE)
--out-file ${_output_xml}
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
DEPENDS
+ ${CMAKE_SOURCE_DIR}/doc/attributes.adoc
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
${ARGN}
)
@@ -110,6 +110,7 @@ if(ASCIIDOCTOR_EXECUTABLE)
--out-file ${_output_html}
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
DEPENDS
+ ${CMAKE_SOURCE_DIR}/doc/attributes.adoc
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
${ARGN}
)
@@ -126,10 +127,12 @@ if(ASCIIDOCTOR_EXECUTABLE)
ADD_CUSTOM_COMMAND(
OUTPUT
${_output_txt}
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
${_output_html}
> ${_output_txt}
DEPENDS
+ ${MAN_INCLUDES}
+ ${CMAKE_SOURCE_DIR}/doc/attributes.adoc
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
${_output_html}
${ARGN}
@@ -156,10 +159,10 @@ if(ASCIIDOCTOR_EXECUTABLE)
--destination-dir ${CMAKE_CURRENT_BINARY_DIR}
${_input_adoc}
DEPENDS
+ ${MAN_INCLUDES}
+ ${CMAKE_SOURCE_DIR}/doc/attributes.adoc
${_input_adoc}
)
- add_custom_target(generate_roff_man${_man_section}_pages DEPENDS ${_output_man})
- set_manpage_target_properties(generate_roff_man${_man_section}_pages)
unset(_src_file)
unset(_input_adoc)
unset(_output_man)
@@ -183,10 +186,10 @@ if(ASCIIDOCTOR_EXECUTABLE)
--destination-dir ${CMAKE_CURRENT_BINARY_DIR}
${_input_adoc}
DEPENDS
+ ${MAN_INCLUDES}
+ ${CMAKE_SOURCE_DIR}/doc/attributes.adoc
${_input_adoc}
)
- add_custom_target(generate_html_man_pages DEPENDS ${_output_man})
- set_manpage_target_properties(generate_html_man_pages)
unset(_src_file)
unset(_input_adoc)
unset(_output_man)
@@ -229,6 +232,7 @@ if(ASCIIDOCTOR_EXECUTABLE)
--out-file "${_output_pdf}"
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
DEPENDS
+ ${CMAKE_SOURCE_DIR}/doc/attributes.adoc
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
${ARGN}
VERBATIM
@@ -279,6 +283,7 @@ if(ASCIIDOCTOR_EXECUTABLE)
--out-file "${_output_epub}"
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
DEPENDS
+ ${CMAKE_SOURCE_DIR}/doc/attributes.adoc
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
${ARGN}
VERBATIM
diff --git a/cmake/modules/FindBCG729.cmake b/cmake/modules/FindBCG729.cmake
index 381fa0e366..37b56938ac 100644
--- a/cmake/modules/FindBCG729.cmake
+++ b/cmake/modules/FindBCG729.cmake
@@ -9,7 +9,7 @@
include( FindWSWinLibs )
FindWSWinLibs( "bcg729-.*" "BCG729_HINTS" )
-if (NOT WIN32)
+if (NOT USE_REPOSITORY)
find_package(PkgConfig QUIET)
pkg_search_module(BCG729 QUIET bcg729)
endif()
diff --git a/cmake/modules/FindCARES.cmake b/cmake/modules/FindCARES.cmake
index e3794a9bb6..f69a2a906b 100644
--- a/cmake/modules/FindCARES.cmake
+++ b/cmake/modules/FindCARES.cmake
@@ -17,10 +17,23 @@ ENDIF (CARES_INCLUDE_DIRS)
INCLUDE(FindWSWinLibs)
FindWSWinLibs("c-ares-.*" "CARES_HINTS")
-FIND_PATH(CARES_INCLUDE_DIR ares.h HINTS "${CARES_HINTS}/include" )
+find_path( CARES_INCLUDE_DIR
+ NAMES ares.h
+ PATH_SUFFIXES
+ include
+ HINTS
+ "${CARES_INCLUDEDIR}"
+ "${CARES_HINTS}"
+)
-SET(CARES_NAMES cares libcares-2)
-FIND_LIBRARY(CARES_LIBRARY NAMES ${CARES_NAMES} HINTS "${CARES_HINTS}/lib" )
+find_library( CARES_LIBRARY
+ NAMES cares libcares-2
+ PATH_SUFFIXES
+ lib64 lib
+ HINTS
+ "${CARES_LIBDIR}"
+ "${CARES_HINTS}"
+)
# Try to retrieve version from header if found
if(CARES_INCLUDE_DIR)
diff --git a/cmake/modules/FindGCRYPT.cmake b/cmake/modules/FindGCRYPT.cmake
index eba5001b91..1da7a66fd0 100644
--- a/cmake/modules/FindGCRYPT.cmake
+++ b/cmake/modules/FindGCRYPT.cmake
@@ -17,24 +17,41 @@ endif()
include(FindWSWinLibs)
FindWSWinLibs("libgcrypt-.*" "GCRYPT_HINTS")
-find_path(GCRYPT_INCLUDE_DIR gcrypt.h
+find_path(GCRYPT_INCLUDE_DIR
+ NAMES gcrypt.h
+ PATH_SUFFIXES
+ include
HINTS
- "${GCRYPT_HINTS}/include"
+ "${GCRYPT_INCLUDEDIR}"
+ "${GCRYPT_HINTS}"
)
+# libgcrypt-20 is used in libgcrypt-1.8.3-win??ws (from Debian).
+# libgcrypt is used in libgcrypt-1.10.1-2-win??ws (from Debian).
find_library(GCRYPT_LIBRARY
- NAMES gcrypt libgcrypt-20
- HINTS "${GCRYPT_HINTS}/bin")
+ NAMES gcrypt libgcrypt libgcrypt-20
+ PATH_SUFFIXES
+ lib
+ HINTS
+ "${GCRYPT_LIBDIR}"
+ "${GCRYPT_HINTS}"
+)
# libgpg-error6-0 is used in libgcrypt-1.7.6-win??ws (built from source).
# libgpg-error-0 is used in libgcrypt-1.8.3-win??ws (from Debian).
+# libgpg-error is used in libgcrypt-1.10.1-2-win??ws (from Debian).
find_library(GCRYPT_ERROR_LIBRARY
- NAMES gpg-error libgpg-error-0 libgpg-error6-0
- HINTS "${GCRYPT_HINTS}/bin")
+ NAMES gpg-error libgpg-error libgpg-error-0 libgpg-error6-0
+ PATH_SUFFIXES
+ lib
+ HINTS
+ "${GCRYPT_LIBDIR}"
+ "${GCRYPT_HINTS}"
+)
# Try to retrieve version from header if found (available since libgcrypt 1.3.0)
if(GCRYPT_INCLUDE_DIR)
- set(_version_regex "^#define[ \t]+GCRYPT_VERSION[ \t]+\"([^\"]+)\".*")
+ set(_version_regex "^#define[ \t]+GCRYPT_VERSION[ \t]+\"([0-9\.]+\.[0-9]+).*")
file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" GCRYPT_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1" GCRYPT_VERSION "${GCRYPT_VERSION}")
unset(_version_regex)
diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake
index 79e8abd29a..6b3876b528 100644
--- a/cmake/modules/FindGLIB2.cmake
+++ b/cmake/modules/FindGLIB2.cmake
@@ -142,11 +142,6 @@ if( GLIB2_FOUND )
# "${GLIB2_DLL_DIR_RELEASE}/libffi.dll"
"${GLIB2_DLL_DIR_RELEASE}/iconv-2.dll"
"${GLIB2_DLL_DIR_RELEASE}/intl-8.dll"
- "${GLIB2_DLL_DIR_RELEASE}/pcre.dll"
- # "${GLIB2_DLL_DIR_RELEASE}/pcre16.dll"
- # "${GLIB2_DLL_DIR_RELEASE}/pcre32.dll"
- # "${GLIB2_DLL_DIR_RELEASE}/pcrecpp.dll"
- # "${GLIB2_DLL_DIR_RELEASE}/pcreposix.dll"
)
set ( GLIB2_DLLS_RELEASE ${_glib2_dlls_release}
# We're storing filenames only. Should we use STRING instead?
@@ -163,11 +158,6 @@ if( GLIB2_FOUND )
# "${GLIB2_DLL_DIR_DEBUG}/libffi.dll"
"${GLIB2_DLL_DIR_DEBUG}/iconv-2.dll"
"${GLIB2_DLL_DIR_DEBUG}/intl-8.dll"
- "${GLIB2_DLL_DIR_DEBUG}/pcred.dll"
- # "${GLIB2_DLL_DIR_DEBUG}/pcre16d.dll"
- # "${GLIB2_DLL_DIR_DEBUG}/pcre32d.dll"
- # "${GLIB2_DLL_DIR_DEBUG}/pcrecppd.dll"
- # "${GLIB2_DLL_DIR_DEBUG}/pcreposixd.dll"
)
set ( GLIB2_DLLS_DEBUG ${_glib2_dlls_debug}
# We're storing filenames only. Should we use STRING instead?
@@ -181,7 +171,6 @@ if( GLIB2_FOUND )
# "${GLIB2_DLL_DIR_RELEASE}/libcharset.pdb"
# "${GLIB2_DLL_DIR_RELEASE}/libiconv.pdb"
# "${GLIB2_DLL_DIR_RELEASE}/libintl.pdb"
- "${GLIB2_DLL_DIR_RELEASE}/pcre.pdb"
)
set ( GLIB2_PDBS_RELEASE ${_glib2_pdbs_release}
CACHE FILEPATH "GLib2 debug release PDB list"
@@ -193,7 +182,6 @@ if( GLIB2_FOUND )
# "${GLIB2_DLL_DIR_DEBUG}/libcharset.pdb"
# "${GLIB2_DLL_DIR_DEBUG}/libiconv.pdb"
# "${GLIB2_DLL_DIR_DEBUG}/libintl.pdb"
- "${GLIB2_DLL_DIR_DEBUG}/pcre.pdb"
)
set ( GLIB2_PDBS_DEBUG ${_glib2_pdbs_debug}
CACHE FILEPATH "GLib2 debug debug PDB list"
diff --git a/cmake/modules/FindGMODULE2.cmake b/cmake/modules/FindGMODULE2.cmake
index 46ff224068..187faef4ab 100644
--- a/cmake/modules/FindGMODULE2.cmake
+++ b/cmake/modules/FindGMODULE2.cmake
@@ -10,7 +10,7 @@
include(FindWSWinLibs)
FindWSWinLibs("vcpkg-export-*" "GMODULE2_HINTS")
-if(NOT WIN32)
+if(NOT USE_REPOSITORY)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_GMODULE2 gmodule-2.0)
endif()
diff --git a/cmake/modules/FindGNUTLS.cmake b/cmake/modules/FindGNUTLS.cmake
index 9028529848..853da4eb65 100644
--- a/cmake/modules/FindGNUTLS.cmake
+++ b/cmake/modules/FindGNUTLS.cmake
@@ -17,7 +17,7 @@ endif()
include(FindWSWinLibs)
findwswinlibs("gnutls-.*" "GNUTLS_HINTS")
-if(NOT WIN32)
+if(NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(GNUTLS gnutls)
endif()
@@ -36,7 +36,7 @@ find_library(GNUTLS_LIBRARY
gnutls libgnutls-28 libgnutls-30
HINTS
"${GNUTLS_LIBDIR}"
- "${GNUTLS_HINTS}/bin"
+ "${GNUTLS_HINTS}/lib"
)
# On systems without pkg-config (e.g. Windows), search its header
@@ -69,6 +69,8 @@ if(GNUTLS_FOUND)
"${GNUTLS_DLL_DIR}/libffi-*.dll"
"${GNUTLS_DLL_DIR}/libgnutls-*.dll"
"${GNUTLS_DLL_DIR}/libhogweed-*.dll"
+ "${GNUTLS_DLL_DIR}/libiconv-*.dll"
+ "${GNUTLS_DLL_DIR}/libintl-*.dll"
"${GNUTLS_DLL_DIR}/libnettle-*.dll"
"${GNUTLS_DLL_DIR}/libp11-kit-*.dll"
"${GNUTLS_DLL_DIR}/libtasn1-*.dll"
diff --git a/cmake/modules/FindGTHREAD2.cmake b/cmake/modules/FindGTHREAD2.cmake
index 3a3567591f..172ee5517e 100644
--- a/cmake/modules/FindGTHREAD2.cmake
+++ b/cmake/modules/FindGTHREAD2.cmake
@@ -10,7 +10,7 @@
include(FindWSWinLibs)
FindWSWinLibs("vcpkg-export-*" "GTHREAD2_HINTS")
-if(NOT WIN32)
+if(NOT USE_REPOSITORY)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_GTHREAD2 gthread-2.0)
endif()
diff --git a/cmake/modules/FindILBC.cmake b/cmake/modules/FindILBC.cmake
index b2c5155106..6dc81a49f2 100644
--- a/cmake/modules/FindILBC.cmake
+++ b/cmake/modules/FindILBC.cmake
@@ -9,7 +9,7 @@
include( FindWSWinLibs )
FindWSWinLibs( "libilbc-.*" "ILBC_HINTS" )
-if (NOT WIN32)
+if (NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(PC_ILBC libilbc)
endif()
@@ -25,7 +25,7 @@ find_path(ILBC_INCLUDE_DIR
find_library(ILBC_LIBRARY
NAMES
ilbc
- libilbc
+ libilbc-2
HINTS
"${PC_ILBC_LIBRARY_DIRS}"
"${ILBC_HINTS}/lib"
@@ -61,7 +61,7 @@ if( ILBC_FOUND )
CACHE PATH "Path to ilbc DLL"
)
file( GLOB _ilbc_dll RELATIVE "${ILBC_DLL_DIR}"
- "${ILBC_DLL_DIR}/libilbc.dll"
+ "${ILBC_DLL_DIR}/libilbc-*.dll"
)
set ( ILBC_DLL ${_ilbc_dll}
# We're storing filenames only. Should we use STRING instead?
diff --git a/cmake/modules/FindKERBEROS.cmake b/cmake/modules/FindKERBEROS.cmake
index 8a3c2c7625..2884fe37b7 100644
--- a/cmake/modules/FindKERBEROS.cmake
+++ b/cmake/modules/FindKERBEROS.cmake
@@ -21,7 +21,7 @@ endif()
include(FindWSWinLibs)
FindWSWinLibs("krb5-.*" "KERBEROS_HINTS")
-if(NOT WIN32)
+if(NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(KERBEROS krb5 mit-krb5 heimdal-krb5)
endif()
diff --git a/cmake/modules/FindLEX.cmake b/cmake/modules/FindLEX.cmake
index 0008bc43dd..20caa096c8 100644
--- a/cmake/modules/FindLEX.cmake
+++ b/cmake/modules/FindLEX.cmake
@@ -34,7 +34,7 @@ MACRO(ADD_LEX_FILES _source _generated)
ADD_CUSTOM_COMMAND(
OUTPUT ${_outc} ${_outh}
- COMMAND ${LEX_EXECUTABLE} -o${_outc} --header-file=${_outh} ${_in}
+ COMMAND ${LEX_EXECUTABLE} $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:--debug> -o${_outc} --header-file=${_outh} ${_in}
DEPENDS ${_in}
)
LIST(APPEND ${_source} ${_in})
diff --git a/cmake/modules/FindLIBSSH.cmake b/cmake/modules/FindLIBSSH.cmake
index 1a758a1adb..31346a3979 100644
--- a/cmake/modules/FindLIBSSH.cmake
+++ b/cmake/modules/FindLIBSSH.cmake
@@ -94,8 +94,7 @@ else ()
CACHE PATH "Path to libssh DLLs"
)
file(GLOB _libssh_dlls RELATIVE "${LIBSSH_DLL_DIR}"
- "${LIBSSH_DLL_DIR}/ssh.dll"
- "${LIBSSH_DLL_DIR}/pthreadVC3.dll"
+ "${LIBSSH_DLL_DIR}/libssh.dll"
)
set(LIBSSH_DLLS ${_libssh_dlls}
# We're storing filenames only. Should we use STRING instead?
diff --git a/cmake/modules/FindLUA.cmake b/cmake/modules/FindLUA.cmake
deleted file mode 100644
index 0336ca6a10..0000000000
--- a/cmake/modules/FindLUA.cmake
+++ /dev/null
@@ -1,110 +0,0 @@
-#
-# Locate Lua library
-# This module defines
-# LUA_FOUND - If false, do not try to link to Lua
-# LUA_LIBRARIES
-# LUA_INCLUDE_DIRS - Where to find lua.h
-# LUA_DLL_DIR - (Windows) Path to the Lua DLL.
-# LUA_DLL - (Windows) Name of the Lua DLL.
-#
-# Note that the expected include convention is
-# #include "lua.h"
-# and not
-# #include <lua/lua.h>
-# This is because, the lua location is not standardized and may exist
-# in locations other than lua/
-
-INCLUDE(FindWSWinLibs)
-FindWSWinLibs("lua-5*" "LUA_HINTS")
-
-if(NOT WIN32)
- find_package(PkgConfig)
- pkg_search_module(LUA lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua51)
- if(NOT LUA_FOUND)
- pkg_search_module(LUA "lua<=5.2.99")
- endif()
-endif()
-
-FIND_PATH(LUA_INCLUDE_DIR lua.h
- HINTS
- "${LUA_INCLUDEDIR}"
- "$ENV{LUA_DIR}"
- ${LUA_HINTS}
- PATH_SUFFIXES include/lua52 include/lua5.2 include/lua-5.2 include/lua51 include/lua5.1 include/lua-5.1 include/lua include
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
-)
-
-if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
- file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" LUA_VERSION_NUM REGEX "LUA_VERSION_NUM")
- if (LUA_VERSION_NUM)
- string(REGEX REPLACE "^#define[ \t]+LUA_VERSION_NUM[ \t]+([0-9]+)" "\\1"
- LUA_VERSION_NUM "${LUA_VERSION_NUM}")
- endif()
-endif()
-string( REGEX REPLACE ".*[/\\]lua(.+)$" "\\1" LUA_INC_SUFFIX "${LUA_INCLUDE_DIR}" )
-if ( LUA_INCLUDE_DIR STREQUAL LUA_INC_SUFFIX )
- set( LUA_INC_SUFFIX "")
-endif()
-
-FIND_LIBRARY(LUA_LIBRARY
- NAMES lua${LUA_INC_SUFFIX} lua52 lua5.2 lua-5.2 lua51 lua5.1 lua-5.1 lua
- HINTS
- "${LUA_LIBDIR}"
- "$ENV{LUA_DIR}"
- ${LUA_HINTS}
- PATH_SUFFIXES lib64 lib
- PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /sw
- /opt/local
- /opt/csw
- /opt
-)
-
-# Lua 5.3 is not supported, only 5.1/5.2 are (due to bitops problem)
-if(LUA_VERSION_NUM GREATER 502)
- set(LUA_VERSION_NUM)
-endif()
-
-INCLUDE(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
-# all listed variables are TRUE
-find_package_handle_standard_args(LUA
- REQUIRED_VARS LUA_LIBRARY LUA_INCLUDE_DIR LUA_VERSION_NUM
- VERSION_VAR LUA_VERSION_NUM)
-
-IF(LUA_FOUND)
- SET( LUA_LIBRARIES "${LUA_LIBRARY}")
- SET( LUA_INCLUDE_DIRS ${LUA_INCLUDE_DIR} )
- if (WIN32)
- set ( LUA_DLL_DIR "${LUA_HINTS}"
- CACHE PATH "Path to Lua DLL"
- )
- file( GLOB _lua_dll RELATIVE "${LUA_DLL_DIR}"
- "${LUA_DLL_DIR}/lua*.dll"
- )
- set ( LUA_DLL ${_lua_dll}
- # We're storing filenames only. Should we use STRING instead?
- CACHE FILEPATH "Lua DLL file name"
- )
- mark_as_advanced( LUA_DLL_DIR LUA_DLL )
- endif()
-ELSE(LUA_FOUND)
- SET( LUA_LIBRARIES )
- SET( LUA_INCLUDE_DIRS )
- SET( LUA_DLL_DIR )
- SET( LUA_DLL )
-ENDIF(LUA_FOUND)
-
-MARK_AS_ADVANCED(LUA_INCLUDE_DIRS LUA_LIBRARIES)
diff --git a/cmake/modules/FindLZ4.cmake b/cmake/modules/FindLZ4.cmake
index 30ce491894..83e639d5c3 100644
--- a/cmake/modules/FindLZ4.cmake
+++ b/cmake/modules/FindLZ4.cmake
@@ -11,7 +11,7 @@
include( FindWSWinLibs )
FindWSWinLibs( "lz4-.*" "LZ4_HINTS" )
-if( NOT WIN32)
+if( NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(LZ4 lz4 liblz4)
endif()
diff --git a/cmake/modules/FindLibXml2.cmake b/cmake/modules/FindLibXml2.cmake
index 29ea779f2e..f3e4762977 100644
--- a/cmake/modules/FindLibXml2.cmake
+++ b/cmake/modules/FindLibXml2.cmake
@@ -50,7 +50,7 @@ The following cache variables may also be set:
include(FindWSWinLibs)
FindWSWinLibs("vcpkg-export-.*" LIBXML2_HINTS)
-if (NOT WIN32) # else we'll find Strawberry Perl's pkgconfig
+if (NOT USE_REPOSITORY) # else we'll find Strawberry Perl's pkgconfig
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
@@ -121,4 +121,4 @@ if(LibXml2_FOUND)
endif()
endif()
-AddWSWinDLLS(LibXml2 LIBXML2_HINTS "libxml2*" "lzma*")
+AddWSWinDLLS(LibXml2 LIBXML2_HINTS "libxml2*" "liblzma*")
diff --git a/cmake/modules/FindLua.cmake b/cmake/modules/FindLua.cmake
new file mode 100644
index 0000000000..45bcddf881
--- /dev/null
+++ b/cmake/modules/FindLua.cmake
@@ -0,0 +1,243 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+FindLua
+-------
+
+Locate Lua library.
+
+.. versionadded:: 3.18
+ Support for Lua 5.4.
+
+This module defines:
+
+``LUA_FOUND``
+ if false, do not try to link to Lua
+``LUA_LIBRARIES``
+ both lua and lualib
+``LUA_INCLUDE_DIR``
+ where to find lua.h
+``LUA_VERSION_STRING``
+ the version of Lua found
+``LUA_VERSION_MAJOR``
+ the major version of Lua
+``LUA_VERSION_MINOR``
+ the minor version of Lua
+``LUA_VERSION_PATCH``
+ the patch version of Lua
+
+Note that the expected include convention is
+
+::
+
+ #include "lua.h"
+
+and not
+
+::
+
+ #include <lua/lua.h>
+
+This is because, the lua location is not standardized and may exist in
+locations other than lua/
+#]=======================================================================]
+
+cmake_policy(PUSH) # Policies apply to functions at definition-time
+cmake_policy(SET CMP0012 NEW) # For while(TRUE)
+
+INCLUDE(FindWSWinLibs)
+FindWSWinLibs("lua-5*" "LUA_HINTS")
+
+unset(_lua_include_subdirs)
+unset(_lua_library_names)
+unset(_lua_append_versions)
+
+# this is a function only to have all the variables inside go away automatically
+function(_lua_get_versions)
+ set(LUA_VERSIONS5 ${LUA_FIND_VERSIONS})
+ list(FILTER LUA_VERSIONS5 INCLUDE REGEX "5\.[4321]")
+ set(_lua_append_versions ${LUA_VERSIONS5})
+ message(STATUS "Considering the following Lua versions: ${_lua_append_versions}")
+
+ set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE)
+endfunction()
+
+function(_lua_set_version_vars)
+ set(_lua_include_subdirs_raw "lua")
+
+ foreach (ver IN LISTS _lua_append_versions)
+ string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}")
+ list(APPEND _lua_include_subdirs_raw
+ lua${CMAKE_MATCH_1}${CMAKE_MATCH_2}
+ lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2}
+ )
+ endforeach ()
+
+ # Prepend "include/" to each path directly after the path
+ set(_lua_include_subdirs "include")
+ foreach (dir IN LISTS _lua_include_subdirs_raw)
+ list(APPEND _lua_include_subdirs "${dir}" "include/${dir}")
+ endforeach ()
+
+ set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE)
+endfunction(_lua_set_version_vars)
+
+function(_lua_get_header_version)
+ unset(LUA_VERSION_STRING PARENT_SCOPE)
+ set(_hdr_file "${LUA_INCLUDE_DIR}/lua.h")
+
+ if (NOT EXISTS "${_hdr_file}")
+ return()
+ endif ()
+
+ # At least 5.[012] have different ways to express the version
+ # so all of them need to be tested. Lua 5.2 defines LUA_VERSION
+ # and LUA_RELEASE as joined by the C preprocessor, so avoid those.
+ file(STRINGS "${_hdr_file}" lua_version_strings
+ REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*")
+
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};")
+ if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};")
+ set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
+ else ()
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$")
+ string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};")
+ endif ()
+ string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}")
+ string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}")
+ endif ()
+ foreach (ver IN LISTS _lua_append_versions)
+ if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")
+ set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE)
+ set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE)
+ set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE)
+ set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE)
+ return()
+ endif ()
+ endforeach ()
+endfunction(_lua_get_header_version)
+
+function(_lua_find_header)
+ _lua_set_version_vars()
+
+ # Initialize as local variable
+ set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH})
+ while (TRUE)
+ # Find the next header to test. Check each possible subdir in order
+ # This prefers e.g. higher versions as they are earlier in the list
+ # It is also consistent with previous versions of FindLua
+ foreach (subdir IN LISTS _lua_include_subdirs)
+ find_path(LUA_INCLUDE_DIR lua.h
+ HINTS ${LUA_HINTS} ENV LUA_DIR
+ PATH_SUFFIXES ${subdir}
+ )
+ if (LUA_INCLUDE_DIR)
+ break()
+ endif()
+ endforeach()
+ # Did not found header -> Fail
+ if (NOT LUA_INCLUDE_DIR)
+ return()
+ endif()
+ _lua_get_header_version()
+ # Found accepted version -> Ok
+ if (LUA_VERSION_STRING)
+ if (LUA_Debug)
+ message(STATUS "Found suitable version ${LUA_VERSION_STRING} in ${LUA_INCLUDE_DIR}/lua.h")
+ endif()
+ return()
+ endif()
+ # Found wrong version -> Ignore this path and retry
+ if (LUA_Debug)
+ message(STATUS "Ignoring unsuitable version in ${LUA_INCLUDE_DIR}")
+ endif()
+ list(APPEND CMAKE_IGNORE_PATH "${LUA_INCLUDE_DIR}")
+ unset(LUA_INCLUDE_DIR CACHE)
+ unset(LUA_INCLUDE_DIR)
+ unset(LUA_INCLUDE_DIR PARENT_SCOPE)
+ endwhile ()
+endfunction()
+
+_lua_get_versions()
+_lua_find_header()
+_lua_get_header_version()
+unset(_lua_append_versions)
+
+if (LUA_VERSION_STRING)
+ set(_lua_library_names
+ lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR}
+ lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+ lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+ lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}
+ )
+endif ()
+
+find_library(LUA_LIBRARY
+ NAMES ${_lua_library_names} lua
+ NAMES_PER_DIR
+ HINTS
+ ${LUA_HINTS}
+ ENV LUA_DIR
+ PATH_SUFFIXES lib
+)
+unset(_lua_library_names)
+
+if (LUA_LIBRARY)
+ # include the math library for Unix
+ if (UNIX AND NOT APPLE AND NOT BEOS)
+ find_library(LUA_MATH_LIBRARY m)
+ mark_as_advanced(LUA_MATH_LIBRARY)
+ set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}")
+
+ # include dl library for statically-linked Lua library
+ get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} EXT)
+ if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX)
+ list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS})
+ endif()
+
+ # For Windows and Mac, don't need to explicitly include the math library
+ else ()
+ set(LUA_LIBRARIES "${LUA_LIBRARY}")
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
+ REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
+ VERSION_VAR LUA_VERSION_STRING)
+
+mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY)
+
+cmake_policy(POP)
+
+IF(Lua_FOUND)
+ SET( LUA_INCLUDE_DIRS ${LUA_INCLUDE_DIR} )
+ if (WIN32)
+ set ( LUA_DLL_DIR "${LUA_HINTS}" CACHE PATH "Path to Lua DLL")
+ file( GLOB _lua_dll RELATIVE "${LUA_DLL_DIR}" "${LUA_DLL_DIR}/lua*.dll")
+ set ( LUA_DLL ${_lua_dll} CACHE FILEPATH "Lua DLL file name")
+ mark_as_advanced( LUA_DLL_DIR LUA_DLL )
+ endif()
+ if(LUA_DLL_DIR MATCHES ".*/lua-.*-unicode-.*")
+ # Do we have Lua with Unicode for Windows patches?
+ # https://github.com/Lekensteyn/lua-unicode
+ # XXX Would be better if it was possible to
+ # detect a Lua-unicode build from C and Lua code
+ # but upstream rejected patches for that so we do
+ # it here.
+ set(HAVE_LUA_UNICODE True)
+ endif()
+ELSE(Lua_FOUND)
+ SET( LUA_LIBRARIES )
+ SET( LUA_INCLUDE_DIRS )
+ SET( LUA_DLL_DIR )
+ SET( LUA_DLL )
+ENDIF(Lua_FOUND)
diff --git a/cmake/modules/FindMaxMindDB.cmake b/cmake/modules/FindMaxMindDB.cmake
index 6e87a6b709..5de81a1130 100644
--- a/cmake/modules/FindMaxMindDB.cmake
+++ b/cmake/modules/FindMaxMindDB.cmake
@@ -16,7 +16,7 @@ ENDIF (MAXMINDDB_INCLUDE_DIRS)
INCLUDE(FindWSWinLibs)
FindWSWinLibs("libmaxminddb-.*" "MAXMINDDB_HINTS")
-IF (NOT WIN32)
+IF (NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_check_modules(PC_LIBMAXMINDDB QUIET libmaxminddb)
set(MAXMINDDB_DEFINITIONS ${PC_LIBMAXMINDDB_CFLAGS_OTHER})
diff --git a/cmake/modules/FindMinizip.cmake b/cmake/modules/FindMinizip.cmake
index c20062b436..b6d9c8673c 100644
--- a/cmake/modules/FindMinizip.cmake
+++ b/cmake/modules/FindMinizip.cmake
@@ -4,10 +4,12 @@
# MINIZIP_INCLUDE_DIRS - where to find minizip headers.
# MINIZIP_LIBRARIES - List of libraries when using minizip.
# MINIZIP_FOUND - True if minizip is found.
+# MINIZIP_DLL_DIR - (Windows) Path to the minizip DLL.
+# MINIZIP_DLL - (Windows) Name of the minizip DLL.
FindWSWinLibs( "minizip-*" "MINIZIP_HINTS" )
-if(NOT WIN32)
+if(NOT USE_REPOSITORY)
find_package(PkgConfig QUIET)
pkg_search_module(MINIZIP QUIET minizip)
endif()
@@ -50,9 +52,29 @@ if(MINIZIP_FOUND)
# for renamed struct members to avoid an endless game of whack-a-mole.
include(CheckStructHasMember)
check_struct_has_member("zip_fileinfo" "dos_date" "minizip/zip.h" HAVE_MZCOMPAT_DOS_DATE)
+ if (WIN32)
+ set ( MINIZIP_DLL_DIR "${MINIZIP_HINTS}/bin"
+ CACHE PATH "Path to Minizip DLL"
+ )
+ file( GLOB _minizip_dll RELATIVE "${MINIZIP_DLL_DIR}"
+ "${MINIZIP_DLL_DIR}/minizip.dll"
+ )
+ set ( MINIZIP_DLL ${_minizip_dll}
+ CACHE FILEPATH "Minizip DLL file name"
+ )
+ file( GLOB _minizip_pdb RELATIVE "${MINIZIP_DLL_DIR}"
+ "${MINIZIP_DLL_DIR}/minizip.pdb"
+ )
+ set ( MINIZIP_PDB ${_minizip_pdb}
+ CACHE FILEPATH "Minizip PDB file name"
+ )
+ mark_as_advanced( MINIZIP_DLL_DIR MINIZIP_DLL MINIZIP_PDB )
+ endif()
else()
set(MINIZIP_LIBRARIES)
set(MINIZIP_INCLUDE_DIRS)
+ SET( MINIZIP_DLL_DIR )
+ SET( MINIZIP_DLL )
endif()
mark_as_advanced(MINIZIP_LIBRARIES MINIZIP_INCLUDE_DIRS)
diff --git a/cmake/modules/FindNGHTTP2.cmake b/cmake/modules/FindNGHTTP2.cmake
index 8cd3ce274b..5f06dbe91a 100644
--- a/cmake/modules/FindNGHTTP2.cmake
+++ b/cmake/modules/FindNGHTTP2.cmake
@@ -9,7 +9,7 @@
include( FindWSWinLibs )
FindWSWinLibs( "nghttp2-.*" "NGHTTP2_HINTS" )
-if( NOT WIN32)
+if( NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(NGHTTP2 libnghttp2)
endif()
diff --git a/cmake/modules/FindNGHTTP3.cmake b/cmake/modules/FindNGHTTP3.cmake
new file mode 100644
index 0000000000..9ec5404b94
--- /dev/null
+++ b/cmake/modules/FindNGHTTP3.cmake
@@ -0,0 +1,62 @@
+# Find the system's Nghttp3 includes and library
+#
+# NGHTTP3_INCLUDE_DIRS - where to find nghttp3.h
+# NGHTTP3_LIBRARIES - List of libraries when using nghttp3
+# NGHTTP3_FOUND - True if nghttp3 found
+# NGHTTP3_DLL_DIR - (Windows) Path to the Nghttp2 DLL
+# NGHTTP3_DLL - (Windows) Name of the Nghttp2 DLL
+
+include( FindWSWinLibs )
+FindWSWinLibs( "nghttp3-.*" "NGHTTP3_HINTS" )
+
+if( NOT WIN32)
+ find_package(PkgConfig)
+ pkg_search_module(NGHTTP3 libnghttp3)
+endif()
+
+find_path( NGHTTP3_INCLUDE_DIR
+ NAMES nghttp3/nghttp3.h
+ HINTS
+ "${NGHTTP3_INCLUDEDIR}"
+ "${NGHTTP3_HINTS}/include"
+ PATHS /usr/local/include /usr/include
+)
+
+find_library( NGHTTP3_LIBRARY
+ NAMES nghttp3
+ HINTS
+ "${NGHTTP3_LIBDIR}"
+ "${NGHTTP3_HINTS}/lib"
+ PATHS /usr/local/lib /usr/lib
+)
+
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( NGHTTP3 DEFAULT_MSG NGHTTP3_LIBRARY NGHTTP3_INCLUDE_DIR )
+
+if( NGHTTP3_FOUND )
+ set( NGHTTP3_INCLUDE_DIRS ${NGHTTP3_INCLUDE_DIR} )
+ set( NGHTTP3_LIBRARIES ${NGHTTP3_LIBRARY} )
+ if (WIN32)
+ set ( NGHTTP3_DLL_DIR "${NGHTTP3_HINTS}/bin"
+ CACHE PATH "Path to nghttp3 DLL"
+ )
+ file( GLOB _nghttp3_dll RELATIVE "${NGHTTP3_DLL_DIR}"
+ "${NGHTTP3_DLL_DIR}/nghttp3.dll"
+ )
+ set ( NGHTTP3_DLL ${_nghttp3_dll}
+ CACHE FILEPATH "nghttp3 DLL file name"
+ )
+ file( GLOB _nghttp3_pdb RELATIVE "${NGHTTP3_DLL_DIR}"
+ "${NGHTTP3_DLL_DIR}/nghttp3.pdb"
+ )
+ set ( NGHTTP3_PDB ${_nghttp3_pdb}
+ CACHE FILEPATH "nghttp3 PDB file name"
+ )
+ mark_as_advanced( NGHTTP3_DLL_DIR NGHTTP3_DLL NGHTTP3_PDB )
+ endif()
+else()
+ set( NGHTTP3_INCLUDE_DIRS )
+ set( NGHTTP3_LIBRARIES )
+endif()
+
+mark_as_advanced( NGHTTP3_LIBRARIES NGHTTP3_INCLUDE_DIRS )
diff --git a/cmake/modules/FindOPUS.cmake b/cmake/modules/FindOPUS.cmake
index 436911d8e5..0e7cfe2c7c 100644
--- a/cmake/modules/FindOPUS.cmake
+++ b/cmake/modules/FindOPUS.cmake
@@ -9,7 +9,7 @@
include( FindWSWinLibs )
FindWSWinLibs( "opus-.*" "OPUS_HINTS" )
-if (NOT WIN32)
+if (NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(OPUS opus)
endif()
diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake
index 62704a1ee4..eb9565bc2f 100644
--- a/cmake/modules/FindPCAP.cmake
+++ b/cmake/modules/FindPCAP.cmake
@@ -12,7 +12,7 @@ FindWSWinLibs("libpcap-*" "PCAP_HINTS")
#
# First, try pkg-config on platforms other than Windows.
#
-if(NOT WIN32)
+if(NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(PC_PCAP libpcap)
endif()
@@ -105,6 +105,8 @@ find_path(PCAP_INCLUDE_DIR
NAMES
pcap/pcap.h
pcap.h
+ PATH_SUFFIXES
+ wpcap
HINTS
${PC_PCAP_INCLUDE_DIRS}
${PCAP_CONFIG_INCLUDE_DIRS}
@@ -115,12 +117,13 @@ find_path(PCAP_INCLUDE_DIR
# capture\capture-wpcap.c. We don't want to link with pcap.lib since
# that would bring in the non-capturing (null) pcap.dll from the vcpkg
# library.
-if(WIN32)
+if(WIN32 AND NOT CMAKE_CROSSCOMPILING)
set(_pkg_required_vars PCAP_INCLUDE_DIR)
else()
find_library(PCAP_LIBRARY
NAMES
pcap
+ wpcap
HINTS
${PC_PCAP_LIBRARY_DIRS}
${PCAP_CONFIG_LIBRARY_DIRS}
@@ -185,7 +188,7 @@ if(PCAP_FOUND)
include(CheckSymbolExists)
- if(WIN32)
+ if(WIN32 AND NOT CMAKE_CROSSCOMPILING)
#
# Prepopulate some values. WinPcap 3.1 and later, and Npcap, have these
# in their SDK, and compilation checks on Windows can be slow. We check
@@ -201,7 +204,7 @@ if(PCAP_FOUND)
set(HAVE_PCAP_SET_TSTAMP_TYPE TRUE)
else(WIN32)
#
- # Make sure we have at least libpcap 0.8, because we we require at
+ # Make sure we have at least libpcap 0.8, because we require at
# least libpcap 0.8's APIs.
#
# We check whether pcap_lib_version is defined in the pcap header,
@@ -215,7 +218,54 @@ if(PCAP_FOUND)
check_function_exists( "pcap_freecode" HAVE_PCAP_FREECODE )
check_function_exists( "pcap_create" HAVE_PCAP_CREATE )
check_function_exists( "pcap_free_datalinks" HAVE_PCAP_FREE_DATALINKS )
- check_function_exists( "pcap_open" HAVE_PCAP_OPEN )
+ #
+ # macOS Sonoma's libpcap includes stub versions of the remote-
+ # capture APIs. They are exported as "weakly linked symbols".
+ #
+ # Xcode 15 offers only a macOS Sonoma SDK, which has a .tbd
+ # file for libpcap that claims it includes those APIs. (Newer
+ # versions of macOS don't provide the system shared libraries,
+ # they only provide the dyld shared cache containing those
+ # libraries, so the OS provides SDKs that include a .tbd file
+ # to use when linking.)
+ #
+ # This means that check_function_exists() will think that
+ # the remote-capture APIs are present, including pcap_open().
+ #
+ # However, they are *not* present in macOS Ventura and earlier,
+ # which means that building on Ventura with Xcode 15 produces
+ # executables that fail to start because one of those APIs
+ # isn't found in the system libpcap.
+ #
+ # Protecting calls to those APIs with __builtin_available()
+ # does not prevent this, because the libpcap header files
+ # in the Sonoma SDK mark them as being first available
+ # in macOS 10.13, just like all the other routines introduced
+ # in libpcap 1.9, even though they're only available if libpcap
+ # is built with remote capture enabled or stub routines are
+ # provided. (A fix to enable this has been checked into the
+ # libpcap repository, and may end up in a later version of
+ # the SDK.)
+ #
+ # Given all that, and given that the versions of the
+ # remote-capture APIs in Sonoma are stubs that always fail,
+ # there doesn't seem to be any point in checking for pcap_open()
+ # if we're linking against the Apple libpcap.
+ #
+ # However, if we're *not* linking against the Apple libpcap,
+ # we should check for it, so that we can use it if it's present.
+ #
+ # So we check for pcap_open if 1) this isn't macOS or 2) the
+ # the libpcap we found is not a system library, meaning that
+ # its path begins neither with /usr/lib (meaning it's a system
+ # dylib) nor /Application/Xcode.app (meaning it's a file in
+ # the Xcode SDK).
+ #
+ if( NOT APPLE OR NOT
+ (PCAP_LIBRARY MATCHES "/usr/lib/.*" OR
+ PCAP_LIBRARY MATCHES "/Application/Xcode.app/.*"))
+ check_function_exists( "pcap_open" HAVE_PCAP_OPEN )
+ endif()
if( HAVE_PCAP_OPEN )
#
# XXX - this *should* be checked for independently of checking
@@ -223,7 +273,7 @@ if(PCAP_FOUND)
# remote capture support.
#
# However, 1) the sampling options are treated as remote options
- # in the GUI and and 2) having pcap_setsampling() doesn't mean
+ # in the GUI and 2) having pcap_setsampling() doesn't mean
# you have sampling support. libpcap needs a way to indicate
# whether a given device supports sampling, and the GUI should
# be changed to decouple them.
@@ -238,7 +288,7 @@ if(PCAP_FOUND)
#
check_function_exists( "pcap_setsampling" HAVE_PCAP_SETSAMPLING )
endif( HAVE_PCAP_OPEN )
- endif(WIN32)
+ endif()
if( HAVE_PCAP_CREATE )
#
@@ -257,6 +307,9 @@ if(PCAP_FOUND)
set( HAVE_PCAP_REMOTE 1 )
endif()
+ check_symbol_exists(PCAP_ERROR_PROMISC_PERM_DENIED ${PCAP_INCLUDE_DIR}/pcap.h HAVE_PCAP_ERROR_PROMISC_PERM_DENIED)
+ check_symbol_exists(PCAP_WARNING_TSTAMP_TYPE_NOTSUP ${PCAP_INCLUDE_DIR}/pcap.h HAVE_PCAP_WARNING_TSTAMP_TYPE_NOTSUP)
+
cmake_pop_check_state()
endif()
diff --git a/cmake/modules/FindPCRE2.cmake b/cmake/modules/FindPCRE2.cmake
new file mode 100644
index 0000000000..a7d80792b5
--- /dev/null
+++ b/cmake/modules/FindPCRE2.cmake
@@ -0,0 +1,102 @@
+#
+# - Find PCRE2 libraries
+#
+# PCRE2_INCLUDE_DIRS - where to find PCRE2 headers.
+# PCRE2_LIBRARIES - List of libraries when using PCRE2.
+# PCRE2_FOUND - True if PCRE2 is found.
+# PCRE2_RELEASE_DLL_DIR - (Windows) Path to the PCRE2 release DLL
+# PCRE2_RELEASE_DLL - (Windows) Name of the PCRE2 release DLL
+# PCRE2_DEBUG_DLL_DIR - (Windows) Path to the PCRE2 debug DLL
+# PCRE2_DEBUG_DLL - (Windows) Name of the PCRE2 debug DLL
+
+# Note that the "8" in "libpcre2-8" refers to "PCRE library version 2 with
+# support for 8-bit code units".
+
+include( FindWSWinLibs )
+# PCRE2 is included with GLib2
+FindWSWinLibs( "vcpkg-export-.*" "PCRE2_HINTS" )
+
+if( NOT USE_REPOSITORY)
+ find_package(PkgConfig QUIET)
+ pkg_search_module(PC_PCRE2 QUIET "libpcre2-8")
+endif()
+
+find_path(PCRE2_INCLUDE_DIR
+ NAMES
+ pcre2.h
+ HINTS
+ ${PC_PCRE2_INCLUDE_DIRS}
+ ${PCRE2_HINTS}/include
+)
+
+find_library(PCRE2_LIBRARY
+ NAMES
+ pcre2-8
+ HINTS
+ ${PC_PCRE2_LIBRARY_DIRS}
+ ${PCRE2_HINTS}/lib
+)
+
+if (USE_REPOSITORY)
+ find_library(PCRE2_DEBUG_LIBRARY
+ NAMES
+ pcre2-8d
+ HINTS
+ ${PCRE2_HINTS}/debug/lib
+ )
+else()
+ set (PCRE2_DEBUG_LIBRARY ${PCRE2_LIBRARY} CACHE FILEPATH "PCRE2 library")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PCRE2
+ REQUIRED_VARS PCRE2_LIBRARY PCRE2_INCLUDE_DIR
+ VERSION_VAR PC_PCRE2_VERSION
+)
+
+if(PCRE2_FOUND)
+ set(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
+ set(PCRE2_DEBUG_LIBRARIES ${PCRE2_DEBUG_LIBRARY})
+ set(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
+ if (USE_REPOSITORY)
+ set (PCRE2_RELEASE_DLL_DIR "${PCRE2_HINTS}/bin"
+ CACHE PATH "Path to PCRE2 release DLL"
+ )
+ file(GLOB _pcre2_release_dll RELATIVE "${PCRE2_RELEASE_DLL_DIR}"
+ "${PCRE2_RELEASE_DLL_DIR}/pcre2-8*.dll"
+ )
+ set (PCRE2_RELEASE_DLL ${_pcre2_release_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "PCRE2 release DLL file name"
+ )
+ file(GLOB _pcre2_release_pdb RELATIVE "${PCRE2_RELEASE_DLL_DIR}"
+ "${PCRE2_RELEASE_DLL_DIR}/pcre2-8*.pdb"
+ )
+ set (PCRE2_RELEASE_PDB ${_pcre2_release_pdb}
+ CACHE FILEPATH "PCRE2 release PDB file name"
+ )
+
+ set (PCRE2_DEBUG_DLL_DIR "${PCRE2_HINTS}/debug/bin"
+ CACHE PATH "Path to PCRE2 debug DLL"
+ )
+ file(GLOB _pcre2_debug_dll RELATIVE "${PCRE2_DEBUG_DLL_DIR}"
+ "${PCRE2_DEBUG_DLL_DIR}/pcre2-8d*.dll"
+ )
+ set (PCRE2_DEBUG_DLL ${_pcre2_debug_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "PCRE2 debug DLL file name"
+ )
+ file(GLOB _pcre2_debug_pdb RELATIVE "${PCRE2_DEBUG_DLL_DIR}"
+ "${PCRE2_DEBUG_DLL_DIR}/pcre2-8d*.pdb"
+ )
+ set (PCRE2_DEBUG_PDB ${_pcre2_debug_pdb}
+ CACHE FILEPATH "PCRE2 debug PDB file name"
+ )
+ mark_as_advanced(PCRE2_RELEASE_DLL_DIR PCRE2_RELEASE_DLL PCRE2_PDB PCRE2_DEBUG_DLL_DIR PCRE2_DEBUG_DLL)
+ endif()
+else()
+ set(PCRE2_LIBRARIES)
+ set(PCRE2_INCLUDE_DIRS)
+endif()
+
+mark_as_advanced(PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS)
diff --git a/cmake/modules/FindPowerShell.cmake b/cmake/modules/FindPowerShell.cmake
index d2befe22d2..307d7e7982 100644
--- a/cmake/modules/FindPowerShell.cmake
+++ b/cmake/modules/FindPowerShell.cmake
@@ -9,7 +9,9 @@
#
find_program(POWERSHELL_EXECUTABLE
- NAMES powershell
+ NAMES
+ powershell
+ pwsh
DOC "PowerShell command"
)
diff --git a/cmake/modules/FindSBC.cmake b/cmake/modules/FindSBC.cmake
index 50a551c507..e9b90d72d6 100644
--- a/cmake/modules/FindSBC.cmake
+++ b/cmake/modules/FindSBC.cmake
@@ -19,6 +19,7 @@ find_path( SBC_INCLUDE_DIR
find_library( SBC_LIBRARY
NAMES
sbc
+ libsbc-1
HINTS
"${SBC_HINTS}/lib"
)
diff --git a/cmake/modules/FindSMI.cmake b/cmake/modules/FindSMI.cmake
index 6c9d031fc4..0fe39735fe 100644
--- a/cmake/modules/FindSMI.cmake
+++ b/cmake/modules/FindSMI.cmake
@@ -20,7 +20,11 @@ FindWSWinLibs("libsmi-.*" "SMI_HINTS")
FIND_PATH(SMI_INCLUDE_DIR smi.h HINTS "${SMI_HINTS}/include" )
-SET(SMI_NAMES smi libsmi-2)
+IF(MSVC)
+ SET(SMI_NAMES libsmi-2)
+ELSE()
+ SET(SMI_NAMES smi libsmi-2)
+ENDIF()
FIND_LIBRARY(SMI_LIBRARY NAMES ${SMI_NAMES} HINTS "${SMI_HINTS}/lib" )
# handle the QUIETLY and REQUIRED arguments and set SMI_FOUND to TRUE if
diff --git a/cmake/modules/FindSNAPPY.cmake b/cmake/modules/FindSNAPPY.cmake
index db3fd09168..afcfc71838 100644
--- a/cmake/modules/FindSNAPPY.cmake
+++ b/cmake/modules/FindSNAPPY.cmake
@@ -11,7 +11,7 @@
include( FindWSWinLibs )
FindWSWinLibs( "snappy-.*" "SNAPPY_HINTS" )
-if( NOT WIN32)
+if( NOT USE_REPOSITORY)
find_package(PkgConfig QUIET)
pkg_search_module(SNAPPY QUIET libsnappy)
endif()
diff --git a/cmake/modules/FindSPANDSP.cmake b/cmake/modules/FindSPANDSP.cmake
index 612304c09e..d4b6de2341 100644
--- a/cmake/modules/FindSPANDSP.cmake
+++ b/cmake/modules/FindSPANDSP.cmake
@@ -9,13 +9,14 @@
include( FindWSWinLibs )
FindWSWinLibs( "spandsp-.*" "SPANDSP_HINTS" )
-if( NOT WIN32)
+if( NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(SPANDSP spandsp)
+
+ # spandsp.h might include tiffio.h.
+ find_package(TIFF QUIET)
endif()
-# spandsp.h includes tiffio.h.
-find_package(TIFF QUIET)
find_path( SPANDSP_INCLUDE_DIR
NAMES spandsp.h
@@ -26,7 +27,9 @@ find_path( SPANDSP_INCLUDE_DIR
)
find_library( SPANDSP_LIBRARY
- NAMES spandsp
+ NAMES
+ spandsp
+ libspandsp-2
HINTS
"${SPANDSP_LIBDIR}"
"${SPANDSP_HINTS}/lib"
diff --git a/cmake/modules/FindSinsp.cmake b/cmake/modules/FindSinsp.cmake
new file mode 100644
index 0000000000..6060b845c6
--- /dev/null
+++ b/cmake/modules/FindSinsp.cmake
@@ -0,0 +1,227 @@
+#
+# - Find libsinsp and libscap
+# Find libsinsp and libscap includes and libraries.
+# Adapted from FindZSTD.cmake.
+#
+# This module will look for libsinsp and libscap using pkg-config. If that
+# fails, it will search ${SINSP_INCLUDEDIR} and ${SINSP_HINTS}/include
+# for the libsinsp and libscap include directory and ${SINSP_LIBDIR} and
+# ${SINSP_HINTS}/lib for the libsinsp and libscap libraries.
+#
+# It will set the following variables:
+#
+# SINSP_FOUND - True if libsinsp found.
+# SINSP_INCLUDE_DIRS - Where to find sinsp.h, scap.h, etc.
+# SINSP_LINK_LIBRARIES - List of libraries when using libsinsp.
+
+# You must manually set the following variables:
+# FALCO_PLUGINS - Paths to plugins built from https://github.com/falcosecurity/plugins/.
+
+# To do:
+# SINSP_DLL_DIR - (Windows) Path to the libsinsp and libscap DLLs
+# SINSP_DLL - (Windows) Name of the libsinsp and libscap DLLs
+
+include( FindWSWinLibs )
+FindWSWinLibs( "libfalcosecurity-.*" SINSP_HINTS )
+
+include(CMakeDependentOption)
+
+if( NOT USE_REPOSITORY)
+ find_package(PkgConfig)
+ pkg_check_modules(SINSP libsinsp)
+endif()
+
+# Include both legacy (#include <sinsp.h>) and current (#include <libsinsp/sinsp.h>) paths for now.
+if(NOT SINSP_FOUND)
+ # pkg_check_modules didn't work, so look for ourselves.
+ find_path(_sinsp_include_dirs NO_CACHE
+ NAMES libsinsp/sinsp.h
+ HINTS "${SINSP_INCLUDEDIR}" "${SINSP_HINTS}/include"
+ PATH_SUFFIXES falcosecurity/userspace
+ /usr/include
+ /usr/local/include
+ )
+ if(_sinsp_include_dirs)
+ list(APPEND _sinsp_include_dirs ${_sinsp_include_dirs}/libsinsp)
+ endif()
+
+ find_path(_scap_include_dir NO_CACHE
+ NAMES scap.h
+ HINTS "${SINSP_INCLUDEDIR}" "${SINSP_HINTS}/include"
+ PATH_SUFFIXES falcosecurity/userspace/libscap
+ /usr/include
+ /usr/local/include
+ )
+ if(_scap_include_dir)
+ list(APPEND _sinsp_include_dirs ${_scap_include_dir})
+ endif()
+ unset(_scap_include_dir)
+
+ find_library(_sinsp_link_libs NO_CACHE
+ NAMES sinsp
+ HINTS "${SINSP_LIBDIR}" "${SINSP_HINTS}/lib"
+ PATHS falcosecurity
+ /usr/lib
+ /usr/local/lib
+ )
+
+ set(_scap_libs
+ scap
+ scap_engine_nodriver
+ scap_engine_noop
+ scap_engine_savefile
+ scap_engine_source_plugin
+ scap_engine_test_input
+ scap_error
+ scap_event_schema
+ scap_platform_util
+ )
+
+ foreach(_scap_lib ${_scap_libs})
+ find_library(_lib NO_CACHE
+ NAMES ${_scap_lib}
+ HINTS "${SINSP_LIBDIR}" "${SINSP_HINTS}/lib"
+ PATHS falcosecurity
+ /usr/lib
+ /usr/local/lib
+ )
+ if (_lib)
+ list(APPEND _sinsp_link_libs ${_lib})
+ unset(_lib)
+ endif()
+ endforeach()
+ unset(_scap_libs)
+ unset(_scap_lib)
+
+ find_path(_jsoncpp_include_dir NO_CACHE
+ NAMES json/json.h
+ HINTS "${SINSP_INCLUDEDIR}" "${SINSP_HINTS}/include"
+ PATH_SUFFIXES falcosecurity jsoncpp
+ PATHS
+ /usr/include
+ /usr/local/include
+ )
+ if (_jsoncpp_include_dir)
+ list(APPEND _sinsp_include_dirs ${_jsoncpp_include_dir})
+ unset(_jsoncpp_include_dir)
+ endif()
+
+ find_library(_jsoncpp_lib NO_CACHE
+ NAMES jsoncpp
+ HINTS "${SINSP_LIBDIR}" "${SINSP_HINTS}/lib" "${SINSP_HINTS}/lib/falcosecurity"
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ )
+ if (_jsoncpp_lib)
+ list(APPEND _sinsp_link_libs ${_jsoncpp_lib})
+ unset(_jsoncpp_lib)
+ endif()
+
+ find_library(_re2_lib NO_CACHE
+ NAMES re2
+ HINTS "${SINSP_LIBDIR}" "${SINSP_HINTS}/lib" "${SINSP_HINTS}/lib/falcosecurity"
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ )
+ if (_re2_lib)
+ list(APPEND _sinsp_link_libs ${_re2_lib})
+ unset(_re2_lib)
+ endif()
+
+ find_path(_tbb_include_dir NO_CACHE
+ NAMES tbb/tbb.h
+ HINTS "${SINSP_INCLUDEDIR}" "${SINSP_HINTS}/include"
+ PATHS
+ /usr/include
+ /usr/local/include
+ )
+ if (_tbb_include_dir)
+ list(APPEND _sinsp_include_dirs ${_tbb_include_dir})
+ unset(_tbb_include_dir)
+ endif()
+
+ find_library(_tbb_lib NO_CACHE
+ NAMES tbb tbb12
+ HINTS "${SINSP_LIBDIR}" "${SINSP_HINTS}/lib" "${SINSP_HINTS}/lib/falcosecurity"
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ )
+ if (_tbb_lib)
+ list(APPEND _sinsp_link_libs ${_tbb_lib})
+ unset(_tbb_lib)
+ endif()
+
+ # This is terrible, but libsinsp/libscap doesn't support dynamic linking on Windows (yet).
+ find_path(_zlib_include_dir NO_CACHE
+ NAMES zlib/zlib.h
+ HINTS "${SINSP_INCLUDEDIR}" "${SINSP_HINTS}/include"
+ PATHS
+ /usr/include
+ /usr/local/include
+ )
+ if (_zlib_include_dir)
+ list(APPEND _sinsp_include_dirs ${_zlib_include_dir})
+ unset(_zlib_include_dir)
+ endif()
+
+ find_library(_zlib_lib NO_CACHE
+ NAMES zlib
+ HINTS "${SINSP_LIBDIR}" "${SINSP_HINTS}/lib" "${SINSP_HINTS}/lib/falcosecurity"
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ )
+ if (_zlib_lib)
+ list(APPEND _sinsp_link_libs ${_zlib_lib})
+ unset(_zlib_lib)
+ endif()
+
+ if(_sinsp_include_dirs AND _sinsp_link_libs)
+ list(REMOVE_DUPLICATES _sinsp_include_dirs)
+ set(SINSP_INCLUDE_DIRS ${_sinsp_include_dirs} CACHE PATH "Paths to libsinsp and libscap headers")
+ set(SINSP_LINK_LIBRARIES ${_sinsp_link_libs} CACHE PATH "Paths to libsinsp, libscap, etc.")
+ set(SINSP_FOUND 1)
+ unset(_sinsp_include_dirs)
+ unset(_sinsp_link_libs)
+ endif()
+
+endif()
+
+# As https://cmake.org/cmake/help/latest/command/link_directories.html
+# says, "Prefer to pass full absolute paths to libraries where possible,
+# since this ensures the correct library will always be linked," so use
+# SINSP_LINK_LIBRARIES instead of SINSP_LIBRARIES
+# XXX SINSP_VERSION will require peeking for a #define or something similar.
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Sinsp
+ REQUIRED_VARS
+ SINSP_INCLUDE_DIRS
+ SINSP_LINK_LIBRARIES
+ # VERSION_VAR SINSP_VERSION
+)
+
+if(SINSP_FOUND)
+# if (WIN32)
+# set ( SINSP_DLL_DIR "${SINSP_HINTS}/bin"
+# CACHE PATH "Path to sinsp DLL"
+# )
+# file( GLOB _SINSP_dll RELATIVE "${SINSP_DLL_DIR}"
+# "${SINSP_DLL_DIR}/sinsp*.dll"
+# )
+# set ( SINSP_DLL ${_SINSP_dll}
+# # We're storing filenames only. Should we use STRING instead?
+# CACHE FILEPATH "sinsp DLL file name"
+# )
+# mark_as_advanced( SINSP_DLL_DIR SINSP_DLL )
+# endif()
+else()
+ set(SINSP_INCLUDE_DIRS)
+ set(SINSP_LINK_LIBRARIES)
+endif()
+
+cmake_dependent_option(FALCO_PLUGINS "Paths to Falco plugins. Semicolon-separated" "" SINSP_FOUND "")
+
+mark_as_advanced(SINSP_INCLUDE_DIRS SINSP_LINK_LIBRARIES)
diff --git a/cmake/modules/FindSparkle.cmake b/cmake/modules/FindSparkle.cmake
index 5c14080d08..1969c02d15 100644
--- a/cmake/modules/FindSparkle.cmake
+++ b/cmake/modules/FindSparkle.cmake
@@ -5,11 +5,12 @@
# SPARKLE_FOUND - True if we found Sparkle
# SPARKLE_INCLUDE_DIRS - Path to Sparkle.h, empty if not found
# SPARKLE_LIBRARIES - Path to Sparkle.framework, empty if not found
+# SPARKLE_VERSION - Sparkle framework bundle version
include(FindPackageHandleStandardArgs)
-file(GLOB USR_LOCAL_HINT "/usr/local/Sparkle-[1-9]*/")
-file(GLOB HOMEBREW_HINT "/usr/local/Caskroom/sparkle/[1-9]*/")
+file(GLOB USR_LOCAL_HINT "/usr/local/Sparkle-[2-9]*/")
+file(GLOB HOMEBREW_HINT "/usr/local/Caskroom/sparkle/[2-9]*/")
find_path(SPARKLE_INCLUDE_DIR Sparkle.h
HINTS ${USR_LOCAL_HINT} ${HOMEBREW_HINT}
@@ -18,7 +19,26 @@ find_library(SPARKLE_LIBRARY NAMES Sparkle
HINTS ${USR_LOCAL_HINT} ${HOMEBREW_HINT}
)
-find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY)
+# Sparkle doesn't appear to provide a version macro, and its Info.plist versions
+# are all over the place. Check for SPUStandardUpdaterController.h, which was
+# added in version 2.
+set(SPARKLE_VERSION 1)
+
+find_file(_spustandardupdatercontroller_h SPUStandardUpdaterController.h
+ ${SPARKLE_LIBRARY}/Headers
+ NO_DEFAULT_PATH
+)
+
+if(_spustandardupdatercontroller_h)
+ set(SPARKLE_VERSION 2)
+endif()
+
+unset(_spustandardupdatercontroller_h CACHE)
+
+find_package_handle_standard_args(Sparkle
+ REQUIRED_VARS SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY
+ VERSION_VAR SPARKLE_VERSION
+)
if(SPARKLE_FOUND)
set(SPARKLE_LIBRARIES ${SPARKLE_LIBRARY} )
diff --git a/cmake/modules/FindSpeexDSP.cmake b/cmake/modules/FindSpeexDSP.cmake
index 6c111111e5..2df717d574 100644
--- a/cmake/modules/FindSpeexDSP.cmake
+++ b/cmake/modules/FindSpeexDSP.cmake
@@ -1,18 +1,26 @@
+# Find the system's SpeexDSP includes and library
#
-# - Find speexdsp libraries
-#
-# SPEEXDSP_INCLUDE_DIRS - where to find speexdsp headers.
-# SPEEXDSP_LIBRARIES - List of libraries when using speexdsp.
-# SPEEXDSP_FOUND - True if speexdsp is found.
+# SPEEXDSP_INCLUDE_DIRS - where to find SpeexDSP headers
+# SPEEXDSP_LIBRARIES - List of libraries when using SpeexDSP
+# SPEEXDSP_FOUND - True if SpeexDSP found
+# SPEEXDSP_DLL_DIR - (Windows) Path to the SpeexDSP DLL
+# SPEEXDSP_DLL - (Windows) Name of the SpeexDSP DLL
+
+include(FindWSWinLibs)
+FindWSWinLibs("speexdsp-.*" "SPEEXDSP_HINTS")
+
+if(NOT USE_REPOSITORY)
+ find_package(PkgConfig)
+ pkg_search_module(PC_SPEEXDSP speexdsp)
+endif()
-find_package(PkgConfig QUIET)
-pkg_search_module(PC_SPEEXDSP QUIET speexdsp)
find_path(SPEEXDSP_INCLUDE_DIR
NAMES
speex/speex_resampler.h
HINTS
${PC_SPEEXDSP_INCLUDE_DIRS}
+ ${SPEEXDSP_HINTS}/include
)
find_library(SPEEXDSP_LIBRARY
@@ -20,16 +28,28 @@ find_library(SPEEXDSP_LIBRARY
speexdsp
HINTS
${PC_SPEEXDSP_LIBRARY_DIRS}
+ ${SPEEXDSP_HINTS}/lib
)
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(SpeexDSP
- REQUIRED_VARS SPEEXDSP_LIBRARY SPEEXDSP_INCLUDE_DIR
- VERSION_VAR PC_SPEEXDSP_VERSION)
+find_package_handle_standard_args(SpeexDSP DEFAULT_MSG SPEEXDSP_LIBRARY SPEEXDSP_INCLUDE_DIR)
if(SPEEXDSP_FOUND)
set(SPEEXDSP_LIBRARIES ${SPEEXDSP_LIBRARY})
set(SPEEXDSP_INCLUDE_DIRS ${SPEEXDSP_INCLUDE_DIR})
+ if(WIN32)
+ set(SPEEXDSP_DLL_DIR "${SPEEXDSP_HINTS}/bin"
+ CACHE PATH "Path to SpeexDSP DLL"
+ )
+ file(GLOB _speexdsp_dll RELATIVE "${SPEEXDSP_DLL_DIR}"
+ "${SPEEXDSP_DLL_DIR}/libspeexdsp.dll"
+ )
+ set(SPEEXDSP_DLL ${_speexdsp_dll}
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "SpeexDSP DLL file name"
+ )
+ mark_as_advanced(SPEEXDSP_DLL_DIR SPEEXDSP_DLL)
+ endif()
else()
set(SPEEXDSP_LIBRARIES)
set(SPEEXDSP_INCLUDE_DIRS)
diff --git a/cmake/modules/FindWSWinLibs.cmake b/cmake/modules/FindWSWinLibs.cmake
index 60f5a2ac8e..71297e6463 100644
--- a/cmake/modules/FindWSWinLibs.cmake
+++ b/cmake/modules/FindWSWinLibs.cmake
@@ -7,7 +7,7 @@
# to set in the callers scope.
function( FindWSWinLibs _WS_LIB_SEARCH_PATH _LIB_HINT_VAR )
- if( WIN32 )
+ if(USE_REPOSITORY)
if( ARGN )
set( _PROJECT_LIB_DIR ${ARGN} )
else()
@@ -22,15 +22,11 @@ function( FindWSWinLibs _WS_LIB_SEARCH_PATH _LIB_HINT_VAR )
file( GLOB _SUBDIR "${_PROJECT_LIB_DIR}/*" )
# We might be able to use $ENV{VSCMD_ARG_TGT_ARCH} here.
- set (_vcpkg_arch x64)
- if(WIRESHARK_TARGET_PLATFORM MATCHES "win32")
- set (_vcpkg_arch x86)
- endif()
foreach( _DIR ${_SUBDIR} )
if( IS_DIRECTORY ${_DIR} )
if( "${_DIR}" MATCHES ".*/${_WS_LIB_SEARCH_PATH}" )
- set(_vcpkg_dir "${_DIR}/installed/${_vcpkg_arch}-windows")
+ set(_vcpkg_dir "${_DIR}/installed/${WIRESHARK_TARGET_PLATFORM}-windows")
if( IS_DIRECTORY "${_vcpkg_dir}")
set( ${_LIB_HINT_VAR} ${_vcpkg_dir} PARENT_SCOPE )
else()
@@ -44,7 +40,7 @@ endfunction()
# Add a single DLL
function(AddWSWinDLL _PKG_NAME _PKG_HINTS _DLL_GLOB)
- if(WIN32 AND ${_PKG_NAME}_FOUND)
+ if(USE_REPOSITORY AND ${_PKG_NAME}_FOUND)
string(TOUPPER ${_PKG_NAME} _PKG_VAR)
set ( ${_PKG_VAR}_DLL_DIR "${${_PKG_HINTS}}/bin"
CACHE PATH "Path to ${_PKG_NAME} DLL"
@@ -70,7 +66,7 @@ endfunction()
# Add a list of DLLs
function(AddWSWinDLLS _PKG_NAME _PKG_HINTS) # ...DLL globs
- if(WIN32 AND ${_PKG_NAME}_FOUND)
+ if(USE_REPOSITORY AND ${_PKG_NAME}_FOUND)
string(TOUPPER ${_PKG_NAME} _PKG_VAR)
set ( ${_PKG_VAR}_DLL_DIR "${${_PKG_HINTS}}/bin"
CACHE PATH "Path to ${_PKG_NAME} DLLs"
diff --git a/cmake/modules/FindWiX.cmake b/cmake/modules/FindWiX.cmake
index e68231596d..ad8e5760d8 100644
--- a/cmake/modules/FindWiX.cmake
+++ b/cmake/modules/FindWiX.cmake
@@ -17,9 +17,9 @@ set(_PF86 "PROGRAMFILES(x86)")
find_program(WIX_CANDLE_EXECUTABLE candle
PATH
"$ENV{WIX}/bin"
- "$ENV{PROGRAMFILES}/WiX Toolset v3.10/bin"
- "$ENV{${_PF86}}/WiX Toolset v3.10/bin"
- "$ENV{PROGRAMW6432}/WiX Toolset v3.10/bin"
+ "$ENV{PROGRAMFILES}/WiX Toolset v3.11/bin"
+ "$ENV{${_PF86}}/WiX Toolset v3.11/bin"
+ "$ENV{PROGRAMW6432}/WiX Toolset v3.11/bin"
DOC "Path to the WiX candle utility."
)
@@ -27,9 +27,9 @@ find_program(WIX_CANDLE_EXECUTABLE candle
find_program(WIX_LIGHT_EXECUTABLE light
PATH
"$ENV{WIX}/bin"
- "$ENV{PROGRAMFILES}/WiX Toolset v3.10/bin"
- "$ENV{${_PF86}}/WiX Toolset v3.10/bin"
- "$ENV{PROGRAMW6432}/WiX Toolset v3.10/bin"
+ "$ENV{PROGRAMFILES}/WiX Toolset v3.11/bin"
+ "$ENV{${_PF86}}/WiX Toolset v3.11/bin"
+ "$ENV{PROGRAMW6432}/WiX Toolset v3.11/bin"
DOC "Path to the WiX light utility."
)
@@ -37,8 +37,8 @@ find_program(WIX_LIGHT_EXECUTABLE light
find_program(WIX_HEAT_EXECUTABLE heat
PATH
"$ENV{WIX}/bin"
- "$ENV{PROGRAMFILES}/WiX Toolset v3.10/bin"
- "$ENV{${_PF86}}/WiX Toolset v3.10/bin"
- "$ENV{PROGRAMW6432}/WiX Toolset v3.10/bin"
+ "$ENV{PROGRAMFILES}/WiX Toolset v3.11/bin"
+ "$ENV{${_PF86}}/WiX Toolset v3.11/bin"
+ "$ENV{PROGRAMW6432}/WiX Toolset v3.11/bin"
DOC "Path to the WiX heat utility."
)
diff --git a/cmake/modules/FindWinSparkle.cmake b/cmake/modules/FindWinSparkle.cmake
index db101ec571..7418cfb7a8 100644
--- a/cmake/modules/FindWinSparkle.cmake
+++ b/cmake/modules/FindWinSparkle.cmake
@@ -17,15 +17,11 @@ ENDIF (WINSPARKLE_INCLUDE_DIRS)
INCLUDE(FindWSWinLibs)
FindWSWinLibs("WinSparkle.*" "WINSPARKLE_HINTS")
-# The 64-bit WinSparkle.lib is under /x64/Release
-set ( _RELEASE_SUBDIR "Release" )
-if( WIN32 AND "${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64" )
- set ( _RELEASE_SUBDIR "x64/Release" )
-endif()
+set (_release_subdir "${WIRESHARK_TARGET_PLATFORM}/Release")
FIND_PATH(WINSPARKLE_INCLUDE_DIR winsparkle.h HINTS "${WINSPARKLE_HINTS}/include" )
-FIND_LIBRARY(WINSPARKLE_LIBRARY NAMES WinSparkle HINTS "${WINSPARKLE_HINTS}/${_RELEASE_SUBDIR}" )
+FIND_LIBRARY(WINSPARKLE_LIBRARY NAMES WinSparkle HINTS "${WINSPARKLE_HINTS}/${_release_subdir}" )
# handle the QUIETLY and REQUIRED arguments and set WINSPARKLE_FOUND to TRUE if
# all listed variables are TRUE
@@ -36,7 +32,7 @@ IF(WINSPARKLE_FOUND)
SET(WINSPARKLE_LIBRARIES ${WINSPARKLE_LIBRARY} )
SET(WINSPARKLE_INCLUDE_DIRS ${WINSPARKLE_INCLUDE_DIR} )
if (WIN32)
- set ( WINSPARKLE_DLL_DIR "${WINSPARKLE_HINTS}/${_RELEASE_SUBDIR}"
+ set (WINSPARKLE_DLL_DIR "${WINSPARKLE_HINTS}/${_release_subdir}"
CACHE PATH "Path to the WinSparkle DLL"
)
file( GLOB _winsparkle_dll RELATIVE "${WINSPARKLE_DLL_DIR}"
@@ -55,4 +51,6 @@ ELSE(WINSPARKLE_FOUND)
SET(WINSPARKLE_DLL )
ENDIF(WINSPARKLE_FOUND)
+unset(_release_subdir)
+
MARK_AS_ADVANCED( WINSPARKLE_LIBRARIES WINSPARKLE_INCLUDE_DIRS )
diff --git a/cmake/modules/FindXSLTPROC.cmake b/cmake/modules/FindXSLTPROC.cmake
index f23082d646..b55462242d 100644
--- a/cmake/modules/FindXSLTPROC.cmake
+++ b/cmake/modules/FindXSLTPROC.cmake
@@ -90,10 +90,10 @@ MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
IF(${_mode} STREQUAL "chunked")
SET(_basedir ${_dir_pfx}_html_chunked)
SET(_stylesheet "http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl")
- SET(_modeparams --stringparam chunker.output.encoding UTF-8)
+ SET(_modeparams --stringparam chunker.output.encoding UTF-8 --stringparam chunk.quietly 1)
ELSE() # single-page
SET(_basedir ${_dir_pfx}_html)
- SET(_stylesheet custom_layer_single_html.xsl)
+ SET(_stylesheet ${CMAKE_SOURCE_DIR}/docbook/custom_layer_single_html.xsl)
SET(_modeparams --output ${_basedir}/index.html)
ENDIF()
@@ -105,27 +105,21 @@ MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
set(_gfx_deps ${CMAKE_CURRENT_SOURCE_DIR}/${_tmpgfx})
ENDFOREACH()
- SET(_gfx_dir ${_dir_pfx}_graphics)
+ SET(_gfx_src_dir ${_dir_pfx}_src/images)
ADD_CUSTOM_COMMAND(
OUTPUT
${_output}
COMMAND ${CMAKE_COMMAND}
-E make_directory ${_out_dir}
COMMAND ${CMAKE_COMMAND}
- -E make_directory ${_out_dir}/${_gfx_dir}/toolbar
- COMMAND ${CMAKE_COMMAND}
- -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${_gfx_dir} ${_out_dir}/${_gfx_dir}
- COMMAND ${CMAKE_COMMAND}
- -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/common_graphics ${_out_dir}/${_gfx_dir}
- COMMAND ${CMAKE_COMMAND}
- -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${_gfx_dir}/toolbar ${_out_dir}/${_gfx_dir}/toolbar
+ -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${_gfx_src_dir} ${_out_dir}/images
COMMAND ${CMAKE_COMMAND}
-E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/ws.css ${_out_dir}
COMMAND ${XSLTPROC_EXECUTABLE}
--path "${_xsltproc_path}"
--stringparam base.dir ${_basedir}/
${_common_xsltproc_args}
- --stringparam admon.graphics.path ${_gfx_dir}/
+ --stringparam admon.graphics.path images/
${_modeparams}
--noout ${_stylesheet}
${_dbk_source}
@@ -135,6 +129,17 @@ MACRO(XML2HTML _target_dep _dir_pfx _mode _dbk_source _gfx_sources)
${_gfx_deps}
custom_layer_single_html.xsl
)
+ if(${_dir_pfx} STREQUAL wsug)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT
+ ${_output}
+ COMMAND ${CMAKE_COMMAND}
+ -E make_directory ${_out_dir}/images/toolbar
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${_gfx_src_dir}/toolbar ${_out_dir}/images/toolbar
+ APPEND
+ )
+ endif()
IF(NOT WIN32)
ADD_CUSTOM_COMMAND(
OUTPUT
diff --git a/cmake/modules/FindZLIB.cmake b/cmake/modules/FindZLIB.cmake
index 09c740597c..b6ac985892 100644
--- a/cmake/modules/FindZLIB.cmake
+++ b/cmake/modules/FindZLIB.cmake
@@ -39,8 +39,13 @@ include( FindWSWinLibs )
# Zlib is included with GLib2
FindWSWinLibs( "vcpkg-export-*" "ZLIB_HINTS" )
+if(MSVC)
+ # else we'll find Strawberry Perl's version
+ set (_zlib_sys_env_option NO_SYSTEM_ENVIRONMENT_PATH)
+endif()
+
if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY)
- if (NOT WIN32) # else we'll find Strawberry Perl's pkgconfig
+ if (NOT USE_REPOSITORY) # else we'll find Strawberry Perl's pkgconfig
find_package(PkgConfig)
pkg_search_module(ZLIB zlib)
endif()
@@ -54,6 +59,7 @@ if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY)
${ZLIB_HINTS}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include"
+ ${_zlib_sys_env_option}
)
SET(ZLIB_NAMES z zlib zdll zlib1 zlibd zlibd1)
@@ -66,8 +72,10 @@ if (NOT ZLIB_INCLUDE_DIR OR NOT ZLIB_LIBRARY)
${ZLIB_HINTS}
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/lib"
+ ${_zlib_sys_env_option}
)
endif()
+unset(_zlib_sys_env_option)
MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
diff --git a/cmake/modules/FindZSTD.cmake b/cmake/modules/FindZSTD.cmake
index 3fefe0fa08..5107d6a3a2 100644
--- a/cmake/modules/FindZSTD.cmake
+++ b/cmake/modules/FindZSTD.cmake
@@ -11,7 +11,7 @@
include( FindWSWinLibs )
FindWSWinLibs( "zstd-.*" "ZSTD_HINTS" )
-if( NOT WIN32)
+if( NOT USE_REPOSITORY)
find_package(PkgConfig)
pkg_search_module(ZSTD libzstd)
endif()
diff --git a/cmake/modules/LocatePythonModule.cmake b/cmake/modules/LocatePythonModule.cmake
deleted file mode 100644
index 3fbe0c793d..0000000000
--- a/cmake/modules/LocatePythonModule.cmake
+++ /dev/null
@@ -1,53 +0,0 @@
-#LOCATE_PYTHON_MODULE(<module> [PATHS <path1> ... <pathN>] [REQUIRED])
-#
-# This function tries to find the given python module.
-# If found the path is provided in <PY_<module> and <<module>_FOUND> is set to TRUE.
-#
-# After PATHS additional paths for python to search can be provided.
-# When REQUIRED is set, the function will abort the cmake execution is the module is not found
-function(LOCATE_PYTHON_MODULE module)
- if(NOT PYTHON_EXECUTABLE)
- find_package(PythonInterp)
- endif()
-
- # Parse (additional) arguments
- set(options REQUIRED)
- set(multiValueArgs PATHS)
- cmake_parse_arguments(LPM "${options}" "" "${multiValueArgs}" ${ARGN})
-
- string(TOUPPER ${module} module_upper)
- if(NOT PY_${module_upper})
-
- if(LPM_PATHS)
- # Append LPM_PATHS to PYTHONPATH to search at provided location (first)
- file(TO_CMAKE_PATH "$ENV{PYTHONPATH}" CMAKE_PATH)
- list(INSERT CMAKE_PATH 0 ${LPM_PATHS})
- file(TO_NATIVE_PATH "${CMAKE_PATH}" NATIVE_PATH)
- if(UNIX)
- string(REPLACE ";" ":" NATIVE_PATH "${NATIVE_PATH}")
- endif(UNIX)
- set(ENV{PYTHONPATH} "${NATIVE_PATH}")
- endif(LPM_PATHS)
-
- # Use the (native) python impl module to find the location of the requested module
- execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
- "import imp; print(imp.find_module('${module}')[1])"
- RESULT_VARIABLE _${module}_status
- OUTPUT_VARIABLE _${module}_location
- ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- if(NOT _${module}_status)
- set(PY_${module_upper} ${_${module}_location} CACHE STRING
- "Location of Python module ${module}")
- set(${module_upper}_FOUND TRUE)
- message(STATUS "Found python module ${module}: ${PY_${module_upper}}")
- else(NOT _${module}_status)
- set(${module_upper}_FOUND FALSE)
- if(LPM_REQUIRED)
- message(FATAL_ERROR "Could NOT find python module ${module}")
- else(LPM_REQUIRED)
- message(STATUS "Could NOT find python module ${module}")
- endif(LPM_REQUIRED)
- endif(NOT _${module}_status)
- endif(NOT PY_${module_upper})
-endfunction(LOCATE_PYTHON_MODULE)
diff --git a/cmake/modules/UseAsn2Wrs.cmake b/cmake/modules/UseAsn2Wrs.cmake
index 9d7cdfed0c..271126c1a3 100644
--- a/cmake/modules/UseAsn2Wrs.cmake
+++ b/cmake/modules/UseAsn2Wrs.cmake
@@ -6,11 +6,6 @@
# absolute path (e.g. "${CMAKE_CURRENT_SOURCE_DIR}").
function(ASN2WRS)
- if(NOT PY_ASN2WRS)
- include(LocatePythonModule)
- locate_python_module(asn2wrs REQUIRED PATHS "${CMAKE_SOURCE_DIR}/tools")
- endif()
-
if(NOT PROTO_OPT)
set(PROTO_OPT -p ${PROTOCOL_NAME})
elseif(PROTO_OPT STREQUAL "_EMPTY_")
@@ -35,11 +30,15 @@ function(ASN2WRS)
endforeach()
endforeach()
+ if(NOT ENABLE_DEBUG_A2W)
+ set(A2W_FLAGS ${A2W_FLAGS} -L)
+ endif()
+
# Creates a dissector in the source directory and store the timestamp.
add_custom_command(
OUTPUT packet-${PROTOCOL_NAME}-stamp
- COMMAND "${PYTHON_EXECUTABLE}"
- ${PY_ASN2WRS}
+ COMMAND "${Python3_EXECUTABLE}"
+ ${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
${A2W_FLAGS}
${PROTO_OPT}
-c "${CMAKE_CURRENT_SOURCE_DIR}/${PROTOCOL_NAME}.cnf"
@@ -48,12 +47,12 @@ function(ASN2WRS)
-O "${A2W_OUTPUT_DIR}"
${EXT_ASN_FILE_LIST} ${ASN_FILE_LIST} ${EXT_ASN_FILE_LIST_LATE}
COMMAND
- "${PYTHON_EXECUTABLE}" -c
+ "${Python3_EXECUTABLE}" -c
"import shutil, sys; x,s,d=sys.argv; open(d, 'w'); shutil.copystat(s, d)"
"${A2W_OUTPUT_DIR}/packet-${PROTOCOL_NAME}.c"
packet-${PROTOCOL_NAME}-stamp
DEPENDS
- "${PY_ASN2WRS}"
+ ${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
${SRC_FILES}
${EXTRA_CNF_targets}
${EXTRA_CNF}
@@ -67,8 +66,8 @@ function(ASN2WRS)
foreach(_asn2wrs_export_file IN LISTS EXPORT_FILES)
add_custom_command(
OUTPUT ${_asn2wrs_export_file}
- COMMAND "${PYTHON_EXECUTABLE}"
- "${PY_ASN2WRS}"
+ COMMAND "${Python3_EXECUTABLE}"
+ ${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
-E
${A2W_FLAGS}
${PROTO_OPT}
@@ -76,7 +75,7 @@ function(ASN2WRS)
-D "${CMAKE_CURRENT_SOURCE_DIR}"
${EXT_ASN_FILE_LIST} ${ASN_FILE_LIST} ${EXT_ASN_FILE_LIST_LATE}
DEPENDS
- "${PY_ASN2WRS}"
+ ${CMAKE_SOURCE_DIR}/tools/asn2wrs.py
${SRC_FILES}
${EXPORT_DEPENDS_targets}
${EXPORT_DEPENDS}
diff --git a/cmake/modules/UseExecutableResources.cmake b/cmake/modules/UseExecutableResources.cmake
index edb80d62e9..8eeb4a790e 100644
--- a/cmake/modules/UseExecutableResources.cmake
+++ b/cmake/modules/UseExecutableResources.cmake
@@ -14,13 +14,13 @@ function(set_executable_resources EXE_NAME PROGRAM_NAME)
# Use the original Wireshark / TShark .rc copyright.
set(COPYRIGHT_INFO "2000 Gerald Combs <gerald@wireshark.org>, Gilbert Ramirez <gram@alumni.rice.edu> and many others")
endif()
- set(${EXE_NAME}_FILES ${${EXE_NAME}_FILES} ${CMAKE_BINARY_DIR}/image/${EXE_NAME}.rc PARENT_SCOPE)
+ set(${EXE_NAME}_FILES ${${EXE_NAME}_FILES} ${CMAKE_BINARY_DIR}/resources/${EXE_NAME}.rc PARENT_SCOPE)
if (EXE_RC_UNIQUE_RC)
set (_in_file ${EXE_NAME})
else()
set (_in_file "cli_template")
endif()
- set(ICON_PATH "${CMAKE_SOURCE_DIR}/image/")
- configure_file( ${CMAKE_SOURCE_DIR}/image/${_in_file}.rc.in ${CMAKE_BINARY_DIR}/image/${EXE_NAME}.rc @ONLY )
+ set(ICON_PATH "${CMAKE_SOURCE_DIR}/resources/icons/")
+ configure_file( ${CMAKE_SOURCE_DIR}/resources/${_in_file}.rc.in ${CMAKE_BINARY_DIR}/resources/${EXE_NAME}.rc @ONLY )
endif()
endfunction()
diff --git a/cmake/modules/UseLemon.cmake b/cmake/modules/UseLemon.cmake
index 28c4982931..8d1d17b717 100644
--- a/cmake/modules/UseLemon.cmake
+++ b/cmake/modules/UseLemon.cmake
@@ -1,29 +1,66 @@
#
-MACRO(ADD_LEMON_FILES _source _generated)
- set(_lemonpardir ${CMAKE_SOURCE_DIR}/tools/lemon)
- FOREACH (_current_FILE ${ARGN})
- GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
- GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)
-
- SET(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename})
-
- ADD_CUSTOM_COMMAND(
- OUTPUT
- ${_out}.c
- # These files are generated as side-effect
- ${_out}.h
- ${_out}.out
- COMMAND $<TARGET_FILE:lemon>
- -T${_lemonpardir}/lempar.c
- -d.
- ${_in}
- DEPENDS
- ${_in}
- lemon
- ${_lemonpardir}/lempar.c
- )
-
- LIST(APPEND ${_source} ${_in})
- LIST(APPEND ${_generated} ${_out}.c)
- ENDFOREACH (_current_FILE)
-ENDMACRO(ADD_LEMON_FILES)
+
+find_program(LEMON_EXECUTABLE lemon)
+
+if(LEMON_EXECUTABLE)
+ # Use system lemon
+ macro(generate_lemon_file _out _in)
+ add_custom_command(
+ OUTPUT
+ ${_out}.c
+ # These files are generated as side-effect
+ ${_out}.h
+ ${_out}.out
+ COMMAND ${LEMON_EXECUTABLE}
+ -T/usr/share/lemon/lempar.c
+ -d.
+ ${_in}
+ DEPENDS
+ ${_in}
+ )
+ endmacro()
+ add_custom_target(lemon)
+else()
+ # Compile bundled lemon with support for -- to end options
+ macro(generate_lemon_file _out _in)
+ add_custom_command(
+ OUTPUT
+ ${_out}.c
+ # These files are generated as side-effect
+ ${_out}.h
+ ${_out}.out
+ COMMAND $<TARGET_FILE:lemon>
+ -T${CMAKE_SOURCE_DIR}/tools/lemon/lempar.c
+ -d.
+ --
+ ${_in}
+ DEPENDS
+ ${_in}
+ lemon
+ ${CMAKE_SOURCE_DIR}/tools/lemon/lempar.c
+ )
+ endmacro()
+endif()
+
+macro(ADD_LEMON_FILES _source _generated)
+
+ foreach (_current_FILE ${ARGN})
+ get_filename_component(_in ${_current_FILE} ABSOLUTE)
+ get_filename_component(_basename ${_current_FILE} NAME_WE)
+
+ set(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename})
+
+ generate_lemon_file(${_out} ${_in})
+
+ list(APPEND ${_source} ${_in})
+ list(APPEND ${_generated} ${_out}.c)
+
+ if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
+ set_source_files_properties(${_out}.c PROPERTIES COMPILE_OPTIONS "/w")
+ elseif(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
+ set_source_files_properties(${_out}.c PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter")
+ else()
+ # Build with some warnings for lemon generated code
+ endif()
+ endforeach(_current_FILE)
+endmacro(ADD_LEMON_FILES)
diff --git a/cmake/modules/UseMakePluginReg.cmake b/cmake/modules/UseMakePluginReg.cmake
index e6e6a9193d..24fd4c4731 100644
--- a/cmake/modules/UseMakePluginReg.cmake
+++ b/cmake/modules/UseMakePluginReg.cmake
@@ -1,20 +1,28 @@
#
-function(register_plugin_files _outputfile _registertype)
- include(LocatePythonModule)
- locate_python_module(make-plugin-reg REQUIRED PATHS ${CMAKE_SOURCE_DIR}/tools)
-
+function(make_plugin_register _outputfile _registertype _api_level _blurb)
file(RELATIVE_PATH output "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${_outputfile}")
add_custom_command(
OUTPUT
${_outputfile}
- COMMAND ${PYTHON_EXECUTABLE}
- ${PY_MAKE-PLUGIN-REG}
+ COMMAND ${Python3_EXECUTABLE}
+ ${CMAKE_SOURCE_DIR}/tools/make-plugin-reg.py
${CMAKE_CURRENT_SOURCE_DIR}
${_registertype}
+ ${_blurb}
+ ${_api_level}
${ARGN}
COMMENT "Generating ${output}"
DEPENDS
${ARGN}
- ${PY_MAKE-PLUGIN-REG}
+ ${CMAKE_SOURCE_DIR}/tools/make-plugin-reg.py
+ VERBATIM
)
endfunction()
+
+macro(register_plugin_files _outputfile _registertype _blurb)
+ make_plugin_register(${_outputfile} ${_registertype} 0 ${_blurb} ${ARGN})
+endmacro()
+
+macro(register_codec_files _outputfile _api_level _blurb)
+ make_plugin_register(${_outputfile} plugin_codec ${_api_level} ${_blurb} ${ARGN})
+endmacro()
diff --git a/cmake/modules/UseMakeTaps.cmake b/cmake/modules/UseMakeTaps.cmake
index aed93183ce..56fd628a80 100644
--- a/cmake/modules/UseMakeTaps.cmake
+++ b/cmake/modules/UseMakeTaps.cmake
@@ -5,7 +5,7 @@ MACRO(REGISTER_TAP_FILES _outputfile)
OUTPUT
${_outputfile}
COMMAND
- ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py taps ${_outputfile} ${_sources}
+ ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-regs.py taps ${_outputfile} ${_sources}
DEPENDS
${CMAKE_SOURCE_DIR}/tools/make-regs.py
${_sources}
diff --git a/cmake/modules/WiresharkPlugin.cmake b/cmake/modules/WiresharkPlugin.cmake
index dc5926807a..4d8cd7a9f8 100644
--- a/cmake/modules/WiresharkPlugin.cmake
+++ b/cmake/modules/WiresharkPlugin.cmake
@@ -28,7 +28,7 @@ macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra)
add_definitions(-DPLUGIN_VERSION=\"${PLUGIN_VERSION}\")
endmacro()
-macro(ADD_PLUGIN_LIBRARY _plugin _subfolder)
+macro(ADD_PLUGIN_LIBRARY _plugin _output_dir _abi_version)
add_library(${_plugin} MODULE
${PLUGIN_FILES}
${PLUGIN_RC_FILE}
@@ -38,25 +38,39 @@ macro(ADD_PLUGIN_LIBRARY _plugin _subfolder)
set_target_properties(${_plugin} PROPERTIES
PREFIX ""
+ SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}.${_abi_version}"
LINK_FLAGS "${WS_LINK_FLAGS}"
FOLDER "Plugins"
+ LIBRARY_OUTPUT_DIRECTORY ${_output_dir}
+ INSTALL_RPATH ""
)
if(MSVC)
set_target_properties(${_plugin} PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
endif()
- set_target_properties(${_plugin} PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR}/${_subfolder}
- INSTALL_RPATH ""
- )
-
add_dependencies(plugins ${_plugin})
endmacro()
+macro(ADD_WIRESHARK_EPAN_PLUGIN_LIBRARY _plugin)
+ ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/epan" ${PROJECT_ABI_VERSION_EPAN})
+endmacro()
+
+macro(ADD_WIRESHARK_WIRETAP_PLUGIN_LIBRARY _plugin)
+ ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/wiretap" ${PROJECT_ABI_VERSION_WIRETAP})
+endmacro()
+
+macro(ADD_WIRESHARK_CODEC_PLUGIN_LIBRARY _plugin)
+ ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/codecs" ${PROJECT_ABI_VERSION_CODEC})
+endmacro()
+
+macro(ADD_LOGRAY_EPAN_PLUGIN_LIBRARY _plugin)
+ ADD_PLUGIN_LIBRARY(${_plugin} "${LOGRAY_PLUGIN_DIR}/epan" ${PROJECT_ABI_VERSION_EPAN})
+endmacro()
+
macro(INSTALL_PLUGIN _plugin _subfolder)
install(TARGETS ${_plugin}
- LIBRARY DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR}/${_subfolder} NAMELINK_SKIP
- RUNTIME DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR}
- ARCHIVE DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR}
+ LIBRARY DESTINATION ${PLUGIN_INSTALL_LIBDIR}/${_subfolder} NAMELINK_SKIP
+ RUNTIME DESTINATION ${PLUGIN_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${PLUGIN_INSTALL_LIBDIR}
)
endmacro()