Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mdns #974

Merged
merged 12 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/mdns/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"20200225":
gocarlos marked this conversation as resolved.
Show resolved Hide resolved
sha256: 5f327b56d932ed5c1a28b7b1b1f528ddfbf69cb45bc4a8d38301ab85116e4b0e
url: https://github.com/mjansson/mdns/archive/0f75def961433102dc4848564c1a865f473dfaed.zip
41 changes: 41 additions & 0 deletions recipes/mdns/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import os
from conans import CMake, ConanFile, tools


class MdnsConan(ConanFile):
name = "mdns"
license = "Public Domain or MIT"
gocarlos marked this conversation as resolved.
Show resolved Hide resolved
homepage = "https://github.com/mjansson/mdns"
url = "https://github.com/conan-io/conan-center-index"
description = """Public domain mDNS/DNS-SD library in C"""
gocarlos marked this conversation as resolved.
Show resolved Hide resolved
topics = ("mdns")
gocarlos marked this conversation as resolved.
Show resolved Hide resolved
settings = "os"
no_copy_source = True

@property
def _source_subfolder(self):
return "source_subfolder"

@property
def _build_subfolder(self):
return "build_subfolder"

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + \
os.path.basename(
self.conan_data["sources"][self.version]["url"]).split(".")[0]
os.rename(extracted_dir, self._source_subfolder)

def package(self):
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
self.copy(pattern="*.h", dst="include", src=self._source_subfolder)

def package_info(self):
if self.settings.os == "Windows":
self.cpp_info.libs = ["iphlpapi", "ws2_32"]
gocarlos marked this conversation as resolved.
Show resolved Hide resolved
if str(self.settings.os) in ["Linux", "Android"]:
self.cpp_info.libs.append('pthread')
gocarlos marked this conversation as resolved.
Show resolved Hide resolved

def package_id(self):
self.info.header_only()
8 changes: 8 additions & 0 deletions recipes/mdns/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 2.8.11)
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
18 changes: 18 additions & 0 deletions recipes/mdns/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os

from conans import ConanFile, CMake, tools


class TestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
bin_path = self.run(bin_path, run_environment=True)
Loading