Skip to content

Commit 4c51e0e

Browse files
committed
CI: expand the matrix for AppVeyor and fix issues that finds.
Add ARM64 builds for VS 2019 and VS 2022. Fix cmake/Modules/FindPCAP.cmake to look in the right directory for pcap libraries if the build isn't being done for 32-bit or 64-bit x86. Use the -A flag for all generators; according to the CMake documentation, they're supported for all generators in CMake 3.1 and later and, on Windows, we require CMake 3.12 or later. That ensures that CMAKE_GENERATOR_PLATFORM will be set, so that we can use it to determine the right directory in which to look for pcap libraries.
1 parent b7bd627 commit 4c51e0e

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

.appveyor.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ environment:
1717
matrix:
1818
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
1919
GENERATOR: "Visual Studio 14 2015"
20+
PLATFORM: Win32
2021
SDK: npcap-sdk-1.13
2122
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
22-
GENERATOR: "Visual Studio 14 2015 Win64"
23+
GENERATOR: "Visual Studio 14 2015"
24+
PLATFORM: x64
2325
SDK: npcap-sdk-1.13
2426
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
2527
GENERATOR: "Visual Studio 15 2017"
28+
PLATFORM: Win32
2629
SDK: npcap-sdk-1.13
2730
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
28-
GENERATOR: "Visual Studio 15 2017 Win64"
31+
GENERATOR: "Visual Studio 15 2017"
32+
PLATFORM: x64
2933
SDK: npcap-sdk-1.13
3034
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
3135
GENERATOR: "Visual Studio 16 2019"
@@ -35,6 +39,10 @@ environment:
3539
GENERATOR: "Visual Studio 16 2019"
3640
PLATFORM: x64
3741
SDK: npcap-sdk-1.13
42+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
43+
GENERATOR: "Visual Studio 16 2019"
44+
PLATFORM: ARM64
45+
SDK: npcap-sdk-1.13
3846
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
3947
GENERATOR: "Visual Studio 17 2022"
4048
PLATFORM: Win32
@@ -43,6 +51,10 @@ environment:
4351
GENERATOR: "Visual Studio 17 2022"
4452
PLATFORM: x64
4553
SDK: npcap-sdk-1.13
54+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
55+
GENERATOR: "Visual Studio 17 2022"
56+
PLATFORM: ARM64
57+
SDK: npcap-sdk-1.13
4658

4759
build_script:
4860
#
@@ -52,6 +64,5 @@ build_script:
5264
- type NUL >.devel
5365
- md build
5466
- cd build
55-
- if NOT DEFINED PLATFORM cmake -DPCAP_ROOT=c:\projects\libpcap\Win32\%SDK% -G"%GENERATOR%" ..
56-
- if DEFINED PLATFORM cmake -DPCAP_ROOT=c:\projects\libpcap\Win32\%SDK% -G"%GENERATOR%" -A %PLATFORM% ..
67+
- cmake -DPCAP_ROOT=c:\projects\libpcap\Win32\%SDK% -G"%GENERATOR%" -A %PLATFORM% ..
5768
- msbuild /m /nologo /p:Configuration=Release tcpdump.sln

cmake/Modules/FindPCAP.cmake

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,27 @@ if(WIN32)
2929
#
3030
find_path(PCAP_INCLUDE_DIR pcap.h)
3131

32-
# The 64-bit Packet.lib is located under /x64
33-
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
32+
if(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
33+
#
34+
# 32-bit x86; no need to look in subdirectories of the SDK's
35+
# Lib directory for the libraries, as the libraries are in
36+
# the Lib directory
37+
#
38+
else()
39+
#
40+
# Platform other than 32-bit x86.
3441
#
3542
# For the WinPcap and Npcap SDKs, the Lib subdirectory of the top-level
36-
# directory contains 32-bit libraries; the 64-bit libraries are in the
37-
# Lib/x64 directory.
43+
# directory contains 32-bit x86 libraries; the libraries for other
44+
# platforms are in subdirectories of the Lib directory whose names
45+
# are the names of the supported platforms.
3846
#
39-
# The only way to *FORCE* CMake to look in the Lib/x64 directory
40-
# without searching in the Lib directory first appears to be to set
41-
# CMAKE_LIBRARY_ARCHITECTURE to "x64".
47+
# The only way to *FORCE* CMake to look in the appropriate
48+
# subdirectory of Lib for libraries without searching in the
49+
# Lib directory first appears to be to set
50+
# CMAKE_LIBRARY_ARCHITECTURE to the name of the subdirectory.
4251
#
43-
set(CMAKE_LIBRARY_ARCHITECTURE "x64")
52+
set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_GENERATOR_PLATFORM}")
4453
endif()
4554
find_library(PCAP_LIBRARY NAMES pcap wpcap)
4655

0 commit comments

Comments
 (0)