diff options
134 files changed, 2401 insertions, 2398 deletions
@@ -125,6 +125,9 @@ std::map<std::string, std::string> bar = * Pylint is good tool for helping with following code guidelines. It's very fussy though, so don't get too worked up about following its suggestions. +## CMake-specific Guidelines + +* CMake commands written in lowercase. ## Revision Control Hygiene diff --git a/firmware/fx2/CMakeLists.txt b/firmware/fx2/CMakeLists.txt index f7f6e96ca..7a41333f5 100644 --- a/firmware/fx2/CMakeLists.txt +++ b/firmware/fx2/CMakeLists.txt @@ -15,22 +15,22 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +cmake_minimum_required(VERSION 2.6) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/config/Toolchain-sdcc.cmake) -PROJECT(USRP1 C) +project(USRP1 C) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/") -INCLUDE(FindPythonInterp) +include(FindPythonInterp) ######################################################################## # Set toolchain to use SDCC ######################################################################## # we're doing mixed ASM and C -ENABLE_LANGUAGE(ASM_SDCC) +enable_language(ASM_SDCC) ######################################################################## # C flags and linking flags ######################################################################## -ADD_DEFINITIONS(-DHAVE_USRP2) +add_definitions(-DHAVE_USRP2) set(CMAKE_C_LINK_FLAGS "--code-loc 0x0000 --code-size 0x1800 --xram-loc 0x1800 --xram-size 0x0800 -Wl '-b USBDESCSEG = 0xE000'") set(CMAKE_C_FLAGS "--no-xinit-opt") @@ -45,5 +45,5 @@ set(BUILD_EEPROM ${CMAKE_SOURCE_DIR}/utils/build_eeprom.py) ######################################################################## # Add the subdirectories ######################################################################## -ADD_SUBDIRECTORY(usrp1) -ADD_SUBDIRECTORY(b100) +add_subdirectory(usrp1) +add_subdirectory(b100) diff --git a/firmware/fx2/config/CMakeASM_SDCCInformation.cmake b/firmware/fx2/config/CMakeASM_SDCCInformation.cmake index d9f28b8d3..6d922bfc6 100644 --- a/firmware/fx2/config/CMakeASM_SDCCInformation.cmake +++ b/firmware/fx2/config/CMakeASM_SDCCInformation.cmake @@ -16,13 +16,13 @@ # # support for the SDCC assembler, asx8051 -SET( ASM_DIALECT "_SDCC" ) -SET( CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS a51 ) +set( ASM_DIALECT "_SDCC" ) +set( CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS a51 ) #i don't want to talk about it. i had such high hopes for CMake. -SET( CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -plosgff <SOURCE>" "${CMAKE_COMMAND} -DFILE=<OBJECT> -DSOURCE=<SOURCE> -P ${CMAKE_SOURCE_DIR}/config/Rename.cmake") +set( CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -plosgff <SOURCE>" "${CMAKE_COMMAND} -DFILE=<OBJECT> -DSOURCE=<SOURCE> -P ${CMAKE_SOURCE_DIR}/config/Rename.cmake") -INCLUDE( CMakeASMInformation ) -SET( CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION ".rel" ) #must go here because the include appears to overwrite it, although it shouldn't +include( CMakeASMInformation ) +set( CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION ".rel" ) #must go here because the include appears to overwrite it, although it shouldn't # for future use -SET( ASM_DIALECT ) +set( ASM_DIALECT ) diff --git a/firmware/fx2/config/CMakeDetermineASM_SDCCCompiler.cmake b/firmware/fx2/config/CMakeDetermineASM_SDCCCompiler.cmake index 37481077c..2cade6002 100644 --- a/firmware/fx2/config/CMakeDetermineASM_SDCCCompiler.cmake +++ b/firmware/fx2/config/CMakeDetermineASM_SDCCCompiler.cmake @@ -14,9 +14,9 @@ # Find the MS assembler (masm or masm64) -SET(ASM_DIALECT "_SDCC") +set(ASM_DIALECT "_SDCC") -SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT sdas8051) +set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT sdas8051) -INCLUDE(CMakeDetermineASMCompiler) -SET(ASM_DIALECT) +include(CMakeDetermineASMCompiler) +set(ASM_DIALECT) diff --git a/firmware/fx2/config/CMakeTestASM_SDCCCompiler.cmake b/firmware/fx2/config/CMakeTestASM_SDCCCompiler.cmake index 1cb71cd9d..16f7ba943 100644 --- a/firmware/fx2/config/CMakeTestASM_SDCCCompiler.cmake +++ b/firmware/fx2/config/CMakeTestASM_SDCCCompiler.cmake @@ -18,6 +18,6 @@ # is set and cmake stops processing commands and will not generate # any makefiles or projects. -SET(ASM_DIALECT "_SDCC") -INCLUDE(CMakeTestASMCompiler) -SET(ASM_DIALECT) +set(ASM_DIALECT "_SDCC") +include(CMakeTestASMCompiler) +set(ASM_DIALECT) diff --git a/firmware/fx2/config/Rename.cmake b/firmware/fx2/config/Rename.cmake index 36cd33527..e96e4bcf7 100644 --- a/firmware/fx2/config/Rename.cmake +++ b/firmware/fx2/config/Rename.cmake @@ -23,8 +23,8 @@ get_filename_component(source_noext ${SOURCE} NAME_WE) get_filename_component(source_path ${SOURCE} PATH) set(compiled_ext .rel) list(APPEND compiled_filepath ${source_path}/${source_noext}${compiled_ext}) -#EXECUTE_PROCESS(COMMAND echo Moving ${compiled_filepath} to ${FILE}) -EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E rename ${compiled_filepath} ${FILE}) +#execute_process(COMMAND echo Moving ${compiled_filepath} to ${FILE}) +execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${compiled_filepath} ${FILE}) #now do the same for the .lst set(compiled_lst .lst) @@ -33,5 +33,5 @@ get_filename_component(lst_noext ${FILE} NAME_WE) get_filename_component(lst_path ${FILE} PATH) list(APPEND compiled_lstpath ${source_path}/${source_noext}${compiled_lst}) list(APPEND compiled_outputlstpath ${lst_path}/${lst_noext}${src_ext}${compiled_lst}) -#EXECUTE_PROCESS(COMMAND echo Moving ${compiled_lstpath} to ${compiled_outputlstpath}) -EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E rename ${compiled_lstpath} ${compiled_outputlstpath}) +#execute_process(COMMAND echo Moving ${compiled_lstpath} to ${compiled_outputlstpath}) +execute_process(COMMAND ${CMAKE_COMMAND} -E rename ${compiled_lstpath} ${compiled_outputlstpath}) diff --git a/firmware/fx2/config/Toolchain-sdcc.cmake b/firmware/fx2/config/Toolchain-sdcc.cmake index f640ae665..9726b8b50 100644 --- a/firmware/fx2/config/Toolchain-sdcc.cmake +++ b/firmware/fx2/config/Toolchain-sdcc.cmake @@ -16,12 +16,12 @@ # # the name of the target operating system -SET(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_NAME Generic) # which compilers to use for C and C++ -SET(CMAKE_C_COMPILER sdcc) +set(CMAKE_C_COMPILER sdcc) # here is where the target environment is located -SET(CMAKE_FIND_ROOT_PATH /usr/bin /usr/share/sdcc /usr/libexec/sdcc) +set(CMAKE_FIND_ROOT_PATH /usr/bin /usr/share/sdcc /usr/libexec/sdcc) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search diff --git a/firmware/octoclock/CMakeLists.txt b/firmware/octoclock/CMakeLists.txt index 0f2af35e9..4d99add0a 100644 --- a/firmware/octoclock/CMakeLists.txt +++ b/firmware/octoclock/CMakeLists.txt @@ -27,7 +27,7 @@ project(OCTOCLOCK C) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmcu=atmega128 -std=gnu99") if(NOT DEFINED PROGRAMMER) - SET(PROGRAMMER "avrisp2") + set(PROGRAMMER "avrisp2") endif(NOT DEFINED PROGRAMMER) if(OCTOCLOCK_DEBUG) diff --git a/firmware/octoclock/lib/CMakeLists.txt b/firmware/octoclock/lib/CMakeLists.txt index 3c992399e..0dfa1b0c9 100644 --- a/firmware/octoclock/lib/CMakeLists.txt +++ b/firmware/octoclock/lib/CMakeLists.txt @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -SET(lib_files +set(lib_files arp_cache.c clkdist.c enc28j60.c @@ -27,11 +27,11 @@ SET(lib_files usart.c ) -IF(OCTOCLOCK_DEBUG) - LIST(APPEND lib_files serial.c) -ENDIF(OCTOCLOCK_DEBUG) +if(OCTOCLOCK_DEBUG) + list(APPEND lib_files serial.c) +endif(OCTOCLOCK_DEBUG) -ADD_LIBRARY(octoclock ${lib_files}) -SET_TARGET_PROPERTIES(octoclock +add_library(octoclock ${lib_files}) +set_target_properties(octoclock PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -O2 -g" ) diff --git a/firmware/usrp2/CMakeLists.txt b/firmware/usrp2/CMakeLists.txt index 80fd074bd..693fbf9c3 100644 --- a/firmware/usrp2/CMakeLists.txt +++ b/firmware/usrp2/CMakeLists.txt @@ -18,19 +18,19 @@ ######################################################################## # setup project and compiler ######################################################################## -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +cmake_minimum_required(VERSION 2.6) #force the compiler because the check wont use the special flag below -INCLUDE(CMakeForceCompiler) -SET(CMAKE_SYSTEM_NAME Generic) +include(CMakeForceCompiler) +set(CMAKE_SYSTEM_NAME Generic) CMAKE_FORCE_C_COMPILER(zpu-elf-gcc GNU) -PROJECT(USRP_NXXX_FW C) +project(USRP_NXXX_FW C) ######################################################################## # lwIP header include dirs ######################################################################## -SET(LWIPDIR ${CMAKE_SOURCE_DIR}/lwip/lwip-1.3.1) +set(LWIPDIR ${CMAKE_SOURCE_DIR}/lwip/lwip-1.3.1) -INCLUDE_DIRECTORIES( +include_directories( ${CMAKE_SOURCE_DIR}/lwip ${CMAKE_SOURCE_DIR}/lwip_port ${LWIPDIR}/src/include @@ -40,16 +40,16 @@ INCLUDE_DIRECTORIES( ######################################################################## # misc flags for the gcc compiler ######################################################################## -SET(CMAKE_C_FLAGS -phi) #always needed compile time and link time -ADD_DEFINITIONS(-Os) -ADD_DEFINITIONS(--std=gnu99) -ADD_DEFINITIONS(-Wall) -ADD_DEFINITIONS(-Werror-implicit-function-declaration) -ADD_DEFINITIONS(-ffunction-sections) +set(CMAKE_C_FLAGS -phi) #always needed compile time and link time +add_definitions(-Os) +add_definitions(--std=gnu99) +add_definitions(-Wall) +add_definitions(-Werror-implicit-function-declaration) +add_definitions(-ffunction-sections) -MACRO(ADD_LINKER_FLAGS flags) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flags}") -ENDMACRO(ADD_LINKER_FLAGS) +macro(ADD_LINKER_FLAGS flags) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flags}") +endmacro(ADD_LINKER_FLAGS) ADD_LINKER_FLAGS("-Wl,--gc-sections") ADD_LINKER_FLAGS("-Wl,--relax") @@ -57,13 +57,13 @@ ADD_LINKER_FLAGS("-Wl,--relax") ######################################################################## # define for the hal io (FIXME move?) ######################################################################## -#ADD_DEFINITIONS(-DHAL_IO_USES_DBOARD_PINS) -ADD_DEFINITIONS(-DHAL_IO_USES_UART) +#add_definitions(-DHAL_IO_USES_DBOARD_PINS) +add_definitions(-DHAL_IO_USES_UART) ######################################################################## # common cflags and ldflags ######################################################################## -INCLUDE_DIRECTORIES( +include_directories( ${CMAKE_SOURCE_DIR}/../../host/lib/usrp ${CMAKE_SOURCE_DIR}/lib ) @@ -71,52 +71,52 @@ INCLUDE_DIRECTORIES( ######################################################################## # setup programs for output files ######################################################################## -FIND_PROGRAM(LINKER zpu-elf-ld) -FIND_PROGRAM(OBJCOPY zpu-elf-objcopy) -FIND_PROGRAM(OBJDUMP zpu-elf-objdump) -FIND_PROGRAM(HEXDUMP hexdump) +find_program(LINKER zpu-elf-ld) +find_program(OBJCOPY zpu-elf-objcopy) +find_program(OBJDUMP zpu-elf-objdump) +find_program(HEXDUMP hexdump) ######################################################################## # helper functions to build output formats ######################################################################## -SET(GEN_OUTPUTS_BIN_SIZE "bin_size_not_set") #set before calling -MACRO(GEN_OUTPUTS target) - GET_FILENAME_COMPONENT(name ${target} NAME_WE) +set(GEN_OUTPUTS_BIN_SIZE "bin_size_not_set") #set before calling +macro(GEN_OUTPUTS target) + get_filename_component(name ${target} NAME_WE) #command to create a map from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.map DEPENDS ${target} COMMAND ${LINKER} -Map ${name}.map ${target} ) #command to create a bin from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.bin DEPENDS ${target} COMMAND ${OBJCOPY} -O binary ${target} ${name}.bin --pad-to ${GEN_OUTPUTS_BIN_SIZE} ) #command to create a ihx from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.ihx DEPENDS ${target} COMMAND ${OBJCOPY} -O ihex ${target} ${name}.ihx --pad-to ${GEN_OUTPUTS_BIN_SIZE} ) #command to create a dump from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.dump DEPENDS ${target} COMMAND ${OBJDUMP} -DSC ${target} > ${name}.dump ) #command to create a rom from bin - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.rom DEPENDS ${name}.bin COMMAND ${HEXDUMP} -v -e'1/1 \"%.2X\\n\"' ${name}.bin > ${name}.rom ) #add a top level target for output files - ADD_CUSTOM_TARGET( + add_custom_target( ${name}_outputs ALL DEPENDS ${name}.map ${name}.bin ${name}.ihx ${name}.dump ${name}.rom ) -ENDMACRO(GEN_OUTPUTS) +endmacro(GEN_OUTPUTS) ######################################################################## # Add the subdirectories ######################################################################## -ADD_SUBDIRECTORY(usrp2) -ADD_SUBDIRECTORY(usrp2p) +add_subdirectory(usrp2) +add_subdirectory(usrp2p) diff --git a/firmware/usrp2/lib/CMakeLists.txt b/firmware/usrp2/lib/CMakeLists.txt index ce6b7fa44..7d83ddb4b 100644 --- a/firmware/usrp2/lib/CMakeLists.txt +++ b/firmware/usrp2/lib/CMakeLists.txt @@ -16,7 +16,7 @@ # ######################################################################## -SET(COMMON_SRCS +set(COMMON_SRCS ${CMAKE_SOURCE_DIR}/lib/u2_init.c ${CMAKE_SOURCE_DIR}/lib/abort.c ${CMAKE_SOURCE_DIR}/lib/ad9510.c diff --git a/firmware/usrp2/usrp2/CMakeLists.txt b/firmware/usrp2/usrp2/CMakeLists.txt index 3662532f1..1cbbd1e7c 100644 --- a/firmware/usrp2/usrp2/CMakeLists.txt +++ b/firmware/usrp2/usrp2/CMakeLists.txt @@ -16,22 +16,22 @@ # ######################################################################## -INCLUDE(${CMAKE_SOURCE_DIR}/lib/CMakeLists.txt) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +include(${CMAKE_SOURCE_DIR}/lib/CMakeLists.txt) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -ADD_DEFINITIONS(-DUSRP2) -ADD_DEFINITIONS(-DUDP_UART_MASK=0) +add_definitions(-DUSRP2) +add_definitions(-DUDP_UART_MASK=0) -ADD_LIBRARY(libusrp2fw STATIC +add_library(libusrp2fw STATIC ${COMMON_SRCS} sd.c ethernet.c ) ######################################################################## -SET(GEN_OUTPUTS_BIN_SIZE 0x3fff) +set(GEN_OUTPUTS_BIN_SIZE 0x3fff) -ADD_EXECUTABLE(usrp2_txrx_uhd.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c) -TARGET_LINK_LIBRARIES(usrp2_txrx_uhd.elf libusrp2fw) +add_executable(usrp2_txrx_uhd.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c) +target_link_libraries(usrp2_txrx_uhd.elf libusrp2fw) GEN_OUTPUTS(usrp2_txrx_uhd.elf) diff --git a/firmware/usrp2/usrp2p/CMakeLists.txt b/firmware/usrp2/usrp2p/CMakeLists.txt index 4cb663742..d83e9e84c 100644 --- a/firmware/usrp2/usrp2p/CMakeLists.txt +++ b/firmware/usrp2/usrp2p/CMakeLists.txt @@ -16,13 +16,13 @@ # ######################################################################## -INCLUDE(${CMAKE_SOURCE_DIR}/lib/CMakeLists.txt) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +include(${CMAKE_SOURCE_DIR}/lib/CMakeLists.txt) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -ADD_DEFINITIONS(-DUSRP2P) -ADD_DEFINITIONS(-DUDP_UART_MASK=4) #GPS=UART2 streaming enabled +add_definitions(-DUSRP2P) +add_definitions(-DUDP_UART_MASK=4) #GPS=UART2 streaming enabled -ADD_LIBRARY(libusrp2pfw STATIC +add_library(libusrp2pfw STATIC ${COMMON_SRCS} spif.c spi_flash.c @@ -34,12 +34,12 @@ ADD_LIBRARY(libusrp2pfw STATIC u2p_init.c ) -ADD_SUBDIRECTORY(bootloader) +add_subdirectory(bootloader) ######################################################################## -SET(GEN_OUTPUTS_BIN_SIZE 0x3fff) +set(GEN_OUTPUTS_BIN_SIZE 0x3fff) -ADD_EXECUTABLE(usrp2p_txrx_uhd.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c) -TARGET_LINK_LIBRARIES(usrp2p_txrx_uhd.elf libusrp2pfw) +add_executable(usrp2p_txrx_uhd.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c) +target_link_libraries(usrp2p_txrx_uhd.elf libusrp2pfw) GEN_OUTPUTS(usrp2p_txrx_uhd.elf) diff --git a/firmware/usrp2/usrp2p/bootloader/CMakeLists.txt b/firmware/usrp2/usrp2p/bootloader/CMakeLists.txt index 07f234302..86a3b0e5c 100644 --- a/firmware/usrp2/usrp2p/bootloader/CMakeLists.txt +++ b/firmware/usrp2/usrp2p/bootloader/CMakeLists.txt @@ -16,27 +16,27 @@ # ######################################################################## -INCLUDE(FindPythonInterp) +include(FindPythonInterp) -MACRO(GEN_RMI target) - GET_FILENAME_COMPONENT(name ${target} NAME_WE) +macro(GEN_RMI target) + get_filename_component(name ${target} NAME_WE) #command to create a rmi from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.rmi DEPENDS ${name}.bin COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/bin/bin_to_ram_macro_init.py ${name}.bin ${name}.rmi ) #add a top level target for output files - ADD_CUSTOM_TARGET( + add_custom_target( ${name}_rmi ALL DEPENDS ${name}.rmi ) -ENDMACRO(GEN_RMI) +endmacro(GEN_RMI) ######################################################################## -ADD_EXECUTABLE(bootloader.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c) -ADD_DEFINITIONS(-DUSRP2P) -ADD_DEFINITIONS(-DBOOTLOADER) -TARGET_LINK_LIBRARIES(bootloader.elf libusrp2pfw) -SET(GEN_OUTPUTS_BIN_SIZE 0x3fff) +add_executable(bootloader.elf ${CMAKE_SOURCE_DIR}/apps/txrx_uhd.c) +add_definitions(-DUSRP2P) +add_definitions(-DBOOTLOADER) +target_link_libraries(bootloader.elf libusrp2pfw) +set(GEN_OUTPUTS_BIN_SIZE 0x3fff) GEN_OUTPUTS(bootloader.elf) GEN_RMI(bootloader.bin) diff --git a/firmware/usrp3/CMakeLists.txt b/firmware/usrp3/CMakeLists.txt index 66a43b6bd..abf1d46cb 100644 --- a/firmware/usrp3/CMakeLists.txt +++ b/firmware/usrp3/CMakeLists.txt @@ -18,27 +18,27 @@ ######################################################################## # setup project and compiler ######################################################################## -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +cmake_minimum_required(VERSION 2.6) #force the compiler because the check wont use the special flag below -INCLUDE(CMakeForceCompiler) -SET(CMAKE_SYSTEM_NAME Generic) +include(CMakeForceCompiler) +set(CMAKE_SYSTEM_NAME Generic) CMAKE_FORCE_C_COMPILER(zpu-elf-gcc GNU) -PROJECT(USRP3_FW C) +project(USRP3_FW C) -SET(UHD_VERSION_HASH 0 CACHE INTEGER "UHD Version Hash") -EXECUTE_PROCESS(COMMAND ${CMAKE_SOURCE_DIR}/utils/git-hash.sh OUTPUT_VARIABLE UHD_VERSION_HASH) -ADD_DEFINITIONS(-DUHD_VERSION_HASH=0x${UHD_VERSION_HASH}) +set(UHD_VERSION_HASH 0 CACHE INTEGER "UHD Version Hash") +execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/git-hash.sh OUTPUT_VARIABLE UHD_VERSION_HASH) +add_definitions(-DUHD_VERSION_HASH=0x${UHD_VERSION_HASH}) -INCLUDE_DIRECTORIES(include) +include_directories(include) find_package(PythonInterp) ######################################################################## # lwIP header include dirs ######################################################################## -SET(LWIPDIR ${CMAKE_SOURCE_DIR}/lwip/lwip-1.3.1) +set(LWIPDIR ${CMAKE_SOURCE_DIR}/lwip/lwip-1.3.1) -INCLUDE_DIRECTORIES( +include_directories( ${CMAKE_SOURCE_DIR}/lwip ${CMAKE_SOURCE_DIR}/lwip_port ${LWIPDIR}/src/include @@ -48,17 +48,17 @@ INCLUDE_DIRECTORIES( ######################################################################## # misc flags for the gcc compiler ######################################################################## -SET(CMAKE_C_FLAGS -phi) #always needed compile time and link time -ADD_DEFINITIONS(-Os) -ADD_DEFINITIONS(--std=gnu99) -ADD_DEFINITIONS(-Wall) -ADD_DEFINITIONS(-Werror-implicit-function-declaration) -ADD_DEFINITIONS(-ffunction-sections) -ADD_DEFINITIONS(-DPRINTF_LONG_SUPPORT) +set(CMAKE_C_FLAGS -phi) #always needed compile time and link time +add_definitions(-Os) +add_definitions(--std=gnu99) +add_definitions(-Wall) +add_definitions(-Werror-implicit-function-declaration) +add_definitions(-ffunction-sections) +add_definitions(-DPRINTF_LONG_SUPPORT) -MACRO(ADD_LINKER_FLAGS flags) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flags}") -ENDMACRO(ADD_LINKER_FLAGS) +macro(ADD_LINKER_FLAGS flags) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flags}") +endmacro(ADD_LINKER_FLAGS) ADD_LINKER_FLAGS("-Wl,--gc-sections") ADD_LINKER_FLAGS("-Wl,--relax") @@ -66,72 +66,72 @@ ADD_LINKER_FLAGS("-Wl,--relax") ######################################################################## # setup programs for output files ######################################################################## -FIND_PROGRAM(LINKER zpu-elf-ld) -FIND_PROGRAM(OBJCOPY zpu-elf-objcopy) -FIND_PROGRAM(OBJDUMP zpu-elf-objdump) -FIND_PROGRAM(HEXDUMP hexdump) +find_program(LINKER zpu-elf-ld) +find_program(OBJCOPY zpu-elf-objcopy) +find_program(OBJDUMP zpu-elf-objdump) +find_program(HEXDUMP hexdump) ######################################################################## # Firmware tracing support ######################################################################## # Look at include/trace.h to see what the different trace levels map to. -SET(TRACE_LEVEL "0" CACHE STRING "Firmware Trace Level") #0 by default -OPTION(TRACE_LEVEL "Firmware Trace Level" "") -IF(TRACE_LEVEL) +set(TRACE_LEVEL "0" CACHE STRING "Firmware Trace Level") #0 by default +option(TRACE_LEVEL "Firmware Trace Level" "") +if(TRACE_LEVEL) #If TRACE_LEVEL == 0, don't define UHD_FW_TRACE_LEVEL so that the C #code can easily detect if tracing is requested - IF(${TRACE_LEVEL} GREATER 0) - ADD_DEFINITIONS(-DUHD_FW_TRACE_LEVEL=${TRACE_LEVEL}) - ENDIF(${TRACE_LEVEL} GREATER 0) -ENDIF(TRACE_LEVEL) + if(${TRACE_LEVEL} GREATER 0) + add_definitions(-DUHD_FW_TRACE_LEVEL=${TRACE_LEVEL}) + endif(${TRACE_LEVEL} GREATER 0) +endif(TRACE_LEVEL) ######################################################################## # helper functions to build output formats ######################################################################## -SET(GEN_OUTPUTS_BIN_SIZE "bin_size_not_set") #set before calling -MACRO(GEN_OUTPUTS target pretty_name) - GET_FILENAME_COMPONENT(name ${target} NAME_WE) +set(GEN_OUTPUTS_BIN_SIZE "bin_size_not_set") #set before calling +macro(GEN_OUTPUTS target pretty_name) + get_filename_component(name ${target} NAME_WE) #command to create a map from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.map DEPENDS ${target} COMMAND ${LINKER} -Map ${name}.map ${target} ) #command to create a bin from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.bin DEPENDS ${target} COMMAND ${OBJCOPY} -O binary ${target} ${name}.bin --pad-to ${GEN_OUTPUTS_BIN_SIZE} ) #command to create a ihx from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.ihx DEPENDS ${target} COMMAND ${OBJCOPY} -O ihex ${target} ${name}.ihx --pad-to ${GEN_OUTPUTS_BIN_SIZE} ) #command to create a dump from elf - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.dump DEPENDS ${target} COMMAND ${OBJDUMP} -DSC ${target} > ${name}.dump ) #command to create a rom from bin - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.rom DEPENDS ${name}.bin COMMAND ${HEXDUMP} -v -e'1/1 \"%.2X\\n\"' ${name}.bin > ${name}.rom ) #command to create a coe from bin - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${name}.coe DEPENDS ${name}.bin COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/utils/bin_to_coe.py ${name}.bin ${name}.coe ) #add a top level target for output files - ADD_CUSTOM_TARGET( + add_custom_target( ${pretty_name} ALL DEPENDS ${name}.map ${name}.bin ${name}.ihx ${name}.dump ${name}.rom ${name}.coe ) -ENDMACRO(GEN_OUTPUTS) +endmacro(GEN_OUTPUTS) ######################################################################## # Add the subdirectories ######################################################################## -ADD_SUBDIRECTORY(lib) -ADD_SUBDIRECTORY(x300) -ADD_SUBDIRECTORY(n230) +add_subdirectory(lib) +add_subdirectory(x300) +add_subdirectory(n230) diff --git a/firmware/usrp3/n230/CMakeLists.txt b/firmware/usrp3/n230/CMakeLists.txt index 5787fbb7d..185704276 100644 --- a/firmware/usrp3/n230/CMakeLists.txt +++ b/firmware/usrp3/n230/CMakeLists.txt @@ -33,7 +33,7 @@ add_executable(n230_main.elf ${n230_sources}) target_link_libraries(n230_main.elf usrp3fw) GEN_OUTPUTS(n230_main.elf n230) -#INSTALL( +#install( # FILES ${CMAKE_CURRENT_BINARY_DIR}/n230_main.bin # DESTINATION share/uhd/images # RENAME usrp_n230_fw.bin diff --git a/firmware/usrp3/x300/CMakeLists.txt b/firmware/usrp3/x300/CMakeLists.txt index 5e6134885..96aa7fe6e 100644 --- a/firmware/usrp3/x300/CMakeLists.txt +++ b/firmware/usrp3/x300/CMakeLists.txt @@ -23,13 +23,13 @@ list(APPEND x300_sources x300_init.c x300_main.c) ######################################################################## set(GEN_OUTPUTS_BIN_SIZE 0x7fff) -SET(CMAKE_C_FLAGS_DEBUG -DX300_DEBUG_UART) +set(CMAKE_C_FLAGS_DEBUG -DX300_DEBUG_UART) add_executable(x300_main.elf ${x300_sources}) target_link_libraries(x300_main.elf usrp3fw) GEN_OUTPUTS(x300_main.elf x300) -INSTALL( +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/x300_main.bin DESTINATION share/uhd/images RENAME usrp_x300_fw.bin diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 1a4c2d0af..5c8b5054b 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -5,19 +5,19 @@ # ######################################################################## -#IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) -# MESSAGE(FATAL_ERROR "Prevented in-tree built. This is bad practice.") -#ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) +#if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) +# message(FATAL_ERROR "Prevented in-tree built. This is bad practice.") +#endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) ######################################################################## # Project setup ######################################################################## -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) -IF(POLICY CMP0048) - CMAKE_POLICY(SET CMP0048 NEW) # Suppress Version warnings -ENDIF(POLICY CMP0048) -PROJECT(UHD CXX C) -ENABLE_TESTING() +cmake_minimum_required(VERSION 2.8.12) +if(POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) # Suppress Version warnings +endif(POLICY CMP0048) +project(UHD CXX C) +enable_testing() #make sure our local CMake Modules path comes first list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) @@ -26,239 +26,239 @@ list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) # UHD Dependency Minimum Versions ######################################################################## # Full C++11 came with GCC 4.7, Clang >= 3.3.0, Apple Clang >= 500 -SET(GCC_MIN_VERSION "4.8.0") -SET(CLANG_MIN_VERSION "3.3.0") -SET(APPLECLANG_MIN_VERSION "500") +set(GCC_MIN_VERSION "4.8.0") +set(CLANG_MIN_VERSION "3.3.0") +set(APPLECLANG_MIN_VERSION "500") # Make sure to update the next two in unison: -SET(MSVC_MIN_VERSION "1900") -SET(MSVC_MIN_VERSION_READABLE "14.0") +set(MSVC_MIN_VERSION "1900") +set(MSVC_MIN_VERSION_READABLE "14.0") # Other deps -SET(BOOST_MIN_VERSION "1.53") +set(BOOST_MIN_VERSION "1.53") ######################################################################## # Check Compiler Version ######################################################################## -IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - IF(DEFINED CMAKE_CXX_COMPILER_VERSION) - IF(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS ${GCC_MIN_VERSION}) - MESSAGE(WARNING "\nThe compiler selected to build UHD (GCC version ${CMAKE_CXX_COMPILER_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${GCC_MIN_VERSION} minimum). This build may or not work. We highly recommend using a more recent GCC version.") - ENDIF() - ELSE() - MESSAGE(WARNING "\nCannot determine the version of the compiler selected to build UHD (GCC : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using GCC version ${GCC_MIN_VERSION} or more recent.") - ENDIF() - SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og") -ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - EXECUTE_PROCESS(COMMAND +if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + if(DEFINED CMAKE_CXX_COMPILER_VERSION) + if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS ${GCC_MIN_VERSION}) + message(WARNING "\nThe compiler selected to build UHD (GCC version ${CMAKE_CXX_COMPILER_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${GCC_MIN_VERSION} minimum). This build may or not work. We highly recommend using a more recent GCC version.") + endif() + else() + message(WARNING "\nCannot determine the version of the compiler selected to build UHD (GCC : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using GCC version ${GCC_MIN_VERSION} or more recent.") + endif() + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og") +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v RESULT_VARIABLE res ERROR_VARIABLE err ERROR_STRIP_TRAILING_WHITESPACE) - IF(${res} STREQUAL "0") + if(${res} STREQUAL "0") # output is in error stream - STRING(REGEX MATCH "^Apple.*" IS_APPLE ${err}) - IF("${IS_APPLE}" STREQUAL "") - SET(MIN_VERSION ${CLANG_MIN_VERSION}) - SET(APPLE_STR "") + string(REGEX MATCH "^Apple.*" IS_APPLE ${err}) + if("${IS_APPLE}" STREQUAL "") + set(MIN_VERSION ${CLANG_MIN_VERSION}) + set(APPLE_STR "") # retrieve the compiler's version from it - STRING(REGEX MATCH "clang version [0-9.]+" CLANG_OTHER_VERSION ${err}) - STRING(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_OTHER_VERSION}) - ELSE() - SET(MIN_VERSION ${APPLECLANG_MIN_VERSION}) - SET(APPLE_STR "Apple ") + string(REGEX MATCH "clang version [0-9.]+" CLANG_OTHER_VERSION ${err}) + string(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_OTHER_VERSION}) + else() + set(MIN_VERSION ${APPLECLANG_MIN_VERSION}) + set(APPLE_STR "Apple ") # retrieve the compiler's version from it - STRING(REGEX MATCH "(clang-[0-9.]+)" CLANG_APPLE_VERSION ${err}) - STRING(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_APPLE_VERSION}) - ENDIF() - IF(${CLANG_VERSION} VERSION_LESS "${MIN_VERSION}") - MESSAGE(WARNING "\nThe compiler selected to build UHD (${APPLE_STR}Clang version ${CLANG_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${MIN_VERSION} minimum). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.") - ENDIF() - ELSE() - MESSAGE(WARNING "\nCannot determine the version of the compiler selected to build UHD (${APPLE_STR}Clang : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.") - ENDIF() -ELSEIF(MSVC) - IF(${MSVC_VERSION} VERSION_LESS ${MSVC_MIN_VERSION}) - MESSAGE(FATAL_ERROR "\nMSVC version is less than the required minimum. Required: ${MSVC_MIN_VERSION_READABLE}") - ENDIF(${MSVC_VERSION} VERSION_LESS ${MSVC_MIN_VERSION}) -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() + string(REGEX MATCH "(clang-[0-9.]+)" CLANG_APPLE_VERSION ${err}) + string(REGEX MATCH "[0-9.]+" CLANG_VERSION ${CLANG_APPLE_VERSION}) + endif() + if(${CLANG_VERSION} VERSION_LESS "${MIN_VERSION}") + message(WARNING "\nThe compiler selected to build UHD (${APPLE_STR}Clang version ${CLANG_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${MIN_VERSION} minimum). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.") + endif() + else() + message(WARNING "\nCannot determine the version of the compiler selected to build UHD (${APPLE_STR}Clang : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent.") + endif() +elseif(MSVC) + if(${MSVC_VERSION} VERSION_LESS ${MSVC_MIN_VERSION}) + message(FATAL_ERROR "\nMSVC version is less than the required minimum. Required: ${MSVC_MIN_VERSION_READABLE}") + endif(${MSVC_VERSION} VERSION_LESS ${MSVC_MIN_VERSION}) +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() ######################################################################## # Packaging Variables ######################################################################## -SET(LIBUHD_PKG ${LIBUHD_PKG} CACHE BOOL "Build Debian libuhd003 package") -SET(LIBUHDDEV_PKG ${LIBUHDDEV_PKG} CACHE BOOL "Build Debian libuhd-dev package") -SET(UHDHOST_PKG ${UHDPOST_PKG} CACHE BOOL "Build Debian uhd-host package") -INCLUDE(UHDComponent) #enable components -INCLUDE(UHDPackage) #setup cpack +set(LIBUHD_PKG ${LIBUHD_PKG} CACHE BOOL "Build Debian libuhd003 package") +set(LIBUHDDEV_PKG ${LIBUHDDEV_PKG} CACHE BOOL "Build Debian libuhd-dev package") +set(UHDHOST_PKG ${UHDPOST_PKG} CACHE BOOL "Build Debian uhd-host package") +include(UHDComponent) #enable components +include(UHDPackage) #setup cpack ######################################################################## # 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/uhd) -IF(NOT DEFINED PKG_LIB_DIR) - SET(PKG_LIB_DIR ${LIBRARY_DIR}/uhd) -ENDIF() -SET(PKG_DOC_DIR share/doc/uhd) -SET(PKG_MAN_DIR share/man/man1) +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/uhd) +if(NOT DEFINED PKG_LIB_DIR) + set(PKG_LIB_DIR ${LIBRARY_DIR}/uhd) +endif() +set(PKG_DOC_DIR share/doc/uhd) +set(PKG_MAN_DIR share/man/man1) ######################################################################## # UHD config files ######################################################################## -SET(UHD_USER_CONF_FILE +set(UHD_USER_CONF_FILE ".uhd/uhd.conf" CACHE STRING "Location of the user-specific UHD configuration file, relative to APPDATA (or HOME)" ) -IF(UNIX) - SET(UHD_SYS_CONF_FILE +if(UNIX) + set(UHD_SYS_CONF_FILE "/etc/uhd/uhd.conf" CACHE STRING "Location of the system-wide UHD configuration file" ) -ELSEIF(WIN32) - SET(UHD_SYS_CONF_FILE +elseif(WIN32) + set(UHD_SYS_CONF_FILE "%programdata%/uhd/uhd.conf" CACHE STRING "Location of the system-wide UHD configuration file" ) -ELSE() - MESSAGE(WARNING "Not setting UHD_SYS_CONF_FILE!") -ENDIF() +else() + message(WARNING "Not setting UHD_SYS_CONF_FILE!") +endif() ######################################################################## # UHD Image Directories ######################################################################## -IF(NOT DEFINED UHD_IMAGES_DIR) - IF(DEFINED FPGA_IMAGES_DIR) - SET(UHD_IMAGES_DIR ${FPGA_IMAGES_DIR}) - ELSE(DEFINED FPGA_IMAGES_DIR) - FILE(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/share/uhd/images using_images_dir) - SET(UHD_IMAGES_DIR ${using_images_dir}) - ENDIF(DEFINED FPGA_IMAGES_DIR) -ENDIF(NOT DEFINED UHD_IMAGES_DIR) +if(NOT DEFINED UHD_IMAGES_DIR) + if(DEFINED FPGA_IMAGES_DIR) + set(UHD_IMAGES_DIR ${FPGA_IMAGES_DIR}) + else(DEFINED FPGA_IMAGES_DIR) + file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/share/uhd/images using_images_dir) + set(UHD_IMAGES_DIR ${using_images_dir}) + endif(DEFINED FPGA_IMAGES_DIR) +endif(NOT DEFINED UHD_IMAGES_DIR) -OPTION(UHD_IMAGES_DIR "Path to installed UHD image binaries.") -MESSAGE( STATUS "Using UHD Images Directory: ${UHD_IMAGES_DIR}" ) -ADD_DEFINITIONS(-DUHD_IMAGES_DIR=${UHD_IMAGES_DIR}) +option(UHD_IMAGES_DIR "Path to installed UHD image binaries.") +message( STATUS "Using UHD Images Directory: ${UHD_IMAGES_DIR}" ) +add_definitions(-DUHD_IMAGES_DIR=${UHD_IMAGES_DIR}) -IF(DEFINED UHD_IMAGES_DIR_WINREG_KEY) - ADD_DEFINITIONS(-DUHD_IMAGES_DIR_WINREG_KEY=${UHD_IMAGES_DIR_WINREG_KEY}) -ENDIF(DEFINED UHD_IMAGES_DIR_WINREG_KEY) +if(DEFINED UHD_IMAGES_DIR_WINREG_KEY) + add_definitions(-DUHD_IMAGES_DIR_WINREG_KEY=${UHD_IMAGES_DIR_WINREG_KEY}) +endif(DEFINED UHD_IMAGES_DIR_WINREG_KEY) ######################################################################## # Local Include Dir ######################################################################## -INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) +include_directories(${CMAKE_BINARY_DIR}/include) +include_directories(${CMAKE_SOURCE_DIR}/include) ######################################################################## # Static Lib Configuration ######################################################################## -OPTION(ENABLE_STATIC_LIBS "Enable building of static libraries" OFF) -IF(ENABLE_STATIC_LIBS) - MESSAGE(STATUS "Building Static Libraries: ${ENABLE_STATIC_LIBS}") -ENDIF(ENABLE_STATIC_LIBS) +option(ENABLE_STATIC_LIBS "Enable building of static libraries" OFF) +if(ENABLE_STATIC_LIBS) + message(STATUS "Building Static Libraries: ${ENABLE_STATIC_LIBS}") +endif(ENABLE_STATIC_LIBS) ######################################################################## # On Apple only, set install name and use rpath correctly, if not already set ######################################################################## -IF(APPLE) - IF(NOT CMAKE_INSTALL_NAME_DIR) - SET(CMAKE_INSTALL_NAME_DIR +if(APPLE) + if(NOT CMAKE_INSTALL_NAME_DIR) + set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/${LIBRARY_DIR} CACHE PATH "Library Install Name Destination Directory" FORCE) - ENDIF(NOT CMAKE_INSTALL_NAME_DIR) - IF(NOT CMAKE_INSTALL_RPATH) - SET(CMAKE_INSTALL_RPATH + endif(NOT CMAKE_INSTALL_NAME_DIR) + if(NOT CMAKE_INSTALL_RPATH) + set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${LIBRARY_DIR} CACHE PATH "Library Install RPath" FORCE) - ENDIF(NOT CMAKE_INSTALL_RPATH) - IF(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) - SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE + endif(NOT CMAKE_INSTALL_RPATH) + if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) + set(CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "Do Build Using Library Install RPath" FORCE) - ENDIF(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) -ENDIF(APPLE) + endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) +endif(APPLE) ######################################################################## # Optional Compiler Flags ######################################################################## -INCLUDE(CheckCXXCompilerFlag) -MACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG flag have) +include(CheckCXXCompilerFlag) +macro(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG flag have) CHECK_CXX_COMPILER_FLAG(${flag} ${have}) - IF(${have}) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") - ENDIF(${have}) -ENDMACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG) + if(${have}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") + endif(${have}) +endmacro(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG) #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 "") +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 "") #force UHD_RELEASE_MODE to be a string for cmake-gui -SET(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE STRING "UHD Release Mode") +set(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE STRING "UHD Release Mode") -IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR +if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - IF(STRIP_BINARIES) - IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") - ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - ENDIF(STRIP_BINARIES) - ADD_DEFINITIONS(-Wall) - ADD_DEFINITIONS(-Wextra) - ADD_DEFINITIONS(-Wsign-compare) - #ADD_DEFINITIONS(-Wconversion) - #ADD_DEFINITIONS(-pedantic) - #ADD_DEFINITIONS(-ansi) - IF(NOT WIN32) + if(STRIP_BINARIES) + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") + endif(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + endif(STRIP_BINARIES) + add_definitions(-Wall) + add_definitions(-Wextra) + add_definitions(-Wsign-compare) + #add_definitions(-Wconversion) + #add_definitions(-pedantic) + #add_definitions(-ansi) + if(NOT WIN32) #only export symbols that are declared to be part of the uhd api (non dll platforms) UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN) UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden HAVE_VISIBILITY_INLINES_HIDDEN) - ENDIF(NOT WIN32) - IF(${CMAKE_BUILD_TYPE} STREQUAL "Coverage") + endif(NOT WIN32) + if(${CMAKE_BUILD_TYPE} STREQUAL "Coverage") include(CodeCoverage) setup_target_for_coverage(coverage "ctest || return 0" coverage) # never fail ctest, always generate coverage report - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C++ compiler during Coverage builds." FORCE) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C compiler during Coverage builds." FORCE) - ENDIF() -ENDIF() - -IF(MSVC) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/cmake/msvc) - ADD_DEFINITIONS( #stop all kinds of compatibility warnings + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C++ compiler during Coverage builds." FORCE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C compiler during Coverage builds." FORCE) + endif() +endif() + +if(MSVC) + include_directories(${CMAKE_SOURCE_DIR}/cmake/msvc) + add_definitions( #stop all kinds of compatibility warnings -DWIN32_LEAN_AND_MEAN -DVC_EXTRALEAN -D_SCL_SECURE_NO_WARNINGS @@ -270,35 +270,35 @@ IF(MSVC) -D_WINSOCK_DEPRECATED_NO_WARNINGS ) # multi-threaded build and increases the number of addressable sections in an .obj file. - SET (COMPILE_FLAGS ${COMPILE_FLAGS} /MP /bigobj) -ENDIF(MSVC) + set (COMPILE_FLAGS ${COMPILE_FLAGS} /MP /bigobj) +endif(MSVC) -IF(CYGWIN) - ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this -ENDIF(CYGWIN) +if(CYGWIN) + add_definitions(-D__USE_W32_SOCKETS) #boost asio says we need this +endif(CYGWIN) -IF(WIN32) - ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp - ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max -ENDIF(WIN32) +if(WIN32) + add_definitions(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp + add_definitions(-DNOMINMAX) #disables stupidity and enables std::min and std::max +endif(WIN32) ######################################################################## # Choose a version of Python ######################################################################## -OPTION(ENABLE_PYTHON3 "Enable Python 3. Default is Python 2" OFF) -SET(BOOST_PYTHON_COMPONENT python) -SET(BOOST_PYTHON_VERSION 2.7) -IF(${ENABLE_PYTHON3}) - SET(BOOST_PYTHON_COMPONENT python3) - SET(BOOST_PYTHON_VERSION 3) -ENDIF() +option(ENABLE_PYTHON3 "Enable Python 3. Default is Python 2" OFF) +set(BOOST_PYTHON_COMPONENT python) +set(BOOST_PYTHON_VERSION 2.7) +if(${ENABLE_PYTHON3}) + set(BOOST_PYTHON_COMPONENT python3) + set(BOOST_PYTHON_VERSION 3) +endif() ######################################################################## # Setup Boost ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring Boost C++ Libraries...") -SET(BOOST_REQUIRED_COMPONENTS +message(STATUS "") +message(STATUS "Configuring Boost C++ Libraries...") +set(BOOST_REQUIRED_COMPONENTS chrono date_time filesystem @@ -309,73 +309,73 @@ SET(BOOST_REQUIRED_COMPONENTS serialization ) -SET(BOOST_OPTIONAL_COMPONENTS ${BOOST_PYTHON_COMPONENT}) -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 +set(BOOST_OPTIONAL_COMPONENTS ${BOOST_PYTHON_COMPONENT}) +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.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.48.0" "1.49" "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" "1.55" "1.56.0" "1.56" "1.57" "1.57" "1.58" "1.59" "1.60" "1.61" "1.62" "1.63" ) #Python API requirements -MESSAGE(STATUS "Looking for optional Boost components...") -FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS}) +message(STATUS "Looking for optional Boost components...") +find_package(Boost ${BOOST_MIN_VERSION} OPTIONAL_COMPONENTS ${BOOST_OPTIONAL_COMPONENTS}) -MESSAGE(STATUS "Looking for required Boost components...") -FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) +message(STATUS "Looking for required Boost components...") +find_package(Boost ${BOOST_MIN_VERSION} COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) -INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) +include_directories(${Boost_INCLUDE_DIRS}) +link_directories(${Boost_LIBRARY_DIRS}) #Check to see if the Python version we're looking for exists -SET(BOOST_PYTHON_FOUND ${Boost_PYTHON_FOUND}) -SET(BOOST_PYTHON_LIBRARY ${Boost_PYTHON_LIBRARY}) -IF(${ENABLE_PYTHON3}) - SET(BOOST_PYTHON_FOUND ${Boost_PYTHON3_FOUND}) - SET(BOOST_PYTHON_LIBRARY ${Boost_PYTHON3_LIBRARY}) -ENDIF() +set(BOOST_PYTHON_FOUND ${Boost_PYTHON_FOUND}) +set(BOOST_PYTHON_LIBRARY ${Boost_PYTHON_LIBRARY}) +if(${ENABLE_PYTHON3}) + set(BOOST_PYTHON_FOUND ${Boost_PYTHON3_FOUND}) + set(BOOST_PYTHON_LIBRARY ${Boost_PYTHON3_LIBRARY}) +endif() -MESSAGE(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}") -MESSAGE(STATUS "Boost library directories: ${Boost_LIBRARY_DIRS}") -MESSAGE(STATUS "Boost libraries: ${Boost_LIBRARIES}") +message(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}") +message(STATUS "Boost library directories: ${Boost_LIBRARY_DIRS}") +message(STATUS "Boost libraries: ${Boost_LIBRARIES}") ######################################################################## # Additional settings for build environment ######################################################################## # Note: RFNoC never gets fully disabled, but the public APIs do -SET(ENABLE_RFNOC OFF CACHE BOOL "Export RFNoC includes and symbols") -INCLUDE(UHDGlobalDefs) -INCLUDE(UHDLog) +set(ENABLE_RFNOC OFF CACHE BOOL "Export RFNoC includes and symbols") +include(UHDGlobalDefs) +include(UHDLog) ######################################################################## # Check Python Modules ######################################################################## -FIND_PACKAGE(PythonInterp ${BOOST_PYTHON_VERSION}) -FIND_PACKAGE(PythonLibs ${BOOST_PYTHON_VERSION}) -INCLUDE(UHDPython) +find_package(PythonInterp ${BOOST_PYTHON_VERSION}) +find_package(PythonLibs ${BOOST_PYTHON_VERSION}) +include(UHDPython) -SET(PYTHON_VERSION "platform.python_version() >= '2.7' and platform.python_version() < '3.0'") -IF(${ENABLE_PYTHON3}) - SET(PYTHON_VERSION "platform.python_version() >= '3.0'") -ENDIF() +set(PYTHON_VERSION "platform.python_version() >= '2.7' and platform.python_version() < '3.0'") +if(${ENABLE_PYTHON3}) + set(PYTHON_VERSION "platform.python_version() >= '3.0'") +endif() PYTHON_CHECK_MODULE( "Python version ${BOOST_PYTHON_VERSION} or greater" @@ -401,17 +401,17 @@ PYTHON_CHECK_MODULE( HAVE_PYTHON_MODULE_NUMPY ) -SET(PYTHON_ADDITIONAL_VERSIONS 2.7 3.4 3.5) +set(PYTHON_ADDITIONAL_VERSIONS 2.7 3.4 3.5) ######################################################################## # Create Uninstall Target ######################################################################## -CONFIGURE_FILE( +configure_file( ${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) -ADD_CUSTOM_TARGET(uninstall +add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ) @@ -430,11 +430,11 @@ UHD_INSTALL(FILES ######################################################################## LIBUHD_REGISTER_COMPONENT("LibUHD" ENABLE_LIBUHD ON "Boost_FOUND;HAVE_PYTHON_PLAT_MIN_VERSION;HAVE_PYTHON_MODULE_MAKO" OFF ON) LIBUHD_REGISTER_COMPONENT("LibUHD - C API" ENABLE_C_API ON "ENABLE_LIBUHD" OFF OFF) -IF(WIN32) +if(WIN32) LIBUHD_REGISTER_COMPONENT("LibUHD - Python API" ENABLE_PYTHON_API OFF "ENABLE_LIBUHD;BOOST_PYTHON_FOUND;HAVE_PYTHON_MODULE_NUMPY;PythonLibs_FOUND" OFF OFF) -ELSE() +else() LIBUHD_REGISTER_COMPONENT("LibUHD - Python API" ENABLE_PYTHON_API ON "ENABLE_LIBUHD;BOOST_PYTHON_FOUND;HAVE_PYTHON_MODULE_NUMPY;PythonLibs_FOUND" OFF OFF) -ENDIF(WIN32) +endif(WIN32) LIBUHD_REGISTER_COMPONENT("Examples" ENABLE_EXAMPLES ON "ENABLE_LIBUHD" OFF OFF) LIBUHD_REGISTER_COMPONENT("Utils" ENABLE_UTILS ON "ENABLE_LIBUHD" OFF OFF) LIBUHD_REGISTER_COMPONENT("Tests" ENABLE_TESTS ON "ENABLE_LIBUHD" OFF OFF) @@ -443,68 +443,68 @@ LIBUHD_REGISTER_COMPONENT("Tests" ENABLE_TESTS ON "ENABLE_LIBUHD" OFF OFF) ######################################################################## # Check for fpga-src submodule ######################################################################## -SET(HAS_FPGA_SUBMODULE FALSE) -EXECUTE_PROCESS( +set(HAS_FPGA_SUBMODULE FALSE) +execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import os; print(os.path.abspath(os.path.join('${CMAKE_SOURCE_DIR}', '..', 'fpga-src')))" OUTPUT_VARIABLE FPGA_SUBMODULE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) -IF(EXISTS "${FPGA_SUBMODULE_DIR}/docs/fpga.md") - SET(HAS_FPGA_SUBMODULE TRUE) - MESSAGE(STATUS "") - MESSAGE(STATUS "Found FPGA submodule: ${FPGA_SUBMODULE_DIR}") -ENDIF(EXISTS "${FPGA_SUBMODULE_DIR}/docs/fpga.md") +if(EXISTS "${FPGA_SUBMODULE_DIR}/docs/fpga.md") + set(HAS_FPGA_SUBMODULE TRUE) + message(STATUS "") + message(STATUS "Found FPGA submodule: ${FPGA_SUBMODULE_DIR}") +endif(EXISTS "${FPGA_SUBMODULE_DIR}/docs/fpga.md") ######################################################################## # Add the subdirectories ######################################################################## -IF(ENABLE_LIBUHD) - ADD_SUBDIRECTORY(lib) -ENDIF(ENABLE_LIBUHD) +if(ENABLE_LIBUHD) + add_subdirectory(lib) +endif(ENABLE_LIBUHD) -ADD_SUBDIRECTORY(include) +add_subdirectory(include) -IF(ENABLE_EXAMPLES) - ADD_SUBDIRECTORY(examples) -ENDIF(ENABLE_EXAMPLES) +if(ENABLE_EXAMPLES) + add_subdirectory(examples) +endif(ENABLE_EXAMPLES) -IF(ENABLE_TESTS) - ADD_SUBDIRECTORY(tests) -ENDIF(ENABLE_TESTS) +if(ENABLE_TESTS) + add_subdirectory(tests) +endif(ENABLE_TESTS) -IF(ENABLE_UTILS) - ADD_SUBDIRECTORY(utils) -ENDIF(ENABLE_UTILS) +if(ENABLE_UTILS) + add_subdirectory(utils) +endif(ENABLE_UTILS) -ADD_SUBDIRECTORY(docs) +add_subdirectory(docs) -IF(ENABLE_PYTHON_API) - ADD_SUBDIRECTORY(python) -ENDIF() +if(ENABLE_PYTHON_API) + add_subdirectory(python) +endif() ######################################################################## # Create Pkg Config File ######################################################################## -FOREACH(inc ${Boost_INCLUDE_DIRS}) - LIST(APPEND UHD_PC_CFLAGS "-I${inc}") -ENDFOREACH(inc) +foreach(inc ${Boost_INCLUDE_DIRS}) + list(APPEND UHD_PC_CFLAGS "-I${inc}") +endforeach(inc) -FOREACH(lib ${Boost_LIBRARY_DIRS}) - LIST(APPEND UHD_PC_LIBS "-L${lib}") -ENDFOREACH(lib) +foreach(lib ${Boost_LIBRARY_DIRS}) + list(APPEND UHD_PC_LIBS "-L${lib}") +endforeach(lib) #use space-separation format for the pc file -STRING(REPLACE ";" " " UHD_PC_REQUIRES "${UHD_PC_REQUIRES}") -STRING(REPLACE ";" " " UHD_PC_CFLAGS "${UHD_PC_CFLAGS}") -STRING(REPLACE ";" " " UHD_PC_LIBS "${UHD_PC_LIBS}") +string(REPLACE ";" " " UHD_PC_REQUIRES "${UHD_PC_REQUIRES}") +string(REPLACE ";" " " UHD_PC_CFLAGS "${UHD_PC_CFLAGS}") +string(REPLACE ";" " " UHD_PC_LIBS "${UHD_PC_LIBS}") #unset these vars to avoid hard-coded paths to cross environment -IF(CMAKE_CROSSCOMPILING) - SET(UHD_PC_CFLAGS) - SET(UHD_PC_LIBS) -ENDIF(CMAKE_CROSSCOMPILING) +if(CMAKE_CROSSCOMPILING) + set(UHD_PC_CFLAGS) + set(UHD_PC_LIBS) +endif(CMAKE_CROSSCOMPILING) -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/uhd.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uhd.pc @ONLY) @@ -518,40 +518,40 @@ UHD_INSTALL( ######################################################################## # Create and Install UHD cmake files ######################################################################## -IF(NOT CMAKE_MODULES_DIR) - SET(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake) -ENDIF(NOT CMAKE_MODULES_DIR) +if(NOT CMAKE_MODULES_DIR) + set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake) +endif(NOT CMAKE_MODULES_DIR) # UHDConfig.cmake needs UHD_LINK_LIST_STATIC set: -LIST(APPEND UHD_LINK_LIST_STATIC "dl") -LIST(APPEND UHD_LINK_LIST_STATIC "pthread") -FOREACH(Boost_Comp ${BOOST_REQUIRED_COMPONENTS}) - IF(NOT ${Boost_Comp} STREQUAL "unit_test_framework") - LIST(APPEND UHD_LINK_LIST_STATIC "boost_${Boost_Comp}") - ENDIF(NOT ${Boost_Comp} STREQUAL "unit_test_framework") -ENDFOREACH(Boost_Comp) -IF(ENABLE_USB) - LIST(APPEND UHD_LINK_LIST_STATIC "usb-1.0") -ENDIF(ENABLE_USB) +list(APPEND UHD_LINK_LIST_STATIC "dl") +list(APPEND UHD_LINK_LIST_STATIC "pthread") +foreach(Boost_Comp ${BOOST_REQUIRED_COMPONENTS}) + if(NOT ${Boost_Comp} STREQUAL "unit_test_framework") + list(APPEND UHD_LINK_LIST_STATIC "boost_${Boost_Comp}") + endif(NOT ${Boost_Comp} STREQUAL "unit_test_framework") +endforeach(Boost_Comp) +if(ENABLE_USB) + list(APPEND UHD_LINK_LIST_STATIC "usb-1.0") +endif(ENABLE_USB) # UHDConfig.cmake also needs UHD_RFNOC_FOUND -IF(ENABLE_RFNOC) - SET(UHD_RFNOC_FOUND "TRUE") -ELSE() - SET(UHD_RFNOC_FOUND "FALSE") -ENDIF(ENABLE_RFNOC) +if(ENABLE_RFNOC) + set(UHD_RFNOC_FOUND "TRUE") +else() + set(UHD_RFNOC_FOUND "FALSE") +endif(ENABLE_RFNOC) -CONFIGURE_FILE( +configure_file( ${CMAKE_SOURCE_DIR}/cmake/Modules/UHDConfigVersion.cmake.in ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake @ONLY ) -CONFIGURE_FILE( +configure_file( ${CMAKE_SOURCE_DIR}/cmake/Modules/UHDConfig.cmake.in ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfig.cmake @ONLY ) -SET(cmake_configs +set(cmake_configs ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfig.cmake ${CMAKE_BINARY_DIR}/cmake/Modules/UHDConfigVersion.cmake ) @@ -565,43 +565,43 @@ UHD_INSTALL( ######################################################################## # Handle pre-built UHD Images for packaging ######################################################################## -IF(DEFINED UHD_IMAGES_SRC_DIR AND EXISTS "${UHD_IMAGES_SRC_DIR}") - MESSAGE(STATUS "Reading images from directory `${UHD_IMAGES_SRC_DIR}'") - FILE(GLOB_RECURSE _image_files "${UHD_IMAGES_SRC_DIR}/*") - MESSAGE(STATUS "These images files will be installed/packaged:") - FOREACH(_img ${_image_files}) - MESSAGE(STATUS " ${_img}") - ENDFOREACH(_img) +if(DEFINED UHD_IMAGES_SRC_DIR AND EXISTS "${UHD_IMAGES_SRC_DIR}") + message(STATUS "Reading images from directory `${UHD_IMAGES_SRC_DIR}'") + file(GLOB_RECURSE _image_files "${UHD_IMAGES_SRC_DIR}/*") + message(STATUS "These images files will be installed/packaged:") + foreach(_img ${_image_files}) + message(STATUS " ${_img}") + endforeach(_img) UHD_INSTALL(FILES ${_image_files} DESTINATION ${PKG_DATA_DIR}/images COMPONENT images) -ENDIF(DEFINED UHD_IMAGES_SRC_DIR AND EXISTS "${UHD_IMAGES_SRC_DIR}") +endif(DEFINED UHD_IMAGES_SRC_DIR AND EXISTS "${UHD_IMAGES_SRC_DIR}") ######################################################################## # Print Summary ######################################################################## -IF(LIBUHD_PKG) - MESSAGE(STATUS "") - SET(PRINT_APPEND " (Debian libuhd003 package configuration)") -ELSEIF(LIBUHDDEV_PKG) - MESSAGE(STATUS "") - SET(PRINT_APPEND " (Debian libuhd-dev package configuration)") -ELSEIF(UHDHOST_PKG) - MESSAGE(STATUS "") - SET(PRINT_APPEND " (Debian uhd-host package configuration)") -ENDIF(LIBUHD_PKG) +if(LIBUHD_PKG) + message(STATUS "") + set(PRINT_APPEND " (Debian libuhd003 package configuration)") +elseif(LIBUHDDEV_PKG) + message(STATUS "") + set(PRINT_APPEND " (Debian libuhd-dev package configuration)") +elseif(UHDHOST_PKG) + message(STATUS "") + set(PRINT_APPEND " (Debian uhd-host package configuration)") +endif(LIBUHD_PKG) UHD_PRINT_COMPONENT_SUMMARY() -IF(UHD_VERSION_DEVEL AND NOT UHD_GIT_BRANCH MATCHES "^UHD-") - MESSAGE(STATUS "******************************************************") - IF(UHD_GIT_BRANCH STREQUAL "master") - MESSAGE(STATUS "* You are building the UHD development master branch.") - MESSAGE(STATUS "* For production code, we recommend our stable,") - MESSAGE(STATUS "* releases or using the release branch (maint).") - ELSE() - MESSAGE(STATUS "* You are building a development branch of UHD.") - MESSAGE(STATUS "* These branches are designed to provide early access") - MESSAGE(STATUS "* to UHD and USRP features, but should be considered") - MESSAGE(STATUS "* unstable and/or experimental!") - ENDIF(UHD_GIT_BRANCH STREQUAL "master") - MESSAGE(STATUS "******************************************************") -ENDIF(UHD_VERSION_DEVEL AND NOT UHD_GIT_BRANCH MATCHES "^UHD-") -MESSAGE(STATUS "Building version: ${UHD_VERSION}${PRINT_APPEND}") -MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") +if(UHD_VERSION_DEVEL AND NOT UHD_GIT_BRANCH MATCHES "^UHD-") + message(STATUS "******************************************************") + if(UHD_GIT_BRANCH STREQUAL "master") + message(STATUS "* You are building the UHD development master branch.") + message(STATUS "* For production code, we recommend our stable,") + message(STATUS "* releases or using the release branch (maint).") + else() + message(STATUS "* You are building a development branch of UHD.") + message(STATUS "* These branches are designed to provide early access") + message(STATUS "* to UHD and USRP features, but should be considered") + message(STATUS "* unstable and/or experimental!") + endif(UHD_GIT_BRANCH STREQUAL "master") + message(STATUS "******************************************************") +endif(UHD_VERSION_DEVEL AND NOT UHD_GIT_BRANCH MATCHES "^UHD-") +message(STATUS "Building version: ${UHD_VERSION}${PRINT_APPEND}") +message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") diff --git a/host/cmake/Modules/CMakeParseArgumentsCopy.cmake b/host/cmake/Modules/CMakeParseArgumentsCopy.cmake index 7ce4c49ae..a7e78bbdc 100644 --- a/host/cmake/Modules/CMakeParseArgumentsCopy.cmake +++ b/host/cmake/Modules/CMakeParseArgumentsCopy.cmake @@ -1,6 +1,6 @@ -# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) +# cmake_parse_arguments(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) # -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# cmake_parse_arguments() is intended to be used in macros or functions for # parsing the arguments given to that macro or function. # It processes the arguments and defines a set of variables which hold the # values of the respective options. @@ -17,7 +17,7 @@ # which can be followed by more than one value, like e.g. the TARGETS or # FILES keywords of the install() command. # -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# When done, cmake_parse_arguments() will have defined for each of the # keywords listed in <options>, <one_value_keywords> and # <multi_value_keywords> a variable composed of the given <prefix> # followed by "_" and the name of the respective keyword. diff --git a/host/cmake/Modules/CodeCoverage.cmake b/host/cmake/Modules/CodeCoverage.cmake index a0b0ef526..e19c6399d 100644 --- a/host/cmake/Modules/CodeCoverage.cmake +++ b/host/cmake/Modules/CodeCoverage.cmake @@ -43,11 +43,11 @@ # 1. Copy this file into your cmake modules path. # # 2. Add the following line to your CMakeLists.txt: -# INCLUDE(CodeCoverage) +# include(CodeCoverage) # # 3. Set compiler flags to turn off optimization and enable coverage: -# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") -# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") +# set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") +# set(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") # # 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target # which runs your test executable and produces a lcov code coverage report: @@ -68,48 +68,48 @@ # # Check prereqs -FIND_PROGRAM( GCOV_PATH gcov ) -FIND_PROGRAM( LCOV_PATH lcov ) -FIND_PROGRAM( GENHTML_PATH genhtml ) -FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) - -IF(NOT GCOV_PATH) - MESSAGE(FATAL_ERROR "gcov not found! Aborting...") -ENDIF() # NOT GCOV_PATH - -IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") - IF("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3) - MESSAGE(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...") - ENDIF() -ELSEIF(NOT CMAKE_COMPILER_IS_GNUCXX) - MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") -ENDIF() # CHECK VALID COMPILER - -SET(CMAKE_CXX_FLAGS_COVERAGE +find_program( GCOV_PATH gcov ) +find_program( LCOV_PATH lcov ) +find_program( GENHTML_PATH genhtml ) +find_program( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) + +if(NOT GCOV_PATH) + message(FATAL_ERROR "gcov not found! Aborting...") +endif() # NOT GCOV_PATH + +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang") + if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 3) + message(FATAL_ERROR "Clang version must be 3.0.0 or greater! Aborting...") + endif() +elseif(NOT CMAKE_COMPILER_IS_GNUCXX) + message(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") +endif() # CHECK VALID COMPILER + +set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C++ compiler during coverage builds." FORCE ) -SET(CMAKE_C_FLAGS_COVERAGE +set(CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C compiler during coverage builds." FORCE ) -SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE +set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "" CACHE STRING "Flags used for linking binaries during coverage builds." FORCE ) -SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE +set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "" CACHE STRING "Flags used by the shared libraries linker during coverage builds." FORCE ) -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) -IF ( NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage")) - MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) -ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" +if ( NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage")) + message( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) +endif() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" # Param _targetname The name of new the custom make target @@ -120,23 +120,23 @@ ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" # HTML report is generated in _outputname/index.html # Optional fourth parameter is passed as arguments to _testrunner # Pass them in list form, e.g.: "-j;2" for -j 2 -FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) +function(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) - IF(NOT LCOV_PATH) - MESSAGE(FATAL_ERROR "lcov not found! Aborting...") - ENDIF() # NOT LCOV_PATH + if(NOT LCOV_PATH) + message(FATAL_ERROR "lcov not found! Aborting...") + endif() # NOT LCOV_PATH - IF(NOT GENHTML_PATH) - MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") - ENDIF() # NOT GENHTML_PATH + if(NOT GENHTML_PATH) + message(FATAL_ERROR "genhtml not found! Aborting...") + endif() # NOT GENHTML_PATH - SET(coverage_info "${CMAKE_BINARY_DIR}/${_outputname}.info") - SET(coverage_cleaned "${coverage_info}.cleaned") + set(coverage_info "${CMAKE_BINARY_DIR}/${_outputname}.info") + set(coverage_cleaned "${coverage_info}.cleaned") - SEPARATE_ARGUMENTS(test_command UNIX_COMMAND "${_testrunner}") + separate_arguments(test_command UNIX_COMMAND "${_testrunner}") # Setup target - ADD_CUSTOM_TARGET(${_targetname} + add_custom_target(${_targetname} # Cleanup lcov ${LCOV_PATH} --directory . --zerocounters @@ -155,29 +155,29 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) ) # Show info where to find the report - ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD + add_custom_command(TARGET ${_targetname} POST_BUILD COMMAND ; COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." ) -ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE +endfunction() # SETUP_TARGET_FOR_COVERAGE # Param _targetname The name of new the custom make target # Param _testrunner The name of the target which runs the tests # Param _outputname cobertura output is generated as _outputname.xml # Optional fourth parameter is passed as arguments to _testrunner # Pass them in list form, e.g.: "-j;2" for -j 2 -FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname) +function(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname) - IF(NOT PYTHON_EXECUTABLE) - MESSAGE(FATAL_ERROR "Python not found! Aborting...") - ENDIF() # NOT PYTHON_EXECUTABLE + if(NOT PYTHON_EXECUTABLE) + message(FATAL_ERROR "Python not found! Aborting...") + endif() # NOT PYTHON_EXECUTABLE - IF(NOT GCOVR_PATH) - MESSAGE(FATAL_ERROR "gcovr not found! Aborting...") - ENDIF() # NOT GCOVR_PATH + if(NOT GCOVR_PATH) + message(FATAL_ERROR "gcovr not found! Aborting...") + endif() # NOT GCOVR_PATH - ADD_CUSTOM_TARGET(${_targetname} + add_custom_target(${_targetname} # Run tests ${_testrunner} ${ARGV3} @@ -189,9 +189,9 @@ FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname ) # Show info where to find the report - ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD + add_custom_command(TARGET ${_targetname} POST_BUILD COMMAND ; COMMENT "Cobertura code coverage report saved in ${_outputname}.xml." ) -ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA +endfunction() # SETUP_TARGET_FOR_COVERAGE_COBERTURA diff --git a/host/cmake/Modules/FindDocutils.cmake b/host/cmake/Modules/FindDocutils.cmake index 7b103879e..2f7f3fa6a 100644 --- a/host/cmake/Modules/FindDocutils.cmake +++ b/host/cmake/Modules/FindDocutils.cmake @@ -6,6 +6,6 @@ # ######################################################################## -FIND_PROGRAM(RST2HTML_EXECUTABLE NAMES rst2html rst2html.py) -INCLUDE(FindPackageHandleStandardArgs) +find_program(RST2HTML_EXECUTABLE NAMES rst2html rst2html.py) +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Docutils DEFAULT_MSG RST2HTML_EXECUTABLE) diff --git a/host/cmake/Modules/FindGPSD.cmake b/host/cmake/Modules/FindGPSD.cmake index 3e29c7498..92216438f 100644 --- a/host/cmake/Modules/FindGPSD.cmake +++ b/host/cmake/Modules/FindGPSD.cmake @@ -12,40 +12,40 @@ # also defined, but not for general use are # LIBGPS_LIBRARY, where to find the GPSD library. -INCLUDE(FindPkgConfig) +include(FindPkgConfig) PKG_CHECK_MODULES(PC_GPSD "libgps") PKG_CHECK_MODULES(PC_GPSD_V3_11 "libgps >= 3.11") -IF(PC_GPSD_FOUND AND NOT PC_GPSD_V3_11_FOUND) - MESSAGE(WARNING "GPSD version found is too old") -ENDIF(PC_GPSD_FOUND AND NOT PC_GPSD_V3_11_FOUND) +if(PC_GPSD_FOUND AND NOT PC_GPSD_V3_11_FOUND) + message(WARNING "GPSD version found is too old") +endif(PC_GPSD_FOUND AND NOT PC_GPSD_V3_11_FOUND) -IF(PC_GPSD_V3_11_FOUND) - FIND_PATH( +if(PC_GPSD_V3_11_FOUND) + find_path( LIBGPS_INCLUDE_DIR NAMES gps.h HINTS ${PC_GPSD_INCLUDE_DIR} ) - SET( + set( LIBGPS_NAMES ${LIBGPS_NAMES} gps ) - FIND_LIBRARY( + find_library( LIBGPS_LIBRARY NAMES ${LIBGPS_NAMES} HINTS ${PC_GPSD_LIBDIR} ) -ENDIF(PC_GPSD_V3_11_FOUND) +endif(PC_GPSD_V3_11_FOUND) # handle the QUIETLY and REQUIRED arguments and set LIBGPS_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGPS DEFAULT_MSG LIBGPS_LIBRARY LIBGPS_INCLUDE_DIR) -IF(LIBGPS_FOUND) - SET(LIBGPS_LIBRARIES ${LIBGPS_LIBRARY}) -ENDIF(LIBGPS_FOUND) +if(LIBGPS_FOUND) + set(LIBGPS_LIBRARIES ${LIBGPS_LIBRARY}) +endif(LIBGPS_FOUND) -MARK_AS_ADVANCED(LIBGPS_LIBRARY LIBGPS_INCLUDE_DIR) +mark_as_advanced(LIBGPS_LIBRARY LIBGPS_INCLUDE_DIR) diff --git a/host/cmake/Modules/FindGZip.cmake b/host/cmake/Modules/FindGZip.cmake index 029e95a22..2964529b2 100644 --- a/host/cmake/Modules/FindGZip.cmake +++ b/host/cmake/Modules/FindGZip.cmake @@ -6,6 +6,6 @@ # ######################################################################## -FIND_PROGRAM(GZIP_EXECUTABLE NAMES gzip) -INCLUDE(FindPackageHandleStandardArgs) +find_program(GZIP_EXECUTABLE NAMES gzip) +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GZip DEFAULT_MSG GZIP_EXECUTABLE) diff --git a/host/cmake/Modules/FindLIBERIO.cmake b/host/cmake/Modules/FindLIBERIO.cmake index 9a29e52e8..77fd49735 100644 --- a/host/cmake/Modules/FindLIBERIO.cmake +++ b/host/cmake/Modules/FindLIBERIO.cmake @@ -13,22 +13,22 @@ # also defined, but not for general use are # LIBERIO_LIBRARY, where to find the liberio library. -FIND_PACKAGE(PkgConfig) +find_package(PkgConfig) PKG_CHECK_MODULES(PC_LIBERIO QUIET liberio >= 0.3) -FIND_PATH(LIBERIO_INCLUDE_DIR liberio/liberio.h +find_path(LIBERIO_INCLUDE_DIR liberio/liberio.h HINTS $ENV{LIBERIO_DIR}/include ${PC_LIBERIO_INCLUDE_DIR} PATH_SUFFIXES liberio ) -FIND_LIBRARY(LIBERIO_LIBRARY +find_library(LIBERIO_LIBRARY NAMES erio liberio HINTS $ENV{LIBERIO_DIR}/lib ${PC_LIBERIO_LIBDIR} ${PC_LIBERIO_LIBRARY_DIRS} ) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBERIO DEFAULT_MSG LIBERIO_LIBRARY LIBERIO_INCLUDE_DIR) -MARK_AS_ADVANCED(LIBERIO_INCLUDE_DIR LIBERIO_LIBRARY) +mark_as_advanced(LIBERIO_INCLUDE_DIR LIBERIO_LIBRARY) set(LIBERIO_LIBRARIES ${LIBERIO_LIBRARY}) set(LIBERIO_INCLUDE_DIRS ${LIBERIO_INCLUDE_DIR}) diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cmake index 7c4a8fb6b..3763d715b 100644 --- a/host/cmake/Modules/FindUSB1.cmake +++ b/host/cmake/Modules/FindUSB1.cmake @@ -3,10 +3,10 @@ #sets LIBUSB_FOUND, LIBUSB_LIBRARIES, LIBUSB_INCLUDE_DIRS #override LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS to manually set -INCLUDE(FindPkgConfig) +include(FindPkgConfig) PKG_CHECK_MODULES(PC_LIBUSB QUIET libusb-1.0) -FIND_PATH(LIBUSB_INCLUDE_DIRS +find_path(LIBUSB_INCLUDE_DIRS NAMES libusb.h HINTS $ENV{LIBUSB_DIR}/include $ENV{LIBUSB_DIR}/include/libusb-1.0 ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDEDIR}/libusb-1.0 @@ -27,7 +27,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD" list(APPEND libusb1_library_names usb) endif() -FIND_LIBRARY(LIBUSB_LIBRARIES +find_library(LIBUSB_LIBRARIES NAMES ${libusb1_library_names} HINTS $ENV{LIBUSB_DIR}/lib ${PC_LIBUSB_LIBDIR} PATHS /usr/local/lib /usr/lib /opt/local/lib @@ -59,4 +59,4 @@ endif(HAVE_LIBUSB_STRERROR) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS) -MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES) +mark_as_advanced(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES) diff --git a/host/cmake/Modules/UHDBuildInfo.cmake b/host/cmake/Modules/UHDBuildInfo.cmake index 21b1e3c1d..468635b15 100644 --- a/host/cmake/Modules/UHDBuildInfo.cmake +++ b/host/cmake/Modules/UHDBuildInfo.cmake @@ -8,46 +8,46 @@ # We need this to be macro because GET_DIRECTORY_PROPERTY works with # the current directory. # -MACRO(UHD_LOAD_BUILD_INFO) - MESSAGE(STATUS "") - MESSAGE(STATUS "Loading build info.") +macro(UHD_LOAD_BUILD_INFO) + message(STATUS "") + message(STATUS "Loading build info.") # Build date - IF(IGNORE_BUILD_DATE) - SET(UHD_BUILD_DATE "") - ELSE() - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c + if(IGNORE_BUILD_DATE) + set(UHD_BUILD_DATE "") + else() + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import time; print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))" OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE ) - ENDIF(IGNORE_BUILD_DATE) + endif(IGNORE_BUILD_DATE) # Compiler name - IF(MSVC) - IF(MSVC10) - SET(UHD_C_COMPILER "MSVC 2010") - SET(UHD_CXX_COMPILER "MSVC 2010") - ELSEIF(MSVC11) - SET(UHD_C_COMPILER "MSVC 2012") - SET(UHD_CXX_COMPILER "MSVC 2012") - ELSEIF(MSVC12) - SET(UHD_C_COMPILER "MSVC 2013") - SET(UHD_CXX_COMPILER "MSVC 2013") - ELSEIF(MSVC14) - SET(UHD_C_COMPILER "MSVC 2015") - SET(UHD_CXX_COMPILER "MSVC 2015") - ELSE() + if(MSVC) + if(MSVC10) + set(UHD_C_COMPILER "MSVC 2010") + set(UHD_CXX_COMPILER "MSVC 2010") + elseif(MSVC11) + set(UHD_C_COMPILER "MSVC 2012") + set(UHD_CXX_COMPILER "MSVC 2012") + elseif(MSVC12) + set(UHD_C_COMPILER "MSVC 2013") + set(UHD_CXX_COMPILER "MSVC 2013") + elseif(MSVC14) + set(UHD_C_COMPILER "MSVC 2015") + set(UHD_CXX_COMPILER "MSVC 2015") + else() # Go with the ugly string - SET(UHD_C_COMPILER "MSVC ${CMAKE_C_COMPILER_VERSION}") - SET(UHD_CXX_COMPILER "MSVC ${CMAKE_CXX_COMPILER_VERSION}") - ENDIF(MSVC10) - ELSE() - SET(UHD_C_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") - SET(UHD_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") - ENDIF(MSVC) + set(UHD_C_COMPILER "MSVC ${CMAKE_C_COMPILER_VERSION}") + set(UHD_CXX_COMPILER "MSVC ${CMAKE_CXX_COMPILER_VERSION}") + endif(MSVC10) + else() + set(UHD_C_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") + set(UHD_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") + endif(MSVC) # Compiler flags - GET_DIRECTORY_PROPERTY(uhd_flags COMPILE_DEFINITIONS) - SET(UHD_C_FLAGS "${uhd_flags}${CMAKE_C_FLAGS}") # CMAKE_C_FLAGS starts with a space - SET(UHD_CXX_FLAGS "${uhd_flags}${CMAKE_CXX_FLAGS}") # CMAKE_CXX_FLAGS starts with a space -ENDMACRO(UHD_LOAD_BUILD_INFO) + get_directory_property(uhd_flags COMPILE_DEFINITIONS) + set(UHD_C_FLAGS "${uhd_flags}${CMAKE_C_FLAGS}") # CMAKE_C_FLAGS starts with a space + set(UHD_CXX_FLAGS "${uhd_flags}${CMAKE_CXX_FLAGS}") # CMAKE_CXX_FLAGS starts with a space +endmacro(UHD_LOAD_BUILD_INFO) diff --git a/host/cmake/Modules/UHDComponent.cmake b/host/cmake/Modules/UHDComponent.cmake index b18f651ea..db8806be9 100644 --- a/host/cmake/Modules/UHDComponent.cmake +++ b/host/cmake/Modules/UHDComponent.cmake @@ -6,8 +6,8 @@ # ######################################################################## -SET(_uhd_enabled_components "" CACHE INTERNAL "" FORCE) -SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE) +set(_uhd_enabled_components "" CACHE INTERNAL "" FORCE) +set(_uhd_disabled_components "" CACHE INTERNAL "" FORCE) ######################################################################## # Register a component into the system @@ -22,29 +22,29 @@ SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE) # "FOO" which is enabled by calling CMake with -DENABLE_FOO=ON. It defaults to # ON, unless DEPENDENCY_FOUND is false, in which case it becomes false. ######################################################################## -MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis req) - MESSAGE(STATUS "") - MESSAGE(STATUS "Configuring ${name} support...") - FOREACH(dep ${deps}) - MESSAGE(STATUS " Dependency ${dep} = ${${dep}}") - ENDFOREACH(dep) +macro(LIBUHD_REGISTER_COMPONENT name var enb deps dis req) + message(STATUS "") + message(STATUS "Configuring ${name} support...") + foreach(dep ${deps}) + message(STATUS " Dependency ${dep} = ${${dep}}") + endforeach(dep) # If user specified option, store here. Note: If the user doesn't specify # this option on the cmake command line, both user_enabled and # user_disabled will be false! - IF("${${var}}" STREQUAL "OFF") - SET(user_disabled TRUE) - ELSE() - SET(user_disabled FALSE) - ENDIF("${${var}}" STREQUAL "OFF") - IF("${${var}}" STREQUAL "ON") - SET(user_enabled TRUE) - ELSE() - SET(user_enabled FALSE) - ENDIF("${${var}}" STREQUAL "ON") + if("${${var}}" STREQUAL "OFF") + set(user_disabled TRUE) + else() + set(user_disabled FALSE) + endif("${${var}}" STREQUAL "OFF") + if("${${var}}" STREQUAL "ON") + set(user_enabled TRUE) + else() + set(user_enabled FALSE) + endif("${${var}}" STREQUAL "ON") #setup the dependent option for this component - INCLUDE(CMakeDependentOption) + include(CMakeDependentOption) CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis}) # There are two failure cases: @@ -52,105 +52,105 @@ MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis req) # requirements are not met. # 2) The user did not explicitly turn off this component (-DENABLE_FOO=OFF) # but it is flagged as required by ${req} - IF(NOT ${var} AND user_enabled) # Case 1) - MESSAGE(FATAL_ERROR "Dependencies for required component ${name} not met.") - ENDIF(NOT ${var} AND user_enabled) - IF(NOT ${var} AND ${req} AND NOT user_disabled) # Case 2) - MESSAGE(FATAL_ERROR "Dependencies for required component ${name} not met.") - ENDIF(NOT ${var} AND ${req} AND NOT user_disabled) + if(NOT ${var} AND user_enabled) # Case 1) + message(FATAL_ERROR "Dependencies for required component ${name} not met.") + endif(NOT ${var} AND user_enabled) + if(NOT ${var} AND ${req} AND NOT user_disabled) # Case 2) + message(FATAL_ERROR "Dependencies for required component ${name} not met.") + endif(NOT ${var} AND ${req} AND NOT user_disabled) #append the component into one of the lists - IF(${var}) - MESSAGE(STATUS " Enabling ${name} support.") - LIST(APPEND _uhd_enabled_components ${name}) - ELSE(${var}) - MESSAGE(STATUS " Disabling ${name} support.") - LIST(APPEND _uhd_disabled_components ${name}) - ENDIF(${var}) - MESSAGE(STATUS " Override with -D${var}=ON/OFF") + if(${var}) + message(STATUS " Enabling ${name} support.") + list(APPEND _uhd_enabled_components ${name}) + else(${var}) + message(STATUS " Disabling ${name} support.") + list(APPEND _uhd_disabled_components ${name}) + endif(${var}) + message(STATUS " Override with -D${var}=ON/OFF") #make components lists into global variables - SET(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) - SET(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE) -ENDMACRO(LIBUHD_REGISTER_COMPONENT) + set(_uhd_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) + set(_uhd_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE) +endmacro(LIBUHD_REGISTER_COMPONENT) ######################################################################## # Install only if appropriate for package and if component is enabled ######################################################################## -FUNCTION(UHD_INSTALL) +function(UHD_INSTALL) include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(UHD_INSTALL "" "DESTINATION;COMPONENT" "TARGETS;FILES;PROGRAMS" ${ARGN}) + cmake_parse_arguments(UHD_INSTALL "" "DESTINATION;COMPONENT" "TARGETS;FILES;PROGRAMS" ${ARGN}) - IF(UHD_INSTALL_FILES) - SET(TO_INSTALL "${UHD_INSTALL_FILES}") - ELSEIF(UHD_INSTALL_PROGRAMS) - SET(TO_INSTALL "${UHD_INSTALL_PROGRAMS}") - ELSEIF(UHD_INSTALL_TARGETS) - SET(TO_INSTALL "${UHD_INSTALL_TARGETS}") - ENDIF(UHD_INSTALL_FILES) + if(UHD_INSTALL_FILES) + set(TO_INSTALL "${UHD_INSTALL_FILES}") + elseif(UHD_INSTALL_PROGRAMS) + set(TO_INSTALL "${UHD_INSTALL_PROGRAMS}") + elseif(UHD_INSTALL_TARGETS) + set(TO_INSTALL "${UHD_INSTALL_TARGETS}") + endif(UHD_INSTALL_FILES) - IF(UHD_INSTALL_COMPONENT STREQUAL "headers") - IF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "devel") - IF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "examples") - IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "tests") - IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "utilities") - IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "manual") - IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "doxygen") - IF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "manpages") - IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "images") - IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) - ELSEIF(UHD_INSTALL_COMPONENT STREQUAL "readme") - IF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) - INSTALL(${ARGN}) - ENDIF(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) - ENDIF(UHD_INSTALL_COMPONENT STREQUAL "headers") -ENDFUNCTION(UHD_INSTALL) + if(UHD_INSTALL_COMPONENT STREQUAL "headers") + if(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "devel") + if(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "examples") + if(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "tests") + if(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "utilities") + if(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "manual") + if(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "doxygen") + if(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT UHDHOST_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "manpages") + if(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "images") + if(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + elseif(UHD_INSTALL_COMPONENT STREQUAL "readme") + if(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + install(${ARGN}) + endif(NOT LIBUHD_PKG AND NOT LIBUHDDEV_PKG AND NOT UHDHOST_PKG) + endif(UHD_INSTALL_COMPONENT STREQUAL "headers") +endfunction(UHD_INSTALL) ######################################################################## # Print the registered component summary ######################################################################## -FUNCTION(UHD_PRINT_COMPONENT_SUMMARY) - MESSAGE(STATUS "") - MESSAGE(STATUS "######################################################") - MESSAGE(STATUS "# UHD enabled components ") - MESSAGE(STATUS "######################################################") - FOREACH(comp ${_uhd_enabled_components}) - MESSAGE(STATUS " * ${comp}") - ENDFOREACH(comp) +function(UHD_PRINT_COMPONENT_SUMMARY) + message(STATUS "") + message(STATUS "######################################################") + message(STATUS "# UHD enabled components ") + message(STATUS "######################################################") + foreach(comp ${_uhd_enabled_components}) + message(STATUS " * ${comp}") + endforeach(comp) - MESSAGE(STATUS "") - MESSAGE(STATUS "######################################################") - MESSAGE(STATUS "# UHD disabled components ") - MESSAGE(STATUS "######################################################") - FOREACH(comp ${_uhd_disabled_components}) - MESSAGE(STATUS " * ${comp}") - ENDFOREACH(comp) + message(STATUS "") + message(STATUS "######################################################") + message(STATUS "# UHD disabled components ") + message(STATUS "######################################################") + foreach(comp ${_uhd_disabled_components}) + message(STATUS " * ${comp}") + endforeach(comp) - MESSAGE(STATUS "") -ENDFUNCTION(UHD_PRINT_COMPONENT_SUMMARY) + message(STATUS "") +endfunction(UHD_PRINT_COMPONENT_SUMMARY) diff --git a/host/cmake/Modules/UHDConfig.cmake.in b/host/cmake/Modules/UHDConfig.cmake.in index 4651e3a9c..30b0d92ff 100644 --- a/host/cmake/Modules/UHDConfig.cmake.in +++ b/host/cmake/Modules/UHDConfig.cmake.in @@ -25,50 +25,50 @@ set(ENV{UHD_CONFIG_USED} TRUE) # set default values -SET(UHD_FOUND TRUE) -SET(UHD_RFNOC_FOUND @UHD_RFNOC_FOUND@) -SET(UHD_INCLUDE_HINTS) -SET(UHD_LIBDIR_HINTS) -SET(UHD_DIR $ENV{UHD_DIR}) - -IF(UHD_DIR) - LIST(APPEND UHD_INCLUDE_HINTS ${UHD_DIR}/include) - LIST(APPEND UHD_LIBDIR_HINTS ${UHD_DIR}/lib) -ENDIF() - -INCLUDE(FindPkgConfig) -IF(PKG_CONFIG_FOUND) - IF(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.0") - SET(UHD_QUIET "QUIET") - ENDIF() +set(UHD_FOUND TRUE) +set(UHD_RFNOC_FOUND @UHD_RFNOC_FOUND@) +set(UHD_INCLUDE_HINTS) +set(UHD_LIBDIR_HINTS) +set(UHD_DIR $ENV{UHD_DIR}) + +if(UHD_DIR) + list(APPEND UHD_INCLUDE_HINTS ${UHD_DIR}/include) + list(APPEND UHD_LIBDIR_HINTS ${UHD_DIR}/lib) +endif() + +include(FindPkgConfig) +if(PKG_CONFIG_FOUND) + if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.0") + set(UHD_QUIET "QUIET") + endif() PKG_CHECK_MODULES(PC_UHD ${UHD_QUIET} uhd) - IF(PC_UHD_FOUND) - LIST(APPEND UHD_INCLUDE_HINTS ${PC_UHD_INCLUDEDIR}) - LIST(APPEND UHD_LIBDIR_HINTS ${PC_UHD_LIBDIR}) - ENDIF() -ENDIF() + if(PC_UHD_FOUND) + list(APPEND UHD_INCLUDE_HINTS ${PC_UHD_INCLUDEDIR}) + list(APPEND UHD_LIBDIR_HINTS ${PC_UHD_LIBDIR}) + endif() +endif() -LIST(APPEND UHD_INCLUDE_HINTS ${CMAKE_INSTALL_PREFIX}/include) -LIST(APPEND UHD_LIBDIR_HINTS ${CMAKE_INSTALL_PREFIX}/lib) +list(APPEND UHD_INCLUDE_HINTS ${CMAKE_INSTALL_PREFIX}/include) +list(APPEND UHD_LIBDIR_HINTS ${CMAKE_INSTALL_PREFIX}/lib) # Search for static libs if so required -IF( UHD_USE_STATIC_LIBS ) - SET( _UHD_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - IF(WIN32) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ELSE() - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ) - ENDIF() +if( UHD_USE_STATIC_LIBS ) + set( _UHD_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() # This is set during build of UHD to match the installed version: - SET(UHD_STATIC_LIB_DEPS "@UHD_LINK_LIST_STATIC@") -ENDIF() + set(UHD_STATIC_LIB_DEPS "@UHD_LINK_LIST_STATIC@") +endif() # Verify that <uhd/config.hpp> and libuhd are available, and, if a # version is provided, that UHD meets the version requirements -- no # matter what pkg-config might think. -FIND_PATH( +find_path( UHD_INCLUDE_DIRS NAMES uhd/config.hpp HINTS ${UHD_INCLUDE_HINTS} @@ -76,7 +76,7 @@ FIND_PATH( /usr/include ) -FIND_LIBRARY( +find_library( UHD_LIBRARIES NAMES uhd HINTS ${UHD_LIBDIR_HINTS} @@ -85,25 +85,25 @@ FIND_LIBRARY( ) # Set up linker flags for static linking: -IF(UHD_USE_STATIC_LIBS) - IF(WIN32) - MESSAGE(FATAL_ERROR "Static linking not available on Windows") - ELSE(WIN32) +if(UHD_USE_STATIC_LIBS) + if(WIN32) + message(FATAL_ERROR "Static linking not available on Windows") + else(WIN32) # This works for gcc and Clang: - SET(UHD_STATIC_LIB_LINK_FLAG "-Wl,-whole-archive ${UHD_LIBRARIES} -Wl,-no-whole-archive") - ENDIF(WIN32) + set(UHD_STATIC_LIB_LINK_FLAG "-Wl,-whole-archive ${UHD_LIBRARIES} -Wl,-no-whole-archive") + endif(WIN32) # Restore the library suffixes, if we changed them: - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_UHD_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) -ENDIF(UHD_USE_STATIC_LIBS) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_UHD_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +endif(UHD_USE_STATIC_LIBS) -IF(UHD_LIBRARIES AND UHD_INCLUDE_DIRS) +if(UHD_LIBRARIES AND UHD_INCLUDE_DIRS) - INCLUDE(FindPackageHandleStandardArgs) + include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) - MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS) + mark_as_advanced(UHD_LIBRARIES UHD_INCLUDE_DIRS) -ELSEIF(UHD_FIND_REQUIRED) +elseif(UHD_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "UHD is required, but was not found.") + message(FATAL_ERROR "UHD is required, but was not found.") -ENDIF() +endif() diff --git a/host/cmake/Modules/UHDConfigVersion.cmake.in b/host/cmake/Modules/UHDConfigVersion.cmake.in index 9945789b1..5e3e9558e 100644 --- a/host/cmake/Modules/UHDConfigVersion.cmake.in +++ b/host/cmake/Modules/UHDConfigVersion.cmake.in @@ -19,14 +19,14 @@ set(ENV{UHD_CONFIG_VERSION_USED} TRUE) # version values as set in cmake/Modules/UHDVersion.cmake, placed # statically in here to avoid using Python all over again. -SET(MAJOR_VERSION @UHD_VERSION_MAJOR@) -SET(API_VERSION @UHD_VERSION_API@) -SET(ABI_VERSION @UHD_VERSION_ABI@) -SET(PATCH_VERSION @UHD_VERSION_PATCH@) -SET(DEVEL_VERSION @UHD_VERSION_DEVEL@) +set(MAJOR_VERSION @UHD_VERSION_MAJOR@) +set(API_VERSION @UHD_VERSION_API@) +set(ABI_VERSION @UHD_VERSION_ABI@) +set(PATCH_VERSION @UHD_VERSION_PATCH@) +set(DEVEL_VERSION @UHD_VERSION_DEVEL@) -SET(PACKAGE_VERSION @UHD_VERSION@) -SET(ENV{UHD_PACKAGE_VERSION} ${PACKAGE_VERSION}) +set(PACKAGE_VERSION @UHD_VERSION@) +set(ENV{UHD_PACKAGE_VERSION} ${PACKAGE_VERSION}) # There is a bug in CMake whereby calling "find_package(FOO)" within # "find_package(FOO)" results in the version being checked in the @@ -34,62 +34,62 @@ SET(ENV{UHD_PACKAGE_VERSION} ${PACKAGE_VERSION}) # "PACKAGE_FIND_VERSION" and if empty set return variables to TRUE to # make CMake happy. Not the best solution, but it does the trick. -IF(NOT PACKAGE_FIND_VERSION) - SET(PACKAGE_VERSION_COMPATIBLE TRUE) - SET(PACKAGE_VERSION_EXACT TRUE) - RETURN() -ENDIF(NOT PACKAGE_FIND_VERSION) +if(NOT PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + set(PACKAGE_VERSION_EXACT TRUE) + return() +endif(NOT PACKAGE_FIND_VERSION) # Development branches of UHD don't have a patch version. This is a hack # to add a fake patch version that should be higher than anything the user # requests. -IF(DEVEL_VERSION) - SET(PACKAGE_VERSION "${MAJOR_VERSION}.${API_VERSION}.${ABI_VERSION}.999") -ENDIF(DEVEL_VERSION) +if(DEVEL_VERSION) + set(PACKAGE_VERSION "${MAJOR_VERSION}.${API_VERSION}.${ABI_VERSION}.999") +endif(DEVEL_VERSION) # assume incorrect versioning by default -SET(PACKAGE_VERSION_COMPATIBLE FALSE) -SET(PACKAGE_VERSION_EXACT FALSE) +set(PACKAGE_VERSION_COMPATIBLE FALSE) +set(PACKAGE_VERSION_EXACT FALSE) # do not use ABI for now -SET(UHD_USE_ABI FALSE) +set(UHD_USE_ABI FALSE) # leave the ABI checking in, for now, just in case it is wanted in the # future. This code works nicely to find the ABI compatibility # version from <uhd/version.hpp>. -IF(UHD_USE_ABI) +if(UHD_USE_ABI) # find ABI compatible version from <uhd/version.hpp> - SET(UHD_INCLUDE_HINTS) - SET(UHD_DIR $ENV{UHD_DIR}) + set(UHD_INCLUDE_HINTS) + set(UHD_DIR $ENV{UHD_DIR}) - IF(UHD_DIR) - LIST(APPEND UHD_INCLUDE_HINTS ${UHD_DIR}/include) - ENDIF() + if(UHD_DIR) + list(APPEND UHD_INCLUDE_HINTS ${UHD_DIR}/include) + endif() - INCLUDE(FindPkgConfig) - IF(PKG_CONFIG_FOUND) - IF(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.0") - SET(UHD_QUIET "QUIET") - ENDIF() - IF(PACKAGE_VERSION_EXACT) + include(FindPkgConfig) + if(PKG_CONFIG_FOUND) + if(NOT ${CMAKE_VERSION} VERSION_LESS "2.8.0") + set(UHD_QUIET "QUIET") + endif() + if(PACKAGE_VERSION_EXACT) PKG_CHECK_MODULES(PC_UHD ${UHD_QUIET} uhd=${UHD_FIND_VERSION}) - ELSE() + else() PKG_CHECK_MODULES(PC_UHD ${UHD_QUIET} uhd>=${UHD_FIND_VERSION}) - ENDIF() - IF(PC_UHD_FOUND) - LIST(APPEND UHD_INCLUDE_HINTS ${PC_UHD_INCLUDEDIR}) - ENDIF() - ENDIF() + endif() + if(PC_UHD_FOUND) + list(APPEND UHD_INCLUDE_HINTS ${PC_UHD_INCLUDEDIR}) + endif() + endif() - LIST(APPEND UHD_INCLUDE_HINTS ${CMAKE_INSTALL_PREFIX}/include) + list(APPEND UHD_INCLUDE_HINTS ${CMAKE_INSTALL_PREFIX}/include) # Verify that <uhd/config.hpp> and libuhd are available, and, if a # version is provided, that UHD meets the version requirements -- no # matter what pkg-config might think. - FIND_PATH( + find_path( UHD_INCLUDE_DIR NAMES uhd/version.hpp HINTS ${UHD_INCLUDE_HINTS} @@ -97,72 +97,72 @@ IF(UHD_USE_ABI) /usr/include ) - IF(UHD_INCLUDE_DIR) + if(UHD_INCLUDE_DIR) # extract the UHD API version from the installed header - FILE(STRINGS "${UHD_INCLUDE_DIR}/uhd/version.hpp" + file(STRINGS "${UHD_INCLUDE_DIR}/uhd/version.hpp" UHD_STRING_VERSION REGEX "UHD_VERSION_ABI_STRING") - STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" UHD_ABI_VERSION_CONCISE ${UHD_STRING_VERSION}) # convert UHD_FIND_VERSION into concise #.#.# format for comparison - STRING(REGEX REPLACE "([^\\.]*)\\.([^\\.]*)\\.([^\\.]*)" + string(REGEX REPLACE "([^\\.]*)\\.([^\\.]*)\\.([^\\.]*)" "\\1.\\2.\\3" UHD_ABI_VERSION_TMP ${UHD_ABI_VERSION_CONCISE}) - STRING(REPLACE "0" "" UHD_ABI_MAJOR ${CMAKE_MATCH_1}) - STRING(REPLACE "0" "" UHD_ABI_MINOR ${CMAKE_MATCH_2}) - STRING(REPLACE "0" "" UHD_ABI_PATCH ${CMAKE_MATCH_3}) + string(REPLACE "0" "" UHD_ABI_MAJOR ${CMAKE_MATCH_1}) + string(REPLACE "0" "" UHD_ABI_MINOR ${CMAKE_MATCH_2}) + string(REPLACE "0" "" UHD_ABI_PATCH ${CMAKE_MATCH_3}) # fix the case where the version number is "000" - IF(NOT UHD_ABI_MAJOR) - SET(UHD_ABI_MAJOR "0") - ENDIF() - IF(NOT UHD_ABI_MINOR) - SET(UHD_ABI_MINOR "0") - ENDIF() - IF(NOT UHD_ABI_PATCH) - SET(UHD_ABI_PATCH "0") - ENDIF() + if(NOT UHD_ABI_MAJOR) + set(UHD_ABI_MAJOR "0") + endif() + if(NOT UHD_ABI_MINOR) + set(UHD_ABI_MINOR "0") + endif() + if(NOT UHD_ABI_PATCH) + set(UHD_ABI_PATCH "0") + endif() - SET(UHD_ABI_VERSION_CONCISE ${UHD_ABI_MAJOR}.${UHD_ABI_MINOR}.${UHD_ABI_PATCH}) + set(UHD_ABI_VERSION_CONCISE ${UHD_ABI_MAJOR}.${UHD_ABI_MINOR}.${UHD_ABI_PATCH}) - ELSE(UHD_INCLUDE_DIR) + else(UHD_INCLUDE_DIR) # no header found ... not a good sign! Assume ABI version is the # same as that known internally here. Let UHDConfig.cmake fail if # it cannot find <uhd/config.hpp> or "libuhd" ... - SET(UHD_ABI_VERSION_CONCISE ${PACKAGE_VERSION}) + set(UHD_ABI_VERSION_CONCISE ${PACKAGE_VERSION}) - ENDIF(UHD_INCLUDE_DIR) + endif(UHD_INCLUDE_DIR) # check for ABI compatibility, both: # ACTUAL VERSION >= DESIRED VERSION >= ABI VERSION - IF(NOT ${PACKAGE_FIND_VERSION} VERSION_LESS ${UHD_ABI_VERSION_CONCISE} AND + if(NOT ${PACKAGE_FIND_VERSION} VERSION_LESS ${UHD_ABI_VERSION_CONCISE} AND NOT ${PACKAGE_FIND_VERSION} VERSION_GREATER ${PACKAGE_VERSION}) - SET(PACKAGE_VERSION_COMPATIBLE TRUE) - ENDIF() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() -ELSE(UHD_USE_ABI) +else(UHD_USE_ABI) # use API only, and assume compatible of requested <= actual # which is the same as "not >" - IF(NOT ${PACKAGE_FIND_VERSION} VERSION_GREATER ${PACKAGE_VERSION}) - SET(PACKAGE_VERSION_COMPATIBLE TRUE) - ENDIF() + if(NOT ${PACKAGE_FIND_VERSION} VERSION_GREATER ${PACKAGE_VERSION}) + set(PACKAGE_VERSION_COMPATIBLE TRUE) + endif() -ENDIF(UHD_USE_ABI) +endif(UHD_USE_ABI) # check for exact version -IF(${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION}) - SET(PACKAGE_VERSION_EXACT TRUE) -ENDIF() +if(${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION}) + set(PACKAGE_VERSION_EXACT TRUE) +endif() # Undo our patch-version-number hack -SET(PACKAGE_VERSION @UHD_VERSION@) +set(PACKAGE_VERSION @UHD_VERSION@) diff --git a/host/cmake/Modules/UHDGlobalDefs.cmake b/host/cmake/Modules/UHDGlobalDefs.cmake index d21519479..47bb83511 100644 --- a/host/cmake/Modules/UHDGlobalDefs.cmake +++ b/host/cmake/Modules/UHDGlobalDefs.cmake @@ -7,22 +7,22 @@ # This file sets up all the stuff for the config.h file -INCLUDE(CheckCXXSymbolExistsCopy) +include(CheckCXXSymbolExistsCopy) ## Check for std::log2 CHECK_CXX_SYMBOL_EXISTS(log2 cmath HAVE_LOG2) ## Macros for the version number -IF(UHD_VERSION_DEVEL) - MATH(EXPR UHD_VERSION_ADDED "1000000 * ${UHD_VERSION_MAJOR} + 10000 * ${UHD_VERSION_API} + 100 * ${UHD_VERSION_ABI} + 99") -ELSE() - MATH(EXPR UHD_VERSION_ADDED "1000000 * ${UHD_VERSION_MAJOR} + 10000 * ${UHD_VERSION_API} + 100 * ${UHD_VERSION_ABI} + ${UHD_VERSION_PATCH}") -ENDIF(UHD_VERSION_DEVEL) +if(UHD_VERSION_DEVEL) + math(EXPR UHD_VERSION_ADDED "1000000 * ${UHD_VERSION_MAJOR} + 10000 * ${UHD_VERSION_API} + 100 * ${UHD_VERSION_ABI} + 99") +else() + math(EXPR UHD_VERSION_ADDED "1000000 * ${UHD_VERSION_MAJOR} + 10000 * ${UHD_VERSION_API} + 100 * ${UHD_VERSION_ABI} + ${UHD_VERSION_PATCH}") +endif(UHD_VERSION_DEVEL) ## RFNoC -IF(ENABLE_RFNOC) - ADD_DEFINITIONS(-DUHD_RFNOC_ENABLED) -ENDIF(ENABLE_RFNOC) +if(ENABLE_RFNOC) + add_definitions(-DUHD_RFNOC_ENABLED) +endif(ENABLE_RFNOC) ## make sure the code knows about config.h -ADD_DEFINITIONS(-DHAVE_CONFIG_H) +add_definitions(-DHAVE_CONFIG_H) diff --git a/host/cmake/Modules/UHDLog.cmake b/host/cmake/Modules/UHDLog.cmake index 4bc1daf13..18643e672 100644 --- a/host/cmake/Modules/UHDLog.cmake +++ b/host/cmake/Modules/UHDLog.cmake @@ -1,72 +1,72 @@ ######################################################################## # Logging Variables ######################################################################## -IF(CMAKE_BUILD_TYPE STREQUAL "Debug") - SET(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") - SET(UHD_LOG_FILE_LEVEL "trace" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_LEVEL "debug" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") -ELSE() - SET(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") - SET(UHD_LOG_FILE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") - SET(UHD_LOG_CONSOLE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") -ENDIF() +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") + set(UHD_LOG_FILE_LEVEL "trace" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_LEVEL "debug" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") +else() + set(UHD_LOG_MIN_LEVEL "debug" CACHE STRING "Set UHD log level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_DISABLE "OFF" CACHE BOOL "Disable UHD logging to stderr") + set(UHD_LOG_FILE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") + set(UHD_LOG_CONSOLE_LEVEL "info" CACHE STRING "SET UHD file logging level to {trace, debug, info, warning, error, fatal}") +endif() -FUNCTION(UHD_LOG_LEVEL_CONVERT ARG1 ARG2) +function(UHD_LOG_LEVEL_CONVERT ARG1 ARG2) string(TOLOWER "${ARG1}" LOG_LEVEL_LOWER) - IF(LOG_LEVEL_LOWER STREQUAL "trace") - ADD_DEFINITIONS(-D${ARG2}=0) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "debug") - ADD_DEFINITIONS(-D${ARG2}=1) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "info") - ADD_DEFINITIONS(-D${ARG2}=2) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "warning") - ADD_DEFINITIONS(-D${ARG2}=3) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "error") - ADD_DEFINITIONS(-D${ARG2}=4) - ELSEIF(LOG_LEVEL_LOWER STREQUAL "fatal") - ADD_DEFINITIONS(-D${ARG2}=5) - ELSE() - ADD_DEFINITIONS(-D${ARG2}=${ARG1}) - ENDIF() -ENDFUNCTION() + if(LOG_LEVEL_LOWER STREQUAL "trace") + add_definitions(-D${ARG2}=0) + elseif(LOG_LEVEL_LOWER STREQUAL "debug") + add_definitions(-D${ARG2}=1) + elseif(LOG_LEVEL_LOWER STREQUAL "info") + add_definitions(-D${ARG2}=2) + elseif(LOG_LEVEL_LOWER STREQUAL "warning") + add_definitions(-D${ARG2}=3) + elseif(LOG_LEVEL_LOWER STREQUAL "error") + add_definitions(-D${ARG2}=4) + elseif(LOG_LEVEL_LOWER STREQUAL "fatal") + add_definitions(-D${ARG2}=5) + else() + add_definitions(-D${ARG2}=${ARG1}) + endif() +endfunction() UHD_LOG_LEVEL_CONVERT(${UHD_LOG_MIN_LEVEL} "UHD_LOG_MIN_LEVEL") UHD_LOG_LEVEL_CONVERT(${UHD_LOG_CONSOLE_LEVEL} "UHD_LOG_CONSOLE_LEVEL") UHD_LOG_LEVEL_CONVERT(${UHD_LOG_FILE_LEVEL} "UHD_LOG_FILE_LEVEL") -IF(UHD_LOG_CONSOLE_DISABLE) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_DISABLE) -ELSE() - IF(UHD_LOG_CONSOLE_TIME) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_TIME) - ENDIF() - IF(UHD_LOG_CONSOLE_THREAD) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_THREAD) - ENDIF() - IF(UHD_LOG_CONSOLE_SRC) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_SRC) - ENDIF() -ENDIF() +if(UHD_LOG_CONSOLE_DISABLE) + add_definitions(-DUHD_LOG_CONSOLE_DISABLE) +else() + if(UHD_LOG_CONSOLE_TIME) + add_definitions(-DUHD_LOG_CONSOLE_TIME) + endif() + if(UHD_LOG_CONSOLE_THREAD) + add_definitions(-DUHD_LOG_CONSOLE_THREAD) + endif() + if(UHD_LOG_CONSOLE_SRC) + add_definitions(-DUHD_LOG_CONSOLE_SRC) + endif() +endif() -SET(UHD_LOG_FASTPATH_DISABLE "OFF" CACHE BOOL "Disable printing of fastpath logging symbols to stderr (DOSU)") -IF(UHD_LOG_FASTPATH_DISABLE) - ADD_DEFINITIONS(-DUHD_LOG_FASTPATH_DISABLE) -ENDIF() +set(UHD_LOG_FASTPATH_DISABLE "OFF" CACHE BOOL "Disable printing of fastpath logging symbols to stderr (DOSU)") +if(UHD_LOG_FASTPATH_DISABLE) + add_definitions(-DUHD_LOG_FASTPATH_DISABLE) +endif() -IF(MSVC OR CYGWIN) - SET(UHD_LOG_CONSOLE_COLOR "OFF" CACHE BOOL "Enable color output on the terminal") -ELSE() - SET(UHD_LOG_CONSOLE_COLOR "ON" CACHE BOOL "Enable color output on the terminal") -ENDIF() +if(MSVC OR CYGWIN) + set(UHD_LOG_CONSOLE_COLOR "OFF" CACHE BOOL "Enable color output on the terminal") +else() + set(UHD_LOG_CONSOLE_COLOR "ON" CACHE BOOL "Enable color output on the terminal") +endif() -IF(UHD_LOG_CONSOLE_COLOR) - ADD_DEFINITIONS(-DUHD_LOG_CONSOLE_COLOR) -ENDIF() +if(UHD_LOG_CONSOLE_COLOR) + add_definitions(-DUHD_LOG_CONSOLE_COLOR) +endif() -SET(UHD_LOG_FILE "" CACHE FILE "Set UHD log file to a file in a existing directory") -IF(NOT UHD_LOG_FILE STREQUAL "") - ADD_DEFINITIONS(-DUHD_LOG_FILE=${UHD_LOG_FILE}) -ENDIF() +set(UHD_LOG_FILE "" CACHE FILE "Set UHD log file to a file in a existing directory") +if(NOT UHD_LOG_FILE STREQUAL "") + add_definitions(-DUHD_LOG_FILE=${UHD_LOG_FILE}) +endif() diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake index 1ba981398..9c418f331 100644 --- a/host/cmake/Modules/UHDPackage.cmake +++ b/host/cmake/Modules/UHDPackage.cmake @@ -6,169 +6,169 @@ # ######################################################################## -INCLUDE(UHDVersion) #sets version information +include(UHDVersion) #sets version information -SET(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE BOOL "set UHD to release mode to build installers") +set(UHD_RELEASE_MODE "${UHD_RELEASE_MODE}" CACHE BOOL "set UHD to release mode to build installers") ######################################################################## # Setup additional defines for OS types ######################################################################## -IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") - SET(LINUX TRUE) -ENDIF() +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(LINUX TRUE) +endif() -IF(NOT CMAKE_CROSSCOMPILING AND LINUX AND EXISTS "/etc/debian_version") - SET(DEBIAN TRUE) -ENDIF() +if(NOT CMAKE_CROSSCOMPILING AND LINUX AND EXISTS "/etc/debian_version") + set(DEBIAN TRUE) +endif() -IF(NOT CMAKE_CROSSCOMPILING AND LINUX AND EXISTS "/etc/redhat-release") - SET(REDHAT TRUE) -ENDIF() +if(NOT CMAKE_CROSSCOMPILING AND LINUX AND EXISTS "/etc/redhat-release") + set(REDHAT TRUE) +endif() ######################################################################## # Set generator type for recognized systems ######################################################################## -IF(CPACK_GENERATOR) +if(CPACK_GENERATOR) #already set -ELSEIF(APPLE) - SET(CPACK_GENERATOR PackageMaker) -ELSEIF(WIN32) - SET(CPACK_GENERATOR NSIS) -ELSEIF(DEBIAN) - SET(CPACK_GENERATOR DEB) -ELSEIF(REDHAT) - SET(CPACK_GENERATOR RPM) -ELSE() - SET(CPACK_GENERATOR TGZ) -ENDIF() +elseif(APPLE) + set(CPACK_GENERATOR PackageMaker) +elseif(WIN32) + set(CPACK_GENERATOR NSIS) +elseif(DEBIAN) + set(CPACK_GENERATOR DEB) +elseif(REDHAT) + set(CPACK_GENERATOR RPM) +else() + set(CPACK_GENERATOR TGZ) +endif() ######################################################################## # Setup package file name ######################################################################## -IF(DEBIAN AND LIBUHD_PKG) - SET(CPACK_PACKAGE_FILE_NAME "libuhd${UHD_VERSION_MAJOR}_${UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") -ELSEIF(DEBIAN AND LIBUHDDEV_PKG) - SET(CPACK_PACKAGE_FILE_NAME "libuhd-dev_${UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") -ELSEIF(DEBIAN AND UHDHOST_PKG) - SET(CPACK_PACKAGE_FILE_NAME "uhd-host_${UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") -ELSE() - IF(DEBIAN OR REDHAT) - FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release) - - IF(LSB_RELEASE_EXECUTABLE) +if(DEBIAN AND LIBUHD_PKG) + set(CPACK_PACKAGE_FILE_NAME "libuhd${UHD_VERSION_MAJOR}_${UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") +elseif(DEBIAN AND LIBUHDDEV_PKG) + set(CPACK_PACKAGE_FILE_NAME "libuhd-dev_${UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") +elseif(DEBIAN AND UHDHOST_PKG) + set(CPACK_PACKAGE_FILE_NAME "uhd-host_${UHD_VERSION}_${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") +else() + if(DEBIAN OR REDHAT) + find_program(LSB_RELEASE_EXECUTABLE lsb_release) + + if(LSB_RELEASE_EXECUTABLE) #extract system information by executing the commands - EXECUTE_PROCESS( + execute_process( COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE ) - EXECUTE_PROCESS( + execute_process( COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE ) #set a more sensible package name for this system - SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") - ENDIF(LSB_RELEASE_EXECUTABLE) - ENDIF(DEBIAN OR REDHAT) -ENDIF(DEBIAN AND LIBUHD_PKG) + set(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "") + endif(LSB_RELEASE_EXECUTABLE) + endif(DEBIAN OR REDHAT) +endif(DEBIAN AND LIBUHD_PKG) -IF(${CPACK_GENERATOR} STREQUAL NSIS) +if(${CPACK_GENERATOR} STREQUAL NSIS) - ENABLE_LANGUAGE(C) + enable_language(C) include(CheckTypeSize) check_type_size("void*[8]" BIT_WIDTH BUILTIN_TYPES_ONLY) # If CMake option given, specify MSVC version in installer filename - IF(SPECIFY_MSVC_VERSION) - IF(MSVC90) # Visual Studio 2008 (9.0) - SET(MSVC_VERSION "VS2008") - ELSEIF(MSVC10) # Visual Studio 2010 (10.0) - SET(MSVC_VERSION "VS2010") - ELSEIF(MSVC11) # Visual Studio 2012 (11.0) - SET(MSVC_VERSION "VS2012") - ELSEIF(MSVC12) # Visual Studio 2013 (12.0) - SET(MSVC_VERSION "VS2013") - ELSEIF(MSVC14) # Visual Studio 2015 (14.0) - SET(MSVC_VERSION "VS2015") - ENDIF() - SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_Win${BIT_WIDTH}_${MSVC_VERSION}" CACHE INTERNAL "") - ELSE() - SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_Win${BIT_WIDTH}" CACHE INTERNAL "") - ENDIF(SPECIFY_MSVC_VERSION) - - SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") -ENDIF() + if(SPECIFY_MSVC_VERSION) + if(MSVC90) # Visual Studio 2008 (9.0) + set(MSVC_VERSION "VS2008") + elseif(MSVC10) # Visual Studio 2010 (10.0) + set(MSVC_VERSION "VS2010") + elseif(MSVC11) # Visual Studio 2012 (11.0) + set(MSVC_VERSION "VS2012") + elseif(MSVC12) # Visual Studio 2013 (12.0) + set(MSVC_VERSION "VS2013") + elseif(MSVC14) # Visual Studio 2015 (14.0) + set(MSVC_VERSION "VS2015") + endif() + set(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_Win${BIT_WIDTH}_${MSVC_VERSION}" CACHE INTERNAL "") + else() + set(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_Win${BIT_WIDTH}" CACHE INTERNAL "") + endif(SPECIFY_MSVC_VERSION) + + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") +endif() ######################################################################## # Setup CPack General ######################################################################## -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - USRP Hardware Driver") -SET(CPACK_PACKAGE_VENDOR "Ettus Research (National Instruments)") -SET(CPACK_PACKAGE_CONTACT "Ettus Research <support@ettus.com>") -SET(CPACK_PACKAGE_VERSION "${UHD_VERSION}") -SET(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.md) -SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ettus Research - USRP Hardware Driver") +set(CPACK_PACKAGE_VENDOR "Ettus Research (National Instruments)") +set(CPACK_PACKAGE_CONTACT "Ettus Research <support@ettus.com>") +set(CPACK_PACKAGE_VERSION "${UHD_VERSION}") +set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.md) +set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE) ######################################################################## # Setup CPack Source ######################################################################## -SET(CPACK_SOURCE_PACKAGE_FILE_NAME "uhd-${UHD_VERSION}" CACHE INTERNAL "") -SET(CPACK_SOURCE_IGNORE_FILES "\\\\.git*;\\\\.swp$") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "uhd-${UHD_VERSION}" CACHE INTERNAL "") +set(CPACK_SOURCE_IGNORE_FILES "\\\\.git*;\\\\.swp$") ######################################################################## # Setup CPack Components ######################################################################## -SET(CPACK_COMPONENT_LIBRARIES_GROUP "Development") -SET(CPACK_COMPONENT_PYTHONAPI_GROUP "Development") -SET(CPACK_COMPONENT_HEADERS_GROUP "Development") -SET(CPACK_COMPONENT_UTILITIES_GROUP "Runtime") -SET(CPACK_COMPONENT_EXAMPLES_GROUP "Runtime") -SET(CPACK_COMPONENT_MANUAL_GROUP "Documentation") -SET(CPACK_COMPONENT_DOXYGEN_GROUP "Documentation") -SET(CPACK_COMPONENT_README_GROUP "Documentation") - -SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") -SET(CPACK_COMPONENT_PYTHONAPI_DISPLAY_NAME "UHD Python API") -SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") -SET(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME "Utilities") -SET(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples") -SET(CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Manual") -SET(CPACK_COMPONENT_DOXYGEN_DISPLAY_NAME "Doxygen") -SET(CPACK_COMPONENT_README_DISPLAY_NAME "Readme") -SET(CPACK_COMPONENT_IMAGES_DISPLAY_NAME "Images") - -SET(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic link library") -SET(CPACK_COMPONENT_PYTHONAPI_DESCRIPTION "UHD Python API") -SET(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ development headers") -SET(CPACK_COMPONENT_UTILITIES_DESCRIPTION "Utility executables and python scripts") -SET(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Example executables") -SET(CPACK_COMPONENT_MANUAL_DESCRIPTION "Manual/application notes (rst and html)") -SET(CPACK_COMPONENT_DOXYGEN_DESCRIPTION "API documentation (html)") -SET(CPACK_COMPONENT_README_DESCRIPTION "Readme files (txt)") -SET(CPACK_COMPONENT_IMAGES_DESCRIPTION "FPGA and firmware images") - -SET(CPACK_COMPONENT_README_REQUIRED TRUE) - -SET(CPACK_COMPONENT_UTILITIES_DEPENDS libraries) -SET(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries) -SET(CPACK_COMPONENT_TESTS_DEPENDS libraries) - -SET(CPACK_COMPONENTS_ALL libraries pythonapi headers utilities examples manual doxygen readme images) +set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") +set(CPACK_COMPONENT_PYTHONAPI_GROUP "Development") +set(CPACK_COMPONENT_HEADERS_GROUP "Development") +set(CPACK_COMPONENT_UTILITIES_GROUP "Runtime") +set(CPACK_COMPONENT_EXAMPLES_GROUP "Runtime") +set(CPACK_COMPONENT_MANUAL_GROUP "Documentation") +set(CPACK_COMPONENT_DOXYGEN_GROUP "Documentation") +set(CPACK_COMPONENT_README_GROUP "Documentation") + +set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries") +set(CPACK_COMPONENT_PYTHONAPI_DISPLAY_NAME "UHD Python API") +set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ Headers") +set(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME "Utilities") +set(CPACK_COMPONENT_EXAMPLES_DISPLAY_NAME "Examples") +set(CPACK_COMPONENT_MANUAL_DISPLAY_NAME "Manual") +set(CPACK_COMPONENT_DOXYGEN_DISPLAY_NAME "Doxygen") +set(CPACK_COMPONENT_README_DISPLAY_NAME "Readme") +set(CPACK_COMPONENT_IMAGES_DISPLAY_NAME "Images") + +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "Dynamic link library") +set(CPACK_COMPONENT_PYTHONAPI_DESCRIPTION "UHD Python API") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION "C++ development headers") +set(CPACK_COMPONENT_UTILITIES_DESCRIPTION "Utility executables and python scripts") +set(CPACK_COMPONENT_EXAMPLES_DESCRIPTION "Example executables") +set(CPACK_COMPONENT_MANUAL_DESCRIPTION "Manual/application notes (rst and html)") +set(CPACK_COMPONENT_DOXYGEN_DESCRIPTION "API documentation (html)") +set(CPACK_COMPONENT_README_DESCRIPTION "Readme files (txt)") +set(CPACK_COMPONENT_IMAGES_DESCRIPTION "FPGA and firmware images") + +set(CPACK_COMPONENT_README_REQUIRED TRUE) + +set(CPACK_COMPONENT_UTILITIES_DEPENDS libraries) +set(CPACK_COMPONENT_EXAMPLES_DEPENDS libraries) +set(CPACK_COMPONENT_TESTS_DEPENDS libraries) + +set(CPACK_COMPONENTS_ALL libraries pythonapi headers utilities examples manual doxygen readme images) ######################################################################## # Setup CPack Debian ######################################################################## -SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-all-dev, python-requests") -SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk") -FOREACH(filename preinst postinst prerm postrm) - LIST(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_BINARY_DIR}/debian/${filename}) - FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian) - CONFIGURE_FILE( +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-all-dev, python-requests") +set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "python, python-tk") +foreach(filename preinst postinst prerm postrm) + list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_BINARY_DIR}/debian/${filename}) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian) + configure_file( ${CMAKE_SOURCE_DIR}/cmake/debian/${filename}.in ${CMAKE_BINARY_DIR}/debian/${filename} @ONLY) -ENDFOREACH(filename) -CONFIGURE_FILE( +endforeach(filename) +configure_file( ${CMAKE_SOURCE_DIR}/cmake/debian/watch ${CMAKE_BINARY_DIR}/debian/watch @ONLY) @@ -176,37 +176,37 @@ CONFIGURE_FILE( ######################################################################## # Setup CPack RPM ######################################################################## -SET(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, python-requests") +set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, python-requests") -FOREACH(filename post_install post_uninstall pre_install pre_uninstall) - STRING(TOUPPER ${filename} filename_upper) - LIST(APPEND CPACK_RPM_${filename_upper}_SCRIPT_FILE ${CMAKE_BINARY_DIR}/redhat/${filename}) - FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/redhat) - CONFIGURE_FILE( +foreach(filename post_install post_uninstall pre_install pre_uninstall) + string(TOUPPER ${filename} filename_upper) + list(APPEND CPACK_RPM_${filename_upper}_SCRIPT_FILE ${CMAKE_BINARY_DIR}/redhat/${filename}) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/redhat) + configure_file( ${CMAKE_SOURCE_DIR}/cmake/redhat/${filename}.in ${CMAKE_BINARY_DIR}/redhat/${filename} @ONLY) -ENDFOREACH(filename) +endforeach(filename) ######################################################################## # Setup CPack NSIS ######################################################################## -SET(CPACK_NSIS_MODIFY_PATH ON) +set(CPACK_NSIS_MODIFY_PATH ON) -SET(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"") +set(HLKM_ENV "\\\"SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\\\\Environment\\\"") -SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " +set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " WriteRegStr HKLM ${HLKM_ENV} \\\"UHD_PKG_PATH\\\" \\\"$INSTDIR\\\" ") -SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " +set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_PATH\\\" ") -IF(WIN32) +if(WIN32) #Install necessary runtime DLL's - INCLUDE(InstallRequiredSystemLibraries) -ENDIF(WIN32) + include(InstallRequiredSystemLibraries) +endif(WIN32) ######################################################################## -INCLUDE(CPack) #include after setting vars +include(CPack) #include after setting vars diff --git a/host/cmake/Modules/UHDPython.cmake b/host/cmake/Modules/UHDPython.cmake index f8f3686c8..fb5874ada 100644 --- a/host/cmake/Modules/UHDPython.cmake +++ b/host/cmake/Modules/UHDPython.cmake @@ -5,58 +5,58 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -IF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE) -SET(INCLUDED_UHD_PYTHON_CMAKE TRUE) +if(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE) +set(INCLUDED_UHD_PYTHON_CMAKE TRUE) ######################################################################## # Setup Python ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring the python interpreter...") +message(STATUS "") +message(STATUS "Configuring the python interpreter...") #this allows the user to override PYTHON_EXECUTABLE -IF(PYTHON_EXECUTABLE) +if(PYTHON_EXECUTABLE) - SET(PYTHONINTERP_FOUND TRUE) + set(PYTHONINTERP_FOUND TRUE) #otherwise if not set, try to automatically find it -ELSE(PYTHON_EXECUTABLE) +else(PYTHON_EXECUTABLE) #use the built-in find script - IF(ENABLE_PYTHON3) - FIND_PACKAGE(PythonInterp 3.0) - ELSE(ENABLE_PYTHON3) - FIND_PACKAGE(PythonInterp 2.0) - ENDIF(ENABLE_PYTHON3) + if(ENABLE_PYTHON3) + find_package(PythonInterp 3.0) + else(ENABLE_PYTHON3) + find_package(PythonInterp 2.0) + endif(ENABLE_PYTHON3) #and if that fails use the find program routine - IF(NOT PYTHONINTERP_FOUND) - IF(ENABLE_PYTHON3) - FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python3 python3.5 python3.6) - ELSE(ENABLE_PYTHON3) - FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python2 python2.7) - ENDIF(ENABLE_PYTHON3) + if(NOT PYTHONINTERP_FOUND) + if(ENABLE_PYTHON3) + find_program(PYTHON_EXECUTABLE NAMES python3 python3.5 python3.6) + else(ENABLE_PYTHON3) + find_program(PYTHON_EXECUTABLE NAMES python2 python2.7) + endif(ENABLE_PYTHON3) - IF(PYTHON_EXECUTABLE) - SET(PYTHONINTERP_FOUND TRUE) - ENDIF(PYTHON_EXECUTABLE) - ENDIF(NOT PYTHONINTERP_FOUND) + if(PYTHON_EXECUTABLE) + set(PYTHONINTERP_FOUND TRUE) + endif(PYTHON_EXECUTABLE) + endif(NOT PYTHONINTERP_FOUND) -ENDIF(PYTHON_EXECUTABLE) +endif(PYTHON_EXECUTABLE) #make the path to the executable appear in the cmake gui -SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") +set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter") -MESSAGE(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}") -MESSAGE(STATUS "Override with: -DPYTHON_EXECUTABLE=<path-to-python>") +message(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}") +message(STATUS "Override with: -DPYTHON_EXECUTABLE=<path-to-python>") -IF(NOT PYTHONINTERP_FOUND) - MESSAGE(FATAL_ERROR "Error: Python interpreter required by the build system.") -ENDIF(NOT PYTHONINTERP_FOUND) +if(NOT PYTHONINTERP_FOUND) + message(FATAL_ERROR "Error: Python interpreter required by the build system.") +endif(NOT PYTHONINTERP_FOUND) -MACRO(PYTHON_CHECK_MODULE desc mod cmd have) - MESSAGE(STATUS "") - MESSAGE(STATUS "Python checking for ${desc}") - EXECUTE_PROCESS( +macro(PYTHON_CHECK_MODULE desc mod cmd have) + message(STATUS "") + message(STATUS "Python checking for ${desc}") + execute_process( COMMAND ${PYTHON_EXECUTABLE} -c " ######################################### from distutils.version import LooseVersion @@ -68,19 +68,19 @@ exit(0) #########################################" RESULT_VARIABLE ${have} ) - IF(${have} EQUAL 0) - MESSAGE(STATUS "Python checking for ${desc} - found") - SET(${have} TRUE) - ELSEIF(${have} EQUAL 1) - MESSAGE(STATUS "Python checking for ${desc} - \"import ${mod}\" failed") - SET(${have} FALSE) - ELSEIF(${have} EQUAL 2) - MESSAGE(STATUS "Python checking for ${desc} - \"assert ${cmd}\" failed") - SET(${have} FALSE) - ELSE() - MESSAGE(STATUS "Python checking for ${desc} - unknown error") - SET(${have} FALSE) - ENDIF() -ENDMACRO(PYTHON_CHECK_MODULE) + if(${have} EQUAL 0) + message(STATUS "Python checking for ${desc} - found") + set(${have} TRUE) + elseif(${have} EQUAL 1) + message(STATUS "Python checking for ${desc} - \"import ${mod}\" failed") + set(${have} FALSE) + elseif(${have} EQUAL 2) + message(STATUS "Python checking for ${desc} - \"assert ${cmd}\" failed") + set(${have} FALSE) + else() + message(STATUS "Python checking for ${desc} - unknown error") + set(${have} FALSE) + endif() +endmacro(PYTHON_CHECK_MODULE) -ENDIF(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE) +endif(NOT DEFINED INCLUDED_UHD_PYTHON_CMAKE) diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake index db245484c..7937db4d3 100644 --- a/host/cmake/Modules/UHDUnitTest.cmake +++ b/host/cmake/Modules/UHDUnitTest.cmake @@ -36,8 +36,8 @@ function(UHD_ADD_TEST test_name) #http://www.cmake.org/pipermail/cmake/2009-May/029464.html #Replaced this add test + set environs code with the shell script generation. #Its nicer to be able to manually run the shell script to diagnose problems. - #ADD_TEST(${ARGV}) - #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") + #add_test(${ARGV}) + #set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${environs}") if(UNIX) set(LD_PATH_VAR "LD_LIBRARY_PATH") diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake index 2cee7db6f..0021ddec9 100644 --- a/host/cmake/Modules/UHDVersion.cmake +++ b/host/cmake/Modules/UHDVersion.cmake @@ -6,8 +6,8 @@ # ######################################################################## -INCLUDE(UHDPython) #requires python for parsing -FIND_PACKAGE(Git QUIET) +include(UHDPython) #requires python for parsing +find_package(Git QUIET) ######################################################################## # Setup Version Numbers @@ -17,64 +17,64 @@ FIND_PACKAGE(Git QUIET) # - Increment patch for bugfixes and docs # - set UHD_VERSION_DEVEL to true for master and development branches ######################################################################## -SET(UHD_VERSION_MAJOR 3) -SET(UHD_VERSION_API 14) -SET(UHD_VERSION_ABI 0) -SET(UHD_VERSION_PATCH 0) -SET(UHD_VERSION_DEVEL TRUE) +set(UHD_VERSION_MAJOR 3) +set(UHD_VERSION_API 14) +set(UHD_VERSION_ABI 0) +set(UHD_VERSION_PATCH 0) +set(UHD_VERSION_DEVEL TRUE) ######################################################################## # If we're on a development branch, we skip the patch version ######################################################################## -IF(DEFINED UHD_VERSION_PATCH_OVERRIDE) - SET(UHD_VERSION_DEVEL FALSE) - SET(UHD_VERSION_PATCH ${UHD_VERSION_PATCH_OVERRIDE}) -ENDIF(DEFINED UHD_VERSION_PATCH_OVERRIDE) -IF(NOT DEFINED UHD_VERSION_DEVEL) - SET(UHD_VERSION_DEVEL FALSE) -ENDIF(NOT DEFINED UHD_VERSION_DEVEL) -SET(UHD_GIT_BRANCH "") -IF(GIT_FOUND) - EXECUTE_PROCESS( +if(DEFINED UHD_VERSION_PATCH_OVERRIDE) + set(UHD_VERSION_DEVEL FALSE) + set(UHD_VERSION_PATCH ${UHD_VERSION_PATCH_OVERRIDE}) +endif(DEFINED UHD_VERSION_PATCH_OVERRIDE) +if(NOT DEFINED UHD_VERSION_DEVEL) + set(UHD_VERSION_DEVEL FALSE) +endif(NOT DEFINED UHD_VERSION_DEVEL) +set(UHD_GIT_BRANCH "") +if(GIT_FOUND) + execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE _git_branch OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _git_branch_result ) - IF(_git_branch_result EQUAL 0) - SET(UHD_GIT_BRANCH ${_git_branch}) - IF(UHD_GIT_BRANCH MATCHES "^UHD-") - MESSAGE(STATUS "Operating on release branch (${UHD_GIT_BRANCH}).") - SET(UHD_VERSION_DEVEL FALSE) - ELSEIF(UHD_GIT_BRANCH STREQUAL "master") - MESSAGE(STATUS "Operating on master branch.") - SET(UHD_VERSION_DEVEL TRUE) - ELSE() - MESSAGE(STATUS "Working off of feature or development branch. Updating version number.") - EXECUTE_PROCESS( + if(_git_branch_result EQUAL 0) + set(UHD_GIT_BRANCH ${_git_branch}) + if(UHD_GIT_BRANCH MATCHES "^UHD-") + message(STATUS "Operating on release branch (${UHD_GIT_BRANCH}).") + set(UHD_VERSION_DEVEL FALSE) + elseif(UHD_GIT_BRANCH STREQUAL "master") + message(STATUS "Operating on master branch.") + set(UHD_VERSION_DEVEL TRUE) + else() + message(STATUS "Working off of feature or development branch. Updating version number.") + execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "print('${_git_branch}'.replace('/', '-'))" OUTPUT_VARIABLE _git_safe_branch OUTPUT_STRIP_TRAILING_WHITESPACE ) - SET(UHD_VERSION_PATCH ${_git_safe_branch}) - SET(UHD_VERSION_DEVEL TRUE) - ENDIF() - ELSE() - MESSAGE(STATUS "Could not determine git branch. Probably building from tarball.") - ENDIF() -ELSE(GIT_FOUND) - MESSAGE(WARNING "Could not detect git executable! Could not determine exact version of UHD!") -ENDIF(GIT_FOUND) -IF(DEFINED UHD_GIT_BRANCH_OVERRIDE) - MESSAGE(STATUS "Overriding auto-detected git branch and setting to: ${UHD_GIT_BRANCH_OVERRIDE}") - SET(UHD_GIT_BRANCH ${UHD_GIT_BRANCH_OVERRIDE}) -ENDIF(DEFINED UHD_GIT_BRANCH_OVERRIDE) + set(UHD_VERSION_PATCH ${_git_safe_branch}) + set(UHD_VERSION_DEVEL TRUE) + endif() + else() + message(STATUS "Could not determine git branch. Probably building from tarball.") + endif() +else(GIT_FOUND) + message(WARNING "Could not detect git executable! Could not determine exact version of UHD!") +endif(GIT_FOUND) +if(DEFINED UHD_GIT_BRANCH_OVERRIDE) + message(STATUS "Overriding auto-detected git branch and setting to: ${UHD_GIT_BRANCH_OVERRIDE}") + set(UHD_GIT_BRANCH ${UHD_GIT_BRANCH_OVERRIDE}) +endif(DEFINED UHD_GIT_BRANCH_OVERRIDE) ######################################################################## # Version information discovery through git log ######################################################################## #grab the git ref id for the current head -EXECUTE_PROCESS( +execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8 --long OUTPUT_VARIABLE _git_describe OUTPUT_STRIP_TRAILING_WHITESPACE @@ -82,9 +82,9 @@ EXECUTE_PROCESS( ) #only set the build info on success -IF(_git_describe_result EQUAL 0) - IF(NOT UHD_GIT_COUNT) - EXECUTE_PROCESS( +if(_git_describe_result EQUAL 0) + if(NOT UHD_GIT_COUNT) + execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${PYTHON_EXECUTABLE} -c " try: @@ -94,9 +94,9 @@ except IndexError: " OUTPUT_VARIABLE UHD_GIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE ) - ENDIF() - IF(NOT UHD_GIT_HASH) - EXECUTE_PROCESS( + endif() + if(NOT UHD_GIT_HASH) + execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${PYTHON_EXECUTABLE} -c " try: @@ -106,42 +106,42 @@ except IndexError: " OUTPUT_VARIABLE UHD_GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) - ENDIF() -ENDIF() + endif() +endif() ## Set default values if all fails. Make sure they're identical to the ones above. -IF(NOT UHD_GIT_COUNT) - SET(UHD_GIT_COUNT "0") -ENDIF() +if(NOT UHD_GIT_COUNT) + set(UHD_GIT_COUNT "0") +endif() -IF(NOT UHD_GIT_HASH) - SET(UHD_GIT_HASH "unknown") -ENDIF() +if(NOT UHD_GIT_HASH) + set(UHD_GIT_HASH "unknown") +endif() -IF(UHD_RELEASE_MODE) - SET(UHD_GIT_HASH ${UHD_RELEASE_MODE}) +if(UHD_RELEASE_MODE) + set(UHD_GIT_HASH ${UHD_RELEASE_MODE}) #Ignore UHD_GIT_COUNT in UHD_VERSION if the string 'release' is in UHD_RELEASE_MODE - EXECUTE_PROCESS( + execute_process( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${PYTHON_EXECUTABLE} -c "print ('release' in '${UHD_RELEASE_MODE}') or ('rc' in '${UHD_RELEASE_MODE}')" OUTPUT_VARIABLE TRIM_UHD_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) -ENDIF() +endif() ######################################################################## # Define the derived version variables: -IF(DEFINED UHD_VERSION) - SET(UHD_VERSION "${UHD_VERSION}" CACHE STRING "Set UHD_VERSION to a custom value") -ELSEIF(TRIM_UHD_VERSION STREQUAL "True") - SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}.${UHD_VERSION_PATCH}-${UHD_GIT_HASH}") -ELSE() - SET(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}") -ENDIF() -IF(DEFINED UHD_ABI_VERSION) - SET(UHD_ABI_VERSION "${UHD_ABI_VERSION}" +if(DEFINED UHD_VERSION) + set(UHD_VERSION "${UHD_VERSION}" CACHE STRING "Set UHD_VERSION to a custom value") +elseif(TRIM_UHD_VERSION STREQUAL "True") + set(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}.${UHD_VERSION_PATCH}-${UHD_GIT_HASH}") +else() + set(UHD_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}.${UHD_VERSION_PATCH}-${UHD_GIT_COUNT}-${UHD_GIT_HASH}") +endif() +if(DEFINED UHD_ABI_VERSION) + set(UHD_ABI_VERSION "${UHD_ABI_VERSION}" CACHE STRING "Set UHD_ABI_VERSION to a custom value") -ELSE() - SET(UHD_ABI_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}") -ENDIF() +else() + set(UHD_ABI_VERSION "${UHD_VERSION_MAJOR}.${UHD_VERSION_API}.${UHD_VERSION_ABI}") +endif() diff --git a/host/cmake/Toolchains/mingw_cross.cmake b/host/cmake/Toolchains/mingw_cross.cmake index f1406ec46..264e1a597 100644 --- a/host/cmake/Toolchains/mingw_cross.cmake +++ b/host/cmake/Toolchains/mingw_cross.cmake @@ -3,10 +3,10 @@ # most likely default if none given. # -SET(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_NAME Windows) -IF(NOT DEFINED MINGW_PREFIX) - SET(POSSIBLE_PREFIXES +if(NOT DEFINED MINGW_PREFIX) + set(POSSIBLE_PREFIXES i586-mingw32msvc i686-pc-mingw32 x86_64-pc-mingw32 @@ -14,36 +14,36 @@ IF(NOT DEFINED MINGW_PREFIX) x86_64-w64-mingw32 ) - SET(MINGW_FOUND 0) - FOREACH(prefix ${POSSIBLE_PREFIXES}) - IF(EXISTS /usr/${prefix}) - SET(MINGW_PREFIX ${prefix}) - SET(MINGW_FOUND 1) - BREAK() - ENDIF(EXISTS /usr/${prefix}) - ENDFOREACH(prefix ${POSSIBLE_PREFIXES}) + set(MINGW_FOUND 0) + foreach(prefix ${POSSIBLE_PREFIXES}) + if(EXISTS /usr/${prefix}) + set(MINGW_PREFIX ${prefix}) + set(MINGW_FOUND 1) + break() + endif(EXISTS /usr/${prefix}) + endforeach(prefix ${POSSIBLE_PREFIXES}) - IF(NOT MINGW_FOUND) - MESSAGE(FATAL_ERROR "No MinGW type specified, but none detected in the usual locations.") - ENDIF(NOT MINGW_FOUND) -ENDIF(NOT DEFINED MINGW_PREFIX) + if(NOT MINGW_FOUND) + message(FATAL_ERROR "No MinGW type specified, but none detected in the usual locations.") + endif(NOT MINGW_FOUND) +endif(NOT DEFINED MINGW_PREFIX) -SET(MINGW_PREFIX ${MINGW_PREFIX} CACHE STRING "MinGW prefix") +set(MINGW_PREFIX ${MINGW_PREFIX} CACHE STRING "MinGW prefix") -SET(CMAKE_C_COMPILER ${MINGW_PREFIX}-gcc) -SET(CMAKE_CXX_COMPILER ${MINGW_PREFIX}-g++) -SET(CMAKE_RC_COMPILER ${MINGW_PREFIX}-windres) +set(CMAKE_C_COMPILER ${MINGW_PREFIX}-gcc) +set(CMAKE_CXX_COMPILER ${MINGW_PREFIX}-g++) +set(CMAKE_RC_COMPILER ${MINGW_PREFIX}-windres) -IF(NOT DEFINED CMAKE_FIND_ROOT_PATH) - SET(CMAKE_FIND_ROOT_PATH /usr/${MINGW_PREFIX}) -ENDIF(NOT DEFINED CMAKE_FIND_ROOT_PATH) +if(NOT DEFINED CMAKE_FIND_ROOT_PATH) + set(CMAKE_FIND_ROOT_PATH /usr/${MINGW_PREFIX}) +endif(NOT DEFINED CMAKE_FIND_ROOT_PATH) -SET(CMAKE_INCLUDE_PATH +set(CMAKE_INCLUDE_PATH ${CMAKE_FIND_ROOT_PATH}/local/include ${CMAKE_FIND_ROOT_PATH}/include ) -SET(CMAKE_LIBRARY_PATH +set(CMAKE_LIBRARY_PATH ${CMAKE_FIND_ROOT_PATH}/local/lib ${CMAKE_FIND_ROOT_PATH}/lib ) diff --git a/host/cmake/cmake_uninstall.cmake.in b/host/cmake/cmake_uninstall.cmake.in index b4d731a14..c22bb4a10 100644 --- a/host/cmake/cmake_uninstall.cmake.in +++ b/host/cmake/cmake_uninstall.cmake.in @@ -1,34 +1,34 @@ # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F -IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") -FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -STRING(REGEX REPLACE "\n" ";" files "${files}") -FOREACH(file ${files}) - MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") - IF(EXISTS "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if(EXISTS "$ENV{DESTDIR}${file}") + exec_program( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) - IF(NOT "${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") - ENDIF(NOT "${rm_retval}" STREQUAL 0) - ELSEIF(NOT "${CMAKE_VERSION}" STRLESS "2.8.1") - IF(IS_SYMLINK "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif(NOT "${rm_retval}" STREQUAL 0) + elseif(NOT "${CMAKE_VERSION}" STRLESS "2.8.1") + if(IS_SYMLINK "$ENV{DESTDIR}${file}") + exec_program( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) - IF(NOT "${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") - ENDIF(NOT "${rm_retval}" STREQUAL 0) - ENDIF(IS_SYMLINK "$ENV{DESTDIR}${file}") - ELSE(EXISTS "$ENV{DESTDIR}${file}") - MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") - ENDIF(EXISTS "$ENV{DESTDIR}${file}") -ENDFOREACH(file) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif(NOT "${rm_retval}" STREQUAL 0) + endif(IS_SYMLINK "$ENV{DESTDIR}${file}") + else(EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif(EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) diff --git a/host/docs/CMakeLists.txt b/host/docs/CMakeLists.txt index 8a9c8b7f4..c65bc2c0a 100644 --- a/host/docs/CMakeLists.txt +++ b/host/docs/CMakeLists.txt @@ -12,8 +12,8 @@ ######################################################################## # Setup general Doxygen variables ######################################################################## -FIND_PACKAGE(Doxygen) -SET(ENABLE_MANUAL_OR_DOXYGEN false) +find_package(Doxygen) +set(ENABLE_MANUAL_OR_DOXYGEN false) ######################################################################## # Setup Manual (using Doxygen) @@ -26,102 +26,102 @@ LIBUHD_REGISTER_COMPONENT("Manual" ENABLE_MANUAL ON "DOXYGEN_FOUND" OFF OFF) # If no: # - Make FPGA Manual reference link to our website -IF(ENABLE_MANUAL) - SET(ENABLE_MANUAL_OR_DOXYGEN true) +if(ENABLE_MANUAL) + set(ENABLE_MANUAL_OR_DOXYGEN true) # First: Set up UHD manual only - FILE(GLOB manual_sources "*.dox") - SET(DOXYGEN_DEPENDENCIES ${manual_sources}) - SET(DOXYGEN_INPUT_DIRS "${CMAKE_SOURCE_DIR}/docs ${CMAKE_CURRENT_BINARY_DIR}") - SET(DOXYGEN_DEP_COMPONENT "manual") - SET(DOXYGEN_FPGA_MANUAL_REFERENCE "<a href=\"http://files.ettus.com/manual/md_fpga.html\">Part III: FPGA Manual</a>") - SET(DOXYGEN_STRIP_EXTRA "") - SET(DOXYGEN_EXCLUDE_DIRS "") - IF(NOT ENABLE_RFNOC) - SET(DOXYGEN_EXCLUDE_DIRS "${DOXYGEN_EXCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include/uhd/rfnoc") - ENDIF(NOT ENABLE_RFNOC) + file(GLOB manual_sources "*.dox") + set(DOXYGEN_DEPENDENCIES ${manual_sources}) + set(DOXYGEN_INPUT_DIRS "${CMAKE_SOURCE_DIR}/docs ${CMAKE_CURRENT_BINARY_DIR}") + set(DOXYGEN_DEP_COMPONENT "manual") + set(DOXYGEN_FPGA_MANUAL_REFERENCE "<a href=\"http://files.ettus.com/manual/md_fpga.html\">Part III: FPGA Manual</a>") + set(DOXYGEN_STRIP_EXTRA "") + set(DOXYGEN_EXCLUDE_DIRS "") + if(NOT ENABLE_RFNOC) + set(DOXYGEN_EXCLUDE_DIRS "${DOXYGEN_EXCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include/uhd/rfnoc") + endif(NOT ENABLE_RFNOC) # Now, check if we have the FPGA sources as well. # If so, pull them in: - IF(HAS_FPGA_SUBMODULE) - FILE(GLOB_RECURSE fpga_manual_sources "${FPGA_SUBMODULE_DIR}/docs/*.md") - LIST(APPEND manual_sources ${fpga_manual_sources}) - SET(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${FPGA_SUBMODULE_DIR}/docs") - SET(DOXYGEN_FPGA_MANUAL_REFERENCE "\\subpage md_fpga \"Part III: FPGA Manual\"") - SET(DOXYGEN_STRIP_EXTRA "${FPGA_SUBMODULE_DIR}/docs") - ENDIF(HAS_FPGA_SUBMODULE) - CONFIGURE_FILE( + if(HAS_FPGA_SUBMODULE) + file(GLOB_RECURSE fpga_manual_sources "${FPGA_SUBMODULE_DIR}/docs/*.md") + list(APPEND manual_sources ${fpga_manual_sources}) + set(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${FPGA_SUBMODULE_DIR}/docs") + set(DOXYGEN_FPGA_MANUAL_REFERENCE "\\subpage md_fpga \"Part III: FPGA Manual\"") + set(DOXYGEN_STRIP_EXTRA "${FPGA_SUBMODULE_DIR}/docs") + endif(HAS_FPGA_SUBMODULE) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/mainpage.dox.in ${CMAKE_CURRENT_BINARY_DIR}/mainpage.dox @ONLY) -ENDIF(ENABLE_MANUAL) +endif(ENABLE_MANUAL) ######################################################################## # Setup API documentation (using Doxygen) ######################################################################## LIBUHD_REGISTER_COMPONENT("API/Doxygen" ENABLE_DOXYGEN ON "DOXYGEN_FOUND" OFF OFF) -OPTION(ENABLE_DOXYGEN_FULL "Use Doxygen to document the entire source tree (not just API)" OFF) -OPTION(ENABLE_DOXYGEN_DOT "Let Doxygen use dot (requires graphviz)" OFF) -OPTION(ENABLE_DOXYGEN_SHORTNAMES "Let Doxygen use shorter filenames (helps on Windows)" OFF) +option(ENABLE_DOXYGEN_FULL "Use Doxygen to document the entire source tree (not just API)" OFF) +option(ENABLE_DOXYGEN_DOT "Let Doxygen use dot (requires graphviz)" OFF) +option(ENABLE_DOXYGEN_SHORTNAMES "Let Doxygen use shorter filenames (helps on Windows)" OFF) -IF(LIBUHDDEV_PKG) - SET(PKG_DOC_DIR share/doc/libuhd-dev) -ENDIF(LIBUHDDEV_PKG) +if(LIBUHDDEV_PKG) + set(PKG_DOC_DIR share/doc/libuhd-dev) +endif(LIBUHDDEV_PKG) -IF(ENABLE_DOXYGEN) - SET(ENABLE_MANUAL_OR_DOXYGEN true) +if(ENABLE_DOXYGEN) + set(ENABLE_MANUAL_OR_DOXYGEN true) #make doxygen directory depend on the header files - FILE(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) - FILE(GLOB_RECURSE h_files ${CMAKE_SOURCE_DIR}/include/*.h) - LIST(APPEND header_files ${h_files}) - SET(DOXYGEN_DEPENDENCIES ${DOXYGEN_DEPENDENCIES} ${header_files} "${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/gen_basic_funcs.py") - IF(ENABLE_DOXYGEN_FULL) - SET(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/python") - ELSE(ENABLE_DOXYGEN_FULL) - SET(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include") - ENDIF(ENABLE_DOXYGEN_FULL) - - SET(DOXYGEN_DEP_COMPONENT "doxygen") -ENDIF(ENABLE_DOXYGEN) + file(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) + file(GLOB_RECURSE h_files ${CMAKE_SOURCE_DIR}/include/*.h) + list(APPEND header_files ${h_files}) + set(DOXYGEN_DEPENDENCIES ${DOXYGEN_DEPENDENCIES} ${header_files} "${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/gen_basic_funcs.py") + if(ENABLE_DOXYGEN_FULL) + set(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/python") + else(ENABLE_DOXYGEN_FULL) + set(DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS} ${CMAKE_SOURCE_DIR}/include") + endif(ENABLE_DOXYGEN_FULL) + + set(DOXYGEN_DEP_COMPONENT "doxygen") +endif(ENABLE_DOXYGEN) ######################################################################## # Run Doxygen (on code and/or manual, depending on CMake flags) ######################################################################## -IF(ENABLE_MANUAL_OR_DOXYGEN) +if(ENABLE_MANUAL_OR_DOXYGEN) #generate the doxygen configuration file - SET(CMAKE_CURRENT_BINARY_DIR_DOXYGEN ${CMAKE_CURRENT_BINARY_DIR}/doxygen) - IF(ENABLE_DOXYGEN_DOT) - SET(DOXYGEN_HAVE_DOT "YES") - ELSE(ENABLE_DOXYGEN_DOT) - SET(DOXYGEN_HAVE_DOT "NO") - ENDIF(ENABLE_DOXYGEN_DOT) - IF(ENABLE_DOXYGEN_SHORTNAMES) - SET(DOXYGEN_SHORT_NAMES "YES") - ELSE(ENABLE_DOXYGEN_SHORTNAMES) - SET(DOXYGEN_SHORT_NAMES "NO") - ENDIF(ENABLE_DOXYGEN_SHORTNAMES) - - CONFIGURE_FILE( + set(CMAKE_CURRENT_BINARY_DIR_DOXYGEN ${CMAKE_CURRENT_BINARY_DIR}/doxygen) + if(ENABLE_DOXYGEN_DOT) + set(DOXYGEN_HAVE_DOT "YES") + else(ENABLE_DOXYGEN_DOT) + set(DOXYGEN_HAVE_DOT "NO") + endif(ENABLE_DOXYGEN_DOT) + if(ENABLE_DOXYGEN_SHORTNAMES) + set(DOXYGEN_SHORT_NAMES "YES") + else(ENABLE_DOXYGEN_SHORTNAMES) + set(DOXYGEN_SHORT_NAMES "NO") + endif(ENABLE_DOXYGEN_SHORTNAMES) + + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) #make doxygen directory depend on the header files - FILE(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) - ADD_CUSTOM_COMMAND( + file(GLOB_RECURSE header_files ${CMAKE_SOURCE_DIR}/include/*.hpp) + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DEPENDS ${DOXYGEN_DEPENDENCIES} COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile COMMENT "Generating documentation with doxygen" ) #make the doxygen generation a built-time dependency - ADD_CUSTOM_TARGET(doxygen_docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN}) + add_custom_target(doxygen_docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN}) UHD_INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} DESTINATION ${PKG_DOC_DIR} COMPONENT ${DOXYGEN_DEP_COMPONENT}) -ENDIF(ENABLE_MANUAL_OR_DOXYGEN) +endif(ENABLE_MANUAL_OR_DOXYGEN) ######################################################################## # List of man page sources ######################################################################## -SET(man_page_sources +set(man_page_sources octoclock_firmware_burner.1 uhd_cal_rx_iq_balance.1 uhd_cal_tx_dc_offset.1 @@ -139,23 +139,23 @@ SET(man_page_sources ######################################################################## # Setup man pages ######################################################################## -FIND_PACKAGE(GZip) +find_package(GZip) # No elegant way in CMake to reverse a boolean -IF(NOT WIN32) - SET(NOT_WIN32 TRUE) -ENDIF(NOT WIN32) +if(NOT WIN32) + set(NOT_WIN32 TRUE) +endif(NOT WIN32) LIBUHD_REGISTER_COMPONENT("Man Pages" ENABLE_MAN_PAGES ON "GZIP_FOUND;NOT_WIN32" OFF OFF) -IF(ENABLE_MAN_PAGES) +if(ENABLE_MAN_PAGES) #Generate man pages - FOREACH(manfile ${man_page_sources}) + foreach(manfile ${man_page_sources}) #make the gzip file depend on the text file - STRING(REPLACE ".1" "" PROGRAM_NAME "${manfile}") - SET(gzfile "${CMAKE_CURRENT_BINARY_DIR}/${manfile}.gz") - SET(manfile "${CMAKE_CURRENT_SOURCE_DIR}/${manfile}") - ADD_CUSTOM_COMMAND( + string(REPLACE ".1" "" PROGRAM_NAME "${manfile}") + set(gzfile "${CMAKE_CURRENT_BINARY_DIR}/${manfile}.gz") + set(manfile "${CMAKE_CURRENT_SOURCE_DIR}/${manfile}") + add_custom_command( OUTPUT ${gzfile} DEPENDS ${manfile} COMMAND ${GZIP_EXECUTABLE} -9 -cf ${manfile} > ${gzfile} @@ -163,10 +163,10 @@ IF(ENABLE_MAN_PAGES) ) #make the man page target depend on the gz file - LIST(APPEND man_page_gz_files ${gzfile}) + list(APPEND man_page_gz_files ${gzfile}) UHD_INSTALL(FILES ${gzfile} DESTINATION ${PKG_MAN_DIR} COMPONENT manpages) - ENDFOREACH(manfile ${man_page_sources}) + endforeach(manfile ${man_page_sources}) #make the man pages a build-time dependency - ADD_CUSTOM_TARGET(man_page_gzips ALL DEPENDS ${man_page_gz_files}) -ENDIF(ENABLE_MAN_PAGES) + add_custom_target(man_page_gzips ALL DEPENDS ${man_page_gz_files}) +endif(ENABLE_MAN_PAGES) 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 diff --git a/host/include/CMakeLists.txt b/host/include/CMakeLists.txt index 0efed9785..f46870dc2 100644 --- a/host/include/CMakeLists.txt +++ b/host/include/CMakeLists.txt @@ -5,16 +5,16 @@ # SPDX-License-Identifier: GPL-3.0 # -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h ) -IF(ENABLE_C_API) +if(ENABLE_C_API) UHD_INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/uhd.h DESTINATION ${INCLUDE_DIR} COMPONENT headers ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) -ADD_SUBDIRECTORY(uhd) +add_subdirectory(uhd) diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt index e0599fd82..b184fb30d 100644 --- a/host/include/uhd/CMakeLists.txt +++ b/host/include/uhd/CMakeLists.txt @@ -5,15 +5,15 @@ # SPDX-License-Identifier: GPL-3.0 # -ADD_SUBDIRECTORY(rfnoc) -ADD_SUBDIRECTORY(transport) -ADD_SUBDIRECTORY(types) -ADD_SUBDIRECTORY(cal) -ADD_SUBDIRECTORY(usrp) -ADD_SUBDIRECTORY(usrp_clock) -ADD_SUBDIRECTORY(utils) +add_subdirectory(rfnoc) +add_subdirectory(transport) +add_subdirectory(types) +add_subdirectory(cal) +add_subdirectory(usrp) +add_subdirectory(usrp_clock) +add_subdirectory(utils) -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/version.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/version.hpp ) @@ -33,19 +33,19 @@ UHD_INSTALL(FILES COMPONENT headers ) -IF(ENABLE_RFNOC) +if(ENABLE_RFNOC) UHD_INSTALL(FILES device3.hpp DESTINATION ${INCLUDE_DIR}/uhd COMPONENT headers ) -ENDIF(ENABLE_RFNOC) +endif(ENABLE_RFNOC) -IF(ENABLE_C_API) +if(ENABLE_C_API) UHD_INSTALL(FILES config.h error.h DESTINATION ${INCLUDE_DIR}/uhd COMPONENT headers ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) diff --git a/host/include/uhd/rfnoc/CMakeLists.txt b/host/include/uhd/rfnoc/CMakeLists.txt index 981a32c98..67b629acb 100644 --- a/host/include/uhd/rfnoc/CMakeLists.txt +++ b/host/include/uhd/rfnoc/CMakeLists.txt @@ -5,7 +5,7 @@ # SPDX-License-Identifier: GPL-3.0 # -IF(ENABLE_RFNOC) +if(ENABLE_RFNOC) UHD_INSTALL(FILES # Infrastructure block_ctrl_base.hpp @@ -38,8 +38,8 @@ IF(ENABLE_RFNOC) DESTINATION ${INCLUDE_DIR}/uhd/rfnoc COMPONENT headers ) -ENDIF(ENABLE_RFNOC) +endif(ENABLE_RFNOC) -ADD_SUBDIRECTORY(blocks) -#ADD_SUBDIRECTORY(components) +add_subdirectory(blocks) +#add_subdirectory(components) diff --git a/host/include/uhd/rfnoc/blocks/CMakeLists.txt b/host/include/uhd/rfnoc/blocks/CMakeLists.txt index 027b6eb53..d694517c6 100644 --- a/host/include/uhd/rfnoc/blocks/CMakeLists.txt +++ b/host/include/uhd/rfnoc/blocks/CMakeLists.txt @@ -5,7 +5,7 @@ # SPDX-License-Identifier: GPL-3.0 # -FILE(GLOB xml_files "*.xml") +file(GLOB xml_files "*.xml") # We always need this, even when RFNoC is 'disabled' UHD_INSTALL( diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt index d9f28b08c..516459e01 100644 --- a/host/include/uhd/types/CMakeLists.txt +++ b/host/include/uhd/types/CMakeLists.txt @@ -33,7 +33,7 @@ UHD_INSTALL(FILES COMPONENT headers ) -IF(ENABLE_C_API) +if(ENABLE_C_API) UHD_INSTALL(FILES metadata.h ranges.h @@ -45,4 +45,4 @@ IF(ENABLE_C_API) DESTINATION ${INCLUDE_DIR}/uhd/types COMPONENT headers ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt index abc159d8f..2c80ed59f 100644 --- a/host/include/uhd/usrp/CMakeLists.txt +++ b/host/include/uhd/usrp/CMakeLists.txt @@ -28,7 +28,7 @@ UHD_INSTALL(FILES COMPONENT headers ) -IF(ENABLE_C_API) +if(ENABLE_C_API) UHD_INSTALL(FILES dboard_eeprom.h mboard_eeprom.h @@ -37,4 +37,4 @@ IF(ENABLE_C_API) DESTINATION ${INCLUDE_DIR}/uhd/usrp COMPONENT headers ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) diff --git a/host/include/uhd/usrp_clock/CMakeLists.txt b/host/include/uhd/usrp_clock/CMakeLists.txt index 5bb2499b2..f45770d03 100644 --- a/host/include/uhd/usrp_clock/CMakeLists.txt +++ b/host/include/uhd/usrp_clock/CMakeLists.txt @@ -12,10 +12,10 @@ UHD_INSTALL(FILES COMPONENT headers ) -IF(ENABLE_C_API) +if(ENABLE_C_API) UHD_INSTALL(FILES usrp_clock.h DESTINATION ${INCLUDE_DIR}/uhd/usrp_clock COMPONENT headers ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index 9c2fed964..7f45df1d3 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -33,11 +33,11 @@ UHD_INSTALL(FILES COMPONENT headers ) -IF(ENABLE_C_API) +if(ENABLE_C_API) UHD_INSTALL(FILES thread_priority.h log.h DESTINATION ${INCLUDE_DIR}/uhd/utils COMPONENT headers ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 0645a1a32..ebe518842 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -8,21 +8,21 @@ ######################################################################## # Helpful Macros ######################################################################## -MACRO(LIBUHD_APPEND_SOURCES) - LIST(APPEND libuhd_sources ${ARGV}) -ENDMACRO(LIBUHD_APPEND_SOURCES) +macro(LIBUHD_APPEND_SOURCES) + list(APPEND libuhd_sources ${ARGV}) +endmacro(LIBUHD_APPEND_SOURCES) -MACRO(LIBUHD_APPEND_LIBS) - LIST(APPEND libuhd_libs ${ARGV}) -ENDMACRO(LIBUHD_APPEND_LIBS) +macro(LIBUHD_APPEND_LIBS) + list(APPEND libuhd_libs ${ARGV}) +endmacro(LIBUHD_APPEND_LIBS) -MACRO(LIBUHD_PYTHON_GEN_SOURCE pyfile outfile) +macro(LIBUHD_PYTHON_GEN_SOURCE pyfile outfile) #ensure that the directory exists for outfile - GET_FILENAME_COMPONENT(outfile_dir ${outfile} PATH) - FILE(MAKE_DIRECTORY ${outfile_dir}) + get_filename_component(outfile_dir ${outfile} PATH) + file(MAKE_DIRECTORY ${outfile_dir}) #make the outfile depend on the python script - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${outfile} DEPENDS ${pyfile} ${LIBUHD_PYTHON_GEN_SOURCE_DEPS} COMMAND ${PYTHON_EXECUTABLE} -B ${pyfile} ${outfile} COMMENT "Generating ${outfile}" @@ -30,39 +30,39 @@ MACRO(LIBUHD_PYTHON_GEN_SOURCE pyfile outfile) #make libuhd depend on the outfile LIBUHD_APPEND_SOURCES(${outfile}) -ENDMACRO(LIBUHD_PYTHON_GEN_SOURCE) +endmacro(LIBUHD_PYTHON_GEN_SOURCE) -MACRO(INCLUDE_SUBDIRECTORY subdir) +macro(INCLUDE_SUBDIRECTORY subdir) #insert the current directories on the front of the list - LIST(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR}) - LIST(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR}) + list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR}) + list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR}) #set the current directories to the names of the subdirs - SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}) - SET(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir}) + set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}) + set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir}) #include the subdirectory CMakeLists to run it - FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) #reset the value of the current directories - LIST(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR) - LIST(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR) + list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR) + list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR) #pop the subdir names of the front of the list - LIST(REMOVE_AT _cmake_source_dirs 0) - LIST(REMOVE_AT _cmake_binary_dirs 0) -ENDMACRO(INCLUDE_SUBDIRECTORY) + list(REMOVE_AT _cmake_source_dirs 0) + list(REMOVE_AT _cmake_binary_dirs 0) +endmacro(INCLUDE_SUBDIRECTORY) ######################################################################## # Register lower level components ######################################################################## -MESSAGE(STATUS "") +message(STATUS "") # Dependencies -FIND_PACKAGE(USB1) -FIND_PACKAGE(GPSD) -FIND_PACKAGE(LIBERIO) -FIND_PACKAGE(DPDK) +find_package(USB1) +find_package(GPSD) +find_package(LIBERIO) +find_package(DPDK) LIBUHD_REGISTER_COMPONENT("LIBERIO" ENABLE_LIBERIO ON "ENABLE_LIBUHD;LIBERIO_FOUND" OFF OFF) LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF OFF) LIBUHD_REGISTER_COMPONENT("GPSD" ENABLE_GPSD OFF "ENABLE_LIBUHD;ENABLE_GPSD;LIBGPS_FOUND" OFF OFF) @@ -99,9 +99,9 @@ INCLUDE_SUBDIRECTORY(transport) ######################################################################## # Build info ######################################################################## -INCLUDE(UHDBuildInfo) +include(UHDBuildInfo) UHD_LOAD_BUILD_INFO() -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/build_info.cpp ${CMAKE_CURRENT_BINARY_DIR}/build_info.cpp @ONLY) @@ -109,7 +109,7 @@ CONFIGURE_FILE( ######################################################################## # Setup UHD_VERSION_STRING for version.cpp ######################################################################## -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/version.cpp ${CMAKE_CURRENT_BINARY_DIR}/version.cpp @ONLY) @@ -129,80 +129,80 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_BINARY_DIR}/version.cpp ) -IF(ENABLE_C_API) +if(ENABLE_C_API) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/error_c.cpp ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) ######################################################################## # Add DLL resource file to Windows build ######################################################################## -IF(MSVC) - MATH(EXPR RC_VERSION_MAJOR_API "${UHD_VERSION_MAJOR} * 1000 + ${UHD_VERSION_API}") - SET(RC_VERSION_PATCH ${UHD_VERSION_PATCH}) - IF(UHD_VERSION_DEVEL) - SET(RC_VERSION_PATCH "999") - ENDIF(UHD_VERSION_DEVEL) +if(MSVC) + math(EXPR RC_VERSION_MAJOR_API "${UHD_VERSION_MAJOR} * 1000 + ${UHD_VERSION_API}") + set(RC_VERSION_PATCH ${UHD_VERSION_PATCH}) + if(UHD_VERSION_DEVEL) + set(RC_VERSION_PATCH "999") + endif(UHD_VERSION_DEVEL) # Allow a custom .rc template file to be used - IF(CUSTOM_RC_FILE) - IF(IS_ABSOLUTE "${CUSTOM_RC_FILE}") - SET(UHD_RC_IN "${CUSTOM_RC_FILE}") - ELSE() - SET(UHD_RC_IN "${CMAKE_BINARY_DIR}/${CUSTOM_RC_FILE}") - ENDIF(IS_ABSOLUTE "${CUSTOM_RC_FILE}") - MESSAGE(STATUS "") - MESSAGE(STATUS "Using custom RC template: ${UHD_RC_IN}") - MESSAGE(STATUS "") - ELSE() - SET(UHD_RC_IN "${CMAKE_CURRENT_SOURCE_DIR}/uhd.rc.in") - ENDIF(CUSTOM_RC_FILE) - SET(UHD_RC_IN ${UHD_RC_IN} CACHE STRING "uhd.rc template filepath") - - CONFIGURE_FILE( + if(CUSTOM_RC_FILE) + if(IS_ABSOLUTE "${CUSTOM_RC_FILE}") + set(UHD_RC_IN "${CUSTOM_RC_FILE}") + else() + set(UHD_RC_IN "${CMAKE_BINARY_DIR}/${CUSTOM_RC_FILE}") + endif(IS_ABSOLUTE "${CUSTOM_RC_FILE}") + message(STATUS "") + message(STATUS "Using custom RC template: ${UHD_RC_IN}") + message(STATUS "") + else() + set(UHD_RC_IN "${CMAKE_CURRENT_SOURCE_DIR}/uhd.rc.in") + endif(CUSTOM_RC_FILE) + set(UHD_RC_IN ${UHD_RC_IN} CACHE STRING "uhd.rc template filepath") + + configure_file( ${UHD_RC_IN} ${CMAKE_CURRENT_BINARY_DIR}/uhd.rc @ONLY) - LIST(APPEND libuhd_sources ${CMAKE_CURRENT_BINARY_DIR}/uhd.rc) -ENDIF(MSVC) + list(APPEND libuhd_sources ${CMAKE_CURRENT_BINARY_DIR}/uhd.rc) +endif(MSVC) ######################################################################## # Setup libuhd library ######################################################################## -IF(ENABLE_MPMD) - INCLUDE_DIRECTORIES(deps/rpclib/include) - ADD_SUBDIRECTORY(deps) - LIST(APPEND libuhd_sources $<TARGET_OBJECTS:uhd_rpclib>) -ENDIF() -ADD_LIBRARY(uhd SHARED ${libuhd_sources}) -TARGET_LINK_LIBRARIES(uhd ${Boost_LIBRARIES} ${libuhd_libs}) -SET_TARGET_PROPERTIES(uhd PROPERTIES DEFINE_SYMBOL "UHD_DLL_EXPORTS") -IF(NOT LIBUHDDEV_PKG) - SET_TARGET_PROPERTIES(uhd PROPERTIES SOVERSION "${UHD_ABI_VERSION}") - SET_TARGET_PROPERTIES(uhd PROPERTIES VERSION "${UHD_ABI_VERSION}") -ENDIF(NOT LIBUHDDEV_PKG) -IF(DEFINED LIBUHD_OUTPUT_NAME) - SET_TARGET_PROPERTIES(uhd PROPERTIES OUTPUT_NAME ${LIBUHD_OUTPUT_NAME}) -ENDIF(DEFINED LIBUHD_OUTPUT_NAME) - -IF(NOT UHDHOST_PKG) #Syntax makes it unusable by UHD_INSTALL - INSTALL(TARGETS uhd +if(ENABLE_MPMD) + include_directories(deps/rpclib/include) + add_subdirectory(deps) + list(APPEND libuhd_sources $<TARGET_OBJECTS:uhd_rpclib>) +endif() +add_library(uhd SHARED ${libuhd_sources}) +target_link_libraries(uhd ${Boost_LIBRARIES} ${libuhd_libs}) +set_target_properties(uhd PROPERTIES DEFINE_SYMBOL "UHD_DLL_EXPORTS") +if(NOT LIBUHDDEV_PKG) + set_target_properties(uhd PROPERTIES SOVERSION "${UHD_ABI_VERSION}") + set_target_properties(uhd PROPERTIES VERSION "${UHD_ABI_VERSION}") +endif(NOT LIBUHDDEV_PKG) +if(DEFINED LIBUHD_OUTPUT_NAME) + set_target_properties(uhd PROPERTIES OUTPUT_NAME ${LIBUHD_OUTPUT_NAME}) +endif(DEFINED LIBUHD_OUTPUT_NAME) + +if(NOT UHDHOST_PKG) #Syntax makes it unusable by UHD_INSTALL + install(TARGETS uhd LIBRARY DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .so file ARCHIVE DESTINATION ${LIBRARY_DIR} COMPONENT libraries # .lib file RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT libraries # .dll file ) -ENDIF(NOT UHDHOST_PKG) +endif(NOT UHDHOST_PKG) ####################################################### # Setup libuhd library (static) ####################################################### -IF(ENABLE_STATIC_LIBS) - ADD_LIBRARY(uhd_static STATIC ${libuhd_sources}) - SET_TARGET_PROPERTIES(uhd_static PROPERTIES OUTPUT_NAME uhd) - SET_TARGET_PROPERTIES(uhd_static PROPERTIES COMPILE_DEFINITIONS UHD_STATIC_LIB) - INSTALL(TARGETS uhd_static +if(ENABLE_STATIC_LIBS) + add_library(uhd_static STATIC ${libuhd_sources}) + set_target_properties(uhd_static PROPERTIES OUTPUT_NAME uhd) + set_target_properties(uhd_static PROPERTIES COMPILE_DEFINITIONS UHD_STATIC_LIB) + install(TARGETS uhd_static ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib or .a file ) -ENDIF(ENABLE_STATIC_LIBS) +endif(ENABLE_STATIC_LIBS) diff --git a/host/lib/cal/CMakeLists.txt b/host/lib/cal/CMakeLists.txt index db15334a4..a66f16aa7 100644 --- a/host/lib/cal/CMakeLists.txt +++ b/host/lib/cal/CMakeLists.txt @@ -8,14 +8,14 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -INCLUDE(CheckIncludeFileCXX) -MESSAGE(STATUS "") +include(CheckIncludeFileCXX) +message(STATUS "") ######################################################################## # Convert types generation ######################################################################## -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/power_container_impl.cpp diff --git a/host/lib/convert/CMakeLists.txt b/host/lib/convert/CMakeLists.txt index 82d1e51f2..5034e2850 100644 --- a/host/lib/convert/CMakeLists.txt +++ b/host/lib/convert/CMakeLists.txt @@ -8,31 +8,31 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -INCLUDE(CheckIncludeFileCXX) -MESSAGE(STATUS "") +include(CheckIncludeFileCXX) +message(STATUS "") ######################################################################## # Check for SSE2 SIMD headers ######################################################################## -IF(CMAKE_COMPILER_IS_GNUCXX) - SET(EMMINTRIN_FLAGS -msse2) - SET(TMMINTRIN_FLAGS -mssse3) -ELSEIF(MSVC) - SET(EMMINTRIN_FLAGS /arch:SSE2) -ENDIF() +if(CMAKE_COMPILER_IS_GNUCXX) + set(EMMINTRIN_FLAGS -msse2) + set(TMMINTRIN_FLAGS -mssse3) +elseif(MSVC) + set(EMMINTRIN_FLAGS /arch:SSE2) +endif() -SET(CMAKE_REQUIRED_FLAGS ${EMMINTRIN_FLAGS}) +set(CMAKE_REQUIRED_FLAGS ${EMMINTRIN_FLAGS}) CHECK_INCLUDE_FILE_CXX(emmintrin.h HAVE_EMMINTRIN_H) -SET(CMAKE_REQUIRED_FLAGS) +set(CMAKE_REQUIRED_FLAGS) -IF(ENABLE_SSSE3) -SET(CMAKE_REQUIRED_FLAGS ${TMMINTRIN_FLAGS}) +if(ENABLE_SSSE3) +set(CMAKE_REQUIRED_FLAGS ${TMMINTRIN_FLAGS}) CHECK_INCLUDE_FILE_CXX(tmmintrin.h HAVE_TMMINTRIN_H) -SET(CMAKE_REQUIRED_FLAGS) -ENDIF(ENABLE_SSSE3) +set(CMAKE_REQUIRED_FLAGS) +endif(ENABLE_SSSE3) -IF(HAVE_EMMINTRIN_H) - SET(convert_with_sse2_sources +if(HAVE_EMMINTRIN_H) + set(convert_with_sse2_sources ${CMAKE_CURRENT_SOURCE_DIR}/sse2_sc16_to_sc16.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sse2_sc16_to_fc64.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sse2_sc16_to_fc32.cpp @@ -43,50 +43,50 @@ IF(HAVE_EMMINTRIN_H) ${CMAKE_CURRENT_SOURCE_DIR}/sse2_fc64_to_sc8.cpp ${CMAKE_CURRENT_SOURCE_DIR}/sse2_fc32_to_sc8.cpp ) - SET_SOURCE_FILES_PROPERTIES( + set_source_files_properties( ${convert_with_sse2_sources} PROPERTIES COMPILE_FLAGS "${EMMINTRIN_FLAGS}" ) LIBUHD_APPEND_SOURCES(${convert_with_sse2_sources}) -ENDIF(HAVE_EMMINTRIN_H) +endif(HAVE_EMMINTRIN_H) -IF(HAVE_TMMINTRIN_H) - SET(convert_with_ssse3_sources +if(HAVE_TMMINTRIN_H) + set(convert_with_ssse3_sources ${CMAKE_CURRENT_SOURCE_DIR}/ssse3_pack_sc12.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ssse3_unpack_sc12.cpp ) - SET_SOURCE_FILES_PROPERTIES( + set_source_files_properties( ${convert_with_ssse3_sources} PROPERTIES COMPILE_FLAGS "${TMMINTRIN_FLAGS}" ) LIBUHD_APPEND_SOURCES(${convert_with_ssse3_sources}) -ENDIF(HAVE_TMMINTRIN_H) +endif(HAVE_TMMINTRIN_H) ######################################################################## # Check for NEON SIMD headers ######################################################################## -SET(NEON_SIMD_ENABLE ON CACHE BOOL +set(NEON_SIMD_ENABLE ON CACHE BOOL "Use NEON SIMD instructions, if applicable") -MARK_AS_ADVANCED(NEON_SIMD_ENABLE) -IF(CMAKE_COMPILER_IS_GNUCXX) +mark_as_advanced(NEON_SIMD_ENABLE) +if(CMAKE_COMPILER_IS_GNUCXX) CHECK_INCLUDE_FILE_CXX(arm_neon.h HAVE_ARM_NEON_H) -ENDIF(CMAKE_COMPILER_IS_GNUCXX) +endif(CMAKE_COMPILER_IS_GNUCXX) -IF(NEON_SIMD_ENABLE AND HAVE_ARM_NEON_H AND +if(NEON_SIMD_ENABLE AND HAVE_ARM_NEON_H AND (${CMAKE_SIZEOF_VOID_P} EQUAL 4)) - ENABLE_LANGUAGE(ASM) + enable_language(ASM) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/convert_with_neon.cpp ${CMAKE_CURRENT_SOURCE_DIR}/convert_neon.S ) -ENDIF() +endif() ######################################################################## # Convert types generation ######################################################################## -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) LIBUHD_PYTHON_GEN_SOURCE( ${CMAKE_CURRENT_SOURCE_DIR}/gen_convert_general.py diff --git a/host/lib/deps/CMakeLists.txt b/host/lib/deps/CMakeLists.txt index a3858bad8..6e171efea 100644 --- a/host/lib/deps/CMakeLists.txt +++ b/host/lib/deps/CMakeLists.txt @@ -4,6 +4,6 @@ # SPDX-License-Identifier: GPL-3.0 # -IF(ENABLE_MPMD) - ADD_SUBDIRECTORY(rpclib) -ENDIF() +if(ENABLE_MPMD) + add_subdirectory(rpclib) +endif() diff --git a/host/lib/deps/rpc_CMakeLists.txt b/host/lib/deps/rpc_CMakeLists.txt index c8cb322da..ef28dbaf1 100644 --- a/host/lib/deps/rpc_CMakeLists.txt +++ b/host/lib/deps/rpc_CMakeLists.txt @@ -1,26 +1,26 @@ -PROJECT(UHD_RPCLIB CXX) +project(UHD_RPCLIB CXX) -SET(RPCLIB_DEFAULT_BUFFER_SIZE "1024 << 10" CACHE STRING "Default buffer size") +set(RPCLIB_DEFAULT_BUFFER_SIZE "1024 << 10" CACHE STRING "Default buffer size") -SET(RPCLIB_VERSION_MAJOR ${rpclib_major_version}) -SET(RPCLIB_VERSION_MINOR ${rpclib_minor_version}) -SET(RPCLIB_VERSION_PATCH ${rpclib_patch_version}) +set(RPCLIB_VERSION_MAJOR ${rpclib_major_version}) +set(RPCLIB_VERSION_MINOR ${rpclib_minor_version}) +set(RPCLIB_VERSION_PATCH ${rpclib_patch_version}) -CONFIGURE_FILE( +configure_file( ${"${CMAKE_CURRENT_SOURCE_DIR}/include/rpc/version.h.in"} ${"${CMAKE_CURRENT_BINARY_DIR}/version.h"}) -CONFIGURE_FILE( +configure_file( ${"${CMAKE_CURRENT_SOURCE_DIR}/include/rpc/config.h.in"} ${"${CMAKE_CURRENT_BINARY_DIR}/config.h"}) -SET(RPCLIB_COMPILE_DEFINITIONS "") -IF(${"${CMAKE_CXX_COMPILER_ID}"} MATCHES "Clang") +set(RPCLIB_COMPILE_DEFINITIONS "") +if(${"${CMAKE_CXX_COMPILER_ID}"} MATCHES "Clang") -ELSEIF(${"${CMAKE_CXX_COMPILER_ID}"} STREQUAL "GNU") +elseif(${"${CMAKE_CXX_COMPILER_ID}"} STREQUAL "GNU") -ELSEIF(${"${CMAKE_CXX_COMPILER_ID}"} STREQUAL "MSVC") - SET(RPCLIB_COMPILE_DEFINITIONS +elseif(${"${CMAKE_CXX_COMPILER_ID}"} STREQUAL "MSVC") + set(RPCLIB_COMPILE_DEFINITIONS "${"${RPCLIB_COMPILE_DEFINITIONS}"}" "WIN32_LEAN_AND_MEAN" "NOMINMAX" @@ -35,11 +35,11 @@ ELSEIF(${"${CMAKE_CXX_COMPILER_ID}"} STREQUAL "MSVC") "ASIO_HAS_STD_SHARED_PTR" "ASIO_HAS_STD_TYPE_TRAITS" ) -ENDIF() +endif() -INCLUDE_DIRECTORIES(include) -INCLUDE_DIRECTORIES(include/rpc) -ADD_LIBRARY(uhd_rpclib OBJECT +include_directories(include) +include_directories(include/rpc) +add_library(uhd_rpclib OBJECT lib/rpc/dispatcher.cc lib/rpc/server.cc lib/rpc/client.cc @@ -51,7 +51,7 @@ ADD_LIBRARY(uhd_rpclib OBJECT lib/rpc/detail/response.cc lib/rpc/detail/client_error.cc ) -SET_TARGET_PROPERTIES(uhd_rpclib +set_target_properties(uhd_rpclib PROPERTIES POSITION_INDEPENDENT_CODE ON COMPILE_DEFINITIONS "${"${RPCLIB_COMPILE_DEFINITIONS}"}" diff --git a/host/lib/deps/rpclib/CMakeLists.txt b/host/lib/deps/rpclib/CMakeLists.txt index dd53fabe8..56c4865c4 100644 --- a/host/lib/deps/rpclib/CMakeLists.txt +++ b/host/lib/deps/rpclib/CMakeLists.txt @@ -1,26 +1,26 @@ -PROJECT(UHD_RPCLIB CXX) +project(UHD_RPCLIB CXX) -SET(RPCLIB_DEFAULT_BUFFER_SIZE "1024 << 10" CACHE STRING "Default buffer size") +set(RPCLIB_DEFAULT_BUFFER_SIZE "1024 << 10" CACHE STRING "Default buffer size") -SET(RPCLIB_VERISION_MAJOR 1) -SET(RPCLIB_VERSION_MINOR 0) -SET(RPCLIB_VERSION_PATCH 0) +set(RPCLIB_VERISION_MAJOR 1) +set(RPCLIB_VERSION_MINOR 0) +set(RPCLIB_VERSION_PATCH 0) -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/include/rpc/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/include/rpc/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) -SET(RPCLIB_COMPILE_DEFINITIONS "") -IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") +set(RPCLIB_COMPILE_DEFINITIONS "") +if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") -ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") -ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") - SET(RPCLIB_COMPILE_DEFINITIONS +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") + set(RPCLIB_COMPILE_DEFINITIONS "${RPCLIB_COMPILE_DEFINITIONS}" "WIN32_LEAN_AND_MEAN" "NOMINMAX" @@ -35,11 +35,11 @@ ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") "ASIO_HAS_STD_SHARED_PTR" "ASIO_HAS_STD_TYPE_TRAITS" ) -ENDIF() +endif() -INCLUDE_DIRECTORIES(include) -INCLUDE_DIRECTORIES(include/rpc) -ADD_LIBRARY(uhd_rpclib OBJECT +include_directories(include) +include_directories(include/rpc) +add_library(uhd_rpclib OBJECT lib/rpc/dispatcher.cc lib/rpc/server.cc lib/rpc/client.cc @@ -51,7 +51,7 @@ ADD_LIBRARY(uhd_rpclib OBJECT lib/rpc/detail/response.cc lib/rpc/detail/client_error.cc ) -SET_TARGET_PROPERTIES(uhd_rpclib +set_target_properties(uhd_rpclib PROPERTIES POSITION_INDEPENDENT_CODE ON COMPILE_DEFINITIONS "${RPCLIB_COMPILE_DEFINITIONS}" diff --git a/host/lib/experts/CMakeLists.txt b/host/lib/experts/CMakeLists.txt index 3101a7330..393c999f1 100644 --- a/host/lib/experts/CMakeLists.txt +++ b/host/lib/experts/CMakeLists.txt @@ -14,9 +14,9 @@ LIBUHD_APPEND_SOURCES( ) # Verbose Debug output for send/recv -SET( UHD_EXPERT_LOGGING OFF CACHE BOOL "Enable verbose logging for experts" ) -OPTION( UHD_EXPERT_LOGGING "Enable verbose logging for experts" "" ) -IF(UHD_EXPERT_LOGGING) - MESSAGE(STATUS "Enabling verbose logging for experts") - ADD_DEFINITIONS(-DUHD_EXPERT_LOGGING) -ENDIF() +set( UHD_EXPERT_LOGGING OFF CACHE BOOL "Enable verbose logging for experts" ) +option( UHD_EXPERT_LOGGING "Enable verbose logging for experts" "" ) +if(UHD_EXPERT_LOGGING) + message(STATUS "Enabling verbose logging for experts") + add_definitions(-DUHD_EXPERT_LOGGING) +endif() diff --git a/host/lib/ic_reg_maps/CMakeLists.txt b/host/lib/ic_reg_maps/CMakeLists.txt index 3f06d9419..42ac4d051 100644 --- a/host/lib/ic_reg_maps/CMakeLists.txt +++ b/host/lib/ic_reg_maps/CMakeLists.txt @@ -9,8 +9,8 @@ # This file included, use CMake directory variables ######################################################################## -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -SET(LIBUHD_PYTHON_GEN_SOURCE_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/common.py) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(LIBUHD_PYTHON_GEN_SOURCE_DEPS ${CMAKE_CURRENT_SOURCE_DIR}/common.py) LIBUHD_PYTHON_GEN_SOURCE( ${CMAKE_CURRENT_SOURCE_DIR}/gen_adf4350_regs.py @@ -142,4 +142,4 @@ LIBUHD_PYTHON_GEN_SOURCE( ${CMAKE_CURRENT_BINARY_DIR}/rhodium_cpld_regs.hpp ) -SET(LIBUHD_PYTHON_GEN_SOURCE_DEPS) +set(LIBUHD_PYTHON_GEN_SOURCE_DEPS) diff --git a/host/lib/include/CMakeLists.txt b/host/lib/include/CMakeLists.txt index a688f4ea9..fc1a6c4d5 100644 --- a/host/lib/include/CMakeLists.txt +++ b/host/lib/include/CMakeLists.txt @@ -4,5 +4,5 @@ # SPDX-License-Identifier: GPL-3.0+ # -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/host/lib/rfnoc/nocscript/CMakeLists.txt b/host/lib/rfnoc/nocscript/CMakeLists.txt index 503bd5e03..8fb7215ad 100644 --- a/host/lib/rfnoc/nocscript/CMakeLists.txt +++ b/host/lib/rfnoc/nocscript/CMakeLists.txt @@ -5,19 +5,19 @@ # SPDX-License-Identifier: GPL-3.0 # -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) LIBUHD_PYTHON_GEN_SOURCE( ${CMAKE_CURRENT_SOURCE_DIR}/gen_basic_funcs.py ${CMAKE_CURRENT_BINARY_DIR}/basic_functions.hpp ) -IF(ENABLE_MANUAL) +if(ENABLE_MANUAL) LIBUHD_PYTHON_GEN_SOURCE( ${CMAKE_CURRENT_SOURCE_DIR}/gen_basic_funcs.py ${CMAKE_BINARY_DIR}/docs/nocscript_functions.dox ) -ENDIF(ENABLE_MANUAL) +endif(ENABLE_MANUAL) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/expression.cpp diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index 7c79bc67c..a7f986277 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -12,17 +12,17 @@ ######################################################################## # Include subdirectories (different than add) ######################################################################## -IF(ENABLE_X300) +if(ENABLE_X300) INCLUDE_SUBDIRECTORY(nirio) -ENDIF(ENABLE_X300) +endif(ENABLE_X300) ######################################################################## # Setup libusb ######################################################################## -IF(ENABLE_USB) - MESSAGE(STATUS "") - MESSAGE(STATUS "USB support enabled via libusb.") - INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS}) +if(ENABLE_USB) + message(STATUS "") + message(STATUS "USB support enabled via libusb.") + include_directories(${LIBUSB_INCLUDE_DIRS}) LIBUHD_APPEND_LIBS(${LIBUSB_LIBRARIES}) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_control.cpp @@ -30,23 +30,23 @@ IF(ENABLE_USB) ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.cpp ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_base.hpp ) - SET_SOURCE_FILES_PROPERTIES( + set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/libusb1_zero_copy.cpp PROPERTIES COMPILE_DEFINITIONS "${LIBUSB_DEFINITIONS}" ) -ELSE(ENABLE_USB) +else(ENABLE_USB) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/usb_dummy_impl.cpp ) -ENDIF(ENABLE_USB) +endif(ENABLE_USB) ######################################################################## # Setup defines for interface address discovery ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring interface address discovery...") -INCLUDE(CheckCXXSourceCompiles) -INCLUDE(CheckIncludeFileCXX) +message(STATUS "") +message(STATUS "Configuring interface address discovery...") +include(CheckCXXSourceCompiles) +include(CheckIncludeFileCXX) CHECK_CXX_SOURCE_COMPILES(" #include <ifaddrs.h> @@ -60,18 +60,18 @@ CHECK_CXX_SOURCE_COMPILES(" CHECK_INCLUDE_FILE_CXX(winsock2.h HAVE_WINSOCK2_H) -IF(HAVE_GETIFADDRS) - MESSAGE(STATUS " Interface address discovery supported through getifaddrs.") - SET(IF_ADDRS_DEFS HAVE_GETIFADDRS) -ELSEIF(HAVE_WINSOCK2_H) - MESSAGE(STATUS " Interface address discovery supported through SIO_GET_INTERFACE_LIST.") - SET(IF_ADDRS_DEFS HAVE_SIO_GET_INTERFACE_LIST) -ELSE() - MESSAGE(STATUS " Interface address discovery not supported.") - SET(IF_ADDRS_DEFS HAVE_IF_ADDRS_DUMMY) -ENDIF() - -SET_SOURCE_FILES_PROPERTIES( +if(HAVE_GETIFADDRS) + message(STATUS " Interface address discovery supported through getifaddrs.") + set(IF_ADDRS_DEFS HAVE_GETIFADDRS) +elseif(HAVE_WINSOCK2_H) + message(STATUS " Interface address discovery supported through SIO_GET_INTERFACE_LIST.") + set(IF_ADDRS_DEFS HAVE_SIO_GET_INTERFACE_LIST) +else() + message(STATUS " Interface address discovery not supported.") + set(IF_ADDRS_DEFS HAVE_IF_ADDRS_DUMMY) +endif() + +set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/if_addrs.cpp PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}" ) @@ -79,29 +79,29 @@ SET_SOURCE_FILES_PROPERTIES( ######################################################################## # Setup UDP ######################################################################## -IF(WIN32) +if(WIN32) LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/udp_wsa_zero_copy.cpp) -ELSE() +else() LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/udp_zero_copy.cpp) -ENDIF() +endif() #On windows, the boost asio implementation uses the winsock2 library. #Note: we exclude the .lib extension for cygwin and mingw platforms. -IF(WIN32) +if(WIN32) LIBUHD_APPEND_LIBS(ws2_32) -ENDIF() +endif() #atlbase.h is not included with visual studio express #conditionally check for atlbase.h and define if found -INCLUDE(CheckIncludeFileCXX) +include(CheckIncludeFileCXX) CHECK_INCLUDE_FILE_CXX(atlbase.h HAVE_ATLBASE_H) -IF(HAVE_ATLBASE_H) - SET_SOURCE_FILES_PROPERTIES( +if(HAVE_ATLBASE_H) + set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/udp_zero_copy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/udp_wsa_zero_copy.cpp PROPERTIES COMPILE_DEFINITIONS "HAVE_ATLBASE_H" ) -ENDIF(HAVE_ATLBASE_H) +endif(HAVE_ATLBASE_H) ######################################################################## # Append to the list of sources for lib uhd @@ -123,29 +123,29 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/zero_copy_flow_ctrl.cpp ) -IF(ENABLE_X300) +if(ENABLE_X300) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/nirio_zero_copy.cpp ) -ENDIF(ENABLE_X300) +endif(ENABLE_X300) -IF(ENABLE_LIBERIO) - INCLUDE_DIRECTORIES(${LIBERIO_INCLUDE_DIRS}) +if(ENABLE_LIBERIO) + include_directories(${LIBERIO_INCLUDE_DIRS}) LIBUHD_APPEND_LIBS(${LIBERIO_LIBRARIES}) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/liberio_zero_copy.cpp ) -ENDIF(ENABLE_LIBERIO) +endif(ENABLE_LIBERIO) -IF(ENABLE_DPDK) +if(ENABLE_DPDK) INCLUDE_SUBDIRECTORY(uhd-dpdk) -ENDIF(ENABLE_DPDK) +endif(ENABLE_DPDK) # Verbose Debug output for send/recv -SET( UHD_TXRX_DEBUG_PRINTS OFF CACHE BOOL "Use verbose debug output for send/recv" ) -OPTION( UHD_TXRX_DEBUG_PRINTS "Use verbose debug output for send/recv" "" ) -IF(UHD_TXRX_DEBUG_PRINTS) - MESSAGE(STATUS "Using verbose debug output for send/recv") - ADD_DEFINITIONS(-DUHD_TXRX_DEBUG_PRINTS) -ENDIF() +set( UHD_TXRX_DEBUG_PRINTS OFF CACHE BOOL "Use verbose debug output for send/recv" ) +option( UHD_TXRX_DEBUG_PRINTS "Use verbose debug output for send/recv" "" ) +if(UHD_TXRX_DEBUG_PRINTS) + message(STATUS "Using verbose debug output for send/recv") + add_definitions(-DUHD_TXRX_DEBUG_PRINTS) +endif() diff --git a/host/lib/transport/nirio/CMakeLists.txt b/host/lib/transport/nirio/CMakeLists.txt index 8336d6063..af456c595 100644 --- a/host/lib/transport/nirio/CMakeLists.txt +++ b/host/lib/transport/nirio/CMakeLists.txt @@ -29,10 +29,10 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/status.cpp ) -IF(WIN32) +if(WIN32) LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/nirio_driver_iface_win.cpp) -ELSEIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") #Built-in variable encompasses all UNIX-like systems +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") #Built-in variable encompasses all UNIX-like systems LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/nirio_driver_iface_linux.cpp) -ELSE() +else() LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_SOURCE_DIR}/nirio_driver_iface_unsupported.cpp) -ENDIF(WIN32) +endif(WIN32) diff --git a/host/lib/transport/nirio/lvbitx/CMakeLists.txt b/host/lib/transport/nirio/lvbitx/CMakeLists.txt index 6fbd6b469..8fb5bd079 100644 --- a/host/lib/transport/nirio/lvbitx/CMakeLists.txt +++ b/host/lib/transport/nirio/lvbitx/CMakeLists.txt @@ -5,21 +5,21 @@ # SPDX-License-Identifier: GPL-3.0 # -MACRO(LIBUHD_LVBITX_GEN_SOURCE_AND_BITSTREAM lvbitx binfile) - GET_FILENAME_COMPONENT(lvbitxprefix ${lvbitx} NAME_WE) +macro(LIBUHD_LVBITX_GEN_SOURCE_AND_BITSTREAM lvbitx binfile) + get_filename_component(lvbitxprefix ${lvbitx} NAME_WE) - IF( ${binfile} STREQUAL "OFF" ) - SET( GEN_OPTIONS ) - MESSAGE( STATUS " Using ${lvbitx} for codegen" ) - ELSE( ${binfile} STREQUAL "OFF" ) - SET( GEN_OPTIONS --merge-bin=${CMAKE_SOURCE_DIR}/../binaries/${binfile} --output-lvbitx-path=${CMAKE_SOURCE_DIR}/../binaries ) - MESSAGE( STATUS " Merging ${lvbitx} with ${binfile} for codegen" ) - ENDIF( ${binfile} STREQUAL "OFF" ) + if( ${binfile} STREQUAL "OFF" ) + set( GEN_OPTIONS ) + message( STATUS " Using ${lvbitx} for codegen" ) + else( ${binfile} STREQUAL "OFF" ) + set( GEN_OPTIONS --merge-bin=${CMAKE_SOURCE_DIR}/../binaries/${binfile} --output-lvbitx-path=${CMAKE_SOURCE_DIR}/../binaries ) + message( STATUS " Merging ${lvbitx} with ${binfile} for codegen" ) + endif( ${binfile} STREQUAL "OFF" ) - SET(OUTPUT_PATH_OPT --output-src-path=${CMAKE_CURRENT_BINARY_DIR}) - SET(IMAGES_PATH_OPT --uhd-images-path=${UHD_IMAGES_DIR}) + set(OUTPUT_PATH_OPT --output-src-path=${CMAKE_CURRENT_BINARY_DIR}) + set(IMAGES_PATH_OPT --uhd-images-path=${UHD_IMAGES_DIR}) - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${lvbitxprefix}_lvbitx.cpp OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${lvbitxprefix}_lvbitx.hpp DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/process-lvbitx.py @@ -33,16 +33,16 @@ MACRO(LIBUHD_LVBITX_GEN_SOURCE_AND_BITSTREAM lvbitx binfile) #make libuhd depend on the output file LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_BINARY_DIR}/${lvbitxprefix}_lvbitx.hpp) LIBUHD_APPEND_SOURCES(${CMAKE_CURRENT_BINARY_DIR}/${lvbitxprefix}_lvbitx.cpp) -ENDMACRO(LIBUHD_LVBITX_GEN_SOURCE_AND_BITSTREAM) +endmacro(LIBUHD_LVBITX_GEN_SOURCE_AND_BITSTREAM) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) ######################################################################## # Generation code ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Processing NI-RIO FPGA LVBITX Bitstreams...") +message(STATUS "") +message(STATUS "Processing NI-RIO FPGA LVBITX Bitstreams...") # X300 Stuff LIBUHD_LVBITX_GEN_SOURCE_AND_BITSTREAM(x300.lvbitx_base OFF) diff --git a/host/lib/types/CMakeLists.txt b/host/lib/types/CMakeLists.txt index 7f8c80c95..938015dca 100644 --- a/host/lib/types/CMakeLists.txt +++ b/host/lib/types/CMakeLists.txt @@ -24,7 +24,7 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/byte_vector.cpp ) -IF(ENABLE_C_API) +if(ENABLE_C_API) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/metadata_c.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ranges_c.cpp @@ -33,4 +33,4 @@ IF(ENABLE_C_API) ${CMAKE_CURRENT_SOURCE_DIR}/tune_c.cpp ${CMAKE_CURRENT_SOURCE_DIR}/usrp_info_c.cpp ) -ENDIF() +endif() diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt index 9a1818599..9998c1a4a 100644 --- a/host/lib/usrp/CMakeLists.txt +++ b/host/lib/usrp/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/dboard_base.cpp @@ -22,21 +22,21 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/fe_connection.cpp ) -IF(ENABLE_C_API) +if(ENABLE_C_API) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/dboard_eeprom_c.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mboard_eeprom_c.cpp ${CMAKE_CURRENT_SOURCE_DIR}/subdev_spec_c.cpp ${CMAKE_CURRENT_SOURCE_DIR}/usrp_c.cpp ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) -IF(ENABLE_GPSD) +if(ENABLE_GPSD) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/gpsd_iface.cpp ) LIBUHD_APPEND_LIBS(${LIBGPS_LIBRARY}) -ENDIF(ENABLE_GPSD) +endif(ENABLE_GPSD) INCLUDE_SUBDIRECTORY(cores) INCLUDE_SUBDIRECTORY(dboard) diff --git a/host/lib/usrp/b100/CMakeLists.txt b/host/lib/usrp/b100/CMakeLists.txt index 8548b961b..6f6050c34 100644 --- a/host/lib/usrp/b100/CMakeLists.txt +++ b/host/lib/usrp/b100/CMakeLists.txt @@ -12,7 +12,7 @@ ######################################################################## # Conditionally configure the B100 support ######################################################################## -IF(ENABLE_B100) +if(ENABLE_B100) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/b100_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.cpp @@ -23,4 +23,4 @@ IF(ENABLE_B100) ${CMAKE_CURRENT_SOURCE_DIR}/usb_zero_copy_wrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/fifo_ctrl_excelsior.cpp ) -ENDIF(ENABLE_B100) +endif(ENABLE_B100) diff --git a/host/lib/usrp/b200/CMakeLists.txt b/host/lib/usrp/b200/CMakeLists.txt index 2f3ea2483..78dfe884d 100644 --- a/host/lib/usrp/b200/CMakeLists.txt +++ b/host/lib/usrp/b200/CMakeLists.txt @@ -12,7 +12,7 @@ ######################################################################## # Conditionally configure the B200 support ######################################################################## -IF(ENABLE_B200) +if(ENABLE_B200) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/b200_image_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/b200_impl.cpp @@ -22,4 +22,4 @@ IF(ENABLE_B200) ${CMAKE_CURRENT_SOURCE_DIR}/b200_cores.cpp ${CMAKE_CURRENT_SOURCE_DIR}/b200_mb_eeprom.cpp ) -ENDIF(ENABLE_B200) +endif(ENABLE_B200) diff --git a/host/lib/usrp/common/CMakeLists.txt b/host/lib/usrp/common/CMakeLists.txt index 6490fac08..673aa7e78 100644 --- a/host/lib/usrp/common/CMakeLists.txt +++ b/host/lib/usrp/common/CMakeLists.txt @@ -8,22 +8,22 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -IF(ENABLE_USB) +if(ENABLE_USB) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/fx2_ctrl.cpp ) -ENDIF(ENABLE_USB) +endif(ENABLE_USB) -IF(ENABLE_E300 OR ENABLE_B200 OR ENABLE_N230 OR ENABLE_E320) - INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/ad9361_driver") +if(ENABLE_E300 OR ENABLE_B200 OR ENABLE_N230 OR ENABLE_E320) + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ad9361_driver") LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/ad9361_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ad936x_manager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ad9361_driver/ad9361_device.cpp ) -ENDIF(ENABLE_E300 OR ENABLE_B200 OR ENABLE_N230 OR ENABLE_E320) +endif(ENABLE_E300 OR ENABLE_B200 OR ENABLE_N230 OR ENABLE_E320) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/adf4001_ctrl.cpp diff --git a/host/lib/usrp/cores/CMakeLists.txt b/host/lib/usrp/cores/CMakeLists.txt index 95102f29d..6d3d988f0 100644 --- a/host/lib/usrp/cores/CMakeLists.txt +++ b/host/lib/usrp/cores/CMakeLists.txt @@ -9,7 +9,7 @@ # This file included, use CMake directory variables ######################################################################## -IF(ENABLE_B100 OR ENABLE_USRP2) +if(ENABLE_B100 OR ENABLE_USRP2) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/gpio_core_200.cpp ${CMAKE_CURRENT_SOURCE_DIR}/i2c_core_200.cpp @@ -18,7 +18,7 @@ IF(ENABLE_B100 OR ENABLE_USRP2) ${CMAKE_CURRENT_SOURCE_DIR}/tx_dsp_core_200.cpp ${CMAKE_CURRENT_SOURCE_DIR}/user_settings_core_200.cpp ) -ENDIF(ENABLE_B100 OR ENABLE_USRP2) +endif(ENABLE_B100 OR ENABLE_USRP2) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/dma_fifo_core_3000.cpp diff --git a/host/lib/usrp/dboard/CMakeLists.txt b/host/lib/usrp/dboard/CMakeLists.txt index 25e1bd2b9..5328fcc90 100644 --- a/host/lib/usrp/dboard/CMakeLists.txt +++ b/host/lib/usrp/dboard/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -IF(ENABLE_X300 OR ENABLE_USRP1 OR ENABLE_USRP2 OR ENABLE_B100) +if(ENABLE_X300 OR ENABLE_USRP1 OR ENABLE_USRP2 OR ENABLE_B100) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/db_basic_and_lf.cpp ${CMAKE_CURRENT_SOURCE_DIR}/db_rfx.cpp @@ -29,31 +29,31 @@ IF(ENABLE_X300 OR ENABLE_USRP1 OR ENABLE_USRP2 OR ENABLE_B100) ${CMAKE_CURRENT_SOURCE_DIR}/db_dbsrx2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/db_tvrx2.cpp ) -ENDIF(ENABLE_X300 OR ENABLE_USRP1 OR ENABLE_USRP2 OR ENABLE_B100) +endif(ENABLE_X300 OR ENABLE_USRP1 OR ENABLE_USRP2 OR ENABLE_B100) -IF(ENABLE_E300) +if(ENABLE_E300) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/db_e3x0.cpp ) -ENDIF(ENABLE_E300) +endif(ENABLE_E300) -IF(ENABLE_X300) +if(ENABLE_X300) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/twinrx/twinrx_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/twinrx/twinrx_experts.cpp ${CMAKE_CURRENT_SOURCE_DIR}/twinrx/twinrx_gain_tables.cpp ${CMAKE_CURRENT_SOURCE_DIR}/db_twinrx.cpp ) -ENDIF(ENABLE_X300) +endif(ENABLE_X300) -IF(ENABLE_N300) +if(ENABLE_N300) INCLUDE_SUBDIRECTORY(magnesium) -ENDIF(ENABLE_N300) -IF(ENABLE_N320) +endif(ENABLE_N300) +if(ENABLE_N320) INCLUDE_SUBDIRECTORY(rhodium) -ENDIF(ENABLE_N320) -IF(ENABLE_MPMD AND ENABLE_EISCAT) +endif(ENABLE_N320) +if(ENABLE_MPMD AND ENABLE_EISCAT) INCLUDE_SUBDIRECTORY(eiscat) -ENDIF(ENABLE_MPMD AND ENABLE_EISCAT) +endif(ENABLE_MPMD AND ENABLE_EISCAT) INCLUDE_SUBDIRECTORY(neon) diff --git a/host/lib/usrp/dboard/eiscat/CMakeLists.txt b/host/lib/usrp/dboard/eiscat/CMakeLists.txt index 13da2d6da..650116ec1 100644 --- a/host/lib/usrp/dboard/eiscat/CMakeLists.txt +++ b/host/lib/usrp/dboard/eiscat/CMakeLists.txt @@ -7,7 +7,7 @@ # This file is conditionally included if ENABLE_MPMD and ENABLE_EISCAT are # set to true. -LIST(APPEND EISCAT_SOURCES +list(APPEND EISCAT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/eiscat_radio_ctrl_impl.cpp ) LIBUHD_APPEND_SOURCES(${EISCAT_SOURCES}) diff --git a/host/lib/usrp/dboard/magnesium/CMakeLists.txt b/host/lib/usrp/dboard/magnesium/CMakeLists.txt index 417cd4f54..9f78ce242 100644 --- a/host/lib/usrp/dboard/magnesium/CMakeLists.txt +++ b/host/lib/usrp/dboard/magnesium/CMakeLists.txt @@ -7,7 +7,7 @@ # This file is conditionally included if ENABLE_MPMD and ENABLE_N300 are # set to true. -LIST(APPEND MAGNESIUM_SOURCES +list(APPEND MAGNESIUM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/magnesium_radio_ctrl_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/magnesium_radio_ctrl_init.cpp ${CMAKE_CURRENT_SOURCE_DIR}/magnesium_radio_ctrl_cpld.cpp diff --git a/host/lib/usrp/dboard/neon/CMakeLists.txt b/host/lib/usrp/dboard/neon/CMakeLists.txt index e1ee0fba4..a2473bd0a 100644 --- a/host/lib/usrp/dboard/neon/CMakeLists.txt +++ b/host/lib/usrp/dboard/neon/CMakeLists.txt @@ -4,12 +4,12 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -IF(ENABLE_E320) - LIST(APPEND NEON_SOURCES +if(ENABLE_E320) + list(APPEND NEON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/neon_radio_ctrl_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/neon_radio_ctrl_init.cpp ${CMAKE_CURRENT_SOURCE_DIR}/neon_ad9361_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/neon_bands.cpp ) LIBUHD_APPEND_SOURCES(${NEON_SOURCES}) -ENDIF(ENABLE_E320) +endif(ENABLE_E320) diff --git a/host/lib/usrp/dboard/rhodium/CMakeLists.txt b/host/lib/usrp/dboard/rhodium/CMakeLists.txt index 617e4af58..2b2e9744c 100644 --- a/host/lib/usrp/dboard/rhodium/CMakeLists.txt +++ b/host/lib/usrp/dboard/rhodium/CMakeLists.txt @@ -4,8 +4,8 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -IF(ENABLE_MPMD) - LIST(APPEND RHODIUM_SOURCES +if(ENABLE_MPMD) + list(APPEND RHODIUM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/rhodium_radio_ctrl_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rhodium_radio_ctrl_init.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rhodium_radio_ctrl_cpld.cpp @@ -14,5 +14,5 @@ IF(ENABLE_MPMD) ${CMAKE_CURRENT_SOURCE_DIR}/rhodium_cpld_ctrl.cpp ) LIBUHD_APPEND_SOURCES(${RHODIUM_SOURCES}) -ENDIF(ENABLE_MPMD) +endif(ENABLE_MPMD) diff --git a/host/lib/usrp/e300/CMakeLists.txt b/host/lib/usrp/e300/CMakeLists.txt index 9e85a6bb4..2b4e3105d 100644 --- a/host/lib/usrp/e300/CMakeLists.txt +++ b/host/lib/usrp/e300/CMakeLists.txt @@ -14,8 +14,8 @@ ######################################################################## find_package(UDev) -IF(ENABLE_E300) - LIST(APPEND E300_SOURCES +if(ENABLE_E300) + list(APPEND E300_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/e300_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/e300_io_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/e300_fifo_config.cpp @@ -31,21 +31,21 @@ IF(ENABLE_E300) ${CMAKE_CURRENT_SOURCE_DIR}/e3xx_radio_ctrl_impl.cpp ) LIBUHD_APPEND_SOURCES(${E300_SOURCES}) - IF(UDEV_FOUND AND NOT E300_FORCE_NETWORK) - INCLUDE_DIRECTORIES(${UDEV_INCLUDE_DIR}) + if(UDEV_FOUND AND NOT E300_FORCE_NETWORK) + include_directories(${UDEV_INCLUDE_DIR}) LIBUHD_APPEND_LIBS(${UDEV_LIBS}) - SET_SOURCE_FILES_PROPERTIES( + set_source_files_properties( ${E300_SOURCES} PROPERTIES COMPILE_DEFINITIONS "E300_NATIVE=1" ) - ENDIF(UDEV_FOUND AND NOT E300_FORCE_NETWORK) + endif(UDEV_FOUND AND NOT E300_FORCE_NETWORK) - IF(ENABLE_GPSD) - SET_SOURCE_FILES_PROPERTIES( + if(ENABLE_GPSD) + set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/e300_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/e300_impl.hpp ${CMAKE_CURRENT_SOURCE_DIR}/e3xx_radio_ctrl_impl.hpp PROPERTIES COMPILE_DEFINITIONS "E300_GPSD=1" ) - ENDIF(ENABLE_GPSD) -ENDIF(ENABLE_E300) + endif(ENABLE_GPSD) +endif(ENABLE_E300) diff --git a/host/lib/usrp/mpmd/CMakeLists.txt b/host/lib/usrp/mpmd/CMakeLists.txt index 4447f2dc4..774ad6593 100644 --- a/host/lib/usrp/mpmd/CMakeLists.txt +++ b/host/lib/usrp/mpmd/CMakeLists.txt @@ -4,11 +4,11 @@ # SPDX-License-Identifier: GPL-3.0 # -IF(ENABLE_MPMD) - IF(ENABLE_LIBERIO) - MESSAGE(STATUS "Compiling MPMD with liberio support...") - ADD_DEFINITIONS(-DHAVE_LIBERIO) - ENDIF(ENABLE_LIBERIO) +if(ENABLE_MPMD) + if(ENABLE_LIBERIO) + message(STATUS "Compiling MPMD with liberio support...") + add_definitions(-DHAVE_LIBERIO) + endif(ENABLE_LIBERIO) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/mpmd_find.cpp @@ -21,10 +21,10 @@ IF(ENABLE_MPMD) ${CMAKE_CURRENT_SOURCE_DIR}/mpmd_xport_ctrl_udp.cpp ) - IF(ENABLE_LIBERIO) + if(ENABLE_LIBERIO) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/mpmd_xport_ctrl_liberio.cpp ) - ENDIF(ENABLE_LIBERIO) + endif(ENABLE_LIBERIO) -ENDIF(ENABLE_MPMD) +endif(ENABLE_MPMD) diff --git a/host/lib/usrp/n230/CMakeLists.txt b/host/lib/usrp/n230/CMakeLists.txt index 9d16067a0..6acb332b8 100644 --- a/host/lib/usrp/n230/CMakeLists.txt +++ b/host/lib/usrp/n230/CMakeLists.txt @@ -12,7 +12,7 @@ ######################################################################## # Conditionally configure the N230 support ######################################################################## -IF(ENABLE_N230) +if(ENABLE_N230) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/n230_cores.cpp ${CMAKE_CURRENT_SOURCE_DIR}/n230_impl.cpp @@ -25,4 +25,4 @@ IF(ENABLE_N230) ${CMAKE_CURRENT_SOURCE_DIR}/n230_image_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/n230_fw_ctrl_iface.cpp ) -ENDIF(ENABLE_N230) +endif(ENABLE_N230) diff --git a/host/lib/usrp/usrp1/CMakeLists.txt b/host/lib/usrp/usrp1/CMakeLists.txt index 0c3c94c7b..95b6abb22 100644 --- a/host/lib/usrp/usrp1/CMakeLists.txt +++ b/host/lib/usrp/usrp1/CMakeLists.txt @@ -12,7 +12,7 @@ ######################################################################## # Conditionally configure the USRP1 support ######################################################################## -IF(ENABLE_USRP1) +if(ENABLE_USRP1) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dboard_iface.cpp @@ -22,4 +22,4 @@ IF(ENABLE_USRP1) ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/usrp1_impl.cpp ) -ENDIF(ENABLE_USRP1) +endif(ENABLE_USRP1) diff --git a/host/lib/usrp/usrp2/CMakeLists.txt b/host/lib/usrp/usrp2/CMakeLists.txt index 8e7e186bb..ab9115eca 100644 --- a/host/lib/usrp/usrp2/CMakeLists.txt +++ b/host/lib/usrp/usrp2/CMakeLists.txt @@ -12,7 +12,7 @@ ######################################################################## # Conditionally configure the USRP2 support ######################################################################## -IF(ENABLE_USRP2) +if(ENABLE_USRP2) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/clock_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/codec_ctrl.cpp @@ -24,4 +24,4 @@ IF(ENABLE_USRP2) ${CMAKE_CURRENT_SOURCE_DIR}/usrp2_fifo_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/n200_image_loader.cpp ) -ENDIF(ENABLE_USRP2) +endif(ENABLE_USRP2) diff --git a/host/lib/usrp/x300/CMakeLists.txt b/host/lib/usrp/x300/CMakeLists.txt index 08dde87d2..ba1a8678c 100644 --- a/host/lib/usrp/x300/CMakeLists.txt +++ b/host/lib/usrp/x300/CMakeLists.txt @@ -12,7 +12,7 @@ ######################################################################## # Conditionally configure the X300 support ######################################################################## -IF(ENABLE_X300) +if(ENABLE_X300) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/x300_radio_ctrl_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/x300_impl.cpp @@ -28,4 +28,4 @@ IF(ENABLE_X300) ${CMAKE_CURRENT_SOURCE_DIR}/x300_mb_eeprom.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cdecode.c ) -ENDIF(ENABLE_X300) +endif(ENABLE_X300) diff --git a/host/lib/usrp_clock/CMakeLists.txt b/host/lib/usrp_clock/CMakeLists.txt index 1812fcca5..ec6bc1ddc 100644 --- a/host/lib/usrp_clock/CMakeLists.txt +++ b/host/lib/usrp_clock/CMakeLists.txt @@ -13,10 +13,10 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/multi_usrp_clock.cpp ) -IF(ENABLE_C_API) +if(ENABLE_C_API) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/usrp_clock_c.cpp ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) INCLUDE_SUBDIRECTORY(octoclock) diff --git a/host/lib/usrp_clock/octoclock/CMakeLists.txt b/host/lib/usrp_clock/octoclock/CMakeLists.txt index 6a978bd2a..e42a66141 100644 --- a/host/lib/usrp_clock/octoclock/CMakeLists.txt +++ b/host/lib/usrp_clock/octoclock/CMakeLists.txt @@ -8,11 +8,11 @@ ######################################################################## # Conditionally configure the OctoClock support ######################################################################## -IF(ENABLE_OCTOCLOCK) +if(ENABLE_OCTOCLOCK) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/octoclock_eeprom.cpp ${CMAKE_CURRENT_SOURCE_DIR}/octoclock_image_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/octoclock_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/octoclock_uart.cpp ) -ENDIF(ENABLE_OCTOCLOCK) +endif(ENABLE_OCTOCLOCK) diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index f81e0763f..1ecf6b9fe 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -12,9 +12,9 @@ ######################################################################## # Setup defines for process scheduling ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring priority scheduling...") -INCLUDE(CheckCXXSourceCompiles) +message(STATUS "") +message(STATUS "Configuring priority scheduling...") +include(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES(" #include <pthread.h> @@ -26,10 +26,10 @@ CHECK_CXX_SOURCE_COMPILES(" " HAVE_PTHREAD_SETSCHEDPARAM ) -IF(CYGWIN) +if(CYGWIN) #SCHED_RR non-operational on cygwin - SET(HAVE_PTHREAD_SETSCHEDPARAM False) -ENDIF(CYGWIN) + set(HAVE_PTHREAD_SETSCHEDPARAM False) +endif(CYGWIN) CHECK_CXX_SOURCE_COMPILES(" #include <windows.h> @@ -43,19 +43,19 @@ CHECK_CXX_SOURCE_COMPILES(" -IF(HAVE_PTHREAD_SETSCHEDPARAM) - MESSAGE(STATUS " Priority scheduling supported through pthread_setschedparam.") - LIST(APPEND THREAD_PRIO_DEFS HAVE_PTHREAD_SETSCHEDPARAM) +if(HAVE_PTHREAD_SETSCHEDPARAM) + message(STATUS " Priority scheduling supported through pthread_setschedparam.") + list(APPEND THREAD_PRIO_DEFS HAVE_PTHREAD_SETSCHEDPARAM) LIBUHD_APPEND_LIBS(pthread) -ELSEIF(HAVE_WIN_SETTHREADPRIORITY) - MESSAGE(STATUS " Priority scheduling supported through windows SetThreadPriority.") - SET(THREAD_PRIO_DEFS HAVE_WIN_SETTHREADPRIORITY) -ELSE() - MESSAGE(STATUS " Priority scheduling not supported.") - SET(THREAD_PRIO_DEFS HAVE_THREAD_PRIO_DUMMY) -ENDIF() +elseif(HAVE_WIN_SETTHREADPRIORITY) + message(STATUS " Priority scheduling supported through windows SetThreadPriority.") + set(THREAD_PRIO_DEFS HAVE_WIN_SETTHREADPRIORITY) +else() + message(STATUS " Priority scheduling not supported.") + set(THREAD_PRIO_DEFS HAVE_THREAD_PRIO_DUMMY) +endif() -SET(CMAKE_REQUIRED_LIBRARIES "pthread") +set(CMAKE_REQUIRED_LIBRARIES "pthread") CHECK_CXX_SOURCE_COMPILES(" #include <pthread.h> @@ -68,22 +68,22 @@ CHECK_CXX_SOURCE_COMPILES(" " HAVE_PTHREAD_SETNAME ) -IF(CYGWIN) +if(CYGWIN) #SCHED_RR non-operational on cygwin - SET(HAVE_PTHREAD_SETNAME False) -ENDIF(CYGWIN) + set(HAVE_PTHREAD_SETNAME False) +endif(CYGWIN) -IF(HAVE_PTHREAD_SETNAME) - MESSAGE(STATUS " Setting thread names is supported through pthread_setname_np.") - LIST(APPEND THREAD_PRIO_DEFS HAVE_PTHREAD_SETNAME) +if(HAVE_PTHREAD_SETNAME) + message(STATUS " Setting thread names is supported through pthread_setname_np.") + list(APPEND THREAD_PRIO_DEFS HAVE_PTHREAD_SETNAME) LIBUHD_APPEND_LIBS(pthread) -ELSE() - MESSAGE(STATUS " Setting thread names is not supported.") - LIST(APPEND THREAD_PRIO_DEFS HAVE_THREAD_SETNAME_DUMMY) -ENDIF() +else() + message(STATUS " Setting thread names is not supported.") + list(APPEND THREAD_PRIO_DEFS HAVE_THREAD_SETNAME_DUMMY) +endif() -SET_SOURCE_FILES_PROPERTIES( +set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/thread.cpp PROPERTIES COMPILE_DEFINITIONS "${THREAD_PRIO_DEFS}" ) @@ -91,11 +91,11 @@ SET_SOURCE_FILES_PROPERTIES( ######################################################################## # Setup defines for high resolution timing ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring high resolution timing...") -INCLUDE(CheckCXXSourceCompiles) +message(STATUS "") +message(STATUS "Configuring high resolution timing...") +include(CheckCXXSourceCompiles) -SET(CMAKE_REQUIRED_LIBRARIES -lrt) +set(CMAKE_REQUIRED_LIBRARIES -lrt) CHECK_CXX_SOURCE_COMPILES(" #include <ctime> int main(){ @@ -104,9 +104,9 @@ CHECK_CXX_SOURCE_COMPILES(" } " HAVE_CLOCK_GETTIME ) -SET(CMAKE_REQUIRED_LIBRARIES) +set(CMAKE_REQUIRED_LIBRARIES) -INCLUDE(CheckCXXSourceCompiles) +include(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES(" #include <mach/mach_time.h> int main(){ @@ -130,22 +130,22 @@ CHECK_CXX_SOURCE_COMPILES(" ) -IF(HAVE_CLOCK_GETTIME) - MESSAGE(STATUS " High resolution timing supported through clock_gettime.") - SET(SYSTEM_TIME_DEFS HAVE_CLOCK_GETTIME) +if(HAVE_CLOCK_GETTIME) + message(STATUS " High resolution timing supported through clock_gettime.") + set(SYSTEM_TIME_DEFS HAVE_CLOCK_GETTIME) LIBUHD_APPEND_LIBS("-lrt") -ELSEIF(HAVE_MACH_ABSOLUTE_TIME) - MESSAGE(STATUS " High resolution timing supported through mach_absolute_time.") - SET(SYSTEM_TIME_DEFS HAVE_MACH_ABSOLUTE_TIME) -ELSEIF(HAVE_QUERY_PERFORMANCE_COUNTER) - MESSAGE(STATUS " High resolution timing supported through QueryPerformanceCounter.") - SET(SYSTEM_TIME_DEFS HAVE_QUERY_PERFORMANCE_COUNTER) -ELSE() - MESSAGE(STATUS " High resolution timing supported though microsec_clock.") - SET(SYSTEM_TIME_DEFS HAVE_MICROSEC_CLOCK) -ENDIF() - -SET_SOURCE_FILES_PROPERTIES( +elseif(HAVE_MACH_ABSOLUTE_TIME) + message(STATUS " High resolution timing supported through mach_absolute_time.") + set(SYSTEM_TIME_DEFS HAVE_MACH_ABSOLUTE_TIME) +elseif(HAVE_QUERY_PERFORMANCE_COUNTER) + message(STATUS " High resolution timing supported through QueryPerformanceCounter.") + set(SYSTEM_TIME_DEFS HAVE_QUERY_PERFORMANCE_COUNTER) +else() + message(STATUS " High resolution timing supported though microsec_clock.") + set(SYSTEM_TIME_DEFS HAVE_MICROSEC_CLOCK) +endif() + +set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/system_time.cpp PROPERTIES COMPILE_DEFINITIONS "${SYSTEM_TIME_DEFS}" ) @@ -153,11 +153,11 @@ SET_SOURCE_FILES_PROPERTIES( ######################################################################## # Setup defines for module loading ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring module loading...") -INCLUDE(CheckCXXSourceCompiles) +message(STATUS "") +message(STATUS "Configuring module loading...") +include(CheckCXXSourceCompiles) -SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) CHECK_CXX_SOURCE_COMPILES(" #include <dlfcn.h> int main(){ @@ -166,7 +166,7 @@ CHECK_CXX_SOURCE_COMPILES(" } " HAVE_DLOPEN ) -SET(CMAKE_REQUIRED_LIBRARIES) +set(CMAKE_REQUIRED_LIBRARIES) CHECK_CXX_SOURCE_COMPILES(" #define WIN32_LEAN_AND_MEAN @@ -178,19 +178,19 @@ CHECK_CXX_SOURCE_COMPILES(" " HAVE_LOAD_LIBRARY ) -IF(HAVE_DLOPEN) - MESSAGE(STATUS " Module loading supported through dlopen.") - SET(LOAD_MODULES_DEFS HAVE_DLOPEN) +if(HAVE_DLOPEN) + message(STATUS " Module loading supported through dlopen.") + set(LOAD_MODULES_DEFS HAVE_DLOPEN) LIBUHD_APPEND_LIBS(${CMAKE_DL_LIBS}) -ELSEIF(HAVE_LOAD_LIBRARY) - MESSAGE(STATUS " Module loading supported through LoadLibrary.") - SET(LOAD_MODULES_DEFS HAVE_LOAD_LIBRARY) -ELSE() - MESSAGE(STATUS " Module loading not supported.") - SET(LOAD_MODULES_DEFS HAVE_LOAD_MODULES_DUMMY) -ENDIF() - -SET_SOURCE_FILES_PROPERTIES( +elseif(HAVE_LOAD_LIBRARY) + message(STATUS " Module loading supported through LoadLibrary.") + set(LOAD_MODULES_DEFS HAVE_LOAD_LIBRARY) +else() + message(STATUS " Module loading not supported.") + set(LOAD_MODULES_DEFS HAVE_LOAD_MODULES_DUMMY) +endif() + +set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/load_modules.cpp PROPERTIES COMPILE_DEFINITIONS "${LOAD_MODULES_DEFS}" ) @@ -198,17 +198,17 @@ SET_SOURCE_FILES_PROPERTIES( ######################################################################## # Define UHD_PKG_DATA_PATH for paths.cpp ######################################################################## -FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" UHD_PKG_PATH) -STRING(REPLACE "\\" "\\\\" UHD_PKG_PATH "${UHD_PKG_PATH}") +file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" UHD_PKG_PATH) +string(REPLACE "\\" "\\\\" UHD_PKG_PATH "${UHD_PKG_PATH}") -STRING(REGEX MATCH ".*/.*" SLASH "${LIB_SUFFIX}") -IF(SLASH STREQUAL "") - SET(UHD_LIB_DIR "lib${LIB_SUFFIX}") -ELSE() - SET(UHD_LIB_DIR "lib") -ENDIF(SLASH STREQUAL "") +string(REGEX MATCH ".*/.*" SLASH "${LIB_SUFFIX}") +if(SLASH STREQUAL "") + set(UHD_LIB_DIR "lib${LIB_SUFFIX}") +else() + set(UHD_LIB_DIR "lib") +endif(SLASH STREQUAL "") -SET_SOURCE_FILES_PROPERTIES( +set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/paths.cpp ${CMAKE_CURRENT_SOURCE_DIR}/images.cpp PROPERTIES COMPILE_DEFINITIONS @@ -237,9 +237,9 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/thread.cpp ) -IF(ENABLE_C_API) +if(ENABLE_C_API) LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/log_c.cpp ${CMAKE_CURRENT_SOURCE_DIR}/thread_priority_c.cpp ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index 32a32592e..07791de55 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -15,66 +15,66 @@ PYTHON_CHECK_MODULE( ) # Get include dirs -INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) -EXECUTE_PROCESS( +include_directories(${PYTHON_INCLUDE_DIRS}) +execute_process( COMMAND "${PYTHON_EXECUTABLE}" -c "from __future__ import print_function\ntry:\n import numpy\n import os\n inc_path = numpy.get_include()\n if os.path.exists(os.path.join(inc_path, 'numpy', 'arrayobject.h')):\n print(inc_path, end='')\nexcept:\n pass" OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR) # Build pyuhd library -ADD_LIBRARY(pyuhd SHARED pyuhd.cpp) -TARGET_INCLUDE_DIRECTORIES(pyuhd PUBLIC +add_library(pyuhd SHARED pyuhd.cpp) +target_include_directories(pyuhd PUBLIC ${PYTHON_NUMPY_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/lib ) -TARGET_LINK_LIBRARIES(pyuhd ${BOOST_PYTHON_LIBRARY} ${Boost_LIBRARIES} ${PYTHON_LIBRARY} uhd) +target_link_libraries(pyuhd ${BOOST_PYTHON_LIBRARY} ${Boost_LIBRARIES} ${PYTHON_LIBRARY} uhd) # Copy pyuhd library to the staging directory -IF(WIN32) - SET(PYUHD_LIBRARY_NAME libpyuhd.pyd) -ELSE() - SET(PYUHD_LIBRARY_NAME libpyuhd${CMAKE_SHARED_LIBRARY_SUFFIX}) -ENDIF(WIN32) +if(WIN32) + set(PYUHD_LIBRARY_NAME libpyuhd.pyd) +else() + set(PYUHD_LIBRARY_NAME libpyuhd${CMAKE_SHARED_LIBRARY_SUFFIX}) +endif(WIN32) -ADD_CUSTOM_COMMAND(TARGET pyuhd +add_custom_command(TARGET pyuhd POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:pyuhd> ${CMAKE_CURRENT_BINARY_DIR}/uhd/${PYUHD_LIBRARY_NAME}) -SET(PYUHD_FILES +set(PYUHD_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/types.py ${CMAKE_CURRENT_SOURCE_DIR}/usrp.py ${CMAKE_CURRENT_SOURCE_DIR}/filters.py ) -SET(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") -SET(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") -SET(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") +set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") +set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") +set(TIMESTAMP_FILE "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") -CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY}) +configure_file(${SETUP_PY_IN} ${SETUP_PY}) -ADD_CUSTOM_COMMAND(OUTPUT ${TIMESTAMP_FILE} +add_custom_command(OUTPUT ${TIMESTAMP_FILE} COMMAND ${CMAKE_COMMAND} -E copy ${PYUHD_FILES} ${CMAKE_CURRENT_BINARY_DIR}/uhd COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q build COMMAND ${CMAKE_COMMAND} -E touch ${TIMESTAMP_FILE} DEPENDS ${PYUHD_FILES}) -ADD_CUSTOM_TARGET(pyuhd_library ALL DEPENDS ${TIMESTAMP_FILE} pyuhd) -IF(HAVE_PYTHON_VIRTUALENV) +add_custom_target(pyuhd_library ALL DEPENDS ${TIMESTAMP_FILE} pyuhd) +if(HAVE_PYTHON_VIRTUALENV) # In virtualenvs, let setuptools do its thing - INSTALL(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q install --force)") -ELSE() + install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q install --force)") +else() # Otherwise, use distutils to determine the correct relative path for Python # packages, and install to our prefix - IF(NOT DEFINED UHD_PYTHON_DIR) + if(NOT DEFINED UHD_PYTHON_DIR) execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from __future__ import print_function;\ from distutils import sysconfig;\ print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'));" OUTPUT_VARIABLE UHD_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) - ENDIF(NOT DEFINED UHD_PYTHON_DIR) + endif(NOT DEFINED UHD_PYTHON_DIR) file(TO_CMAKE_PATH ${UHD_PYTHON_DIR} UHD_PYTHON_DIR) - MESSAGE(STATUS "Utilizing the python install directory: ${UHD_PYTHON_DIR}") - INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/uhd DESTINATION ${UHD_PYTHON_DIR} COMPONENT pythonapi) -ENDIF(HAVE_PYTHON_VIRTUALENV) + message(STATUS "Utilizing the python install directory: ${UHD_PYTHON_DIR}") + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/uhd DESTINATION ${UHD_PYTHON_DIR} COMPONENT pythonapi) +endif(HAVE_PYTHON_VIRTUALENV) diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt index 0424b1b53..4b068321b 100644 --- a/host/tests/CMakeLists.txt +++ b/host/tests/CMakeLists.txt @@ -13,15 +13,15 @@ include(UHDUnitTest) ######################################################################## # build test common ######################################################################## -SET(test_common_SOURCEDIR ${CMAKE_CURRENT_SOURCE_DIR}/common) -ADD_SUBDIRECTORY(common) -LINK_DIRECTORIES(test_common_SOURCEDIR) +set(test_common_SOURCEDIR ${CMAKE_CURRENT_SOURCE_DIR}/common) +add_subdirectory(common) +link_directories(test_common_SOURCEDIR) ######################################################################## # unit test suite ######################################################################## -SET(test_sources +set(test_sources addr_test.cpp buffer_test.cpp byteswap_test.cpp @@ -55,10 +55,10 @@ SET(test_sources ) #turn each test cpp file into an executable with an int main() function -ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) +add_definitions(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) -IF(ENABLE_RFNOC) - LIST(APPEND test_sources +if(ENABLE_RFNOC) + list(APPEND test_sources block_id_test.cpp blockdef_test.cpp device3_test.cpp @@ -68,10 +68,10 @@ IF(ENABLE_RFNOC) stream_sig_test.cpp tick_node_test.cpp ) -ENDIF(ENABLE_RFNOC) +endif(ENABLE_RFNOC) -IF(ENABLE_C_API) - LIST(APPEND test_sources +if(ENABLE_C_API) + list(APPEND test_sources eeprom_c_test.c error_c_test.cpp ranges_c_test.c @@ -79,54 +79,54 @@ IF(ENABLE_C_API) string_vector_c_test.c subdev_spec_c_test.c ) -ENDIF(ENABLE_C_API) +endif(ENABLE_C_API) -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/lib/include") -INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/common") +include_directories("${CMAKE_SOURCE_DIR}/lib/include") +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/common") #for each source: build an executable, register it as a test -FOREACH(test_source ${test_sources}) - GET_FILENAME_COMPONENT(test_name ${test_source} NAME_WE) - ADD_EXECUTABLE(${test_name} ${test_source}) - TARGET_LINK_LIBRARIES(${test_name} uhd uhd_test ${Boost_LIBRARIES}) +foreach(test_source ${test_sources}) + get_filename_component(test_name ${test_source} NAME_WE) + add_executable(${test_name} ${test_source}) + target_link_libraries(${test_name} uhd uhd_test ${Boost_LIBRARIES}) UHD_ADD_TEST(${test_name} ${test_name}) UHD_INSTALL(TARGETS ${test_name} RUNTIME DESTINATION ${PKG_LIB_DIR}/tests COMPONENT tests) -ENDFOREACH(test_source) +endforeach(test_source) # Other tests that don't directly link with libuhd: (TODO find a nicer way to do this) -INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/lib/rfnoc/nocscript/) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/) -ADD_EXECUTABLE(nocscript_expr_test +include_directories(${CMAKE_BINARY_DIR}/lib/rfnoc/nocscript/) +include_directories(${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/) +add_executable(nocscript_expr_test nocscript_expr_test.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/expression.cpp ) -TARGET_LINK_LIBRARIES(nocscript_expr_test uhd ${Boost_LIBRARIES}) +target_link_libraries(nocscript_expr_test uhd ${Boost_LIBRARIES}) UHD_ADD_TEST(nocscript_expr_test nocscript_expr_test) UHD_INSTALL(TARGETS nocscript_expr_test RUNTIME DESTINATION ${PKG_LIB_DIR}/tests COMPONENT tests) -ADD_EXECUTABLE(nocscript_ftable_test +add_executable(nocscript_ftable_test nocscript_ftable_test.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/function_table.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/expression.cpp ) -TARGET_LINK_LIBRARIES(nocscript_ftable_test uhd ${Boost_LIBRARIES}) +target_link_libraries(nocscript_ftable_test uhd ${Boost_LIBRARIES}) UHD_ADD_TEST(nocscript_ftable_test nocscript_ftable_test) UHD_INSTALL(TARGETS nocscript_ftable_test RUNTIME DESTINATION ${PKG_LIB_DIR}/tests COMPONENT tests) -ADD_EXECUTABLE(nocscript_parser_test +add_executable(nocscript_parser_test nocscript_parser_test.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/parser.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/function_table.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/nocscript/expression.cpp ) -TARGET_LINK_LIBRARIES(nocscript_parser_test uhd ${Boost_LIBRARIES}) +target_link_libraries(nocscript_parser_test uhd ${Boost_LIBRARIES}) UHD_ADD_TEST(nocscript_parser_test nocscript_parser_test) UHD_INSTALL(TARGETS nocscript_parser_test RUNTIME DESTINATION ${PKG_LIB_DIR}/tests COMPONENT tests) -ADD_EXECUTABLE(config_parser_test +add_executable(config_parser_test config_parser_test.cpp ${CMAKE_SOURCE_DIR}/lib/utils/config_parser.cpp ) -TARGET_LINK_LIBRARIES(config_parser_test uhd ${Boost_LIBRARIES}) +target_link_libraries(config_parser_test uhd ${Boost_LIBRARIES}) UHD_ADD_TEST(config_parser_test config_parser_test) UHD_INSTALL(TARGETS config_parser_test @@ -135,21 +135,21 @@ UHD_INSTALL(TARGETS COMPONENT tests ) -ADD_EXECUTABLE(paths_test +add_executable(paths_test paths_test.cpp ${CMAKE_SOURCE_DIR}/lib/utils/pathslib.cpp ) # Careful: This is to satisfy the out-of-library build of paths.cpp. This is # duplicate code from lib/utils/CMakeLists.txt, and it's been simplified. -SET(UHD_LIB_DIR "lib") -FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" UHD_PKG_PATH) -STRING(REPLACE "\\" "\\\\" UHD_PKG_PATH "${UHD_PKG_PATH}") -SET_SOURCE_FILES_PROPERTIES( +set(UHD_LIB_DIR "lib") +file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" UHD_PKG_PATH) +string(REPLACE "\\" "\\\\" UHD_PKG_PATH "${UHD_PKG_PATH}") +set_source_files_properties( ${CMAKE_SOURCE_DIR}/lib/utils/paths.cpp PROPERTIES COMPILE_DEFINITIONS "UHD_PKG_PATH=\"${UHD_PKG_PATH}\";UHD_LIB_DIR=\"${UHD_LIB_DIR}\"" ) -TARGET_LINK_LIBRARIES(paths_test uhd ${Boost_LIBRARIES}) +target_link_libraries(paths_test uhd ${Boost_LIBRARIES}) UHD_ADD_TEST(paths_test paths_test) UHD_INSTALL(TARGETS paths_test @@ -161,9 +161,9 @@ UHD_INSTALL(TARGETS ######################################################################## # demo of a loadable module ######################################################################## -IF(MSVC OR APPLE OR LINUX) - ADD_LIBRARY(module_test MODULE module_test.cpp) - TARGET_LINK_LIBRARIES(module_test uhd) -ENDIF() +if(MSVC OR APPLE OR LINUX) + add_library(module_test MODULE module_test.cpp) + target_link_libraries(module_test uhd) +endif() -ADD_SUBDIRECTORY(devtest) +add_subdirectory(devtest) diff --git a/host/tests/common/CMakeLists.txt b/host/tests/common/CMakeLists.txt index 91a70dfae..e48e85c2f 100644 --- a/host/tests/common/CMakeLists.txt +++ b/host/tests/common/CMakeLists.txt @@ -7,8 +7,8 @@ ######################################################################## # Build uhd_test static lib ######################################################################## -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/lib/include") -ADD_LIBRARY(uhd_test ${CMAKE_CURRENT_SOURCE_DIR}/mock_ctrl_iface_impl.cpp +include_directories("${CMAKE_SOURCE_DIR}/lib/include") +add_library(uhd_test ${CMAKE_CURRENT_SOURCE_DIR}/mock_ctrl_iface_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mock_zero_copy.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/graph_impl.cpp ${CMAKE_SOURCE_DIR}/lib/rfnoc/async_msg_handler.cpp diff --git a/host/tests/devtest/CMakeLists.txt b/host/tests/devtest/CMakeLists.txt index 0bce8050d..69acc638f 100644 --- a/host/tests/devtest/CMakeLists.txt +++ b/host/tests/devtest/CMakeLists.txt @@ -6,10 +6,10 @@ # # Formatting -MESSAGE(STATUS "") +message(STATUS "") # All devtest files get installed: -FILE(GLOB py_devtest_files "*.py") +file(GLOB py_devtest_files "*.py") UHD_INSTALL(PROGRAMS ${py_devtest_files} DESTINATION ${PKG_LIB_DIR}/tests/devtest @@ -20,9 +20,9 @@ UHD_INSTALL(PROGRAMS # - pattern: This will be used to identify which devtest_*.py is to be executed. # - filter: Will be used in args strings as "type=<filter>". # - devtype: A descriptive string. Is only used for CMake output. -MACRO(ADD_DEVTEST pattern filter devtype) - MESSAGE(STATUS "Adding ${devtype} device test target") - ADD_CUSTOM_TARGET("test_${pattern}" +macro(ADD_DEVTEST pattern filter devtype) + message(STATUS "Adding ${devtype} device test target") + add_custom_target("test_${pattern}" ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run_testsuite.py "--src-dir" "${CMAKE_CURRENT_SOURCE_DIR}" "--devtest-pattern" "${pattern}" @@ -32,20 +32,20 @@ MACRO(ADD_DEVTEST pattern filter devtype) COMMENT "Running device test on all connected ${devtype} devices:" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" ) -ENDMACRO(ADD_DEVTEST) +endmacro(ADD_DEVTEST) -IF(ENABLE_B200) +if(ENABLE_B200) ADD_DEVTEST("b2xx" "b200" "B2XX") -ENDIF(ENABLE_B200) -IF(ENABLE_X300) +endif(ENABLE_B200) +if(ENABLE_X300) ADD_DEVTEST("x3x0" "x300" "X3x0") -ENDIF(ENABLE_X300) -IF(ENABLE_E300) +endif(ENABLE_X300) +if(ENABLE_E300) ADD_DEVTEST("e3xx" "e3x0" "E3XX") -ENDIF(ENABLE_E300) -IF(ENABLE_MPMD) +endif(ENABLE_E300) +if(ENABLE_MPMD) ADD_DEVTEST("n3x0" "n3xx" "N3XX") ADD_DEVTEST("e320" "e3xx" "E32x") -ENDIF(ENABLE_MPMD) +endif(ENABLE_MPMD) # Formatting -MESSAGE(STATUS "") +message(STATUS "") diff --git a/host/utils/CMakeLists.txt b/host/utils/CMakeLists.txt index b8dd70a54..4e8d8e5f0 100644 --- a/host/utils/CMakeLists.txt +++ b/host/utils/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Utilities that get installed into the runtime path ######################################################################## -SET(util_runtime_sources +set(util_runtime_sources uhd_config_info.cpp uhd_find_devices.cpp uhd_usrp_probe.cpp @@ -19,89 +19,89 @@ SET(util_runtime_sources ) find_package(UDev) -IF(ENABLE_E300 AND NOT E300_FORCE_NETWORK) - IF(UDEV_FOUND) - LIST(APPEND util_runtime_sources usrp_e3x0_network_mode.cpp) - ENDIF(UDEV_FOUND) -ENDIF(ENABLE_E300 AND NOT E300_FORCE_NETWORK) +if(ENABLE_E300 AND NOT E300_FORCE_NETWORK) + if(UDEV_FOUND) + list(APPEND util_runtime_sources usrp_e3x0_network_mode.cpp) + endif(UDEV_FOUND) +endif(ENABLE_E300 AND NOT E300_FORCE_NETWORK) #for each source: build an executable and install -FOREACH(util_source ${util_runtime_sources}) - GET_FILENAME_COMPONENT(util_name ${util_source} NAME_WE) - ADD_EXECUTABLE(${util_name} ${util_source}) - TARGET_LINK_LIBRARIES(${util_name} uhd ${Boost_LIBRARIES}) +foreach(util_source ${util_runtime_sources}) + get_filename_component(util_name ${util_source} NAME_WE) + add_executable(${util_name} ${util_source}) + target_link_libraries(${util_name} uhd ${Boost_LIBRARIES}) UHD_INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${RUNTIME_DIR} COMPONENT utilities) -ENDFOREACH(util_source) +endforeach(util_source) ######################################################################## # Utilities that get installed into the share path ######################################################################## -SET(util_share_sources +set(util_share_sources converter_benchmark.cpp query_gpsdo_sensors.cpp usrp_burn_db_eeprom.cpp usrp_burn_mb_eeprom.cpp ) -SET(util_share_sources_py +set(util_share_sources_py converter_benchmark.py ) -IF(ENABLE_USB) - LIST(APPEND util_share_sources +if(ENABLE_USB) + list(APPEND util_share_sources fx2_init_eeprom.cpp ) - INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS}) - IF(ENABLE_B200) - LIST(APPEND util_share_sources + include_directories(${LIBUSB_INCLUDE_DIRS}) + if(ENABLE_B200) + list(APPEND util_share_sources b2xx_fx3_utils.cpp ) # Additional include directories for b2xx_fx3_utils - INCLUDE_DIRECTORIES( + include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../lib/include ${CMAKE_CURRENT_SOURCE_DIR}/../lib/usrp/b200 ${CMAKE_CURRENT_SOURCE_DIR}/../lib/usrp/common ${CMAKE_CURRENT_SOURCE_DIR}/../lib/usrp/common/ad9361_driver ) - ENDIF(ENABLE_B200) -ENDIF(ENABLE_USB) -IF(ENABLE_OCTOCLOCK) - LIST(APPEND util_share_sources + endif(ENABLE_B200) +endif(ENABLE_USB) +if(ENABLE_OCTOCLOCK) + list(APPEND util_share_sources octoclock_burn_eeprom.cpp ) -ENDIF(ENABLE_OCTOCLOCK) +endif(ENABLE_OCTOCLOCK) -IF(LINUX AND ENABLE_USB) +if(LINUX AND ENABLE_USB) UHD_INSTALL(FILES uhd-usrp.rules DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities ) -ENDIF(LINUX AND ENABLE_USB) +endif(LINUX AND ENABLE_USB) #for each source: build an executable and install -FOREACH(util_source ${util_share_sources}) - GET_FILENAME_COMPONENT(util_name ${util_source} NAME_WE) - ADD_EXECUTABLE(${util_name} ${util_source}) - TARGET_LINK_LIBRARIES(${util_name} uhd ${Boost_LIBRARIES}) +foreach(util_source ${util_share_sources}) + get_filename_component(util_name ${util_source} NAME_WE) + add_executable(${util_name} ${util_source}) + target_link_libraries(${util_name} uhd ${Boost_LIBRARIES}) UHD_INSTALL(TARGETS ${util_name} RUNTIME DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities) -ENDFOREACH(util_source) -FOREACH(util_source ${util_share_sources_py}) +endforeach(util_source) +foreach(util_source ${util_share_sources_py}) UHD_INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${util_source} DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities ) -ENDFOREACH(util_source) +endforeach(util_source) #UHD images downloader configuration -FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/../../images/manifest.txt CMAKE_MANIFEST_CONTENTS) -CONFIGURE_FILE( +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../../images/manifest.txt CMAKE_MANIFEST_CONTENTS) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/uhd_images_downloader.py.in ${CMAKE_CURRENT_BINARY_DIR}/uhd_images_downloader.py @ONLY) # TODO: FIXME when know how. # This is a hack to force cmake regenerate uhd_images_downloader.py # whenever manifest.txt file changed. -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../../images/manifest.txt ${CMAKE_CURRENT_SOURCE_DIR}/../../images/manifest.txt COPYONLY) @@ -111,26 +111,26 @@ UHD_INSTALL(PROGRAMS DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities ) -IF(LINUX) +if(LINUX) UHD_INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/uhd_images_downloader.py RENAME uhd_images_downloader DESTINATION ${RUNTIME_DIR} COMPONENT utilities ) -ENDIF(LINUX) -IF(NOT HAVE_PYTHON_MODULE_REQUESTS) - MESSAGE(WARNING "Python module `requests' not found -- uhd_images_downloader.py will not work without it.") - MESSAGE(WARNING "You may be able to install this by running 'pip install requests'") -ENDIF(NOT HAVE_PYTHON_MODULE_REQUESTS) +endif(LINUX) +if(NOT HAVE_PYTHON_MODULE_REQUESTS) + message(WARNING "Python module `requests' not found -- uhd_images_downloader.py will not work without it.") + message(WARNING "You may be able to install this by running 'pip install requests'") +endif(NOT HAVE_PYTHON_MODULE_REQUESTS) -IF(ENABLE_USRP2) - SET(burners +if(ENABLE_USRP2) + set(burners usrp2_card_burner.py ) - IF(WIN32 AND UHD_RELEASE_MODE) #include dd.exe - FILE(DOWNLOAD + if(WIN32 AND UHD_RELEASE_MODE) #include dd.exe + file(DOWNLOAD "http://files.ettus.com/dd.exe" ${CMAKE_CURRENT_BINARY_DIR}/dd.exe ) @@ -139,8 +139,8 @@ IF(ENABLE_USRP2) DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities ) - ENDIF(WIN32 AND UHD_RELEASE_MODE) - IF(LINUX) + endif(WIN32 AND UHD_RELEASE_MODE) + if(LINUX) UHD_INSTALL(PROGRAMS usrp2_recovery.py DESTINATION ${PKG_LIB_DIR}/utils @@ -152,22 +152,22 @@ IF(ENABLE_USRP2) DESTINATION ${RUNTIME_DIR} COMPONENT utilities ) - ENDIF(LINUX) - FOREACH(burner ${burners}) + endif(LINUX) + foreach(burner ${burners}) UHD_INSTALL(PROGRAMS ${burner} DESTINATION ${PKG_LIB_DIR}/utils COMPONENT utilities ) - ENDFOREACH(burner ${burners}) + endforeach(burner ${burners}) -ENDIF(ENABLE_USRP2) +endif(ENABLE_USRP2) ######################################################################## # Other files that are not utilities or executables ######################################################################## -IF(WIN32) - SET(windows_extra_files +if(WIN32) + set(windows_extra_files FastSendDatagramThreshold.reg ) UHD_INSTALL( @@ -175,6 +175,6 @@ IF(WIN32) DESTINATION ${PKG_DATA_DIR} COMPONENT utilities ) -ENDIF(WIN32) +endif(WIN32) -ADD_SUBDIRECTORY(latency) +add_subdirectory(latency) diff --git a/host/utils/latency/CMakeLists.txt b/host/utils/latency/CMakeLists.txt index 4ccfd3eba..05bacd77a 100644 --- a/host/utils/latency/CMakeLists.txt +++ b/host/utils/latency/CMakeLists.txt @@ -5,32 +5,32 @@ # SPDX-License-Identifier: GPL-3.0 # -FIND_PACKAGE(Curses) +find_package(Curses) -IF(CURSES_FOUND) - INCLUDE_DIRECTORIES(${CURSES_INCLUDE_DIR}) - SET(latency_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/include) - INCLUDE_DIRECTORIES(${latency_include_dir}) - SET(latency_lib_path ${CMAKE_CURRENT_SOURCE_DIR}/lib/Responder.cpp) +if(CURSES_FOUND) + include_directories(${CURSES_INCLUDE_DIR}) + set(latency_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/include) + include_directories(${latency_include_dir}) + set(latency_lib_path ${CMAKE_CURRENT_SOURCE_DIR}/lib/Responder.cpp) - SET(sources + set(sources responder.cpp ) - SET(latency_comp_name utilities) - SET(latency_comp_dest ${PKG_LIB_DIR}/utils/latency) + set(latency_comp_name utilities) + set(latency_comp_dest ${PKG_LIB_DIR}/utils/latency) #for each source: build an executable and install - FOREACH(source ${sources}) - GET_FILENAME_COMPONENT(name ${source} NAME_WE) - ADD_EXECUTABLE(${name} ${source} ${latency_lib_path}) + foreach(source ${sources}) + get_filename_component(name ${source} NAME_WE) + add_executable(${name} ${source} ${latency_lib_path}) LIBUHD_APPEND_SOURCES(${name}) - TARGET_LINK_LIBRARIES(${name} uhd ${Boost_LIBRARIES} ${CURSES_LIBRARIES}) + target_link_libraries(${name} uhd ${Boost_LIBRARIES} ${CURSES_LIBRARIES}) UHD_INSTALL(TARGETS ${name} RUNTIME DESTINATION ${latency_comp_dest} COMPONENT ${latency_comp_name}) - ENDFOREACH(source) + endforeach(source) UHD_INSTALL(PROGRAMS run_tests.py graph.py DESTINATION ${latency_comp_dest} COMPONENT ${latency_comp_name} ) -ENDIF(CURSES_FOUND) +endif(CURSES_FOUND) diff --git a/mpm/CMakeLists.txt b/mpm/CMakeLists.txt index 9fc24b98b..678ef670f 100644 --- a/mpm/CMakeLists.txt +++ b/mpm/CMakeLists.txt @@ -4,137 +4,137 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) -PROJECT(MPM C CXX) # Also has Python, but CMake can take care of that later +cmake_minimum_required(VERSION 3.1) +project(MPM C CXX) # Also has Python, but CMake can take care of that later # Set the default value for CMAKE_INSTALL_PREFIX to /usr -IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - SET(CMAKE_INSTALL_PREFIX "/usr" +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Default installation path for MPM" FORCE ) -ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) +endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) -LIST(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) -SET(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) +list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules) +set(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) ######################################################################## # Setup Python API ######################################################################## -SET(PYTHON_ADDITIONAL_VERSIONS 3.4 3.5) -FIND_PACKAGE(PythonInterp 3 REQUIRED) -FIND_PACKAGE(PythonLibs 3 REQUIRED) +set(PYTHON_ADDITIONAL_VERSIONS 3.4 3.5) +find_package(PythonInterp 3 REQUIRED) +find_package(PythonLibs 3 REQUIRED) # Now, we can also include CMake modules from UHD: -LIST(INSERT CMAKE_MODULE_PATH 0 ${UHD_HOST_ROOT}/cmake/Modules) +list(INSERT CMAKE_MODULE_PATH 0 ${UHD_HOST_ROOT}/cmake/Modules) ######################################################################## # Version Information ######################################################################## -INCLUDE(MPMVersion) +include(MPMVersion) ######################################################################## # useful macros ######################################################################## -INCLUDE(MPMComponent) # enable components +include(MPMComponent) # enable components -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_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) +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}>) + list(APPEND usrp_periphs_objects $<TARGET_OBJECTS:${arg}>) endforeach(arg) - SET(usrp_periphs_objects ${usrp_periphs_objects} PARENT_SCOPE) -ENDMACRO(USRP_PERIPHS_APPEND_OBJECTS) + 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) +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) +endmacro(USRP_PERIPHS_ADD_OBJECT) ######################################################################## # Setup Boost ######################################################################## -MESSAGE(STATUS "") -MESSAGE(STATUS "Configuring Boost C++ Libraries...") -SET(BOOST_REQUIRED_COMPONENTS +message(STATUS "") +message(STATUS "Configuring Boost C++ Libraries...") +set(BOOST_REQUIRED_COMPONENTS system python3 ) -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 +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}) +find_package(Boost 1.53 COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) -INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) -LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) +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}") +message(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}") +message(STATUS "Boost library directories: ${Boost_LIBRARY_DIRS}") +message(STATUS "Boost libraries: ${Boost_LIBRARIES}") ######################################################################## # 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) +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 14) +set(CMAKE_CXX_STANDARD 14) include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-Wno-psabi" _has_no_psabi) if(_has_no_psabi) - MESSAGE(STATUS "Disabling psABI warnings.") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") + message(STATUS "Disabling psABI warnings.") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") endif(_has_no_psabi) -SET(MPM_ALL_DEVICES n3xx e320 tests) -SET(MPM_DEVICE "n3xx" CACHE STRING "Choose an MPM device to build") -SET_PROPERTY(CACHE MPM_DEVICE PROPERTY STRINGS ${MPM_ALL_DEVICES}) +set(MPM_ALL_DEVICES n3xx e320 tests) +set(MPM_DEVICE "n3xx" CACHE STRING "Choose an MPM device to build") +set_property(CACHE MPM_DEVICE PROPERTY STRINGS ${MPM_ALL_DEVICES}) # Validate MPM_DEVICE list(FIND MPM_ALL_DEVICES ${MPM_DEVICE} mpm_device_check) if(mpm_device_check EQUAL -1) @@ -143,66 +143,66 @@ if(mpm_device_check EQUAL -1) endif() # Request required components for MPM_DEVICE -IF(MPM_DEVICE STREQUAL "n3xx") - SET(ENABLE_MYKONOS ON) - SET(ENABLE_MAGNESIUM ON) -ELSEIF(MPM_DEVICE STREQUAL "e320") - SET(ENABLE_E320 ON) -ENDIF() +if(MPM_DEVICE STREQUAL "n3xx") + set(ENABLE_MYKONOS ON) + set(ENABLE_MAGNESIUM ON) +elseif(MPM_DEVICE STREQUAL "e320") + set(ENABLE_E320 ON) +endif() MPM_REGISTER_COMPONENT("LibMPM" ENABLE_LIBMPM ON "Boost_FOUND" OFF ON) MPM_REGISTER_COMPONENT("Mykonos" ENABLE_MYKONOS ON "ENABLE_LIBMPM" OFF OFF) MPM_REGISTER_COMPONENT("Magnesium" ENABLE_MAGNESIUM ON "ENABLE_MYKONOS" OFF OFF) MPM_REGISTER_COMPONENT("E320" ENABLE_E320 ON "ENABLE_LIBMPM" OFF OFF) -ADD_SUBDIRECTORY(include) -INCLUDE_DIRECTORIES( +add_subdirectory(include) +include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include ${UHD_HOST_ROOT}/include ) -ADD_SUBDIRECTORY(lib) +add_subdirectory(lib) -MESSAGE("usrp_periphs objects: ${usrp_periphs_objects}") -ADD_LIBRARY(usrp-periphs SHARED ${usrp_periphs_objects}) -TARGET_LINK_LIBRARIES(usrp-periphs +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) +if(WIN32) + set(DESTINATION_KEYWORD RUNTIME) +else() + set(DESTINATION_KEYWORD LIBRARY) +endif() +install(TARGETS usrp-periphs ${DESTINATION_KEYWORD} DESTINATION ${LIBRARY_DIR} COMPONENT libraries) # TODO: Come up with a versioning scheme for the MPM ABI. Not high priority # though... we're the only ones linking against that. -SET_TARGET_PROPERTIES(usrp-periphs PROPERTIES VERSION "${MPM_VERSION_MAJOR}.${MPM_VERSION_API}.${MPM_VERSION_ABI}") -SET_TARGET_PROPERTIES(usrp-periphs PROPERTIES SOVERSION ${MPM_VERSION_MAJOR}) +set_target_properties(usrp-periphs PROPERTIES VERSION "${MPM_VERSION_MAJOR}.${MPM_VERSION_API}.${MPM_VERSION_ABI}") +set_target_properties(usrp-periphs PROPERTIES SOVERSION ${MPM_VERSION_MAJOR}) -ADD_SUBDIRECTORY(python) -ADD_SUBDIRECTORY(tools) -ADD_SUBDIRECTORY(systemd) +add_subdirectory(python) +add_subdirectory(tools) +add_subdirectory(systemd) ######################################################################## # Print Summary ######################################################################## -IF(MPM_VERSION_DEVEL AND NOT MPM_GIT_BRANCH STREQUAL "maint") - MESSAGE(STATUS "******************************************************") - IF(MPM_GIT_BRANCH STREQUAL "master") - MESSAGE(STATUS "* You are building the UHD development master branch.") - MESSAGE(STATUS "* For production code, we recommend our stable,") - MESSAGE(STATUS "* releases or using the release branch (maint).") - ELSE() - MESSAGE(STATUS "* You are building a development branch of UHD.") - MESSAGE(STATUS "* These branches are designed to provide early access") - MESSAGE(STATUS "* to UHD and USRP features, but should be considered") - MESSAGE(STATUS "* unstable and/or experimental!") - ENDIF(MPM_GIT_BRANCH STREQUAL "master") - MESSAGE(STATUS "******************************************************") -ENDIF(MPM_VERSION_DEVEL AND NOT MPM_GIT_BRANCH STREQUAL "maint") -MESSAGE(STATUS "Building version: ${MPM_VERSION}") -MESSAGE(STATUS "Building for device: ${MPM_DEVICE}") +if(MPM_VERSION_DEVEL AND NOT MPM_GIT_BRANCH STREQUAL "maint") + message(STATUS "******************************************************") + if(MPM_GIT_BRANCH STREQUAL "master") + message(STATUS "* You are building the UHD development master branch.") + message(STATUS "* For production code, we recommend our stable,") + message(STATUS "* releases or using the release branch (maint).") + else() + message(STATUS "* You are building a development branch of UHD.") + message(STATUS "* These branches are designed to provide early access") + message(STATUS "* to UHD and USRP features, but should be considered") + message(STATUS "* unstable and/or experimental!") + endif(MPM_GIT_BRANCH STREQUAL "master") + message(STATUS "******************************************************") +endif(MPM_VERSION_DEVEL AND NOT MPM_GIT_BRANCH STREQUAL "maint") +message(STATUS "Building version: ${MPM_VERSION}") +message(STATUS "Building for device: ${MPM_DEVICE}") diff --git a/mpm/cmake/Modules/MPMComponent.cmake b/mpm/cmake/Modules/MPMComponent.cmake index fefcc5d65..461d95185 100644 --- a/mpm/cmake/Modules/MPMComponent.cmake +++ b/mpm/cmake/Modules/MPMComponent.cmake @@ -5,8 +5,8 @@ # ######################################################################## -SET(_mpm_enabled_components "" CACHE INTERNAL "" FORCE) -SET(_mpm_disabled_components "" CACHE INTERNAL "" FORCE) +set(_mpm_enabled_components "" CACHE INTERNAL "" FORCE) +set(_mpm_disabled_components "" CACHE INTERNAL "" FORCE) ######################################################################## # Register a component into the system @@ -21,36 +21,36 @@ SET(_mpm_disabled_components "" CACHE INTERNAL "" FORCE) # "FOO" which is enabled by calling CMake with -DENABLE_FOO=ON. It defaults to # ON, unless DEPENDENCY_FOUND is false, in which case it becomes false. ######################################################################## -MACRO(MPM_REGISTER_COMPONENT name var enb deps dis req) - MESSAGE(STATUS "") - MESSAGE(STATUS "Configuring ${name} support...") - FOREACH(dep ${deps}) - MESSAGE(STATUS " Dependency ${dep} = ${${dep}}") - ENDFOREACH(dep) +macro(MPM_REGISTER_COMPONENT name var enb deps dis req) + message(STATUS "") + message(STATUS "Configuring ${name} support...") + foreach(dep ${deps}) + message(STATUS " Dependency ${dep} = ${${dep}}") + endforeach(dep) # If user specified option, store here. Note: If the user doesn't specify # this option on the cmake command line, both user_enabled and # user_disabled will be false! - IF("${${var}}" STREQUAL "OFF") - SET(user_disabled TRUE) - ELSE() - SET(user_disabled FALSE) - ENDIF("${${var}}" STREQUAL "OFF") - IF("${${var}}" STREQUAL "ON") - SET(user_enabled TRUE) - ELSE() - SET(user_enabled FALSE) - ENDIF("${${var}}" STREQUAL "ON") + if("${${var}}" STREQUAL "OFF") + set(user_disabled TRUE) + else() + set(user_disabled FALSE) + endif("${${var}}" STREQUAL "OFF") + if("${${var}}" STREQUAL "ON") + set(user_enabled TRUE) + else() + set(user_enabled FALSE) + endif("${${var}}" STREQUAL "ON") # Override default if user set - IF(user_enabled OR user_disabled) - SET(option "${${var}}") - ELSE(user_enabled OR user_disabled) - SET(option ${req}) - ENDIF() + if(user_enabled OR user_disabled) + set(option "${${var}}") + else(user_enabled OR user_disabled) + set(option ${req}) + endif() # setup the dependent option for this component - INCLUDE(CMakeDependentOption) + include(CMakeDependentOption) CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${option} "${deps}" ${dis}) # There are two failure cases: @@ -58,47 +58,47 @@ MACRO(MPM_REGISTER_COMPONENT name var enb deps dis req) # requirements are not met. # 2) The user did not explicitly turn off this component (-DENABLE_FOO=OFF) # but it is flagged as required by ${req} - IF(NOT ${var} AND user_enabled) # Case 1) - MESSAGE(FATAL_ERROR "Dependencies for required component ${name} not met.") - ENDIF(NOT ${var} AND user_enabled) - IF(NOT ${var} AND ${req} AND NOT user_disabled) # Case 2) - MESSAGE(FATAL_ERROR "Dependencies for required component ${name} not met.") - ENDIF(NOT ${var} AND ${req} AND NOT user_disabled) + if(NOT ${var} AND user_enabled) # Case 1) + message(FATAL_ERROR "Dependencies for required component ${name} not met.") + endif(NOT ${var} AND user_enabled) + if(NOT ${var} AND ${req} AND NOT user_disabled) # Case 2) + message(FATAL_ERROR "Dependencies for required component ${name} not met.") + endif(NOT ${var} AND ${req} AND NOT user_disabled) #append the component into one of the lists - IF(${var}) - MESSAGE(STATUS " Enabling ${name} support.") - LIST(APPEND _mpm_enabled_components ${name}) - ELSE(${var}) - MESSAGE(STATUS " Disabling ${name} support.") - LIST(APPEND _mpm_disabled_components ${name}) - ENDIF(${var}) - MESSAGE(STATUS " Override with -D${var}=ON/OFF") + if(${var}) + message(STATUS " Enabling ${name} support.") + list(APPEND _mpm_enabled_components ${name}) + else(${var}) + message(STATUS " Disabling ${name} support.") + list(APPEND _mpm_disabled_components ${name}) + endif(${var}) + message(STATUS " Override with -D${var}=ON/OFF") #make components lists into global variables - SET(_mpm_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) - SET(_mpm_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE) -ENDMACRO(MPM_REGISTER_COMPONENT) + set(_mpm_enabled_components ${_uhd_enabled_components} CACHE INTERNAL "" FORCE) + set(_mpm_disabled_components ${_uhd_disabled_components} CACHE INTERNAL "" FORCE) +endmacro(MPM_REGISTER_COMPONENT) ######################################################################## # Print the registered component summary ######################################################################## -FUNCTION(MPM_PRINT_COMPONENT_SUMMARY) - MESSAGE(STATUS "") - MESSAGE(STATUS "######################################################") - MESSAGE(STATUS "# MPM enabled components ") - MESSAGE(STATUS "######################################################") - FOREACH(comp ${_mpm_enabled_components}) - MESSAGE(STATUS " * ${comp}") - ENDFOREACH(comp) +function(MPM_PRINT_COMPONENT_SUMMARY) + message(STATUS "") + message(STATUS "######################################################") + message(STATUS "# MPM enabled components ") + message(STATUS "######################################################") + foreach(comp ${_mpm_enabled_components}) + message(STATUS " * ${comp}") + endforeach(comp) - MESSAGE(STATUS "") - MESSAGE(STATUS "######################################################") - MESSAGE(STATUS "# MPM disabled components ") - MESSAGE(STATUS "######################################################") - FOREACH(comp ${_mpm_disabled_components}) - MESSAGE(STATUS " * ${comp}") - ENDFOREACH(comp) + message(STATUS "") + message(STATUS "######################################################") + message(STATUS "# MPM disabled components ") + message(STATUS "######################################################") + foreach(comp ${_mpm_disabled_components}) + message(STATUS " * ${comp}") + endforeach(comp) - MESSAGE(STATUS "") -ENDFUNCTION(MPM_PRINT_COMPONENT_SUMMARY) + message(STATUS "") +endfunction(MPM_PRINT_COMPONENT_SUMMARY) diff --git a/mpm/cmake/Modules/MPMVersion.cmake b/mpm/cmake/Modules/MPMVersion.cmake index dfe22efb2..622892417 100644 --- a/mpm/cmake/Modules/MPMVersion.cmake +++ b/mpm/cmake/Modules/MPMVersion.cmake @@ -6,26 +6,26 @@ # -INCLUDE(UHDVersion) +include(UHDVersion) ############################################################################### # Set all version info equivalent to UHD versions ############################################################################### -SET(MPM_VERSION_MAJOR ${UHD_VERSION_MAJOR}) -SET(MPM_VERSION_API ${UHD_VERSION_API}) -SET(MPM_VERSION_ABI ${UHD_VERSION_ABI}) -SET(MPM_VERSION_PATCH ${UHD_VERSION_PATCH}) -SET(MPM_VERSION_DEVEL ${UHD_VERSION_DEVEL}) -SET(MPM_GIT_BRANCH ${UHD_GIT_BRANCH}) -SET(MPM_GIT_COUNT ${UHD_GIT_COUNT}) -SET(MPM_GIT_HASH ${UHD_GIT_HASH}) -STRING(REPLACE "g" "" MPM_GIT_HASH_RAW ${UHD_GIT_HASH}) +set(MPM_VERSION_MAJOR ${UHD_VERSION_MAJOR}) +set(MPM_VERSION_API ${UHD_VERSION_API}) +set(MPM_VERSION_ABI ${UHD_VERSION_ABI}) +set(MPM_VERSION_PATCH ${UHD_VERSION_PATCH}) +set(MPM_VERSION_DEVEL ${UHD_VERSION_DEVEL}) +set(MPM_GIT_BRANCH ${UHD_GIT_BRANCH}) +set(MPM_GIT_COUNT ${UHD_GIT_COUNT}) +set(MPM_GIT_HASH ${UHD_GIT_HASH}) +string(REPLACE "g" "" MPM_GIT_HASH_RAW ${UHD_GIT_HASH}) -IF(DEFINED MPM_VERSION) - SET(MPM_VERSION "${MPM_VERSION}" CACHE STRING "Set MPM_VERSION to a custom value") -ELSEIF(TRIM_UHD_VERSION STREQUAL "True") - SET(MPM_VERSION "${MPM_VERSION_MAJOR}.${MPM_VERSION_API}.${MPM_VERSION_ABI}.${MPM_VERSION_PATCH}-${MPM_GIT_HASH}") -ELSE() - SET(MPM_VERSION "${MPM_VERSION_MAJOR}.${MPM_VERSION_API}.${MPM_VERSION_ABI}.${MPM_VERSION_PATCH}-${MPM_GIT_COUNT}-${MPM_GIT_HASH}") -ENDIF() +if(DEFINED MPM_VERSION) + set(MPM_VERSION "${MPM_VERSION}" CACHE STRING "Set MPM_VERSION to a custom value") +elseif(TRIM_UHD_VERSION STREQUAL "True") + set(MPM_VERSION "${MPM_VERSION_MAJOR}.${MPM_VERSION_API}.${MPM_VERSION_ABI}.${MPM_VERSION_PATCH}-${MPM_GIT_HASH}") +else() + set(MPM_VERSION "${MPM_VERSION_MAJOR}.${MPM_VERSION_API}.${MPM_VERSION_ABI}.${MPM_VERSION_PATCH}-${MPM_GIT_COUNT}-${MPM_GIT_HASH}") +endif() diff --git a/mpm/include/CMakeLists.txt b/mpm/include/CMakeLists.txt index 83ee6bd09..49ffd9df9 100644 --- a/mpm/include/CMakeLists.txt +++ b/mpm/include/CMakeLists.txt @@ -4,4 +4,4 @@ # SPDX-License-Identifier: GPL-3.0 # -ADD_SUBDIRECTORY(mpm) +add_subdirectory(mpm) diff --git a/mpm/include/mpm/CMakeLists.txt b/mpm/include/mpm/CMakeLists.txt index 44ea1dedb..6d64ba61b 100644 --- a/mpm/include/mpm/CMakeLists.txt +++ b/mpm/include/mpm/CMakeLists.txt @@ -3,19 +3,19 @@ # # SPDX-License-Identifier: GPL-3.0 # -INSTALL(FILES +install(FILES xbar_iface.hpp exception.hpp DESTINATION ${INCLUDE_DIR}/mpm ) -IF(ENABLE_MYKONOS) - ADD_SUBDIRECTORY(ad937x) -ELSEIF(ENABLE_E320) - ADD_SUBDIRECTORY(ad9361) -ENDIF(ENABLE_MYKONOS) +if(ENABLE_MYKONOS) + add_subdirectory(ad937x) +elseif(ENABLE_E320) + add_subdirectory(ad9361) +endif(ENABLE_MYKONOS) -ADD_SUBDIRECTORY(chips) -ADD_SUBDIRECTORY(dboards) -ADD_SUBDIRECTORY(spi) -ADD_SUBDIRECTORY(types) +add_subdirectory(chips) +add_subdirectory(dboards) +add_subdirectory(spi) +add_subdirectory(types) diff --git a/mpm/include/mpm/ad9361/CMakeLists.txt b/mpm/include/mpm/ad9361/CMakeLists.txt index a3f23de05..94ea655a7 100644 --- a/mpm/include/mpm/ad9361/CMakeLists.txt +++ b/mpm/include/mpm/ad9361/CMakeLists.txt @@ -5,7 +5,7 @@ # -INSTALL(FILES +install(FILES ad9361_ctrl.hpp e320_defaults.hpp DESTINATION ${INCLUDE_DIR}/mpm/catalina diff --git a/mpm/include/mpm/ad937x/CMakeLists.txt b/mpm/include/mpm/ad937x/CMakeLists.txt index de27f322e..2ccd141f4 100644 --- a/mpm/include/mpm/ad937x/CMakeLists.txt +++ b/mpm/include/mpm/ad937x/CMakeLists.txt @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: GPL-3.0 # -INSTALL(FILES +install(FILES adi_ctrl.hpp ad937x_ctrl.hpp DESTINATION ${INCLUDE_DIR}/mpm/mykonos diff --git a/mpm/include/mpm/dboards/CMakeLists.txt b/mpm/include/mpm/dboards/CMakeLists.txt index 6b95e8ebb..03a5404bc 100644 --- a/mpm/include/mpm/dboards/CMakeLists.txt +++ b/mpm/include/mpm/dboards/CMakeLists.txt @@ -3,14 +3,14 @@ # # SPDX-License-Identifier: GPL-3.0-or-later # -IF(ENABLE_MAGNESIUM) - INSTALL(FILES +if(ENABLE_MAGNESIUM) + install(FILES magnesium_manager.hpp DESTINATION ${INCLUDE_DIR}/mpm/dboards ) -ELSEIF(ENABLE_E320) - INSTALL(FILES +elseif(ENABLE_E320) + install(FILES neon_manager.hpp DESTINATION ${INCLUDE_DIR}/mpm/dboards ) -ENDIF(ENABLE_MAGNESIUM) +endif(ENABLE_MAGNESIUM) diff --git a/mpm/include/mpm/i2c/CMakeLists.txt b/mpm/include/mpm/i2c/CMakeLists.txt index 13851bca0..3fb4cdcb9 100644 --- a/mpm/include/mpm/i2c/CMakeLists.txt +++ b/mpm/include/mpm/i2c/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -INSTALL(FILES +install(FILES i2c_iface.hpp i2c_regs_iface.hpp DESTINATION ${INCLUDE_DIR}/mpm/i2c diff --git a/mpm/include/mpm/spi/CMakeLists.txt b/mpm/include/mpm/spi/CMakeLists.txt index 6c961d266..c04c240f6 100644 --- a/mpm/include/mpm/spi/CMakeLists.txt +++ b/mpm/include/mpm/spi/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0 # -INSTALL(FILES +install(FILES spi_iface.hpp spi_regs_iface.hpp DESTINATION ${INCLUDE_DIR}/mpm/spi diff --git a/mpm/include/mpm/types/CMakeLists.txt b/mpm/include/mpm/types/CMakeLists.txt index ce22c7a52..42d65ee66 100644 --- a/mpm/include/mpm/types/CMakeLists.txt +++ b/mpm/include/mpm/types/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0 # -INSTALL(FILES +install(FILES regs_iface.hpp DESTINATION ${INCLUDE_DIR}/mpm/types ) diff --git a/mpm/lib/CMakeLists.txt b/mpm/lib/CMakeLists.txt index 615b60b67..51745c5f1 100644 --- a/mpm/lib/CMakeLists.txt +++ b/mpm/lib/CMakeLists.txt @@ -4,18 +4,18 @@ # SPDX-License-Identifier: GPL-3.0 # -SET(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) +set(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) -ADD_SUBDIRECTORY(dboards) -ADD_SUBDIRECTORY(chips) -ADD_SUBDIRECTORY(spi) -ADD_SUBDIRECTORY(i2c) -ADD_SUBDIRECTORY(types) +add_subdirectory(dboards) +add_subdirectory(chips) +add_subdirectory(spi) +add_subdirectory(i2c) +add_subdirectory(types) if(ENABLE_MYKONOS) - ADD_SUBDIRECTORY(mykonos) + add_subdirectory(mykonos) elseif(ENABLE_E320) - ADD_SUBDIRECTORY(catalina) + add_subdirectory(catalina) endif(ENABLE_MYKONOS) USRP_PERIPHS_ADD_OBJECT(periphs diff --git a/mpm/lib/catalina/CMakeLists.txt b/mpm/lib/catalina/CMakeLists.txt index 615843bea..b003387ee 100644 --- a/mpm/lib/catalina/CMakeLists.txt +++ b/mpm/lib/catalina/CMakeLists.txt @@ -8,23 +8,23 @@ # This file included, use CMake directory variables ######################################################################## -MACRO(CATALINA_APPEND_SOURCES) - SET(catalina_sources ${catalina_sources}) - LIST(APPEND catalina_sources ${ARGV}) - SET(catalina_sources ${catalina_sources} PARENT_SCOPE) -ENDMACRO(CATALINA_APPEND_SOURCES) +macro(CATALINA_APPEND_SOURCES) + set(catalina_sources ${catalina_sources}) + list(APPEND catalina_sources ${ARGV}) + set(catalina_sources ${catalina_sources} PARENT_SCOPE) +endmacro(CATALINA_APPEND_SOURCES) -SET (CMAKE_CATALINA_SOURCE_DIR +set (CMAKE_CATALINA_SOURCE_DIR ${UHD_HOST_ROOT}/lib/usrp/common ) -CONFIGURE_FILE( +configure_file( ${UHD_HOST_ROOT}/include/uhd/version.hpp.in ${CMAKE_BINARY_DIR}/include/uhd/version.hpp ) # TODO: Do something better than listing all the files individually -SET(catalina_sources +set(catalina_sources ${CMAKE_CATALINA_SOURCE_DIR}/ad9361_ctrl.cpp ${CMAKE_CATALINA_SOURCE_DIR}/ad936x_manager.cpp ${CMAKE_CATALINA_SOURCE_DIR}/ad9361_driver/ad9361_device.cpp @@ -39,12 +39,12 @@ SET(catalina_sources USRP_PERIPHS_ADD_OBJECT(catalina ${catalina_sources}) -TARGET_INCLUDE_DIRECTORIES(catalina PUBLIC +target_include_directories(catalina PUBLIC $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/include>) -TARGET_INCLUDE_DIRECTORIES(catalina PUBLIC +target_include_directories(catalina PUBLIC $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/usrp/common/ad9361_driver>) -TARGET_INCLUDE_DIRECTORIES(catalina PUBLIC +target_include_directories(catalina PUBLIC $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/include>) -TARGET_INCLUDE_DIRECTORIES(dboards PUBLIC +target_include_directories(dboards PUBLIC $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/usrp/common/ad9361_driver>) diff --git a/mpm/lib/chips/CMakeLists.txt b/mpm/lib/chips/CMakeLists.txt index 89f750fc0..ff4dbd723 100644 --- a/mpm/lib/chips/CMakeLists.txt +++ b/mpm/lib/chips/CMakeLists.txt @@ -4,39 +4,39 @@ # SPDX-License-Identifier: GPL-3.0 # -#MACRO(ETTUS_PYTHON_GEN_SOURCE pyfile outfile) +#macro(ETTUS_PYTHON_GEN_SOURCE pyfile outfile) ##ensure that the directory exists for outfile - #GET_FILENAME_COMPONENT(outfile_dir ${outfile} PATH) - #FILE(MAKE_DIRECTORY ${outfile_dir}) - #IF(NOT PYTHON_EXECUTABLE) - #MESSAGE( FATAL_ERROR "No python executable found to generate ic_regmaps!" ) - #ENDIF(NOT PYTHON_EXECUTABLE) + #get_filename_component(outfile_dir ${outfile} PATH) + #file(MAKE_DIRECTORY ${outfile_dir}) + #if(NOT PYTHON_EXECUTABLE) + #message( FATAL_ERROR "No python executable found to generate ic_regmaps!" ) + #endif(NOT PYTHON_EXECUTABLE) ##make the outfile depend on the python script - #ADD_CUSTOM_COMMAND( + #add_custom_command( #OUTPUT ${outfile} DEPENDS ${pyfile} ${ETTUS_PYTHON_GEN_SOURCE_DEPS} #COMMAND ${PYTHON_EXECUTABLE} -B ${pyfile} ${outfile} #COMMENT "Generating ${outfile}" #) ##make lmk04828 depend on the outfile - #LIST(APPEND lmk04828_srcs ${ARGV}) -#ENDMACRO(ETTUS_PYTHON_GEN_SOURCE) + #list(APPEND lmk04828_srcs ${ARGV}) +#endmacro(ETTUS_PYTHON_GEN_SOURCE) #################################################### # LMK04828 #################################################### # Register definitions need to be generated -#SET(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) -#MESSAGE("uhd host root: ${UHD_HOST_ROOT}") -#SET(UHD_IC_REG_MAP_PATH ${UHD_HOST_ROOT}/lib/ic_reg_maps) +#set(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) +#message("uhd host root: ${UHD_HOST_ROOT}") +#set(UHD_IC_REG_MAP_PATH ${UHD_HOST_ROOT}/lib/ic_reg_maps) -#SET(ETTUS_PYTHON_GEN_SOURCE_DEPS ${UHD_IC_REG_MAP_PATH}/common.py) +#set(ETTUS_PYTHON_GEN_SOURCE_DEPS ${UHD_IC_REG_MAP_PATH}/common.py) #ETTUS_PYTHON_GEN_SOURCE( #${UHD_IC_REG_MAP_PATH}/gen_lmk04828_regs.py #${CMAKE_CURRENT_BINARY_DIR}/lmk04828_regs.hpp #) -#SET(LIBUHD_PYTHON_GEN_SOURCE_DEPS) +#set(LIBUHD_PYTHON_GEN_SOURCE_DEPS) # Define the object #USRP_PERIPHS_ADD_OBJECT(chips diff --git a/mpm/lib/i2c/CMakeLists.txt b/mpm/lib/i2c/CMakeLists.txt index a6af95ff8..f083325a7 100644 --- a/mpm/lib/i2c/CMakeLists.txt +++ b/mpm/lib/i2c/CMakeLists.txt @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: GPL-3.0-or-later # -SET(I2C_SOURCES +set(I2C_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/i2cdev_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/i2c_regs_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/i2cdev.c diff --git a/mpm/lib/mykonos/CMakeLists.txt b/mpm/lib/mykonos/CMakeLists.txt index db6fbf517..166c039af 100644 --- a/mpm/lib/mykonos/CMakeLists.txt +++ b/mpm/lib/mykonos/CMakeLists.txt @@ -8,13 +8,13 @@ # This file included, use CMake directory variables ######################################################################## -MACRO(MYKONOS_APPEND_SOURCES) - SET(mykonos_sources ${mykonos_sources}) - LIST(APPEND mykonos_sources ${ARGV}) - SET(mykonos_sources ${mykonos_sources} PARENT_SCOPE) -ENDMACRO(MYKONOS_APPEND_SOURCES) +macro(MYKONOS_APPEND_SOURCES) + set(mykonos_sources ${mykonos_sources}) + list(APPEND mykonos_sources ${ARGV}) + set(mykonos_sources ${mykonos_sources} PARENT_SCOPE) +endmacro(MYKONOS_APPEND_SOURCES) -SET(mykonos_sources +set(mykonos_sources ${CMAKE_CURRENT_SOURCE_DIR}/ad937x_ctrl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ad937x_device.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ad937x_spi_iface.cpp @@ -22,7 +22,7 @@ SET(mykonos_sources ${UHD_HOST_ROOT}/lib/types/ranges.cpp ) -ADD_SUBDIRECTORY(adi) -ADD_SUBDIRECTORY(config) +add_subdirectory(adi) +add_subdirectory(config) USRP_PERIPHS_ADD_OBJECT(mykonos ${mykonos_sources}) diff --git a/mpm/lib/mykonos/adi/CMakeLists.txt b/mpm/lib/mykonos/adi/CMakeLists.txt index 4bab71e05..dfdffd898 100644 --- a/mpm/lib/mykonos/adi/CMakeLists.txt +++ b/mpm/lib/mykonos/adi/CMakeLists.txt @@ -9,4 +9,4 @@ MYKONOS_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/mykonos_user.c ) -ADD_SUBDIRECTORY(mykonos_debug) +add_subdirectory(mykonos_debug) diff --git a/mpm/lib/spi/CMakeLists.txt b/mpm/lib/spi/CMakeLists.txt index ccc9597f9..d195c62b3 100644 --- a/mpm/lib/spi/CMakeLists.txt +++ b/mpm/lib/spi/CMakeLists.txt @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: GPL-3.0 # -SET(SPI_SOURCES +set(SPI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/spidev_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/spi_regs_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/spidev.c diff --git a/mpm/lib/types/CMakeLists.txt b/mpm/lib/types/CMakeLists.txt index dc97bc0e8..bbebca27e 100644 --- a/mpm/lib/types/CMakeLists.txt +++ b/mpm/lib/types/CMakeLists.txt @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: GPL-3.0 # -SET(TYPES_SOURCES +set(TYPES_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/lockable.cpp ${CMAKE_CURRENT_SOURCE_DIR}/log_buf.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mmap_regs_iface.cpp diff --git a/mpm/python/CMakeLists.txt b/mpm/python/CMakeLists.txt index 8218ce915..7338b5167 100644 --- a/mpm/python/CMakeLists.txt +++ b/mpm/python/CMakeLists.txt @@ -9,60 +9,60 @@ ######################################################################## if(MPM_DEVICE STREQUAL "n3xx") - ADD_LIBRARY(pyusrp_periphs SHARED pyusrp_periphs/n3xx/pyusrp_periphs.cpp) + add_library(pyusrp_periphs SHARED pyusrp_periphs/n3xx/pyusrp_periphs.cpp) elseif(MPM_DEVICE STREQUAL "e320") - ADD_LIBRARY(pyusrp_periphs SHARED pyusrp_periphs/e320/pyusrp_periphs.cpp) + add_library(pyusrp_periphs SHARED pyusrp_periphs/e320/pyusrp_periphs.cpp) endif(MPM_DEVICE STREQUAL "n3xx") -TARGET_INCLUDE_DIRECTORIES(pyusrp_periphs PUBLIC +target_include_directories(pyusrp_periphs PUBLIC ${PYTHON_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/lib/ ${UHD_HOST_ROOT}/lib/usrp/common ${UHD_HOST_ROOT}/lib/usrp/common/ad9361_driver ) -TARGET_LINK_LIBRARIES(pyusrp_periphs ${Boost_PYTHON_LIBRARY} ${Boost_LIBRARIES} usrp-periphs) -ADD_CUSTOM_COMMAND(TARGET pyusrp_periphs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libpyusrp_periphs.so ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/libpyusrp_periphs.so) +target_link_libraries(pyusrp_periphs ${Boost_PYTHON_LIBRARY} ${Boost_LIBRARIES} usrp-periphs) +add_custom_command(TARGET pyusrp_periphs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libpyusrp_periphs.so ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/libpyusrp_periphs.so) -SET(USRP_MPM_FILES "") -ADD_SUBDIRECTORY(usrp_mpm) +set(USRP_MPM_FILES "") +add_subdirectory(usrp_mpm) -SET(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") -SET(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") -SET(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") -SET(PERIPH_MGR_INIT_IN "${CMAKE_CURRENT_SOURCE_DIR}/usrp_mpm/periph_manager/__init__.py.in") -SET(PERIPH_MGR_INIT "${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/periph_manager/__init__.py") +set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp") +set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in") +set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") +set(PERIPH_MGR_INIT_IN "${CMAKE_CURRENT_SOURCE_DIR}/usrp_mpm/periph_manager/__init__.py.in") +set(PERIPH_MGR_INIT "${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/periph_manager/__init__.py") -CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY}) -CONFIGURE_FILE(${PERIPH_MGR_INIT_IN} ${PERIPH_MGR_INIT}) -CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/usrp_hwd.py" "${CMAKE_CURRENT_BINARY_DIR}/usrp_hwd.py" COPYONLY) +configure_file(${SETUP_PY_IN} ${SETUP_PY}) +configure_file(${PERIPH_MGR_INIT_IN} ${PERIPH_MGR_INIT}) +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/usrp_hwd.py" "${CMAKE_CURRENT_BINARY_DIR}/usrp_hwd.py" COPYONLY) -ADD_CUSTOM_COMMAND(OUTPUT ${OUTPUT} +add_custom_command(OUTPUT ${OUTPUT} COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" -DBINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}" -P ${CMAKE_CURRENT_SOURCE_DIR}/copy_python_module.cmake COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} -q build COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} DEPENDS ${USRP_MPM_FILES}) -ADD_CUSTOM_TARGET(usrp_mpm ALL DEPENDS ${OUTPUT} pyusrp_periphs) +add_custom_target(usrp_mpm ALL DEPENDS ${OUTPUT} pyusrp_periphs) -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c +execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from __future__ import print_function; from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix=''))" OUTPUT_VARIABLE USRP_MPM_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) -INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build/lib/usrp_mpm DESTINATION ${CMAKE_INSTALL_PREFIX}/${USRP_MPM_PYTHON_DIR}) -INSTALL(PROGRAMS +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/build/lib/usrp_mpm DESTINATION ${CMAKE_INSTALL_PREFIX}/${USRP_MPM_PYTHON_DIR}) +install(PROGRAMS aurora_bist_test.py usrp_update_fs usrp_hwd.py DESTINATION ${RUNTIME_DIR} ) -IF (ENABLE_MYKONOS) - INSTALL(PROGRAMS +if (ENABLE_MYKONOS) + install(PROGRAMS n3xx_bist DESTINATION ${RUNTIME_DIR} ) -ELSEIF (ENABLE_E320) - INSTALL(PROGRAMS +elseif (ENABLE_E320) + install(PROGRAMS e320_bist DESTINATION ${RUNTIME_DIR} ) -ENDIF (ENABLE_MYKONOS) +endif (ENABLE_MYKONOS) diff --git a/mpm/python/copy_python_module.cmake b/mpm/python/copy_python_module.cmake index 501793419..76d546d01 100644 --- a/mpm/python/copy_python_module.cmake +++ b/mpm/python/copy_python_module.cmake @@ -1,4 +1,4 @@ -SET(BINARY_DIR "" CACHE STRING "") -SET(SOURCE_DIR "" CACHE STRING "") -FILE(COPY "${SOURCE_DIR}/usrp_mpm/" DESTINATION ${BINARY_DIR}/usrp_mpm +set(BINARY_DIR "" CACHE STRING "") +set(SOURCE_DIR "" CACHE STRING "") +file(COPY "${SOURCE_DIR}/usrp_mpm/" DESTINATION ${BINARY_DIR}/usrp_mpm FILES_MATCHING PATTERN *.py) diff --git a/mpm/python/usrp_mpm/CMakeLists.txt b/mpm/python/usrp_mpm/CMakeLists.txt index 8d2af75ce..c978107ba 100644 --- a/mpm/python/usrp_mpm/CMakeLists.txt +++ b/mpm/python/usrp_mpm/CMakeLists.txt @@ -7,8 +7,8 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -SET(USRP_MPM_FILES ${USRP_MPM_FILES}) -SET(USRP_MPM_TOP_FILES +set(USRP_MPM_FILES ${USRP_MPM_FILES}) +set(USRP_MPM_TOP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/aurora_control.py ${CMAKE_CURRENT_SOURCE_DIR}/bfrfs.py @@ -24,11 +24,11 @@ SET(USRP_MPM_TOP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/prefs.py ${CMAKE_CURRENT_SOURCE_DIR}/rpc_server.py ) -LIST(APPEND USRP_MPM_FILES ${USRP_MPM_TOP_FILES}) -ADD_SUBDIRECTORY(chips) -ADD_SUBDIRECTORY(cores) -ADD_SUBDIRECTORY(dboard_manager) -ADD_SUBDIRECTORY(periph_manager) -ADD_SUBDIRECTORY(sys_utils) -ADD_SUBDIRECTORY(xports) -SET(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) +list(APPEND USRP_MPM_FILES ${USRP_MPM_TOP_FILES}) +add_subdirectory(chips) +add_subdirectory(cores) +add_subdirectory(dboard_manager) +add_subdirectory(periph_manager) +add_subdirectory(sys_utils) +add_subdirectory(xports) +set(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) diff --git a/mpm/python/usrp_mpm/chips/CMakeLists.txt b/mpm/python/usrp_mpm/chips/CMakeLists.txt index ff4f61bdd..56c06fbeb 100644 --- a/mpm/python/usrp_mpm/chips/CMakeLists.txt +++ b/mpm/python/usrp_mpm/chips/CMakeLists.txt @@ -4,12 +4,12 @@ # SPDX-License-Identifier: GPL-3.0 # -SET(USRP_MPM_FILES ${USRP_MPM_FILES}) -SET(USRP_MPM_CHIP_FILES +set(USRP_MPM_FILES ${USRP_MPM_FILES}) +set(USRP_MPM_CHIP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/lmk04828.py ${CMAKE_CURRENT_SOURCE_DIR}/adf400x.py ${CMAKE_CURRENT_SOURCE_DIR}/ds125df410.py ) -LIST(APPEND USRP_MPM_FILES ${USRP_MPM_CHIP_FILES}) -SET(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) +list(APPEND USRP_MPM_FILES ${USRP_MPM_CHIP_FILES}) +set(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) diff --git a/mpm/python/usrp_mpm/cores/CMakeLists.txt b/mpm/python/usrp_mpm/cores/CMakeLists.txt index 39a15c0ed..e924408ba 100644 --- a/mpm/python/usrp_mpm/cores/CMakeLists.txt +++ b/mpm/python/usrp_mpm/cores/CMakeLists.txt @@ -4,14 +4,14 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -SET(USRP_MPM_FILES ${USRP_MPM_FILES}) -SET(USRP_MPM_CORE_FILES +set(USRP_MPM_FILES ${USRP_MPM_FILES}) +set(USRP_MPM_CORE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/tdc_sync.py ${CMAKE_CURRENT_SOURCE_DIR}/nijesdcore.py ${CMAKE_CURRENT_SOURCE_DIR}/eyescan.py ${CMAKE_CURRENT_SOURCE_DIR}/white_rabbit.py ) -LIST(APPEND USRP_MPM_FILES ${USRP_MPM_CORE_FILES}) -SET(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) +list(APPEND USRP_MPM_FILES ${USRP_MPM_CORE_FILES}) +set(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) diff --git a/mpm/python/usrp_mpm/dboard_manager/CMakeLists.txt b/mpm/python/usrp_mpm/dboard_manager/CMakeLists.txt index 0b34e4d70..650a21aab 100644 --- a/mpm/python/usrp_mpm/dboard_manager/CMakeLists.txt +++ b/mpm/python/usrp_mpm/dboard_manager/CMakeLists.txt @@ -7,8 +7,8 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -SET(USRP_MPM_FILES ${USRP_MPM_FILES}) -SET(USRP_MPM_DBMGR_FILES +set(USRP_MPM_FILES ${USRP_MPM_FILES}) +set(USRP_MPM_DBMGR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/base.py ${CMAKE_CURRENT_SOURCE_DIR}/rhodium.py @@ -30,5 +30,5 @@ SET(USRP_MPM_DBMGR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.py ${CMAKE_CURRENT_SOURCE_DIR}/unknown.py ) -LIST(APPEND USRP_MPM_FILES ${USRP_MPM_DBMGR_FILES}) -SET(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) +list(APPEND USRP_MPM_FILES ${USRP_MPM_DBMGR_FILES}) +set(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) diff --git a/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt b/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt index 0689cdda9..994b1d64a 100644 --- a/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt +++ b/mpm/python/usrp_mpm/periph_manager/CMakeLists.txt @@ -7,8 +7,8 @@ ######################################################################## # This file included, use CMake directory variables ######################################################################## -SET(USRP_MPM_FILES ${USRP_MPM_FILES}) -SET(USRP_MPM_PERIPHMGR_FILES +set(USRP_MPM_FILES ${USRP_MPM_FILES}) +set(USRP_MPM_PERIPHMGR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in ${CMAKE_CURRENT_SOURCE_DIR}/base.py ${CMAKE_CURRENT_SOURCE_DIR}/n3xx.py @@ -16,5 +16,5 @@ SET(USRP_MPM_PERIPHMGR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/e320.py ${CMAKE_CURRENT_SOURCE_DIR}/e320_periphs.py ) -LIST(APPEND USRP_MPM_FILES ${USRP_MPM_PERIPHMGR_FILES}) -SET(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) +list(APPEND USRP_MPM_FILES ${USRP_MPM_PERIPHMGR_FILES}) +set(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) diff --git a/mpm/python/usrp_mpm/sys_utils/CMakeLists.txt b/mpm/python/usrp_mpm/sys_utils/CMakeLists.txt index e1d830c94..84e3fcc79 100644 --- a/mpm/python/usrp_mpm/sys_utils/CMakeLists.txt +++ b/mpm/python/usrp_mpm/sys_utils/CMakeLists.txt @@ -4,8 +4,8 @@ # SPDX-License-Identifier: GPL-3.0 # -SET(USRP_MPM_FILES ${USRP_MPM_FILES}) -SET(USRP_MPM_SYSUTILS_FILES +set(USRP_MPM_FILES ${USRP_MPM_FILES}) +set(USRP_MPM_SYSUTILS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/dtoverlay.py ${CMAKE_CURRENT_SOURCE_DIR}/i2c_dev.py @@ -16,6 +16,6 @@ SET(USRP_MPM_SYSUTILS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/uio.py ${CMAKE_CURRENT_SOURCE_DIR}/watchdog.py ) -LIST(APPEND USRP_MPM_FILES ${USRP_MPM_SYSUTILS_FILES}) -SET(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) +list(APPEND USRP_MPM_FILES ${USRP_MPM_SYSUTILS_FILES}) +set(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) diff --git a/mpm/python/usrp_mpm/xports/CMakeLists.txt b/mpm/python/usrp_mpm/xports/CMakeLists.txt index 1f8ffc2b1..87e2ac66d 100644 --- a/mpm/python/usrp_mpm/xports/CMakeLists.txt +++ b/mpm/python/usrp_mpm/xports/CMakeLists.txt @@ -4,12 +4,12 @@ # SPDX-License-Identifier: GPL-3.0 # -SET(USRP_MPM_FILES ${USRP_MPM_FILES}) -SET(USRP_MPM_XPORT_FILES +set(USRP_MPM_FILES ${USRP_MPM_FILES}) +set(USRP_MPM_XPORT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/xportmgr_udp.py ${CMAKE_CURRENT_SOURCE_DIR}/xportmgr_liberio.py ) -LIST(APPEND USRP_MPM_FILES ${USRP_MPM_XPORT_FILES}) -SET(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) +list(APPEND USRP_MPM_FILES ${USRP_MPM_XPORT_FILES}) +set(USRP_MPM_FILES ${USRP_MPM_FILES} PARENT_SCOPE) diff --git a/mpm/systemd/CMakeLists.txt b/mpm/systemd/CMakeLists.txt index bd8dded91..008def6bf 100644 --- a/mpm/systemd/CMakeLists.txt +++ b/mpm/systemd/CMakeLists.txt @@ -4,18 +4,18 @@ # SPDX-License-Identifier: GPL-3.0 # -INCLUDE(FindPkgConfig) +include(FindPkgConfig) PKG_CHECK_MODULES(SYSTEMD "systemd" REQUIRED) PKG_GET_VARIABLE(SYSTEMD_SYSTEM_UNITDIR systemd systemdsystemunitdir) -MESSAGE(STATUS "Systemd system unit directory ${SYSTEMD_SYSTEM_UNITDIR}") +message(STATUS "Systemd system unit directory ${SYSTEMD_SYSTEM_UNITDIR}") -CONFIGURE_FILE( +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/usrp-hwd.service.in ${CMAKE_CURRENT_BINARY_DIR}/usrp-hwd.service ) -INSTALL(FILES +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/usrp-hwd.service DESTINATION ${SYSTEMD_SYSTEM_UNITDIR} ) diff --git a/mpm/tools/CMakeLists.txt b/mpm/tools/CMakeLists.txt index 4ab83aa41..d0d5d2504 100644 --- a/mpm/tools/CMakeLists.txt +++ b/mpm/tools/CMakeLists.txt @@ -4,41 +4,41 @@ # SPDX-License-Identifier: GPL-3.0 # -INSTALL(PROGRAMS +install(PROGRAMS mpm_shell.py mpm_debug.py DESTINATION ${RUNTIME_DIR} ) -SET(eeprom_tool_sources) -SET(eeprom_tool_libs) +set(eeprom_tool_sources) +set(eeprom_tool_libs) -IF(ENABLE_LIBMPM) - MESSAGE(STATUS "Adding MPM EEPROM tools...") - SET(eeprom_tool_libs eeprom.c) - LIST(APPEND eeprom_tool_sources +if(ENABLE_LIBMPM) + message(STATUS "Adding MPM EEPROM tools...") + set(eeprom_tool_libs eeprom.c) + list(APPEND eeprom_tool_sources eeprom-blank.c eeprom-dump.c eeprom-id.c eeprom-init.c eeprom-set-flags.c ) -ENDIF(ENABLE_LIBMPM) -IF(ENABLE_MYKONOS) - MESSAGE(STATUS "Adding N3XX-specific EEPROM tools...") - SET(eeprom_tool_libs eeprom.c) - LIST(APPEND eeprom_tool_sources +endif(ENABLE_LIBMPM) +if(ENABLE_MYKONOS) + message(STATUS "Adding N3XX-specific EEPROM tools...") + set(eeprom_tool_libs eeprom.c) + list(APPEND eeprom_tool_sources db-dump.c db-id.c db-init.c fan-limits.c ) -ENDIF(ENABLE_MYKONOS) +endif(ENABLE_MYKONOS) #for each source: build an executable and install -FOREACH(eeprom_tool_source ${eeprom_tool_sources}) - GET_FILENAME_COMPONENT(eeprom_tool ${eeprom_tool_source} NAME_WE) - ADD_EXECUTABLE(${eeprom_tool} ${eeprom_tool_source} ${eeprom_tool_libs}) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${eeprom_tool} DESTINATION ${RUNTIME_DIR}) -ENDFOREACH(eeprom_tool_source ${eeprom_tool_sources}) +foreach(eeprom_tool_source ${eeprom_tool_sources}) + get_filename_component(eeprom_tool ${eeprom_tool_source} NAME_WE) + add_executable(${eeprom_tool} ${eeprom_tool_source} ${eeprom_tool_libs}) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${eeprom_tool} DESTINATION ${RUNTIME_DIR}) +endforeach(eeprom_tool_source ${eeprom_tool_sources}) diff --git a/tools/dissectors/cmake/Modules/FindGLIB2.cmake b/tools/dissectors/cmake/Modules/FindGLIB2.cmake index ae7baddbb..e51c0b882 100644 --- a/tools/dissectors/cmake/Modules/FindGLIB2.cmake +++ b/tools/dissectors/cmake/Modules/FindGLIB2.cmake @@ -24,36 +24,36 @@ # -IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) +if (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) # in cache already - SET(GLIB2_FOUND TRUE) -ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) + set(GLIB2_FOUND TRUE) +else (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) - INCLUDE(FindPkgConfig) + include(FindPkgConfig) ## Glib - IF ( GLIB2_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "REQUIRED" ) - ELSE ( GLIB2_FIND_REQUIRED ) - SET( _pkgconfig_REQUIRED "" ) - ENDIF ( GLIB2_FIND_REQUIRED ) + if ( GLIB2_FIND_REQUIRED ) + set( _pkgconfig_REQUIRED "REQUIRED" ) + else ( GLIB2_FIND_REQUIRED ) + set( _pkgconfig_REQUIRED "" ) + endif ( GLIB2_FIND_REQUIRED ) - IF ( GLIB2_MIN_VERSION ) + if ( GLIB2_MIN_VERSION ) PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} ) - ELSE ( GLIB2_MIN_VERSION ) + else ( GLIB2_MIN_VERSION ) PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 ) - ENDIF ( GLIB2_MIN_VERSION ) - IF ( PKG_CONFIG_FOUND ) - IF ( GLIB2_FOUND ) - SET ( GLIB2_CORE_FOUND TRUE ) - ELSE ( GLIB2_FOUND ) - SET ( GLIB2_CORE_FOUND FALSE ) - ENDIF ( GLIB2_FOUND ) - ENDIF ( PKG_CONFIG_FOUND ) + endif ( GLIB2_MIN_VERSION ) + if ( PKG_CONFIG_FOUND ) + if ( GLIB2_FOUND ) + set ( GLIB2_CORE_FOUND TRUE ) + else ( GLIB2_FOUND ) + set ( GLIB2_CORE_FOUND FALSE ) + endif ( GLIB2_FOUND ) + endif ( PKG_CONFIG_FOUND ) # Look for glib2 include dir and libraries w/o pkgconfig - IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) - FIND_PATH( + if ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) + find_path( _glibconfig_include_DIR NAMES glibconfig.h @@ -71,7 +71,7 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) glib-2.0/include ) - FIND_PATH( + find_path( _glib2_include_DIR NAMES glib.h @@ -85,9 +85,9 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) glib-2.0 ) - #MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}") + #message(STATUS "Glib headers: ${_glib2_include_DIR}") - FIND_LIBRARY( + find_library( _glib2_link_DIR NAMES glib-2.0 @@ -99,23 +99,23 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) /usr/lib /usr/local/lib ) - IF ( _glib2_include_DIR AND _glib2_link_DIR ) - SET ( _glib2_FOUND TRUE ) - ENDIF ( _glib2_include_DIR AND _glib2_link_DIR ) + if ( _glib2_include_DIR AND _glib2_link_DIR ) + set ( _glib2_FOUND TRUE ) + endif ( _glib2_include_DIR AND _glib2_link_DIR ) - IF ( _glib2_FOUND ) - SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} ) - SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} ) - SET ( GLIB2_CORE_FOUND TRUE ) - ELSE ( _glib2_FOUND ) - SET ( GLIB2_CORE_FOUND FALSE ) - ENDIF ( _glib2_FOUND ) + if ( _glib2_FOUND ) + set ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} ) + set ( GLIB2_LIBRARIES ${_glib2_link_DIR} ) + set ( GLIB2_CORE_FOUND TRUE ) + else ( _glib2_FOUND ) + set ( GLIB2_CORE_FOUND FALSE ) + endif ( _glib2_FOUND ) # Handle dependencies # libintl - IF ( NOT LIBINTL_FOUND ) - FIND_PATH(LIBINTL_INCLUDE_DIR + if ( NOT LIBINTL_FOUND ) + find_path(LIBINTL_INCLUDE_DIR NAMES libintl.h PATHS @@ -126,7 +126,7 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) /usr/local/include ) - FIND_LIBRARY(LIBINTL_LIBRARY + find_library(LIBINTL_LIBRARY NAMES intl PATHS @@ -137,14 +137,14 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) /usr/lib ) - IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) - SET (LIBINTL_FOUND TRUE) - ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) - ENDIF ( NOT LIBINTL_FOUND ) + if (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) + set (LIBINTL_FOUND TRUE) + endif (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) + endif ( NOT LIBINTL_FOUND ) # libiconv - IF ( NOT LIBICONV_FOUND ) - FIND_PATH(LIBICONV_INCLUDE_DIR + if ( NOT LIBICONV_FOUND ) + find_path(LIBICONV_INCLUDE_DIR NAMES iconv.h PATHS @@ -159,7 +159,7 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) glib-2.0 ) - FIND_LIBRARY(LIBICONV_LIBRARY + find_library(LIBICONV_LIBRARY NAMES iconv PATHS @@ -170,69 +170,69 @@ ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) /usr/local/lib ) - IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) - SET (LIBICONV_FOUND TRUE) - ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) - ENDIF ( NOT LIBICONV_FOUND ) + if (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + set (LIBICONV_FOUND TRUE) + endif (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + endif ( NOT LIBICONV_FOUND ) - IF (LIBINTL_FOUND) - SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY}) - SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR}) - ENDIF (LIBINTL_FOUND) + if (LIBINTL_FOUND) + set (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY}) + set (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR}) + endif (LIBINTL_FOUND) - IF (LIBICONV_FOUND) - SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) - SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) - ENDIF (LIBICONV_FOUND) + if (LIBICONV_FOUND) + set (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) + set (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) + endif (LIBICONV_FOUND) - ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) + endif ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) ## - IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) - SET (GLIB2_FOUND TRUE) - ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) + if (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) + set (GLIB2_FOUND TRUE) + endif (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) - IF (GLIB2_FOUND) - IF (NOT GLIB2_FIND_QUIETLY) - MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}") - ENDIF (NOT GLIB2_FIND_QUIETLY) - ELSE (GLIB2_FOUND) - IF (GLIB2_FIND_REQUIRED) - MESSAGE (SEND_ERROR "Could not find GLib2") - ENDIF (GLIB2_FIND_REQUIRED) - ENDIF (GLIB2_FOUND) + if (GLIB2_FOUND) + if (NOT GLIB2_FIND_QUIETLY) + message (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}") + endif (NOT GLIB2_FIND_QUIETLY) + else (GLIB2_FOUND) + if (GLIB2_FIND_REQUIRED) + message (SEND_ERROR "Could not find GLib2") + endif (GLIB2_FIND_REQUIRED) + endif (GLIB2_FOUND) # show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view - MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES) - MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY) - MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) + mark_as_advanced(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES) + mark_as_advanced(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY) + mark_as_advanced(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) -ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS) +endif (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS) -IF ( WIN32 ) +if ( WIN32 ) # include libiconv for win32 - IF ( NOT LIBICONV_FOUND ) - FIND_PATH(LIBICONV_INCLUDE_DIR iconv.h PATH_SUFFIXES glib-2.0) - - FIND_LIBRARY(LIBICONV_LIBRARY NAMES iconv) - - IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) - SET (LIBICONV_FOUND TRUE) - ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) - ENDIF ( NOT LIBICONV_FOUND ) - IF (LIBICONV_FOUND) - SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) - SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) - ENDIF (LIBICONV_FOUND) -ENDIF ( WIN32 ) - -IF ( GLIB2_FOUND ) + if ( NOT LIBICONV_FOUND ) + find_path(LIBICONV_INCLUDE_DIR iconv.h PATH_SUFFIXES glib-2.0) + + find_library(LIBICONV_LIBRARY NAMES iconv) + + if (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + set (LIBICONV_FOUND TRUE) + endif (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + endif ( NOT LIBICONV_FOUND ) + if (LIBICONV_FOUND) + set (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) + set (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) + endif (LIBICONV_FOUND) +endif ( WIN32 ) + +if ( GLIB2_FOUND ) # Check if system has a newer version of glib # which supports g_regex_match_simple - INCLUDE( CheckIncludeFiles ) - SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) + include( CheckIncludeFiles ) + set( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H ) CHECK_INCLUDE_FILES ( glib/gchecksum.h HAVE_GLIB_GCHECKSUM_H ) # Reset CMAKE_REQUIRED_INCLUDES - SET( CMAKE_REQUIRED_INCLUDES "" ) -ENDIF( GLIB2_FOUND ) + set( CMAKE_REQUIRED_INCLUDES "" ) +endif( GLIB2_FOUND ) diff --git a/tools/dissectors/cmake/Modules/FindWireshark.cmake b/tools/dissectors/cmake/Modules/FindWireshark.cmake index 276201245..7c73cf41f 100644 --- a/tools/dissectors/cmake/Modules/FindWireshark.cmake +++ b/tools/dissectors/cmake/Modules/FindWireshark.cmake @@ -16,13 +16,13 @@ # wireshark does not install its library with pkg-config information, # so we need to manually find the libraries and headers -FIND_PATH( WIRESHARK_INCLUDE_DIRS epan/column.h PATH_SUFFIXES wireshark ) -FIND_LIBRARY( WIRESHARK_LIBRARIES wireshark ) +find_path( WIRESHARK_INCLUDE_DIRS epan/column.h PATH_SUFFIXES wireshark ) +find_library( WIRESHARK_LIBRARIES wireshark ) # Report results -IF ( WIRESHARK_LIBRARIES AND WIRESHARK_INCLUDE_DIRS ) - SET( WIRESHARK_FOUND 1 ) -ELSE ( WIRESHARK_LIBRARIES AND WIRESHARK_INCLUDE_DIRS ) - MESSAGE( SEND_ERROR "Could NOT find the wireshark library and headers" ) -ENDIF ( WIRESHARK_LIBRARIES AND WIRESHARK_INCLUDE_DIRS ) +if ( WIRESHARK_LIBRARIES AND WIRESHARK_INCLUDE_DIRS ) + set( WIRESHARK_FOUND 1 ) +else ( WIRESHARK_LIBRARIES AND WIRESHARK_INCLUDE_DIRS ) + message( SEND_ERROR "Could NOT find the wireshark library and headers" ) +endif ( WIRESHARK_LIBRARIES AND WIRESHARK_INCLUDE_DIRS ) diff --git a/tools/gr-usrptest/cmake/Modules/CMakeParseArgumentsCopy.cmake b/tools/gr-usrptest/cmake/Modules/CMakeParseArgumentsCopy.cmake index 7ce4c49ae..a7e78bbdc 100644 --- a/tools/gr-usrptest/cmake/Modules/CMakeParseArgumentsCopy.cmake +++ b/tools/gr-usrptest/cmake/Modules/CMakeParseArgumentsCopy.cmake @@ -1,6 +1,6 @@ -# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) +# cmake_parse_arguments(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) # -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# cmake_parse_arguments() is intended to be used in macros or functions for # parsing the arguments given to that macro or function. # It processes the arguments and defines a set of variables which hold the # values of the respective options. @@ -17,7 +17,7 @@ # which can be followed by more than one value, like e.g. the TARGETS or # FILES keywords of the install() command. # -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# When done, cmake_parse_arguments() will have defined for each of the # keywords listed in <options>, <one_value_keywords> and # <multi_value_keywords> a variable composed of the given <prefix> # followed by "_" and the name of the respective keyword. diff --git a/tools/gr-usrptest/cmake/Modules/FindCppUnit.cmake b/tools/gr-usrptest/cmake/Modules/FindCppUnit.cmake index f93ade341..3ed6a8521 100644 --- a/tools/gr-usrptest/cmake/Modules/FindCppUnit.cmake +++ b/tools/gr-usrptest/cmake/Modules/FindCppUnit.cmake @@ -9,10 +9,10 @@ # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. # CPPUNIT_FOUND, If false, do not try to use CppUnit. -INCLUDE(FindPkgConfig) +include(FindPkgConfig) PKG_CHECK_MODULES(PC_CPPUNIT "cppunit") -FIND_PATH(CPPUNIT_INCLUDE_DIRS +find_path(CPPUNIT_INCLUDE_DIRS NAMES cppunit/TestCase.h HINTS ${PC_CPPUNIT_INCLUDE_DIR} ${CMAKE_INSTALL_PREFIX}/include @@ -21,7 +21,7 @@ FIND_PATH(CPPUNIT_INCLUDE_DIRS /usr/include ) -FIND_LIBRARY(CPPUNIT_LIBRARIES +find_library(CPPUNIT_LIBRARIES NAMES cppunit HINTS ${PC_CPPUNIT_LIBDIR} ${CMAKE_INSTALL_PREFIX}/lib @@ -32,8 +32,8 @@ FIND_LIBRARY(CPPUNIT_LIBRARIES /usr/lib ) -LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) +list(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) -INCLUDE(FindPackageHandleStandardArgs) +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) -MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) +mark_as_advanced(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) diff --git a/tools/gr-usrptest/cmake/Modules/FindGnuradioRuntime.cmake b/tools/gr-usrptest/cmake/Modules/FindGnuradioRuntime.cmake index afed684a5..6c5f38f28 100644 --- a/tools/gr-usrptest/cmake/Modules/FindGnuradioRuntime.cmake +++ b/tools/gr-usrptest/cmake/Modules/FindGnuradioRuntime.cmake @@ -1,9 +1,9 @@ -INCLUDE(FindPkgConfig) +include(FindPkgConfig) PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime) if(PC_GNURADIO_RUNTIME_FOUND) # look for include files - FIND_PATH( + find_path( GNURADIO_RUNTIME_INCLUDE_DIRS NAMES gnuradio/top_block.h HINTS $ENV{GNURADIO_RUNTIME_DIR}/include @@ -14,7 +14,7 @@ if(PC_GNURADIO_RUNTIME_FOUND) ) # look for libs - FIND_LIBRARY( + find_library( GNURADIO_RUNTIME_LIBRARIES NAMES gnuradio-runtime HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib @@ -30,7 +30,7 @@ if(PC_GNURADIO_RUNTIME_FOUND) set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND}) endif(PC_GNURADIO_RUNTIME_FOUND) -INCLUDE(FindPackageHandleStandardArgs) +include(FindPackageHandleStandardArgs) # do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used. FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES) -MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) +mark_as_advanced(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) diff --git a/tools/gr-usrptest/cmake/Modules/GrMiscUtils.cmake b/tools/gr-usrptest/cmake/Modules/GrMiscUtils.cmake index 5bad57c51..2a4e01a8e 100644 --- a/tools/gr-usrptest/cmake/Modules/GrMiscUtils.cmake +++ b/tools/gr-usrptest/cmake/Modules/GrMiscUtils.cmake @@ -95,7 +95,7 @@ macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have) CHECK_CXX_COMPILER_FLAG(${flag} ${have}) if(${have}) if(${CMAKE_VERSION} VERSION_GREATER "2.8.4") - STRING(FIND "${CMAKE_CXX_FLAGS}" "${flag}" flag_dup) + string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" flag_dup) if(${flag_dup} EQUAL -1) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}") @@ -117,7 +117,7 @@ function(GR_LIBTOOL) if(GENERATE_LIBTOOL) include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN}) + cmake_parse_arguments(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN}) find_program(LIBTOOL libtool) if(LIBTOOL) @@ -137,7 +137,7 @@ endfunction(GR_LIBTOOL) function(GR_LIBRARY_FOO target) #parse the arguments for component names include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN}) + cmake_parse_arguments(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN}) #set additional target properties set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER}) @@ -188,7 +188,7 @@ endfunction(GR_LIBRARY_FOO) # Create a dummy custom command that depends on other targets. # Usage: # GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...) -# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps}) +# add_custom_command(<the usual args> ${target_deps}) # # Custom command cant depend on targets, but can depend on executables, # and executables can depend on targets. So this is the process: @@ -226,7 +226,7 @@ endfunction(GR_GEN_TARGET_DEPS) function(GR_LOGGING) find_package(Log4cpp) - OPTION(ENABLE_GR_LOG "Use gr_logger" ON) + option(ENABLE_GR_LOG "Use gr_logger" ON) if(ENABLE_GR_LOG) # If gr_logger is enabled, make it usable add_definitions( -DENABLE_GR_LOG ) @@ -234,22 +234,22 @@ function(GR_LOGGING) # also test LOG4CPP; if we have it, use this version of the logger # otherwise, default to the stdout/stderr model. if(LOG4CPP_FOUND) - SET(HAVE_LOG4CPP True CACHE INTERNAL "" FORCE) + set(HAVE_LOG4CPP True CACHE INTERNAL "" FORCE) add_definitions( -DHAVE_LOG4CPP ) else(not LOG4CPP_FOUND) - SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) - SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) + set(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) + set(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) + set(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) + set(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) endif(LOG4CPP_FOUND) - SET(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE) + set(ENABLE_GR_LOG ${ENABLE_GR_LOG} CACHE INTERNAL "" FORCE) else(ENABLE_GR_LOG) - SET(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) - SET(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) - SET(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) + set(HAVE_LOG4CPP False CACHE INTERNAL "" FORCE) + set(LOG4CPP_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) + set(LOG4CPP_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) + set(LOG4CPP_LIBRARIES "" CACHE INTERNAL "" FORCE) endif(ENABLE_GR_LOG) message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.") @@ -274,7 +274,7 @@ function(GRCC) set(filenames ${ARGV}) file(MAKE_DIRECTORY ${directory}) - SET(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/python/grcc) + set(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/python/grcc) # GRCC uses some stuff in grc and gnuradio-runtime, so we force # the known paths here diff --git a/tools/gr-usrptest/cmake/Modules/GrPython.cmake b/tools/gr-usrptest/cmake/Modules/GrPython.cmake index 06e061e21..9ac72c2d8 100644 --- a/tools/gr-usrptest/cmake/Modules/GrPython.cmake +++ b/tools/gr-usrptest/cmake/Modules/GrPython.cmake @@ -130,7 +130,7 @@ endfunction(GR_UNIQUE_TARGET) ######################################################################## function(GR_PYTHON_INSTALL) include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN}) + cmake_parse_arguments(GR_PYTHON_INSTALL "" "DESTINATION;COMPONENT" "FILES;PROGRAMS" ${ARGN}) #################################################################### if(GR_PYTHON_INSTALL_FILES) diff --git a/tools/gr-usrptest/cmake/Modules/GrSwig.cmake b/tools/gr-usrptest/cmake/Modules/GrSwig.cmake index abf4dc461..36b5191dd 100644 --- a/tools/gr-usrptest/cmake/Modules/GrSwig.cmake +++ b/tools/gr-usrptest/cmake/Modules/GrSwig.cmake @@ -110,7 +110,7 @@ macro(GR_SWIG_MAKE name) # vector<long unsigned int> (on 64-bit machines). Use this to test # the size of size_t, then set SIZE_T_32 if it's a 32-bit machine # or not if it's 64-bit. The logic in gr_type.i handles the rest. - INCLUDE(CheckTypeSize) + include(CheckTypeSize) CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T) CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT) if(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT}) @@ -173,7 +173,7 @@ macro(GR_SWIG_MAKE name) SWIG_ADD_MODULE(${name} python ${ifiles}) SWIG_LINK_LIBRARIES(${name} ${PYTHON_LIBRARIES} ${GR_SWIG_LIBRARIES}) if(${name} STREQUAL "runtime_swig") - SET_TARGET_PROPERTIES(${SWIG_MODULE_runtime_swig_REAL_NAME} PROPERTIES DEFINE_SYMBOL "gnuradio_runtime_EXPORTS") + set_target_properties(${SWIG_MODULE_runtime_swig_REAL_NAME} PROPERTIES DEFINE_SYMBOL "gnuradio_runtime_EXPORTS") endif(${name} STREQUAL "runtime_swig") endmacro(GR_SWIG_MAKE) @@ -189,7 +189,7 @@ endmacro(GR_SWIG_MAKE) macro(GR_SWIG_INSTALL) include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) + cmake_parse_arguments(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN}) foreach(name ${GR_SWIG_INSTALL_TARGETS}) install(TARGETS ${SWIG_MODULE_${name}_REAL_NAME} diff --git a/tools/gr-usrptest/cmake/Modules/GrTest.cmake b/tools/gr-usrptest/cmake/Modules/GrTest.cmake index 62caab4b5..9304d33a9 100644 --- a/tools/gr-usrptest/cmake/Modules/GrTest.cmake +++ b/tools/gr-usrptest/cmake/Modules/GrTest.cmake @@ -72,8 +72,8 @@ function(GR_ADD_TEST test_name) #http://www.cmake.org/pipermail/cmake/2009-May/029464.html #Replaced this add test + set environs code with the shell script generation. #Its nicer to be able to manually run the shell script to diagnose problems. - #ADD_TEST(${ARGV}) - #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") + #add_test(${ARGV}) + #set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${environs}") if(UNIX) set(LD_PATH_VAR "LD_LIBRARY_PATH") diff --git a/tools/gr-usrptest/cmake/Modules/usrptestConfig.cmake b/tools/gr-usrptest/cmake/Modules/usrptestConfig.cmake index 5244d466e..a593b2b68 100644 --- a/tools/gr-usrptest/cmake/Modules/usrptestConfig.cmake +++ b/tools/gr-usrptest/cmake/Modules/usrptestConfig.cmake @@ -1,7 +1,7 @@ -INCLUDE(FindPkgConfig) +include(FindPkgConfig) PKG_CHECK_MODULES(PC_USRPTEST usrptest) -FIND_PATH( +find_path( USRPTEST_INCLUDE_DIRS NAMES usrptest/api.h HINTS $ENV{USRPTEST_DIR}/include @@ -11,7 +11,7 @@ FIND_PATH( /usr/include ) -FIND_LIBRARY( +find_library( USRPTEST_LIBRARIES NAMES gnuradio-usrptest HINTS $ENV{USRPTEST_DIR}/lib @@ -24,7 +24,7 @@ FIND_LIBRARY( /usr/lib64 ) -INCLUDE(FindPackageHandleStandardArgs) +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(USRPTEST DEFAULT_MSG USRPTEST_LIBRARIES USRPTEST_INCLUDE_DIRS) -MARK_AS_ADVANCED(USRPTEST_LIBRARIES USRPTEST_INCLUDE_DIRS) +mark_as_advanced(USRPTEST_LIBRARIES USRPTEST_INCLUDE_DIRS) diff --git a/tools/gr-usrptest/cmake/cmake_uninstall.cmake.in b/tools/gr-usrptest/cmake/cmake_uninstall.cmake.in index 9ae1ae4bd..ab8f77ad7 100644 --- a/tools/gr-usrptest/cmake/cmake_uninstall.cmake.in +++ b/tools/gr-usrptest/cmake/cmake_uninstall.cmake.in @@ -1,32 +1,32 @@ # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F -IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") -FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -STRING(REGEX REPLACE "\n" ";" files "${files}") -FOREACH(file ${files}) - MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") - IF(EXISTS "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if(EXISTS "$ENV{DESTDIR}${file}") + exec_program( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) - IF(NOT "${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") - ENDIF(NOT "${rm_retval}" STREQUAL 0) - ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif(NOT "${rm_retval}" STREQUAL 0) + elseif(IS_SYMLINK "$ENV{DESTDIR}${file}") + exec_program( "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out RETURN_VALUE rm_retval ) - IF(NOT "${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") - ENDIF(NOT "${rm_retval}" STREQUAL 0) - ELSE(EXISTS "$ENV{DESTDIR}${file}") - MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") - ENDIF(EXISTS "$ENV{DESTDIR}${file}") -ENDFOREACH(file) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif(NOT "${rm_retval}" STREQUAL 0) + else(EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif(EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) diff --git a/tools/gr-usrptest/lib/CMakeLists.txt b/tools/gr-usrptest/lib/CMakeLists.txt index 10ba461e1..1d6aeafac 100644 --- a/tools/gr-usrptest/lib/CMakeLists.txt +++ b/tools/gr-usrptest/lib/CMakeLists.txt @@ -31,7 +31,7 @@ list(APPEND usrptest_sources set(usrptest_sources "${usrptest_sources}" PARENT_SCOPE) if(NOT usrptest_sources) - MESSAGE(STATUS "No C++ sources... skipping lib/") + message(STATUS "No C++ sources... skipping lib/") return() endif(NOT usrptest_sources) diff --git a/tools/gr-usrptest/swig/CMakeLists.txt b/tools/gr-usrptest/swig/CMakeLists.txt index ae42be628..d1b1fa8ee 100644 --- a/tools/gr-usrptest/swig/CMakeLists.txt +++ b/tools/gr-usrptest/swig/CMakeLists.txt @@ -21,7 +21,7 @@ # Check if there is C++ code at all ######################################################################## if(NOT usrptest_sources) - MESSAGE(STATUS "No C++ sources... skipping swig/") + message(STATUS "No C++ sources... skipping swig/") return() endif(NOT usrptest_sources) diff --git a/tools/kitchen_sink/CMakeLists.txt b/tools/kitchen_sink/CMakeLists.txt index edbc33bd0..dc7f5c6ef 100644 --- a/tools/kitchen_sink/CMakeLists.txt +++ b/tools/kitchen_sink/CMakeLists.txt @@ -37,27 +37,27 @@ set(BOOST_REQUIRED_COMPONENTS thread unit_test_framework ) -IF(UNIX AND EXISTS "/usr/lib64") - LIST(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix -ENDIF(UNIX AND EXISTS "/usr/lib64") +if(UNIX AND EXISTS "/usr/lib64") + list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix +endif(UNIX 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) - UNSET(BOOST_REQUIRED_COMPONENTS) #empty components list for static link - ENDIF(BOOST_ALL_DYN_LINK) -ENDIF(MSVC) +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) + unset(BOOST_REQUIRED_COMPONENTS) #empty components list for static link + endif(BOOST_ALL_DYN_LINK) +endif(MSVC) -SET(Boost_ADDITIONAL_VERSIONS +set(Boost_ADDITIONAL_VERSIONS "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" ) -FIND_PACKAGE(Boost 1.46 COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) +find_package(Boost 1.46 COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) #### Set up UHD: find_package(UHD "3.7.3" REQUIRED) diff --git a/tools/nirio_programmer/CMakeLists.txt b/tools/nirio_programmer/CMakeLists.txt index bde0ea574..9d3884863 100644 --- a/tools/nirio_programmer/CMakeLists.txt +++ b/tools/nirio_programmer/CMakeLists.txt @@ -57,7 +57,7 @@ link_directories(${Boost_LIBRARY_DIRS}) ### Make the executable ####################################################### add_executable(nirio_programmer nirio_programmer.cpp) -SET(CMAKE_BUILD_TYPE "Release") +set(CMAKE_BUILD_TYPE "Release") # Shared library case: All we need to do is link against the library, and # anything else we need (in this case, some Boost libraries): |