diff options
Diffstat (limited to 'host/examples')
-rw-r--r-- | host/examples/CMakeLists.txt | 76 | ||||
-rw-r--r-- | host/examples/getopt/CMakeLists.txt | 4 | ||||
-rw-r--r-- | host/examples/init_usrp/CMakeLists.txt | 48 | ||||
-rw-r--r-- | host/examples/python/CMakeLists.txt | 2 |
4 files changed, 65 insertions, 65 deletions
diff --git a/host/examples/CMakeLists.txt b/host/examples/CMakeLists.txt index 8ebf2cc09..3d4e064bd 100644 --- a/host/examples/CMakeLists.txt +++ b/host/examples/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # example applications ######################################################################## -SET(example_sources +set(example_sources benchmark_rate.cpp network_relay.cpp rx_multi_samples.cpp @@ -30,52 +30,52 @@ SET(example_sources sync_to_gps.cpp ) -IF(ENABLE_RFNOC) - LIST(APPEND +if(ENABLE_RFNOC) + list(APPEND example_sources rfnoc_nullsource_ce_rx.cpp rfnoc_rx_to_file.cpp rfnoc_radio_loopback.cpp benchmark_streamer.cpp ) -ENDIF(ENABLE_RFNOC) +endif(ENABLE_RFNOC) -IF(ENABLE_OCTOCLOCK) - LIST(APPEND example_sources test_clock_synch.cpp) -ENDIF(ENABLE_OCTOCLOCK) +if(ENABLE_OCTOCLOCK) + list(APPEND example_sources test_clock_synch.cpp) +endif(ENABLE_OCTOCLOCK) #for each source: build an executable and install -FOREACH(example_source ${example_sources}) - GET_FILENAME_COMPONENT(example_name ${example_source} NAME_WE) - ADD_EXECUTABLE(${example_name} ${example_source}) - TARGET_LINK_LIBRARIES(${example_name} uhd ${Boost_LIBRARIES}) +foreach(example_source ${example_sources}) + get_filename_component(example_name ${example_source} NAME_WE) + add_executable(${example_name} ${example_source}) + target_link_libraries(${example_name} uhd ${Boost_LIBRARIES}) UHD_INSTALL(TARGETS ${example_name} RUNTIME DESTINATION ${PKG_LIB_DIR}/examples COMPONENT examples) -ENDFOREACH(example_source) +endforeach(example_source) ######################################################################## # ASCII Art DFT - requires curses, so this part is optional ######################################################################## -FIND_PACKAGE(Curses) +find_package(Curses) -IF(CURSES_FOUND) - INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR}) - ADD_EXECUTABLE(rx_ascii_art_dft rx_ascii_art_dft.cpp) - TARGET_LINK_LIBRARIES(rx_ascii_art_dft uhd ${CURSES_LIBRARIES} ${Boost_LIBRARIES}) +if(CURSES_FOUND) + include_directories(${CURSES_INCLUDE_DIR}) + add_executable(rx_ascii_art_dft rx_ascii_art_dft.cpp) + target_link_libraries(rx_ascii_art_dft uhd ${CURSES_LIBRARIES} ${Boost_LIBRARIES}) UHD_INSTALL(TARGETS rx_ascii_art_dft RUNTIME DESTINATION ${PKG_LIB_DIR}/examples COMPONENT examples) - ADD_EXECUTABLE(twinrx_freq_hopping twinrx_freq_hopping.cpp) - TARGET_LINK_LIBRARIES(twinrx_freq_hopping uhd ${CURSES_LIBRARIES} ${Boost_LIBRARIES}) + add_executable(twinrx_freq_hopping twinrx_freq_hopping.cpp) + target_link_libraries(twinrx_freq_hopping uhd ${CURSES_LIBRARIES} ${Boost_LIBRARIES}) UHD_INSTALL(TARGETS twinrx_freq_hopping RUNTIME DESTINATION ${PKG_LIB_DIR}/examples COMPONENT examples) -ENDIF(CURSES_FOUND) +endif(CURSES_FOUND) ######################################################################## # Examples using C API ######################################################################## -IF(ENABLE_C_API) +if(ENABLE_C_API) # # Check if this particular C99 feature is available with this compiler # - INCLUDE(CheckCSourceCompiles) + include(CheckCSourceCompiles) CHECK_C_SOURCE_COMPILES(" typedef struct { int bar; @@ -93,26 +93,26 @@ IF(ENABLE_C_API) } " HAVE_C99_STRUCTDECL) - IF(HAVE_C99_STRUCTDECL) - ADD_SUBDIRECTORY(getopt) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/getopt) + if(HAVE_C99_STRUCTDECL) + add_subdirectory(getopt) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/getopt) - SET(C_API_EXAMPLES + set(C_API_EXAMPLES rx_samples_c tx_samples_c ) - FOREACH(example ${C_API_EXAMPLES}) - ADD_EXECUTABLE(${example} ${example}.c) - TARGET_LINK_LIBRARIES(${example} uhd getopt) - IF(UNIX) - TARGET_LINK_LIBRARIES(${example} m) - ENDIF(UNIX) + foreach(example ${C_API_EXAMPLES}) + add_executable(${example} ${example}.c) + target_link_libraries(${example} uhd getopt) + if(UNIX) + target_link_libraries(${example} m) + endif(UNIX) UHD_INSTALL(TARGETS ${example} RUNTIME DESTINATION ${PKG_LIB_DIR}/examples COMPONENT examples) - ENDFOREACH(example ${C_API_EXAMPLES}) - ENDIF(HAVE_C99_STRUCTDECL) -ENDIF(ENABLE_C_API) + endforeach(example ${C_API_EXAMPLES}) + endif(HAVE_C99_STRUCTDECL) +endif(ENABLE_C_API) -IF(ENABLE_PYTHON_API) - ADD_SUBDIRECTORY(python) -ENDIF(ENABLE_PYTHON_API) +if(ENABLE_PYTHON_API) + add_subdirectory(python) +endif(ENABLE_PYTHON_API) diff --git a/host/examples/getopt/CMakeLists.txt b/host/examples/getopt/CMakeLists.txt index 047572108..4fe8ab43d 100644 --- a/host/examples/getopt/CMakeLists.txt +++ b/host/examples/getopt/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # getopt library for C examples since MSVC does not include it ######################################################################## -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIRECTORY}) -ADD_LIBRARY(getopt STATIC +include_directories(${CMAKE_CURRENT_SOURCE_DIRECTORY}) +add_library(getopt STATIC ${CMAKE_CURRENT_SOURCE_DIR}/getopt.c ) diff --git a/host/examples/init_usrp/CMakeLists.txt b/host/examples/init_usrp/CMakeLists.txt index ccbe3a1e3..9cc835442 100644 --- a/host/examples/init_usrp/CMakeLists.txt +++ b/host/examples/init_usrp/CMakeLists.txt @@ -36,24 +36,24 @@ find_package(UHD "3.8.0" REQUIRED) #find_package(UHD 3.8.1 EXACT REQUIRED) ### Configure Compiler ######################################################## -IF(CMAKE_VERSION VERSION_LESS "3.1") - IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - SET(CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}") - ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - IF("${IS_APPLE}" STREQUAL "") - SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") - ELSE() - SET(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}") - ENDIF() - ENDIF() -ELSE() - SET(CMAKE_CXX_STANDARD 11) -ENDIF() +if(CMAKE_VERSION VERSION_LESS "3.1") + if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}") + elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + if("${IS_APPLE}" STREQUAL "") + set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}") + endif() + endif() +else() + set(CMAKE_CXX_STANDARD 11) +endif() -IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - SET(CMAKE_EXE_LINKER_FLAGS "-lthr ${CMAKE_EXE_LINKER_FLAGS}") - SET(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") -ENDIF() +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + set(CMAKE_EXE_LINKER_FLAGS "-lthr ${CMAKE_EXE_LINKER_FLAGS}") + set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") +endif() include_directories( ${Boost_INCLUDE_DIRS} @@ -64,13 +64,13 @@ link_directories(${Boost_LIBRARY_DIRS}) ### Make the executable ####################################################### add_executable(init_usrp init_usrp.cpp) -SET(CMAKE_BUILD_TYPE "Release") -MESSAGE(STATUS "******************************************************************************") -MESSAGE(STATUS "* NOTE: When building your own app, you probably need all kinds of different ") -MESSAGE(STATUS "* compiler flags. This is just an example, so it's unlikely these settings ") -MESSAGE(STATUS "* exactly match what you require. Make sure to double-check compiler and ") -MESSAGE(STATUS "* linker flags to make sure your specific requirements are included. ") -MESSAGE(STATUS "******************************************************************************") +set(CMAKE_BUILD_TYPE "Release") +message(STATUS "******************************************************************************") +message(STATUS "* NOTE: When building your own app, you probably need all kinds of different ") +message(STATUS "* compiler flags. This is just an example, so it's unlikely these settings ") +message(STATUS "* exactly match what you require. Make sure to double-check compiler and ") +message(STATUS "* linker flags to make sure your specific requirements are included. ") +message(STATUS "******************************************************************************") # Shared library case: All we need to do is link against the library, and # anything else we need (in this case, some Boost libraries): diff --git a/host/examples/python/CMakeLists.txt b/host/examples/python/CMakeLists.txt index 758a69af1..23d1b83c6 100644 --- a/host/examples/python/CMakeLists.txt +++ b/host/examples/python/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -SET(python_examples +set(python_examples rx_to_file.py tx_waveforms.py curses_fft.py |