root / host / lib / transport / CMakeLists.txt @ a8bb5ec9
History | View | Annotate | Download (3.34 KB)
| 1 |
# |
|---|---|
| 2 |
# Copyright 2010-2011 Ettus Research LLC |
| 3 |
# |
| 4 |
# This program is free software: you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation, either version 3 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
# |
| 17 |
|
| 18 |
######################################################################## |
| 19 |
# This file included, use CMake directory variables |
| 20 |
######################################################################## |
| 21 |
|
| 22 |
######################################################################## |
| 23 |
# Setup libusb |
| 24 |
######################################################################## |
| 25 |
MESSAGE(STATUS "") |
| 26 |
FIND_PACKAGE(USB1) |
| 27 |
|
| 28 |
LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF)
|
| 29 |
|
| 30 |
IF(ENABLE_USB) |
| 31 |
MESSAGE(STATUS "USB support enabled via libusb.") |
| 32 |
INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIR})
|
| 33 |
LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES})
|
| 34 |
LIBUHD_APPEND_SOURCES( |
| 35 |
${CMAKE_CURRENT_SOURCE_DIR}/libusb1_control.cpp
|
| 36 |
${CMAKE_CURRENT_SOURCE_DIR}/libusb1_zero_copy.cpp
|
| 37 |
${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.cpp
|
| 38 |
${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.hpp
|
| 39 |
) |
| 40 |
ELSE(ENABLE_USB) |
| 41 |
LIBUHD_APPEND_SOURCES( |
| 42 |
${CMAKE_CURRENT_SOURCE_DIR}/usb_dummy_impl.cpp
|
| 43 |
) |
| 44 |
ENDIF(ENABLE_USB) |
| 45 |
|
| 46 |
######################################################################## |
| 47 |
# Setup defines for interface address discovery |
| 48 |
######################################################################## |
| 49 |
MESSAGE(STATUS "") |
| 50 |
MESSAGE(STATUS "Configuring interface address discovery...") |
| 51 |
INCLUDE(CheckCXXSourceCompiles) |
| 52 |
INCLUDE(CheckIncludeFileCXX) |
| 53 |
|
| 54 |
CHECK_CXX_SOURCE_COMPILES("
|
| 55 |
#include <ifaddrs.h> |
| 56 |
int main(){
|
| 57 |
struct ifaddrs *ifap; |
| 58 |
getifaddrs(&ifap); |
| 59 |
return 0; |
| 60 |
} |
| 61 |
" HAVE_GETIFADDRS |
| 62 |
) |
| 63 |
|
| 64 |
CHECK_INCLUDE_FILE_CXX(winsock2.h HAVE_WINSOCK2_H) |
| 65 |
|
| 66 |
IF(HAVE_GETIFADDRS) |
| 67 |
MESSAGE(STATUS " Interface address discovery supported through getifaddrs.") |
| 68 |
SET(IF_ADDRS_DEFS HAVE_GETIFADDRS) |
| 69 |
ELSEIF(HAVE_WINSOCK2_H) |
| 70 |
MESSAGE(STATUS " Interface address discovery supported through SIO_GET_INTERFACE_LIST.") |
| 71 |
SET(IF_ADDRS_DEFS HAVE_SIO_GET_INTERFACE_LIST) |
| 72 |
ELSE() |
| 73 |
MESSAGE(STATUS " Interface address discovery not supported.") |
| 74 |
SET(IF_ADDRS_DEFS HAVE_IF_ADDRS_DUMMY) |
| 75 |
ENDIF() |
| 76 |
|
| 77 |
SET_SOURCE_FILES_PROPERTIES( |
| 78 |
${CMAKE_CURRENT_SOURCE_DIR}/if_addrs.cpp
|
| 79 |
PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}"
|
| 80 |
) |
| 81 |
|
| 82 |
######################################################################## |
| 83 |
# Append to the list of sources for lib uhd |
| 84 |
######################################################################## |
| 85 |
LIBUHD_PYTHON_GEN_SOURCE( |
| 86 |
${CMAKE_CURRENT_SOURCE_DIR}/gen_vrt_if_packet.py
|
| 87 |
${CMAKE_CURRENT_BINARY_DIR}/vrt_if_packet.cpp
|
| 88 |
) |
| 89 |
|
| 90 |
LIBUHD_APPEND_SOURCES( |
| 91 |
${CMAKE_CURRENT_SOURCE_DIR}/buffer_pool.cpp
|
| 92 |
${CMAKE_CURRENT_SOURCE_DIR}/if_addrs.cpp
|
| 93 |
${CMAKE_CURRENT_SOURCE_DIR}/udp_simple.cpp
|
| 94 |
${CMAKE_CURRENT_SOURCE_DIR}/udp_zero_copy.cpp
|
| 95 |
${CMAKE_CURRENT_SOURCE_DIR}/vrt_packet_handler.hpp
|
| 96 |
) |