-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add avahi discover Log: add avahi discover Task: https://pms.uniontech.com/task-view-354339.html
- Loading branch information
1 parent
ce1be0b
commit 564d609
Showing
138 changed files
with
35,385 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
--- | ||
Language: Cpp | ||
AlignConsecutiveMacros: AcrossEmptyLinesAndComments | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Right | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: InlineOnly | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: MultiLine | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
BraceWrapping: | ||
AfterClass: true | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: true | ||
AfterNamespace: true | ||
AfterObjCDeclaration: true | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
LambdaBodyIndentation: OuterScope | ||
BreakBeforeBinaryOperators: All | ||
BreakBeforeBraces: Custom #Linux | ||
BreakBeforeInheritanceComma: false | ||
BreakInheritanceList: BeforeColon | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 180 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: false | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: false | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/' | ||
Priority: 2 | ||
- Regex: '^(<|"(gtest|gmock|isl|json)/)' | ||
Priority: 3 | ||
- Regex: '.*' | ||
Priority: 1 | ||
IncludeIsMainRegex: '(Test)?$' | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Auto | ||
ObjCBlockIndentWidth: 1 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Right | ||
ReflowComments: true | ||
SortIncludes: false | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: false | ||
#SpaceBeforeAssignmentOperators: false | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Cpp11 | ||
TabWidth: 4 | ||
UseTab: AlignWithSpaces | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.user | ||
*.o | ||
moc_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(QtZeroConf VERSION 0.1.0) | ||
|
||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network) | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
set(PUBLIC_HEADERS | ||
qzeroconfservice.h | ||
qzeroconfglobal.h | ||
qzeroconf.h | ||
) | ||
add_library(QtZeroConf | ||
${PUBLIC_HEADERS} | ||
qzeroconfservice.cpp | ||
) | ||
|
||
include(GNUInstallDirs) | ||
|
||
if(BUILD_SHARED_LIBS) | ||
target_compile_definitions(QtZeroConf PRIVATE QT_BUILD_ZEROCONF_LIB) | ||
set_target_properties(QtZeroConf PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 0) | ||
else() | ||
target_compile_definitions(QtZeroConf PUBLIC QZEROCONF_STATIC) | ||
endif() | ||
|
||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") | ||
find_library(avahi-client-lib avahi-client REQUIRED) | ||
find_library(avahi-common-lib avahi-common REQUIRED) | ||
find_path(avahi-client-includes avahi-client/client.h REQUIRED) | ||
find_path(avahi-common-includes avahi-common/defs.h REQUIRED) | ||
target_sources(QtZeroConf PRIVATE | ||
avahi-qt/qt-watch_p.h | ||
avahi-qt/qt-watch.cpp | ||
avahiclient.cpp | ||
) | ||
target_include_directories(QtZeroConf PRIVATE ${avahi-client-includes} ${avahi-common-includes}) | ||
list(APPEND ${PUBLIC_HEADERS} | ||
avahi-qt/qt-watch.h | ||
) | ||
target_link_libraries(QtZeroConf PRIVATE ${avahi-client-lib} ${avahi-common-lib}) | ||
endif() | ||
|
||
if(APPLE) | ||
target_sources(QtZeroConf PRIVATE | ||
bonjour_p.h | ||
bonjour.cpp | ||
) | ||
find_library(CoreServices CoreServices) | ||
target_link_libraries(QtZeroConf PUBLIC ${CoreServices}) | ||
endif() | ||
|
||
target_include_directories(QtZeroConf PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:include/QtZeroConf> | ||
) | ||
target_link_libraries(QtZeroConf PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network) | ||
|
||
if(WIN32) | ||
target_sources(QtZeroConf PRIVATE | ||
bonjour_p.h | ||
bonjour.cpp | ||
bonjour-sdk/dnssd_clientlib.c | ||
bonjour-sdk/dnssd_clientstub.c | ||
bonjour-sdk/dnssd_ipc.c | ||
) | ||
target_link_libraries(QtZeroConf PUBLIC ws2_32) | ||
if(MSVC) | ||
target_link_libraries(QtZeroConf PUBLIC "legacy_stdio_definitions.lib") | ||
endif() | ||
target_compile_definitions(QtZeroConf PRIVATE | ||
-DWIN32 | ||
-D_USRDLL | ||
-DMDNS_DEBUGMSGS=0 | ||
-DWIN32_LEAN_AND_MEAN | ||
-DUSE_TCP_LOOPBACK | ||
-D_NO_CRT_STDIO_INLINE | ||
-D_CRT_SECURE_NO_DEPRECATE | ||
-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 | ||
-DNOT_HAVE_SA_LEN) | ||
target_include_directories(QtZeroConf PRIVATE "${CMAKE_CURRENT_LIST_DIR}/bonjour-sdk") | ||
endif() | ||
|
||
if(ANDROID_AVAHI) | ||
set(ACM "${CMAKE_CURRENT_LIST_DIR}/avahi-common") | ||
set(ACR "${CMAKE_CURRENT_LIST_DIR}/avahi-core") | ||
target_sources(QtZeroConf PRIVATE | ||
qzeroconf.h | ||
avahi-qt/qt-watch.h | ||
avahi-qt/qt-watch_p.h | ||
avahicore.cpp | ||
avahi-qt/qt-watch.cpp | ||
${ACM}/address.c | ||
${ACM}/alternative.c | ||
${ACM}/domain.c | ||
${ACM}/error.c | ||
${ACM}/i18n.c | ||
${ACM}/malloc.c | ||
${ACM}/rlist.c | ||
${ACM}/simple-watch.c | ||
${ACM}/strlst.c | ||
${ACM}/thread-watch.c | ||
${ACM}/timeval.c | ||
${ACM}/utf8.c | ||
${ACR}/addr-util.c | ||
${ACR}/announce.c | ||
${ACR}/browse.c | ||
${ACR}/browse-dns-server.c | ||
${ACR}/browse-domain.c | ||
${ACR}/browse-service.c | ||
${ACR}/browse-service-type.c | ||
${ACR}/cache.c | ||
${ACR}/dns.c | ||
${ACR}/domain-util.c | ||
${ACR}/entry.c | ||
${ACR}/fdutil.c | ||
${ACR}/hashmap.c | ||
${ACR}/iface.c | ||
${ACR}/iface-linux.c | ||
${ACR}/log.c | ||
${ACR}/multicast-lookup.c | ||
${ACR}/netlink.c | ||
${ACR}/prioq.c | ||
${ACR}/probe-sched.c | ||
${ACR}/querier.c | ||
${ACR}/query-sched.c | ||
${ACR}/resolve-address.c | ||
${ACR}/resolve-host-name.c | ||
${ACR}/resolve-service.c | ||
${ACR}/response-sched.c | ||
${ACR}/rr.c | ||
${ACR}/rrlist.c | ||
${ACR}/server.c | ||
${ACR}/socket.c | ||
${ACR}/timeeventq.c | ||
${ACR}/util.c | ||
${ACR}/wide-area.c | ||
) | ||
list(APPEND ${PUBLIC_HEADERS} | ||
avahi-qt/qt-watch.h | ||
) | ||
target_compile_definitions(QtZeroConf PRIVATE HAVE_STRLCPY GETTEXT_PACKAGE HAVE_NETLINK) | ||
elseif(ANDROID) | ||
target_sources(QtZeroConf PRIVATE | ||
qzeroconf.h | ||
androidnsd_p.h | ||
androidnsd.cpp | ||
) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui) | ||
target_link_libraries(QtZeroConf PUBLIC Qt${QT_VERSION_MAJOR}::Gui) | ||
if (QT_VERSION_MAJOR EQUAL 5) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS AndroidExtras) | ||
target_link_libraries(QtZeroConf PUBLIC Qt${QT_VERSION_MAJOR}::AndroidExtras) | ||
endif () | ||
endif() | ||
|
||
# install | ||
set(INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE STRING "Installation directory for cmake config files") | ||
set_target_properties(QtZeroConf PROPERTIES PUBLIC_HEADER | ||
"${PUBLIC_HEADERS}" | ||
) | ||
install(TARGETS QtZeroConf | ||
EXPORT QtZeroConfConfig | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} | ||
) | ||
export(TARGETS QtZeroConf | ||
FILE ${CMAKE_CURRENT_BINARY_DIR}/QtZeroConfConfig.cmake | ||
) | ||
install(EXPORT QtZeroConfConfig | ||
DESTINATION ${INSTALL_CMAKEDIR} | ||
) | ||
|
||
set(BUILD_EXAMPLE false) | ||
if(BUILD_EXAMPLE) | ||
add_subdirectory(example) | ||
endif() |
Oops, something went wrong.