blob: 88f7c74cded8daf70d1dd6416d51bef2cc35f358 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
cmake_minimum_required(VERSION 3.5)
project(pcap-editor VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CPACK_PACKAGE_CONTACT "toni@impl.cc")
set(CPACK_DEBIAN_PACKAGE_NAME "pcap-editor")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
include(ExternalProject)
include(CPack)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)
find_library(PCAP_LIBRARY NAMES pcap wpcap)
set_property(SOURCE qhexedit2_init.cpp PROPERTY SKIP_AUTOGEN ON)
qt_add_plugin(qhexedit2
STATIC
qhexedit2/src/chunks.cpp
qhexedit2/src/chunks.h
qhexedit2/src/commands.cpp
qhexedit2/src/commands.h
qhexedit2/src/qhexedit.cpp
qhexedit2/src/qhexedit.h
qhexedit2/src/QHexEditPlugin.cpp
qhexedit2/src/QHexEditPlugin.h
)
ExternalProject_Add(PcapPlusPlus SOURCE_DIR ${CMAKE_SOURCE_DIR}/PcapPlusPlus
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/ppp-install
-DBUILD_SHARED_LIBS=OFF -DPCAPPP_BUILD_COVERAGE=OFF
-DPCAPPP_BUILD_EXAMPLES=OFF -DPCAPPP_BUILD_TESTS=OFF)
option(ENABLE_SANITIZER "Enable ASAN/LSAN/UBSAN." OFF)
if(ENABLE_SANITIZER)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=enum -fsanitize=leak")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=enum -fsanitize=leak")
endif()
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
bytewindow.cpp
bytewindow.h
bytewindow.ui
pcapplusplus.cpp
pcapplusplus.h
qhexedit2/src/chunks.cpp
qhexedit2/src/chunks.h
qhexedit2/src/commands.cpp
qhexedit2/src/commands.h
qhexedit2/src/qhexedit.cpp
qhexedit2/src/qhexedit.h
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(pcap-editor
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
qt_import_plugins(pcap-editor INCLUDE qhexedit2)
else()
if(ANDROID)
add_library(pcap-editor SHARED
${PROJECT_SOURCES}
)
else()
add_executable(pcap-editor
${PROJECT_SOURCES}
)
endif()
endif()
add_dependencies(pcap-editor PcapPlusPlus)
target_include_directories(pcap-editor PRIVATE ${CMAKE_BINARY_DIR}/ppp-install/include/pcapplusplus)
target_link_libraries(pcap-editor PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
${CMAKE_BINARY_DIR}/ppp-install/lib/libPcap++.a
${CMAKE_BINARY_DIR}/ppp-install/lib/libPacket++.a
${CMAKE_BINARY_DIR}/ppp-install/lib/libCommon++.a
${PCAP_LIBRARY})
set_target_properties(pcap-editor PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
install(TARGETS pcap-editor
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(pcap-editor)
endif()
message(STATUS "QT_DIR: ${QT_DIR}")
|