Skip to content

Commit c260fdc

Browse files
authored
chore: use conanfile.py for more flexibility (#725)
1 parent e4a1ab8 commit c260fdc

20 files changed

Lines changed: 66 additions & 74 deletions

File tree

.github/actions/build-cpp/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function build() {
1818
cp -rf /github/workspace/integration_tests/ /pktvisor-src/integration_tests/
1919
cp -rf /github/workspace/cmake/ /pktvisor-src/cmake/
2020
cp -rf /github/workspace/CMakeLists.txt /pktvisor-src/
21-
cp -rf /github/workspace/conanfile.txt /pktvisor-src/
21+
cp -rf /github/workspace/conanfile.py /pktvisor-src/
2222
mkdir /tmp/build
2323
cd /tmp/build
2424
cp -rf /pktvisor-src/build/conan_home/ .

.github/workflows/build-develop.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
uses: actions/cache@v4
5252
with:
5353
path: ${{github.workspace}}/build/conan_home/
54-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
54+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
5555
restore-keys: conan-${{ runner.os }}-
5656

5757
- name: Configure CMake
@@ -112,7 +112,7 @@ jobs:
112112
uses: actions/cache@v4
113113
with:
114114
path: ${{github.workspace}}/build/conan_home/
115-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
115+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
116116
restore-keys: conan-${{ runner.os }}-
117117

118118
- name: Configure CMake
@@ -170,16 +170,11 @@ jobs:
170170
with:
171171
version: 1.64.1
172172

173-
- name: Remove libpcap from conanfile
174-
shell: bash
175-
run: |
176-
sed -i -e "s/libpcap.*//g" "${{github.workspace}}\conanfile.txt"
177-
178173
- name: Setup Conan Cache
179174
uses: actions/cache@v4
180175
with:
181176
path: ${{github.workspace}}/build/conan_home/
182-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
177+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
183178
restore-keys: conan-${{ runner.os }}-
184179

185180
- name: Configure CMake
@@ -292,7 +287,7 @@ jobs:
292287
uses: actions/cache@v4
293288
with:
294289
path: ${{github.workspace}}/build/conan_home/
295-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
290+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
296291
restore-keys: conan-${{ runner.os }}-
297292

298293
- name: Build pktvisord + push symbol to bugsplat.com
@@ -832,7 +827,7 @@ jobs:
832827
uses: actions/cache@v4
833828
with:
834829
path: ${{github.workspace}}/build/conan_home/
835-
key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
830+
key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
836831
restore-keys: conan-${{ runner.os }}-arm64-
837832

838833
- name: Build pktvisord + push symbol to bugsplat.com

.github/workflows/build-release.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: actions/cache@v4
3939
with:
4040
path: ${{github.workspace}}/build/conan_home/
41-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
41+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
4242
restore-keys: conan-${{ runner.os }}-
4343

4444
- name: linux package install
@@ -282,16 +282,11 @@ jobs:
282282
with:
283283
version: 1.64.1
284284

285-
- name: Remove libpcap from conanfile
286-
shell: bash
287-
run: |
288-
sed -i -e "s/libpcap.*//g" "${{github.workspace}}\conanfile.txt"
289-
290285
- name: Setup Conan Cache
291286
uses: actions/cache@v4
292287
with:
293288
path: ${{github.workspace}}/build/conan_home/
294-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
289+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
295290
restore-keys: conan-${{ runner.os }}-
296291

297292
- name: Configure CMake
@@ -406,7 +401,7 @@ jobs:
406401
uses: actions/cache@v4
407402
with:
408403
path: ${{github.workspace}}/build/conan_home/
409-
key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
404+
key: conan-${{ runner.os }}-arm64-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
410405
restore-keys: conan-${{ runner.os }}-arm64-
411406

412407
- name: Build pktvisord + push symbol to backtrace.io
@@ -528,7 +523,7 @@ jobs:
528523
uses: actions/cache@v4
529524
with:
530525
path: ${{github.workspace}}/build/conan_home/
531-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
526+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
532527
restore-keys: conan-${{ runner.os }}-
533528

534529
- name: Build pktvisord + push symbol to backtrace.io

.github/workflows/build_cross.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ jobs:
114114
path: src
115115

116116
- name: Remove crashpad from conanfile
117-
run: |
118-
sed -i -e "s/crashpad.*//g" ${{github.workspace}}/src/conanfile.txt
117+
run: sed -i "/crashpad/d" ${{github.workspace}}/src/conanfile.py
119118

120119
- name: Install dependencies
121120
run: |

.github/workflows/build_debug.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/cache@v4
4040
with:
4141
path: ${{github.workspace}}/build/conan_home/
42-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
42+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
4343
restore-keys: conan-${{ runner.os }}-
4444

4545
- name: linux package install
@@ -100,7 +100,7 @@ jobs:
100100
uses: actions/cache@v4
101101
with:
102102
path: ${{github.workspace}}/build/conan_home/
103-
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt', '*/conanfile.txt') }}
103+
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.py', '*/conanfile.py') }}
104104
restore-keys: conan-${{ runner.os }}-
105105

106106
- name: Build pktvisord + push symbol to backtrace.io

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ localconfig/
1313
.cache/
1414
.vscode/
1515
build/
16+
CMakeUserPresets.json

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ pktvisor is developed and tested on Linux and OSX. A Windows port is in progress
595595
* CMake >= 3.13 (`cmake`)
596596
* C++ compiler supporting C++17
597597

598-
For the list of packages included by conan, see [conanfile.txt](conanfile.txt)
598+
For the list of packages included by conan, see [conanfile.py](conanfile.py)
599599

600600
#### Building
601601

cmd/pktvisor-reader/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ find_package(docopt REQUIRED)
44

55
target_link_libraries(pktvisor-reader
66
PRIVATE
7-
docopt::docopt
7+
docopt_s
88
${VISOR_STATIC_PLUGINS}
99
)

cmd/pktvisord/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ target_link_libraries(pktvisord
1515
PRIVATE
1616
timer
1717
${ADDITIONAL_LIBS}
18-
docopt::docopt
18+
docopt_s
1919
Visor::Core
2020
${VISOR_STATIC_PLUGINS}
2121
)

conanfile.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from conan import ConanFile
2+
3+
4+
class Pktvisor(ConanFile):
5+
settings = "os", "compiler", "build_type", "arch"
6+
generators = "CMakeToolchain", "CMakeDeps"
7+
8+
def requirements(self):
9+
self.requires("catch2/3.6.0")
10+
self.requires("corrade/2020.06")
11+
self.requires("cpp-httplib/0.16.0")
12+
self.requires("docopt.cpp/0.6.3")
13+
self.requires("fast-cpp-csv-parser/cci.20240102")
14+
self.requires("json-schema-validator/2.3.0")
15+
self.requires("libmaxminddb/1.10.0")
16+
self.requires("nlohmann_json/3.11.3")
17+
self.requires("openssl/3.3.1")
18+
if self.settings.os != "Windows":
19+
self.requires("libpcap/1.10.4", force=True)
20+
self.requires("opentelemetry-proto/1.3.0")
21+
self.requires("pcapplusplus/23.09")
22+
self.requires("abseil/20240116.2", force=True)
23+
self.requires("protobuf/5.27.0")
24+
self.requires("sigslot/1.2.2")
25+
self.requires("spdlog/1.14.1")
26+
self.requires("uvw/3.4.0")
27+
self.requires("yaml-cpp/0.8.0")
28+
self.requires("robin-hood-hashing/3.11.5")
29+
self.requires("libcurl/8.9.1")
30+
self.requires("crashpad/cci.20220219")
31+
32+
def build_requirements(self):
33+
self.tool_requires("corrade/2020.06")
34+
self.tool_requires("protobuf/5.27.0")

0 commit comments

Comments
 (0)