Merge branch 'topic/timw/vcpkg'

* topic/timw/vcpkg:
  Fix searching for libpcap installed by vcpkg
  Switch all of the conan configuration to vcpkg
This commit is contained in:
Tim Wojtulewicz 2024-02-02 15:27:23 -07:00
commit 9609f1fe1a
10 changed files with 40 additions and 30 deletions

3
.gitmodules vendored
View file

@ -73,3 +73,6 @@
[submodule "auxil/zeekjs"]
path = auxil/zeekjs
url = https://github.com/corelight/zeekjs.git
[submodule "auxil/vcpkg"]
path = auxil/vcpkg
url = https://github.com/microsoft/vcpkg

View file

@ -1,3 +1,9 @@
6.2.0-dev.500 | 2024-02-02 15:27:23 -0700
* Fix searching for libpcap installed by vcpkg (Tim Wojtulewicz)
* Switch all of the conan configuration to vcpkg (Tim Wojtulewicz)
6.2.0-dev.497 | 2024-02-02 13:50:05 -0800
* Fix markup typo in the Intel::seen_policy hook docstring [skip ci] (Christian Kreibich, Corelight)

View file

@ -5,6 +5,17 @@ cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
if (WIN32)
# Enable usage of CMAKE_MSVC_RUNTIME_LIBRARY variable
cmake_policy(SET CMP0091 NEW)
# I tried to just use CMAKE_SOURCE_DIR and CMAKE_CURRENT_SOURCE_DIR
# but it's not setting the path correctly and so the toolchain
# variable doesn't get passed down to submodules like libkqueue
# correctly. Instead get the absolute path to the vcpkg.cmake file
# and use that.
get_filename_component(_toolchain ./auxil/vcpkg/scripts/buildsystems/vcpkg.cmake ABSOLUTE)
# This needs to happen before the project() call below so that it
# doesn't need to be manually passed on the command line.
set(CMAKE_TOOLCHAIN_FILE ${_toolchain} CACHE STRING "Vcpkg toolchain file")
endif ()
project(Zeek C CXX)
@ -119,33 +130,23 @@ if (MSVC)
set(OPENSSL_USE_STATIC_LIBS true)
set(OPENSSL_MSVC_STATIC_RT true)
if (ZEEK_STANDALONE)
include(${CMAKE_SOURCE_DIR}/cmake/conan.cmake)
conan_cmake_autodetect(settings)
# Install packages from conanfile
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR}/ci/windows/conanfile_windows.txt
BUILD missing SETTINGS ${settings})
endif ()
# Set LibPCAP to point to libpcap binaries.
# Set PCAP_ROOT_DIR to point at the installation from vcpkg. A later call
# to FindPCAP.cmake will fill in the rest of the necessary variables.
if (NOT PCAP_ROOT_DIR)
find_package(libpcap)
set(PCAP_ROOT_DIR "${libpcap_LIB_DIRS}/../")
set(PCAP_INCLUDE_DIR ${libpcap_INCLUDES})
set(PCAP_LIBRARY ${libpcap_LIBS})
set(PCAP_ROOT_DIR ${VCPKG_INSTALLED_DIR}/x64-windows-static)
endif ()
set(LIBPCAP_PCAP_COMPILE_NOPCAP_HAS_ERROR_PARAMETER false)
# Set ZLib to point at the right variable.
# Find zlib installed by vcpkg.
find_package(ZLIB)
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
set(ZLIB_LIBRARY ZLIB::ZLIB)
# Set CAres
# Find c-ares installed by vcpkg.
find_package(c-ares)
set(HAVE_CARES true) # Disable FindCAres cmake file
include_directories(BEFORE ${c-ares_INCLUDE_DIRS})
set(zeekdeps ${zeekdeps} ${c-ares_LIBRARIES})
set(zeekdeps ${zeekdeps} c-ares::cares)
add_definitions(-DCARES_STATICLIB)
add_subdirectory(auxil/libunistd)

View file

@ -1 +1 @@
6.2.0-dev.497
6.2.0-dev.500

1
auxil/vcpkg Submodule

@ -0,0 +1 @@
Subproject commit 38d1652f152d36481f2f4e8a85c0f1e14f3769f7

View file

@ -16,8 +16,6 @@ RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePoin
# Install prerequisites
RUN choco install -y --no-progress visualstudio2019buildtools --version=16.11.11.0
RUN choco install -y --no-progress visualstudio2019-workload-vctools --version=1.0.0 --package-parameters '--add Microsoft.VisualStudio.Component.VC.ATLMFC'
# Pin conan to 1.58.0 until conan.cmake is updated to support 2.0
RUN choco install -y --no-progress conan --version=1.58.0
RUN choco install -y --no-progress sed
RUN choco install -y --no-progress winflexbison3
RUN choco install -y --no-progress msysgit

View file

@ -7,5 +7,5 @@ call "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliar
mkdir build
cd build
cmake.exe .. -DCMAKE_BUILD_TYPE=release -DENABLE_ZEEK_UNIT_TESTS=yes -G Ninja
cmake.exe .. -DCMAKE_BUILD_TYPE=release -DVCPKG_TARGET_TRIPLET="x64-windows-static" -DENABLE_ZEEK_UNIT_TESTS=yes -G Ninja
cmake.exe --build .

View file

@ -1,8 +0,0 @@
[requires]
zlib/1.2.11
libpcap/1.10.1
c-ares/1.21.0
[generators]
cmake_find_package
cmake

2
cmake

@ -1 +1 @@
Subproject commit 01fcb683005e3c3a71ae867aa983b772a77e32d1
Subproject commit bec5aec8a44fbe535a845f55622e1497bd11ba31

9
vcpkg.json Normal file
View file

@ -0,0 +1,9 @@
{
"name": "main",
"version-string": "latest",
"dependencies": [
"c-ares",
"libpcap",
"zlib"
]
}