diff options
Diffstat (limited to 'mpm')
30 files changed, 343 insertions, 343 deletions
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}) |