This commit is contained in:
bing
2026-04-02 23:18:28 +08:00
commit 6198e1b53c
112 changed files with 20893 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

48
cmake/FindPOPT.cmake Normal file
View File

@@ -0,0 +1,48 @@
# - Try to find the popt options processing library
# The module will set the following variables
#
# POPT_FOUND - System has popt
# POPT_INCLUDE_DIR - The popt include directory
# POPT_LIBRARY - The libraries needed to use popt
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(PC_POPT QUIET popt)
endif()
# Find the include directories
find_path(POPT_INCLUDE_DIR
NAMES popt.h
HINTS
${PC_POPT_INCLUDEDIR}
${PC_POPT_INCLUDE_DIRS}
DOC "Path containing the popt.h include file"
)
find_library(POPT_LIBRARY
NAMES popt
HINTS
${PC_POPT_LIBRARYDIR}
${PC_POPT_LIBRARY_DIRS}
DOC "popt library path"
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(POPT
REQUIRED_VARS POPT_INCLUDE_DIR POPT_LIBRARY
VERSION_VAR PC_POPT_VERSION)
mark_as_advanced(POPT_INCLUDE_DIR POPT_LIBRARY)
if(POPT_FOUND AND NOT TARGET popt::popt)
add_library(popt::popt UNKNOWN IMPORTED)
set_target_properties(popt::popt PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${POPT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${POPT_INCLUDE_DIR}"
)
endif()

98
cmake/FindXMLTO.cmake Normal file
View File

@@ -0,0 +1,98 @@
# - Convert XML docBook files to various formats
# This will convert XML docBook files to various formats like:
# man html txt dvi ps pdf
# macro XMLTO(outfiles infiles... MODES modes...)
find_program ( XMLTO_EXECUTABLE
NAMES xmlto
DOC "path to the xmlto docbook xslt frontend"
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XMLTO
REQUIRED_VARS XMLTO_EXECUTABLE)
mark_as_advanced( XMLTO_EXECUTABLE )
macro ( _XMLTO_FILE outfiles mode)
#special settings
set ( XMLTO_FILEEXT_man 1 )
set ( XMLTO_MODE_html xhtml-nochunks )
if ( NOT XMLTO_MODE_${mode})
set ( XMLTO_MODE_${mode} ${mode} )
endif ( NOT XMLTO_MODE_${mode} )
if ( NOT XMLTO_FILEEXT_${mode} )
set ( XMLTO_FILEEXT_${mode} ${mode} )
endif ( NOT XMLTO_FILEEXT_${mode} )
foreach ( dbFile ${ARGN} )
#TODO: set XMLTO_FILEEXT_man to value from <manvolnum>
if ( "${mode}" STREQUAL "man" )
file ( READ "${dbFile}" _DB_FILE_CONTENTS )
string ( REGEX MATCH "<manvolnum>[^<]*" XMLTO_FILEEXT_${mode} "${_DB_FILE_CONTENTS}" )
string ( REGEX REPLACE "^<manvolnum>" "" XMLTO_FILEEXT_${mode} "${XMLTO_FILEEXT_${mode}}" )
string ( REGEX REPLACE "[[:space:]]" "" XMLTO_FILEEXT_${mode} "${XMLTO_FILEEXT_${mode}}" )
endif ( "${mode}" STREQUAL "man" )
get_filename_component ( dbFilePath ${CMAKE_CURRENT_BINARY_DIR}/${dbFile} PATH )
get_filename_component ( dbFileWE ${dbFile} NAME_WE )
get_filename_component ( dbFileAbsWE ${dbFilePath}/${dbFileWE} ABSOLUTE )
add_custom_command (
OUTPUT ${dbFileAbsWE}.${XMLTO_FILEEXT_${mode}}
COMMAND ${XMLTO_EXECUTABLE} ${XMLTO_COMMAND_ARGS} -o ${dbFilePath}
${XMLTO_MODE_${mode}} "${CMAKE_CURRENT_SOURCE_DIR}/${dbFile}"
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${dbFile}
DEPENDS ${XMLTO_DEPENDS}
VERBATIM
)
set ( ${outfiles}
${${outfiles}}
${dbFileAbsWE}.${XMLTO_FILEEXT_${mode}}
)
endforeach ( dbFile )
endmacro ( _XMLTO_FILE outfiles )
macro ( XMLTO )
set ( XMLTO_MODES )
set ( XMLTO_FILES )
set ( XMLTO_HAS_MODES false )
set ( XMLTO_ADD_DEFAULT false )
foreach ( arg ${ARGN} )
if ( ${arg} STREQUAL "MODES" )
set ( XMLTO_HAS_MODES true )
elseif ( ${arg} STREQUAL "ALL" )
set ( XMLTO_ADD_DEFAULT true )
else ( ${arg} STREQUAL "MODES" )
if ( XMLTO_HAS_MODES )
set ( XMLTO_MODES ${XMLTO_MODES} ${arg} )
else ( XMLTO_HAS_MODES )
set ( XMLTO_FILES ${XMLTO_FILES} ${arg} )
endif ( XMLTO_HAS_MODES )
endif ( ${arg} STREQUAL "MODES" )
endforeach ( arg ${ARGN} )
if ( NOT XMLTO_MODES )
set ( XMLTO_MODES html )
endif ( NOT XMLTO_MODES )
foreach ( mode ${XMLTO_MODES} )
_xmlto_file ( XMLTO_FILES_${mode} ${mode} ${XMLTO_FILES} )
if ( XMLTO_ADD_DEFAULT )
add_custom_target ( ${mode} ALL
DEPENDS ${XMLTO_FILES_${mode}}
VERBATIM
)
else ( XMLTO_ADD_DEFAULT )
add_custom_target ( ${mode}
DEPENDS ${XMLTO_FILES_${mode}}
VERBATIM
)
endif ( XMLTO_ADD_DEFAULT )
endforeach ( mode )
set ( XMLTO_MODES )
set ( XMLTO_FILES )
endmacro ( XMLTO )

View File

@@ -0,0 +1,20 @@
function(get_library_version VERSION_ARG)
file(STRINGS include/rabbitmq-c/amqp.h _API_VERSION_MAJOR REGEX "^#define AMQP_VERSION_MAJOR [0-9]+$")
file(STRINGS include/rabbitmq-c/amqp.h _API_VERSION_MINOR REGEX "^#define AMQP_VERSION_MINOR [0-9]+$")
file(STRINGS include/rabbitmq-c/amqp.h _API_VERSION_PATCH REGEX "^#define AMQP_VERSION_PATCH [0-9]+$")
string(REGEX MATCH "[0-9]+" _API_VERSION_MAJOR ${_API_VERSION_MAJOR})
string(REGEX MATCH "[0-9]+" _API_VERSION_MINOR ${_API_VERSION_MINOR})
string(REGEX MATCH "[0-9]+" _API_VERSION_PATCH ${_API_VERSION_PATCH})
# VERSION to match what is in autotools
set(${VERSION_ARG} ${_API_VERSION_MAJOR}.${_API_VERSION_MINOR}.${_API_VERSION_PATCH} PARENT_SCOPE)
endfunction()
function(compute_soversion CURRENT REVISION AGE SOVERSION)
math(EXPR MAJOR "${CURRENT} - ${AGE}")
math(EXPR MINOR "${AGE}")
math(EXPR PATCH "${REVISION}")
set(${SOVERSION} ${MAJOR} PARENT_SCOPE)
endfunction()

12
cmake/config.h.in Normal file
View File

@@ -0,0 +1,12 @@
#ifndef CONFIG_H
#define CONFIG_H
#cmakedefine HAVE_SELECT
#cmakedefine HAVE_POLL
#define AMQ_PLATFORM "@CMAKE_SYSTEM_NAME@"
#cmakedefine ENABLE_SSL_ENGINE_API
#endif /* CONFIG_H */

View File

@@ -0,0 +1,17 @@
@PACKAGE_INIT@
set(RMQ_USES_OPENSSL @ENABLE_SSL_SUPPORT@)
include(CMakeFindDependencyMacro)
if (RMQ_USES_OPENSSL)
find_dependency(OpenSSL REQUIRED)
if(OPENSSL_VERSION)
if(OPENSSL_VERSION VERSION_LESS RMQ_OPENSSL_MIN_VERSION)
MESSAGE(FATAL_ERROR "Found OpenSSL version @OPENSSL_VERSION@ but @RMQ_OPENSSL_MIN_VERSION@ or later is required")
endif()
endif()
endif ()
include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
check_required_components(rabbitmq-c)