mirror of https://github.com/labapart/gattlib
examples: Use 'gattlib' pkg-config to build the examples
parent
5b76fada47
commit
6a083a8496
|
@ -109,6 +109,11 @@ set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
|||
add_library(gattlib SHARED ${gattlib_SRCS})
|
||||
target_link_libraries(gattlib ${gattlib_LIBS})
|
||||
|
||||
# Generate pkg-config file before building the examples
|
||||
configure_file(gattlib.pc.in gattlib.pc @ONLY)
|
||||
# Add the build directory to PKG_CONFIG_PATH
|
||||
set(ENV{PKG_CONFIG_PATH} "${PROJECT_BINARY_DIR}:$ENV{PKG_CONFIG_PATH}")
|
||||
|
||||
# Examples
|
||||
add_subdirectory(examples/ble_scan)
|
||||
add_subdirectory(examples/discover)
|
||||
|
@ -138,7 +143,6 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "libglib2.0-0")
|
|||
#
|
||||
# List of file to install
|
||||
#
|
||||
configure_file(gattlib.pc.in gattlib.pc @ONLY)
|
||||
install(TARGETS gattlib LIBRARY DESTINATION lib)
|
||||
install(FILES include/gattlib.h DESTINATION include)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/gattlib.pc DESTINATION lib/pkgconfig)
|
||||
|
|
|
@ -1,8 +1,31 @@
|
|||
#
|
||||
# GattLib - GATT Library
|
||||
#
|
||||
# Copyright (C) 2016-2017 Olivier Martin <olivier@labapart.org>
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(ble_scan_LIBS gattlib pthread)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_search_module(GATTLIB REQUIRED gattlib)
|
||||
|
||||
set(ble_scan_SRCS ble_scan.c)
|
||||
|
||||
add_executable(ble_scan ${ble_scan_SRCS})
|
||||
target_link_libraries(ble_scan ${ble_scan_LIBS})
|
||||
target_link_libraries(ble_scan ${GATTLIB_LIBRARIES} pthread)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#
|
||||
#
|
||||
# GattLib - GATT Library
|
||||
#
|
||||
# Copyright (C) 2016 Olivier Martin <olivier@labapart.org>
|
||||
# Copyright (C) 2016-2017 Olivier Martin <olivier@labapart.org>
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -22,9 +21,11 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(discover_LIBS gattlib)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_search_module(GATTLIB REQUIRED gattlib)
|
||||
|
||||
set(discover_SRCS discover.c)
|
||||
|
||||
add_executable(discover ${discover_SRCS})
|
||||
target_link_libraries(discover ${discover_LIBS})
|
||||
target_link_libraries(discover ${GATTLIB_LIBRARIES})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# GattLib - GATT Library
|
||||
#
|
||||
# Copyright (C) 2016 Olivier Martin <olivier@labapart.org>
|
||||
# Copyright (C) 2016-2017 Olivier Martin <olivier@labapart.org>
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -22,9 +22,11 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(gatttool_LIBS gattlib readline)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_search_module(GATTLIB REQUIRED gattlib)
|
||||
|
||||
set(gatttool_SRCS gatttool.c interactive.c utils.c)
|
||||
|
||||
add_executable(gatttool ${gatttool_SRCS})
|
||||
target_link_libraries(gatttool ${gatttool_LIBS})
|
||||
target_link_libraries(gatttool ${GATTLIB_LIBRARIES} readline)
|
||||
|
|
|
@ -22,9 +22,11 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(nordic_uart_LIBS gattlib)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_search_module(GATTLIB REQUIRED gattlib)
|
||||
|
||||
set(nordic_uart_SRCS nordic_uart.c)
|
||||
|
||||
add_executable(nordic_uart ${nordic_uart_SRCS})
|
||||
target_link_libraries(nordic_uart ${nordic_uart_LIBS})
|
||||
target_link_libraries(nordic_uart ${GATTLIB_LIBRARIES})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# GattLib - GATT Library
|
||||
#
|
||||
# Copyright (C) 2016 Olivier Martin <olivier@labapart.org>
|
||||
# Copyright (C) 2016-2017 Olivier Martin <olivier@labapart.org>
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
@ -22,9 +22,11 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(read_write_LIBS gattlib)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_search_module(GATTLIB REQUIRED gattlib)
|
||||
|
||||
set(read_write_SRCS read_write.c)
|
||||
|
||||
add_executable(read_write ${read_write_SRCS})
|
||||
target_link_libraries(read_write ${read_write_LIBS})
|
||||
target_link_libraries(read_write ${GATTLIB_LIBRARIES})
|
||||
|
|
Loading…
Reference in New Issue