aboutsummaryrefslogtreecommitdiffstats
path: root/extras/packethicn/CMakeLists.txt
diff options
context:
space:
mode:
authorMarco Trinelli <marcotrinelli@gmail.com>2021-03-23 15:55:01 +0100
committerMarco Trinelli <marcotrinelli@gmail.com>2021-03-25 16:53:16 +0100
commit9f30bf6e794a7b431217ce91038a4ec0f917dc08 (patch)
tree32d58faf4e61045730e1fedc58153b979ce1e420 /extras/packethicn/CMakeLists.txt
parenteedc20451418af57a6ffe4c6d41652828f01b9fe (diff)
[HICN-688] Include packethicn in hicn build
Add license headers Add dependencies Fix build for Ubuntu 18.04 Move doc Signed-off-by: Marco Trinelli <marcotrinelli@gmail.com> Change-Id: Ie92268d2d3a47c47746107ac6f9c34b21949671c
Diffstat (limited to 'extras/packethicn/CMakeLists.txt')
-rw-r--r--extras/packethicn/CMakeLists.txt86
1 files changed, 86 insertions, 0 deletions
diff --git a/extras/packethicn/CMakeLists.txt b/extras/packethicn/CMakeLists.txt
new file mode 100644
index 000000000..cf5f7c26f
--- /dev/null
+++ b/extras/packethicn/CMakeLists.txt
@@ -0,0 +1,86 @@
+# Copyright (c) 2021 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cmake_minimum_required(VERSION 3.5)
+cmake_policy(SET CMP0048 NEW)
+
+project(packethicn VERSION 0.0.1 DESCRIPTION "hICN protocol plugin" LANGUAGES C)
+
+set(CMAKE_MODULE_PATH
+ ${CMAKE_MODULE_PATH}
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules"
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
+)
+
+include(BuildMacros)
+include(Packaging)
+
+set(PACKETHICN packethicn)
+
+find_package(Wireshark CONFIG REQUIRED)
+
+if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
+ find_package(Libhicn REQUIRED)
+else()
+ if (DISABLE_SHARED_LIBRARIES)
+ if (WIN32)
+ set(HICN_LIBRARIES ${LIBHICN_STATIC})
+ else ()
+ set(HICN_LIBRARIES ${LIBHICN_STATIC} log)
+ endif ()
+ list(APPEND DEPENDENCIES
+ ${LIBHICN_STATIC}
+ )
+ else ()
+ set(HICN_LIBRARIES ${LIBHICN_SHARED})
+ list(APPEND DEPENDENCIES
+ ${LIBHICN_SHARED}
+ )
+ endif ()
+endif()
+
+if(NOT Wireshark_PLUGINS_ENABLED)
+ message(FATAL_ERROR "Wireshark was compiled without support for plugins")
+endif()
+
+set(CMAKE_C_VISIBILITY_PRESET hidden)
+if (CMAKE_COMPILER_IS_GNUCC)
+ set(CMAKE_C_FLAGS "-Wall -Wextra ${CMAKE_C_FLAGS}")
+endif()
+
+set(COMPILER_DEFINITIONS -DVERSION=\"${PROJECT_VERSION}\")
+
+set(SOURCE_FILES
+ packet-hicn.c
+)
+
+list(APPEND PACKETHICN_INCLUDE_DIRS
+ ${HICN_INCLUDE_DIRS}
+)
+
+list(APPEND LIBRARIES
+ ${HICN_LIBRARIES}
+ epan
+)
+
+build_library(${PACKETHICN}
+ MODULE
+ SOURCES ${SOURCE_FILES}
+ LINK_LIBRARIES ${LIBRARIES}
+ DEPENDS ${DEPENDENCIES}
+ COMPONENT ${PACKETHICN}
+ INCLUDE_DIRS ${PACKETHICN_INCLUDE_DIRS}
+ INSTALL_FULL_PATH_DIR ${Wireshark_PLUGIN_INSTALL_DIR}/epan
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ EMPTY_PREFIX true
+) \ No newline at end of file