Statistics
| Branch: | Tag: | Revision:

root / host / lib / transport / CMakeLists.txt @ 25494489

History | View | Annotate | Download (3.7 KB)

1 1acc7467 Josh Blum
#
2 a076dc12 Josh Blum
# Copyright 2010-2011 Ettus Research LLC
3 1acc7467 Josh Blum
#
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 42ed1d34 Josh Blum
########################################################################
19
# This file included, use CMake directory variables
20
########################################################################
21 1acc7467 Josh Blum
22
########################################################################
23 d10de2f6 Josh Blum
# Setup libusb
24
########################################################################
25 ea20cc27 Josh Blum
MESSAGE(STATUS "")
26 e46edab9 Josh Blum
FIND_PACKAGE(USB1)
27 d10de2f6 Josh Blum
28 47c92a2a Josh Blum
LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF)
29
30
IF(ENABLE_USB)
31 14033d36 Josh Blum
    MESSAGE(STATUS "USB support enabled via libusb.")
32 d10de2f6 Josh Blum
    INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIR})
33
    LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES})
34
    LIBUHD_APPEND_SOURCES(
35 42ed1d34 Josh Blum
        ${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 d10de2f6 Josh Blum
    )
40 47c92a2a Josh Blum
ELSE(ENABLE_USB)
41 50ff7e4d Josh Blum
    LIBUHD_APPEND_SOURCES(
42 42ed1d34 Josh Blum
        ${CMAKE_CURRENT_SOURCE_DIR}/usb_dummy_impl.cpp
43 50ff7e4d Josh Blum
    )
44 47c92a2a Josh Blum
ENDIF(ENABLE_USB)
45 d10de2f6 Josh Blum
46
########################################################################
47 1acc7467 Josh Blum
# Setup defines for interface address discovery
48
########################################################################
49 5e4875eb Josh Blum
MESSAGE(STATUS "")
50 1acc7467 Josh Blum
MESSAGE(STATUS "Configuring interface address discovery...")
51 a8bb5ec9 Josh Blum
INCLUDE(CheckCXXSourceCompiles)
52 1acc7467 Josh Blum
INCLUDE(CheckIncludeFileCXX)
53 a8bb5ec9 Josh Blum
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 1acc7467 Josh Blum
CHECK_INCLUDE_FILE_CXX(winsock2.h HAVE_WINSOCK2_H)
65
66 a8bb5ec9 Josh Blum
IF(HAVE_GETIFADDRS)
67 1acc7467 Josh Blum
    MESSAGE(STATUS "  Interface address discovery supported through getifaddrs.")
68 a8bb5ec9 Josh Blum
    SET(IF_ADDRS_DEFS HAVE_GETIFADDRS)
69 1acc7467 Josh Blum
ELSEIF(HAVE_WINSOCK2_H)
70
    MESSAGE(STATUS "  Interface address discovery supported through SIO_GET_INTERFACE_LIST.")
71 a8bb5ec9 Josh Blum
    SET(IF_ADDRS_DEFS HAVE_SIO_GET_INTERFACE_LIST)
72
ELSE()
73 1acc7467 Josh Blum
    MESSAGE(STATUS "  Interface address discovery not supported.")
74 a8bb5ec9 Josh Blum
    SET(IF_ADDRS_DEFS HAVE_IF_ADDRS_DUMMY)
75
ENDIF()
76 1acc7467 Josh Blum
77 8b0fbfcd Josh Blum
SET_SOURCE_FILES_PROPERTIES(
78
    ${CMAKE_CURRENT_SOURCE_DIR}/if_addrs.cpp
79
    PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}"
80
)
81
82 60edbd7f Josh Blum
########################################################################
83
# Setup UDP
84
########################################################################
85 56445374 Josh Blum
LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/udp_zero_copy.cpp)
86 60edbd7f Josh Blum
87 74fc8946 Josh Blum
#On windows, the boost asio implementation uses the winsock2 library.
88
#Note: we exclude the .lib extension for cygwin and mingw platforms.
89
IF(WIN32)
90 dbfbc497 Josh Blum
    LIBUHD_APPEND_LIBS(ws2_32)
91
ENDIF()
92
93 1acc7467 Josh Blum
########################################################################
94
# Append to the list of sources for lib uhd
95
########################################################################
96
LIBUHD_PYTHON_GEN_SOURCE(
97 42ed1d34 Josh Blum
    ${CMAKE_CURRENT_SOURCE_DIR}/gen_vrt_if_packet.py
98
    ${CMAKE_CURRENT_BINARY_DIR}/vrt_if_packet.cpp
99 1acc7467 Josh Blum
)
100
101
LIBUHD_APPEND_SOURCES(
102 ed6a2941 Josh Blum
    ${CMAKE_CURRENT_SOURCE_DIR}/buffer_pool.cpp
103 42ed1d34 Josh Blum
    ${CMAKE_CURRENT_SOURCE_DIR}/if_addrs.cpp
104
    ${CMAKE_CURRENT_SOURCE_DIR}/udp_simple.cpp
105 5dfc4581 Josh Blum
    ${CMAKE_CURRENT_SOURCE_DIR}/usb_zero_copy_wrapper.cpp
106 1acc7467 Josh Blum
)