Skip to content

Commit 24da395

Browse files
add CMake build system (seladb#944)
* add CMake build system * first review * this one ? * Second review * fix typo and PF_RING_HOME is now PF_RING_ROOT * cmake: pcap_set_direction set to off by default * cmake: add build_tutorials option * rename dpdk to DPDK * clean * remove timestamp from semver * allow to install examples and tutorials binaries * ci: don't indent 3rdParty cmake files * indent cmakes * ci: add cmake format to pre-commit job * ci: reduce windows jobs * ci: zstd test is handle by cirrus ci * lightpcapng: switch to zstd OFF by default * cmake: version remove git hash and add + when it's dirty * Use semver for Pkgconfig file, cmake and so libs * cmake: dpdk config and install tools * cmake: use defined version instead of git * Add Cmake on Cirrus CI * Add LLC and STP layers * Remove install tutorials * Add SomeIP layer to cmake * build mingw with 2 jobs in parallel * Fix mingw * Disable pcap immediate mode by default * Move compile options for static link with mingw to all libs * remove setup dpdk settings * Keep camelCase for lib names * Rework FindDPDK * cmake: add WakeOnLan layer * cirrus: avoid out of memory on cirrusCI * cirrus: limit to 2 jobs to avoid OOM * clean * cmake_minimum_required(VERSION 3.12) implies the new behaviour of CMP0074 * dpdk: fix for 18.11.11 * cmake: Add SomeIP SD layer * Revert "dpdk: fix for 18.11.11" This reverts commit 85d63be. * Bump PCAPPP_VERSION Co-authored-by: Ege Çetin <[email protected]> * fix DPDK v2 * Rename PCAPPP_HAS_PCAP_IMMEDIATE_MODE to PCAPPP_ENABLE_PCAP_IMMEDIATE_MODE * Rename PCAPPP_HAS_PCAP_SET_DIRECTION to PCAPPP_ENABLE_PCAP_SET_DIRECTION * Fix comment made by Kai Pastor * Remove DetectOS * Fix CMAKE Linux variable * Dpdk: if version not found try to read it from rte_build_config.h * fix dpdk * cmake: set the RUNTIME destination folder for windows DLL * cmake: FindDPDK: numa and threads are mandatory * cmake: macos: direct link with corefoundation Co-authored-by: Ege Çetin <[email protected]>
1 parent 3e764a8 commit 24da395

File tree

55 files changed

+2129
-37
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2129
-37
lines changed

.cirrus.yml

+50
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@ task:
2121
- python -m pip install -r requirements.txt
2222
- python -m pytest --interface vtnet0 --use-sudo
2323

24+
name: Test FreeBSD w/ CMake
25+
freebsd_instance:
26+
matrix:
27+
image_family: freebsd-12-3
28+
image_family: freebsd-13-0
29+
install_script:
30+
- pkg install -y bash cmake git gmake gsed libpcap tcpreplay
31+
configure_script:
32+
- cmake -S . -B Dist
33+
build_script:
34+
- cmake --build Dist -j 2
35+
test_pcapplusplus_script:
36+
- ifconfig vtnet0 promisc
37+
- python -m ensurepip
38+
- python -m pip install -r ci/run_tests/requirements.txt
39+
- python ci/run_tests/run_tests.py --interface vtnet0
40+
test_examples_script:
41+
- cd Tests/ExamplesTest
42+
- python -m ensurepip
43+
- python -m pip install -r requirements.txt
44+
- python -m pytest --interface vtnet0 --use-sudo --root-path=../../Dist/examples_bin
45+
2446
task:
2547
name: Test Zstd Linux
2648
container:
@@ -34,6 +56,18 @@ task:
3456
- python3 -m pip install -r ci/run_tests/requirements.txt
3557
- python3 ci/run_tests/run_tests.py --interface eth0
3658

59+
task:
60+
name: Test Zstd Linux w/ CMake
61+
container:
62+
image: seladb/ubuntu2004-zstd:latest
63+
configure_script:
64+
- cmake -DLIGHT_PCAPNG_ZSTD=ON -S . -B Dist
65+
build_script:
66+
- cmake --build Dist -j 2
67+
test_pcapplusplus_script:
68+
- python3 -m pip install -r ci/run_tests/requirements.txt
69+
- python3 ci/run_tests/run_tests.py --interface eth0
70+
3771
task:
3872
name: Test Zstd MacOS
3973
osx_instance:
@@ -50,6 +84,22 @@ task:
5084
- python3 -m pip install -r ci/run_tests/requirements.txt
5185
- python3 ci/run_tests/run_tests.py --interface en0 --use-sudo --test-args="-x TestPcapLiveDeviceSpecialCfg"
5286

87+
task:
88+
name: Test Zstd MacOS w/ CMake
89+
osx_instance:
90+
image: monterey-xcode
91+
configure_script:
92+
- brew install zstd
93+
- cmake -DLIGHT_PCAPNG_ZSTD=ON -S . -B Dist
94+
build_script:
95+
- cmake --build Dist -j
96+
install_tcpreplay_script:
97+
- brew install tcpreplay
98+
test_pcapplusplus_script:
99+
- python3 -m ensurepip
100+
- python3 -m pip install -r ci/run_tests/requirements.txt
101+
- python3 ci/run_tests/run_tests.py --interface en0 --use-sudo --test-args="-x TestPcapLiveDeviceSpecialCfg"
102+
53103
task:
54104
name: Regression Tests Linux (Memory Behavior Sanitizer)
55105
container:

.cmake-format

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# --------------------------
2+
# General Formatting Options
3+
# --------------------------
4+
# How wide to allow formatted cmake files
5+
line_width = 120
6+
7+
# How many spaces to tab for indent
8+
tab_size = 2
9+
10+
# If an argument group contains more than this many sub-groups (parg or kwarg
11+
# groups), then force it to a vertical layout.
12+
max_subgroups_hwrap = 2
13+
14+
# If a positional argument group contains more than this many arguments, then
15+
# force it to a vertical layout.
16+
max_pargs_hwrap = 3
17+
18+
# If true, separate flow control names from their parentheses with a space
19+
separate_ctrl_name_with_space = False
20+
21+
# If true, separate function names from parentheses with a space
22+
separate_fn_name_with_space = False
23+
24+
# If a statement is wrapped to more than one line, than dangle the closing
25+
# parenthesis on it's own line.
26+
dangle_parens = False
27+
28+
# If the trailing parenthesis must be 'dangled' on it's on line, then align it
29+
# to this reference: `prefix`: the start of the statement, `prefix-indent`: the
30+
# start of the statement, plus one indentation level, `child`: align to the
31+
# column of the arguments
32+
dangle_align = 'prefix'
33+
34+
min_prefix_chars = 4
35+
36+
# If the statement spelling length (including space and parenthesis) is larger
37+
# than the tab width by more than this amount, then force reject un-nested
38+
# layouts.
39+
max_prefix_chars = 10
40+
41+
# If a candidate layout is wrapped horizontally but it exceeds this many lines,
42+
# then reject the layout.
43+
max_lines_hwrap = 2
44+
45+
# What style line endings to use in the output.
46+
line_ending = 'unix'
47+
48+
# Format command names consistently as 'lower' or 'upper' case
49+
command_case = 'lower'
50+
51+
# Format keywords consistently as 'lower' or 'upper' case
52+
keyword_case = 'unchanged'
53+
54+
# If true, the argument lists which are known to be sortable will be sorted
55+
# lexicographicall
56+
enable_sort = True
57+
58+
# If true, the parsers may infer whether or not an argument list is sortable
59+
# (without annotation).
60+
autosort = True
61+
62+
# By default, if cmake-format cannot successfully fit everything into the
63+
# desired linewidth it will apply the last, most aggressive attempt that it
64+
# made. If this flag is True, however, cmake-format will print error, exit
65+
# with non-zero status code, and write-out nothing
66+
require_valid_layout = False
67+
68+
# Specify structure for custom cmake functions
69+
additional_commands = {
70+
"pkg_find": {
71+
"kwargs": {
72+
"PKG": "*"
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)