2015-01-18 21:27:13 +00:00
|
|
|
# Plugin convenience macros.
|
|
|
|
|
2016-06-08 13:57:00 +00:00
|
|
|
# Set information
|
2015-01-18 21:27:13 +00:00
|
|
|
macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra)
|
2017-12-15 00:04:32 +00:00
|
|
|
if(WIN32)
|
|
|
|
# Create the Windows .rc file for the plugin.
|
2017-12-15 22:13:59 +00:00
|
|
|
set(MODULE_NAME ${_plugin})
|
2017-12-15 00:04:32 +00:00
|
|
|
set(MODULE_VERSION_MAJOR ${_ver_major})
|
|
|
|
set(MODULE_VERSION_MINOR ${_ver_minor})
|
|
|
|
set(MODULE_VERSION_MICRO ${_ver_micro})
|
|
|
|
set(MODULE_VERSION_EXTRA ${_ver_extra})
|
|
|
|
set(MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_MICRO}.${MODULE_VERSION_EXTRA}")
|
|
|
|
set(RC_MODULE_VERSION "${MODULE_VERSION_MAJOR},${MODULE_VERSION_MINOR},${MODULE_VERSION_MICRO},${MODULE_VERSION_EXTRA}")
|
|
|
|
|
|
|
|
set(MSVC_VARIANT "${CMAKE_GENERATOR}")
|
|
|
|
|
|
|
|
# Create the plugin.rc file from the template
|
|
|
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugin.rc.in)
|
|
|
|
set(_plugin_rc_in ${CMAKE_CURRENT_SOURCE_DIR}/plugin.rc.in)
|
|
|
|
else()
|
|
|
|
set(_plugin_rc_in ${CMAKE_SOURCE_DIR}/plugins/plugin.rc.in)
|
|
|
|
endif()
|
|
|
|
configure_file(${_plugin_rc_in} plugin.rc @ONLY)
|
2017-12-17 12:26:26 +00:00
|
|
|
set(PLUGIN_RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/plugin.rc)
|
2017-12-15 00:04:32 +00:00
|
|
|
endif()
|
2017-12-15 00:49:31 +00:00
|
|
|
|
|
|
|
set(PLUGIN_VERSION "${_ver_major}.${_ver_minor}.${_ver_micro}")
|
|
|
|
add_definitions(-DPLUGIN_VERSION=\"${PLUGIN_VERSION}\")
|
2015-01-18 21:27:13 +00:00
|
|
|
endmacro()
|
|
|
|
|
Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
lib/plugins/{epan,wiretap,codecs}
Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.
This is a simplified filesystem layoutfor plugins some
important benefits such as:
* improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
* does not clash with Apple guidelines
* simpler for users to understand and apply
* just overall simpler and easier to maintain, removes a lot
of complexity from CMake code
It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.
It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.
Follow-up to 90b16b40921b737aadf9186685d866fd80e37ee6.
2023-12-13 02:14:33 +00:00
|
|
|
macro(ADD_PLUGIN_LIBRARY _plugin _output_dir _abi_version)
|
2017-11-01 20:22:32 +00:00
|
|
|
add_library(${_plugin} MODULE
|
2015-01-18 21:27:13 +00:00
|
|
|
${PLUGIN_FILES}
|
2017-12-17 12:26:26 +00:00
|
|
|
${PLUGIN_RC_FILE}
|
2015-01-18 21:27:13 +00:00
|
|
|
)
|
|
|
|
|
2021-06-21 17:43:41 +00:00
|
|
|
target_include_directories(${_plugin} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
2015-01-18 21:27:13 +00:00
|
|
|
set_target_properties(${_plugin} PROPERTIES
|
|
|
|
PREFIX ""
|
Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
lib/plugins/{epan,wiretap,codecs}
Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.
This is a simplified filesystem layoutfor plugins some
important benefits such as:
* improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
* does not clash with Apple guidelines
* simpler for users to understand and apply
* just overall simpler and easier to maintain, removes a lot
of complexity from CMake code
It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.
It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.
Follow-up to 90b16b40921b737aadf9186685d866fd80e37ee6.
2023-12-13 02:14:33 +00:00
|
|
|
SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}.${_abi_version}"
|
2015-01-18 21:27:13 +00:00
|
|
|
LINK_FLAGS "${WS_LINK_FLAGS}"
|
|
|
|
FOLDER "Plugins"
|
2023-12-13 12:42:40 +00:00
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${_output_dir}
|
|
|
|
INSTALL_RPATH ""
|
2015-01-18 21:27:13 +00:00
|
|
|
)
|
2021-03-29 10:10:16 +00:00
|
|
|
if(MSVC)
|
|
|
|
set_target_properties(${_plugin} PROPERTIES LINK_FLAGS_DEBUG "${WS_MSVC_DEBUG_LINK_FLAGS}")
|
|
|
|
endif()
|
2015-01-18 21:27:13 +00:00
|
|
|
|
2015-01-06 23:07:50 +00:00
|
|
|
add_dependencies(plugins ${_plugin})
|
2015-01-18 21:27:13 +00:00
|
|
|
endmacro()
|
2017-09-30 23:56:03 +00:00
|
|
|
|
2023-12-13 12:42:40 +00:00
|
|
|
macro(ADD_WIRESHARK_EPAN_PLUGIN_LIBRARY _plugin)
|
Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
lib/plugins/{epan,wiretap,codecs}
Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.
This is a simplified filesystem layoutfor plugins some
important benefits such as:
* improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
* does not clash with Apple guidelines
* simpler for users to understand and apply
* just overall simpler and easier to maintain, removes a lot
of complexity from CMake code
It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.
It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.
Follow-up to 90b16b40921b737aadf9186685d866fd80e37ee6.
2023-12-13 02:14:33 +00:00
|
|
|
ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/epan" ${PROJECT_ABI_VERSION_EPAN})
|
2022-04-04 18:32:53 +00:00
|
|
|
endmacro()
|
|
|
|
|
2023-12-13 12:42:40 +00:00
|
|
|
macro(ADD_WIRESHARK_WIRETAP_PLUGIN_LIBRARY _plugin)
|
Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
lib/plugins/{epan,wiretap,codecs}
Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.
This is a simplified filesystem layoutfor plugins some
important benefits such as:
* improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
* does not clash with Apple guidelines
* simpler for users to understand and apply
* just overall simpler and easier to maintain, removes a lot
of complexity from CMake code
It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.
It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.
Follow-up to 90b16b40921b737aadf9186685d866fd80e37ee6.
2023-12-13 02:14:33 +00:00
|
|
|
ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/wiretap" ${PROJECT_ABI_VERSION_WIRETAP})
|
2023-12-13 12:42:40 +00:00
|
|
|
endmacro()
|
2022-02-21 00:19:22 +00:00
|
|
|
|
2023-12-13 12:42:40 +00:00
|
|
|
macro(ADD_WIRESHARK_CODEC_PLUGIN_LIBRARY _plugin)
|
Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
lib/plugins/{epan,wiretap,codecs}
Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.
This is a simplified filesystem layoutfor plugins some
important benefits such as:
* improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
* does not clash with Apple guidelines
* simpler for users to understand and apply
* just overall simpler and easier to maintain, removes a lot
of complexity from CMake code
It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.
It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.
Follow-up to 90b16b40921b737aadf9186685d866fd80e37ee6.
2023-12-13 02:14:33 +00:00
|
|
|
ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/codecs" ${PROJECT_ABI_VERSION_CODEC})
|
2023-12-13 12:42:40 +00:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(ADD_LOGRAY_EPAN_PLUGIN_LIBRARY _plugin)
|
Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
lib/plugins/{epan,wiretap,codecs}
Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.
This is a simplified filesystem layoutfor plugins some
important benefits such as:
* improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
* does not clash with Apple guidelines
* simpler for users to understand and apply
* just overall simpler and easier to maintain, removes a lot
of complexity from CMake code
It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.
It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.
Follow-up to 90b16b40921b737aadf9186685d866fd80e37ee6.
2023-12-13 02:14:33 +00:00
|
|
|
ADD_PLUGIN_LIBRARY(${_plugin} "${LOGRAY_PLUGIN_DIR}/epan" ${PROJECT_ABI_VERSION_EPAN})
|
2022-02-21 00:19:22 +00:00
|
|
|
endmacro()
|
|
|
|
|
2018-02-04 01:22:09 +00:00
|
|
|
macro(INSTALL_PLUGIN _plugin _subfolder)
|
2017-09-30 23:56:03 +00:00
|
|
|
install(TARGETS ${_plugin}
|
Remove version component from plugin path
Remove the major.minor version from the plugin path, i.e:
lib/plugins/X.Y/{epan,wiretap,codecs}
and use an unversioned path:
lib/plugins/{epan,wiretap,codecs}
Introduce a new naming policy for plugins that requires
name.so.ABI_VERSION.
This is a simplified filesystem layoutfor plugins some
important benefits such as:
* improves compatibility between Wireshark versions, because
a plugin that wasn't recompiled will be automatically picked
up, but only if it has a compatible ABI version in the file name.
* does not clash with Apple guidelines
* simpler for users to understand and apply
* just overall simpler and easier to maintain, removes a lot
of complexity from CMake code
It does impose more requirements on the plugin naming scheme
but this should be handled completely transparently
by the build system.
It would also be possible to add support for unversioned *.so file
extensions at the same time, although in ths case it is not possible
to support multiple Wireshark ABI versions with only *.so, of course.
This wasn't done here but it may or may not be a useful enhancement
in the future.
Follow-up to 90b16b40921b737aadf9186685d866fd80e37ee6.
2023-12-13 02:14:33 +00:00
|
|
|
LIBRARY DESTINATION ${PLUGIN_INSTALL_LIBDIR}/${_subfolder} NAMELINK_SKIP
|
|
|
|
RUNTIME DESTINATION ${PLUGIN_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${PLUGIN_INSTALL_LIBDIR}
|
2017-09-30 23:56:03 +00:00
|
|
|
)
|
|
|
|
endmacro()
|