-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
89 lines (76 loc) · 3.43 KB
/
CMakeLists.txt
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
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.1.0)
project(SoapyVOLKConverters CXX)
enable_testing()
#select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
# C++-14 required for VOLK
set(CMAKE_CXX_STANDARD 14)
########################################################################
# Dependencies
########################################################################
find_package(SoapySDR "0.7" REQUIRED)
find_package(Volk REQUIRED)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${SoapySDR_INCLUDE_DIRS}
${Volk_INCLUDE_DIRS})
########################################################################
# Build a Soapy module to add VOLK converters
########################################################################
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.in.h
${CMAKE_CURRENT_BINARY_DIR}/config.h)
SOAPY_SDR_MODULE_UTIL(
TARGET volkConverters
SOURCES SoapyVOLKConverters.cpp
LIBRARIES
Volk::volk
)
if(MSVC)
target_compile_options(volkConverters PUBLIC /wd4251) #disable 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
endif()
########################################################################
# Common code for unit test and benchmark
########################################################################
add_library(TestUtility STATIC TestUtility.cpp)
target_link_libraries(TestUtility Volk::volk)
if(MSVC)
target_compile_options(TestUtility PUBLIC /wd4251) #disable 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
endif()
########################################################################
# Add test
########################################################################
add_executable(TestSoapyVOLKConverters TestSoapyVOLKConverters.cpp)
add_test(TestSoapyVOLKConverters TestSoapyVOLKConverters)
# Link against Soapy, not the module, which is loaded at runtime
target_link_libraries(TestSoapyVOLKConverters
TestUtility
${SoapySDR_LIBRARIES}
Volk::volk)
if(MSVC)
target_compile_options(TestSoapyVOLKConverters PUBLIC /wd4251) #disable 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
endif()
########################################################################
# Benchmark VOLK vs. generic converters
########################################################################
add_executable(BenchmarkSoapyVOLKConverters BenchmarkSoapyVOLKConverters.cpp)
# Link against Soapy, not the module, which is loaded at runtime
target_link_libraries(BenchmarkSoapyVOLKConverters
TestUtility
${SoapySDR_LIBRARIES}
Volk::volk)
if(MSVC)
target_compile_options(BenchmarkSoapyVOLKConverters PUBLIC /wd4251) #disable 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
endif()
########################################################################
# Print Summary
########################################################################
MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")