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

Conan #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
34 changes: 13 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.10)
project(ucanet C)

if (POLICY CMP0053)
cmake_policy(SET CMP0053 OLD)
endif ()
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message(FATAL_ERROR "Please run 'conan install' first!")
endif()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)

if (POLICY CMP0054)
cmake_policy(SET CMP0054 OLD)
endif ()

project(ucanet C)
conan_basic_setup(TARGETS)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

find_package(PkgConfig)

include(FindPackageHandleStandardArgs)
include(PkgConfigVars)
include(GNUInstallDirs)

add_definitions("-std=c99 -Wall -fPIC")
if (GNU)
add_definitions("-std=c99 -Wall -fPIC")
endif()

add_definitions(-DG_LOG_DOMAIN="Uca-Net")

pkg_check_modules(GIO gio-2.0>=2.22 REQUIRED)
pkg_check_modules(UCA libuca>=2.1.0 REQUIRED)
pkg_check_variable(libuca plugindir)

set(UCA_NET_DEFAULT_PORT 8989)

Expand All @@ -49,8 +43,7 @@ link_directories(
add_library(ucanet SHARED uca-net-camera.c)

target_link_libraries(ucanet
${UCA_LIBRARIES}
${GIO_LIBRARIES})
PUBLIC CONAN_PKG::libuca)

install(TARGETS ucanet
LIBRARY DESTINATION ${LIBUCA_PLUGINDIR}
Expand All @@ -60,8 +53,7 @@ install(TARGETS ucanet
add_executable(ucad ucad.c)

target_link_libraries(ucad
${UCA_LIBRARIES}
${GIO_LIBRARIES})
PUBLIC CONAN_PKG::libuca)

install(TARGETS ucad
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
Expand Down
4 changes: 4 additions & 0 deletions cmake/ConfigurePaths.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ function(configure_paths _prefix)
_set_var("${_prefix}" "SYSCONFDIR" "${SYSCONFDIR}" "${${_prefix}_PREFIX}/etc" "read-only single-machine data")
_set_var("${_prefix}" "LOCALSTATEDIR" "${LOCALSTATEDIR}" "${${_prefix}_PREFIX}/var" "modifiable single-machine data")
_set_var("${_prefix}" "BINDIR" "${BINDIR}" "${${_prefix}_EPREFIX}/bin" "user executables")
if(WIN32)
_set_var("${_prefix}" "LIBDIR" "${LIBDIR}" "${${_prefix}_EPREFIX}/bin" "object code libraries")
else()
_set_var("${_prefix}" "LIBDIR" "${LIBDIR}" "${${_prefix}_EPREFIX}/lib" "object code libraries")
endif()
_set_var("${_prefix}" "INCLUDEDIR" "${INCLUDEDIR}" "${${_prefix}_PREFIX}/include" "C header files")
_set_var("${_prefix}" "PKGCONFIGDIR" "${PKGCONFIGDIR}" "${${_prefix}_LIBDIR}/pkgconfig" "pkg-config files")
_set_var("${_prefix}" "TYPELIBDIR" "${TYPELIBDIR}" "${${_prefix}_LIBDIR}/girepository-1.0" "GObject run-time introspection data")
Expand Down
32 changes: 32 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from conans import ConanFile, CMake, tools


class UcaConan(ConanFile):
name = "uca-net"
version = "9906e95"
license = "MIT"
author = "Marius Elvert marius.elvert@softwareschneiderei.de"
url = "https://github.com/ufo-kit/libuca"
description = "TCP-based network bridge for libuca."
topics = ("utilities",)
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
exports_sources = "src/*", "include/*", "test/*", "bin/*", "CMakeLists.txt", "package.sh.in"
requires = "libuca/2.3.0",

def _configured_cmake(self):
cmake = CMake(self)
cmake.configure(source_folder=".")
return cmake

def build(self):
self._configured_cmake().build()

def package(self):
self._configured_cmake().install()

def imports(self):
self.copy("*.dll", "bin", "bin")
self.copy("*.dylib", "lib", "lib")