aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/modules/FindMDNS.cmake47
-rw-r--r--cmake/treedata/optional/common/mdns.txt1
-rw-r--r--xbmc/network/mdns/CMakeLists.txt12
-rw-r--r--xbmc/network/mdns/ZeroconfBrowserMDNS.cpp2
-rw-r--r--xbmc/network/mdns/ZeroconfMDNS.cpp2
-rw-r--r--xbmc/system.h8
7 files changed, 60 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4e2009ceec..660fb71071 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,7 +114,7 @@ endif()
# Optional dependencies
set(optional_deps MicroHttpd MySqlClient SSH XSLT
- Alsa UDEV DBus Avahi SmbClient CCache
+ Alsa UDEV DBus Avahi MDNS SmbClient CCache
PulseAudio VDPAU VAAPI Bluetooth CAP)
# Required, dyloaded deps
diff --git a/cmake/modules/FindMDNS.cmake b/cmake/modules/FindMDNS.cmake
new file mode 100644
index 0000000000..59416b3d61
--- /dev/null
+++ b/cmake/modules/FindMDNS.cmake
@@ -0,0 +1,47 @@
+#.rst:
+# FindMDNS
+# --------
+# Finds the mDNS library
+#
+# This will will define the following variables::
+#
+# MDNS_FOUND - system has mDNS
+# MDNS_INCLUDE_DIRS - the mDNS include directory
+# MDNS_LIBRARIES - the mDNS libraries
+# MDNS_DEFINITIONS - the mDNS definitions
+#
+# and the following imported targets::
+#
+# MDNS::MDNS - The mDNSlibrary
+
+find_path(MDNS_INCLUDE_DIR NAMES dmDnsEmbedded.h dns_sd.h)
+find_library(MDNS_LIBRARY NAMES mDNSEmbedded dnssd)
+
+find_path(MDNS_EMBEDDED_INCLUDE_DIR NAMES mDnsEmbedded.h)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(mDNS
+ REQUIRED_VARS MDNS_LIBRARY MDNS_INCLUDE_DIR)
+
+if(MDNS_FOUND)
+ set(MDNS_INCLUDE_DIRS ${MDNS_INCLUDE_DIR})
+ set(MDNS_LIBRARIES ${MDNS_LIBRARY})
+ set(MDNS_DEFINITIONS -DHAVE_LIBMDNS=1)
+ if(MDNS_EMBEDDED_INCLUDE_DIR)
+ list(APPEND MDNS_DEFINITIONS -DHAVE_LIBMDNSEMBEDDED=1)
+ endif()
+
+ if(NOT TARGET MDNS::MDNS)
+ add_library(MDNS::MDNS UNKNOWN IMPORTED)
+ set_target_properties(MDNS::MDNS PROPERTIES
+ IMPORTED_LOCATION "${MDNS_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${MDNS_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBMDNS=1)
+ if(MDNS_EMBEDDED_INCLUDE_DIR)
+ set_target_properties(MDNS::MDNS PROPERTIES
+ INTERFACE_COMPILE_DEFINITIONS HAVE_LIBMDNSEMBEDDED=1)
+ endif()
+ endif()
+endif()
+
+mark_as_advanced(MDNS_INCLUDE_DIR MDNS_EMBEDDED_INCLUDE_DIR MDNS_LIBRARY)
diff --git a/cmake/treedata/optional/common/mdns.txt b/cmake/treedata/optional/common/mdns.txt
new file mode 100644
index 0000000000..9bebb8921d
--- /dev/null
+++ b/cmake/treedata/optional/common/mdns.txt
@@ -0,0 +1 @@
+xbmc/network/mdns mdns # MDNS
diff --git a/xbmc/network/mdns/CMakeLists.txt b/xbmc/network/mdns/CMakeLists.txt
index ed7ba93501..e0b084a886 100644
--- a/xbmc/network/mdns/CMakeLists.txt
+++ b/xbmc/network/mdns/CMakeLists.txt
@@ -1,7 +1,9 @@
-set(SOURCES ZeroconfBrowserMDNS.cpp
- ZeroconfMDNS.cpp)
+if(MDNS_FOUND)
+ set(SOURCES ZeroconfBrowserMDNS.cpp
+ ZeroconfMDNS.cpp)
-set(HEADERS ZeroconfBrowserMDNS.h
- ZeroconfMDNS.h)
+ set(HEADERS ZeroconfBrowserMDNS.h
+ ZeroconfMDNS.h)
-core_add_library(network_mdns)
+ core_add_library(network_mdns)
+endif()
diff --git a/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp b/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp
index ef8f7dc441..fa31cbdf6c 100644
--- a/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp
+++ b/xbmc/network/mdns/ZeroconfBrowserMDNS.cpp
@@ -35,8 +35,6 @@
#include "platform/win32/WIN32Util.h"
#endif //TARGET_WINDOWS
-#pragma comment(lib, "dnssd.lib")
-
extern HWND g_hWnd;
diff --git a/xbmc/network/mdns/ZeroconfMDNS.cpp b/xbmc/network/mdns/ZeroconfMDNS.cpp
index 6ffb7adee5..17921b76eb 100644
--- a/xbmc/network/mdns/ZeroconfMDNS.cpp
+++ b/xbmc/network/mdns/ZeroconfMDNS.cpp
@@ -35,8 +35,6 @@
#include <mDnsEmbedded.h>
#endif //HAS_MDNS_EMBEDDED
-#pragma comment(lib, "dnssd.lib")
-
extern HWND g_hWnd;
void CZeroconfMDNS::Process()
diff --git a/xbmc/system.h b/xbmc/system.h
index 62f837a6b1..901d033303 100644
--- a/xbmc/system.h
+++ b/xbmc/system.h
@@ -71,10 +71,12 @@
#define HAS_UPNP
#endif
-#if defined(HAVE_LIBMDNSEMBEDDED)
+#if defined(HAVE_LIBMDNS)
#define HAS_ZEROCONF
#define HAS_MDNS
- #define HAS_MDNS_EMBEDDED
+ #if defined(HAVE_LIBMDNSEMBEDDED)
+ #define HAS_MDNS_EMBEDDED
+ #endif
#endif
/**********************
@@ -93,8 +95,6 @@
#define HAS_WIN32_NETWORK
#define HAS_IRSERVERSUITE
#define HAS_FILESYSTEM_SMB
-#define HAS_ZEROCONF
-#define HAS_MDNS
#define DECLARE_UNUSED(a,b) a b;
#endif