blob: 0d7f330490445d4dd8a80d0ef63ff07a6bfeeec9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
cmake_minimum_required(VERSION 3.1)
########################################################################
# useful macros
########################################################################
MACRO(USRP_PERIPHS_APPEND_SOURCES)
SET(usrp_periphs_sources ${usrp_periphs_sources} PARENT_SCOPE)
LIST(APPEND usrp_periphs_sources ${ARGV})
ENDMACRO(USRP_PERIPHS_APPEND_SOURCES)
MACRO(USRP_PERIPHS_APPEND_OBJECTS)
SET(usrp_periphs_objects ${usrp_periphs_objects} PARENT_SCOPE)
foreach(arg ${ARGV})
LIST(APPEND usrp_periphs_objects $<TARGET_OBJECTS:${arg}>)
endforeach(arg)
SET(usrp_periphs_objects ${usrp_periphs_objects} PARENT_SCOPE)
ENDMACRO(USRP_PERIPHS_APPEND_OBJECTS)
MACRO(USRP_PERIPHS_ADD_OBJECT name)
ADD_LIBRARY(${name} OBJECT ${ARGN})
SET_PROPERTY(TARGET ${name} PROPERTY POSITION_INDEPENDENT_CODE ON)
USRP_PERIPHS_APPEND_OBJECTS(${name})
ENDMACRO(USRP_PERIPHS_ADD_OBJECT)
########################################################################
# Setup Boost
########################################################################
MESSAGE(STATUS "")
MESSAGE(STATUS "Configuring Boost C++ Libraries...")
SET(BOOST_REQUIRED_COMPONENTS
system
)
IF(MPM_PYTHON_VER EQUAL 3)
LIST(APPEND BOOST_REQUIRED_COMPONENTS python3)
ELSE()
LIST(APPEND BOOST_REQUIRED_COMPONENTS python)
ENDIF()
IF(MINGW)
LIST(APPEND BOOST_REQUIRED_COMPONENTS thread_win32)
ELSE()
LIST(APPEND BOOST_REQUIRED_COMPONENTS thread)
ENDIF()
IF(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
ENDIF(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64")
IF(MSVC)
SET(BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking")
IF(BOOST_ALL_DYN_LINK)
ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc
ELSE(BOOST_ALL_DYN_LINK)
SET(BOOST_REQUIRED_COMPONENTS) #empty components list for static link
ENDIF(BOOST_ALL_DYN_LINK)
ENDIF(MSVC)
SET(Boost_ADDITIONAL_VERSIONS
"1.56.0" "1.56" "1.57" "1.57" "1.58" "1.59" "1.60" "1.61" "1.62" "1.63"
"1.64"
)
FIND_PACKAGE(Boost 1.53 COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
MESSAGE(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}")
MESSAGE(STATUS "Boost library directories: ${Boost_LIBRARY_DIRS}")
MESSAGE(STATUS "Boost libraries: ${Boost_LIBRARIES}")
########################################################################
# Setup Python API
########################################################################
SET(MPM_PYTHON_VER 2 CACHE STRING "Python version (2 or 3)")
IF(MPM_PYTHON_VER EQUAL 2)
SET(PYTHON_ADDITIONAL_VERSIONS 2.7)
ELSE()
SET(PYTHON_ADDITIONAL_VERSIONS 3.4 3.5)
ENDIF()
FIND_PACKAGE(PythonInterp ${MPM_PYTHON_VER})
#IF(MPM_PYTHON_VER EQUAL "2")
#FIND_PACKAGE(PythonInterp)
#ELSE()
#FIND_PACKAGE(PythonInterp 3)
#ENDIF()
FIND_PACKAGE(PythonLibs ${MPM_PYTHON_VER})
########################################################################
# Install Dirs
########################################################################
#when the library suffix should be 64 (applies to redhat linux family)
IF(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$")
SET(LIB_SUFFIX 64)
ENDIF()
IF(CMAKE_INSTALL_LIBDIR MATCHES lib64)
SET(LIB_SUFFIX 64)
ENDIF()
SET(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix")
SET(RUNTIME_DIR bin)
SET(LIBRARY_DIR lib${LIB_SUFFIX})
SET(INCLUDE_DIR include)
SET(PKG_DATA_DIR share/mpm)
IF(NOT DEFINED PKG_LIB_DIR)
SET(PKG_LIB_DIR ${LIBRARY_DIR}/mpm)
ENDIF()
SET(PKG_DOC_DIR share/doc/mpm)
SET(PKG_MAN_DIR share/man/man1)
########################################################################
# Setup library configuration
########################################################################
SET(CMAKE_CXX_STANDARD 11)
SET(MPM_DEVICE "n310" CACHE STRING "Choose an MPM device to build")
SET_PROPERTY(CACHE MPM_DEVICE PROPERTY STRINGS n310 tests)
SET(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host)
ADD_SUBDIRECTORY(include)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
${UHD_HOST_ROOT}/include
)
ADD_SUBDIRECTORY(lib)
MESSAGE("usrp_periphs objects: ${usrp_periphs_objects}")
ADD_LIBRARY(usrp-periphs SHARED ${usrp_periphs_objects})
TARGET_LINK_LIBRARIES(usrp-periphs
udev
${Boost_LIBRARIES}
)
IF(WIN32)
SET(DESTINATION_KEYWORD RUNTIME)
ELSE()
SET(DESTINATION_KEYWORD LIBRARY)
ENDIF()
INSTALL(TARGETS usrp-periphs ${DESTINATION_KEYWORD} DESTINATION ${LIBRARY_DIR} COMPONENT libraries)
SET(USRP_PERIPHS_MAJOR 0)
SET(USRP_PERIPHS_MINOR 1)
SET(USRP_PERIPHS_PATCH 0)
SET(USRP_PERIPHS_VERSION ${USRP_PERIPHS_MAJOR}.${USRP_PERIPHS_MINOR}.${USRP_PERIPHS_PATCH})
SET_TARGET_PROPERTIES(usrp-periphs PROPERTIES VERSION ${USRP_PERIPHS_VERSION})
SET_TARGET_PROPERTIES(usrp-periphs PROPERTIES SOVERSION ${USRP_PERIPHS_MAJOR})
ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(tools)
|