diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-09-02 11:38:05 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-09-10 15:08:10 -0500 |
commit | 09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d (patch) | |
tree | f632274ec4af60e1559a361bd2b607cc65e9d5f7 /mpm | |
parent | e64d3e28316f642c1203722b6f5f2af710a7e281 (diff) | |
download | uhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.tar.gz uhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.tar.bz2 uhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.zip |
cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIR
See the CMake 3.8 documentation on these two variables:
https://cmake.org/cmake/help/v3.8/variable/PROJECT-NAME_SOURCE_DIR.html
https://cmake.org/cmake/help/v3.8/variable/CMAKE_SOURCE_DIR.html
Under normal circumstances, these two are identical. For sub-projects
(i.e., when building UHD as part of something else that is also a CMake
project), only the former is useful. There is no discernible downside of
using UHD_SOURCE_DIR over CMAKE_SOURCE_DIR.
This was changed using sed:
$ sed -i "s/CMAKE_SOURCE_DIR/UHD_SOURCE_DIR/g" \
`ag -l CMAKE_SOURCE_DIR **/{CMakeLists.txt,*.cmake}`
$ sed -i "s/CMAKE_BINARY_DIR/UHD_BINARY_DIR/g" \
`ag -l CMAKE_BINARY_DIR **/{CMakeLists.txt,*.cmake}`
At the same time, we also replace the CMake variable UHD_HOST_ROOT (used
in MPM) with UHD_SOURCE_DIR. There's no reason to have two variables
with the same meaning and different names, but more importantly, this
means that UHD_SOURCE_DIR is defined even in those cases where MPM calls
into CMake files from UHD without any additional patches.
Shoutout to GitHub user marcobergamin for bringing this up.
Diffstat (limited to 'mpm')
-rw-r--r-- | mpm/CMakeLists.txt | 6 | ||||
-rw-r--r-- | mpm/lib/CMakeLists.txt | 4 | ||||
-rw-r--r-- | mpm/lib/catalina/CMakeLists.txt | 30 | ||||
-rw-r--r-- | mpm/lib/chips/CMakeLists.txt | 6 | ||||
-rw-r--r-- | mpm/lib/mykonos/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mpm/python/CMakeLists.txt | 6 | ||||
-rwxr-xr-x | mpm/python/usrp_mpm/chips/ic_reg_maps/CMakeLists.txt | 8 |
7 files changed, 31 insertions, 31 deletions
diff --git a/mpm/CMakeLists.txt b/mpm/CMakeLists.txt index 731e2ba13..7596529dc 100644 --- a/mpm/CMakeLists.txt +++ b/mpm/CMakeLists.txt @@ -18,8 +18,8 @@ if(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 ${UHD_HOST_ROOT}/cmake/Modules) +set(UHD_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../host) +list(INSERT CMAKE_MODULE_PATH 0 ${UHD_SOURCE_DIR}/cmake/Modules) ######################################################################## # Setup Python API ######################################################################## @@ -167,7 +167,7 @@ if(NOT ENABLE_SIM) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include - ${UHD_HOST_ROOT}/include + ${UHD_SOURCE_DIR}/include ) add_subdirectory(lib) diff --git a/mpm/lib/CMakeLists.txt b/mpm/lib/CMakeLists.txt index f127af0a6..c46a3da40 100644 --- a/mpm/lib/CMakeLists.txt +++ b/mpm/lib/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -set(UHD_HOST_ROOT ${CMAKE_SOURCE_DIR}/../host) +set(UHD_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../host) add_subdirectory(dboards) add_subdirectory(chips) @@ -24,7 +24,7 @@ endif(ENABLE_X400) USRP_PERIPHS_ADD_OBJECT(periphs exception.cpp - ${UHD_HOST_ROOT}/lib/exception.cpp + ${UHD_SOURCE_DIR}/lib/exception.cpp ) # vim: set sw=4 et: diff --git a/mpm/lib/catalina/CMakeLists.txt b/mpm/lib/catalina/CMakeLists.txt index 7780b738e..d04b4d93e 100644 --- a/mpm/lib/catalina/CMakeLists.txt +++ b/mpm/lib/catalina/CMakeLists.txt @@ -15,7 +15,7 @@ macro(CATALINA_APPEND_SOURCES) endmacro(CATALINA_APPEND_SOURCES) set (CMAKE_CATALINA_SOURCE_DIR - ${UHD_HOST_ROOT}/lib/usrp/common + ${UHD_SOURCE_DIR}/lib/usrp/common ) ######################################################################## @@ -26,7 +26,7 @@ message(STATUS " Priority scheduling disabled.") set(THREAD_PRIO_DEFS HAVE_THREAD_PRIO_DUMMY) set_source_files_properties( - ${UHD_HOST_ROOT}/lib/utils/thread.cpp + ${UHD_SOURCE_DIR}/lib/utils/thread.cpp PROPERTIES COMPILE_DEFINITIONS "${THREAD_PRIO_DEFS}" ) @@ -34,11 +34,11 @@ set_source_files_properties( # Setup UHD_VERSION and UHD_COMPONENT for version.cpp ######################################################################## configure_file( - ${UHD_HOST_ROOT}/include/uhd/version.hpp.in + ${UHD_SOURCE_DIR}/include/uhd/version.hpp.in ${CMAKE_BINARY_DIR}/include/uhd/version.hpp ) configure_file( - ${UHD_HOST_ROOT}/lib/version.cpp + ${UHD_SOURCE_DIR}/lib/version.cpp ${CMAKE_BINARY_DIR}/lib/version.cpp ) @@ -47,24 +47,24 @@ 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 - ${UHD_HOST_ROOT}/lib/types/filters.cpp - ${UHD_HOST_ROOT}/lib/types/ranges.cpp - ${UHD_HOST_ROOT}/lib/types/sensors.cpp - ${UHD_HOST_ROOT}/lib/types/serial.cpp - ${UHD_HOST_ROOT}/lib/property_tree.cpp - ${UHD_HOST_ROOT}/lib/utils/log.cpp - ${UHD_HOST_ROOT}/lib/utils/thread.cpp + ${UHD_SOURCE_DIR}/lib/types/filters.cpp + ${UHD_SOURCE_DIR}/lib/types/ranges.cpp + ${UHD_SOURCE_DIR}/lib/types/sensors.cpp + ${UHD_SOURCE_DIR}/lib/types/serial.cpp + ${UHD_SOURCE_DIR}/lib/property_tree.cpp + ${UHD_SOURCE_DIR}/lib/utils/log.cpp + ${UHD_SOURCE_DIR}/lib/utils/thread.cpp ${CMAKE_BINARY_DIR}/lib/version.cpp ) USRP_PERIPHS_ADD_OBJECT(catalina ${catalina_sources}) target_include_directories(catalina PUBLIC - $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/include>) + $<BUILD_INTERFACE:${UHD_SOURCE_DIR}/lib/include>) target_include_directories(catalina PUBLIC - $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/usrp/common/ad9361_driver>) + $<BUILD_INTERFACE:${UHD_SOURCE_DIR}/lib/usrp/common/ad9361_driver>) target_include_directories(catalina PUBLIC - $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/include>) + $<BUILD_INTERFACE:${UHD_SOURCE_DIR}/lib/include>) target_include_directories(dboards PUBLIC - $<BUILD_INTERFACE:${UHD_HOST_ROOT}/lib/usrp/common/ad9361_driver>) + $<BUILD_INTERFACE:${UHD_SOURCE_DIR}/lib/usrp/common/ad9361_driver>) diff --git a/mpm/lib/chips/CMakeLists.txt b/mpm/lib/chips/CMakeLists.txt index c03ace9f4..ba3060673 100644 --- a/mpm/lib/chips/CMakeLists.txt +++ b/mpm/lib/chips/CMakeLists.txt @@ -27,9 +27,9 @@ #################################################### # 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_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../host) +#message("uhd host root: ${UHD_SOURCE_DIR}") +#set(UHD_IC_REG_MAP_PATH ${UHD_SOURCE_DIR}/lib/ic_reg_maps) #set(ETTUS_PYTHON_GEN_SOURCE_DEPS ${UHD_IC_REG_MAP_PATH}/common.py) #ETTUS_PYTHON_GEN_SOURCE( diff --git a/mpm/lib/mykonos/CMakeLists.txt b/mpm/lib/mykonos/CMakeLists.txt index 0cfe7f412..4d167ae80 100644 --- a/mpm/lib/mykonos/CMakeLists.txt +++ b/mpm/lib/mykonos/CMakeLists.txt @@ -19,7 +19,7 @@ set(mykonos_sources ${CMAKE_CURRENT_SOURCE_DIR}/ad937x_device.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ad937x_spi_iface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/adi_ctrl.cpp - ${UHD_HOST_ROOT}/lib/types/ranges.cpp + ${UHD_SOURCE_DIR}/lib/types/ranges.cpp ) add_subdirectory(adi) diff --git a/mpm/python/CMakeLists.txt b/mpm/python/CMakeLists.txt index 9041347e1..b15578484 100644 --- a/mpm/python/CMakeLists.txt +++ b/mpm/python/CMakeLists.txt @@ -63,9 +63,9 @@ if(NOT ENABLE_SIM) 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 - ${UHD_HOST_ROOT}/lib/deps/pybind11/include + ${UHD_SOURCE_DIR}/lib/usrp/common + ${UHD_SOURCE_DIR}/lib/usrp/common/ad9361_driver + ${UHD_SOURCE_DIR}/lib/deps/pybind11/include ) target_link_libraries(pyusrp_periphs ${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) diff --git a/mpm/python/usrp_mpm/chips/ic_reg_maps/CMakeLists.txt b/mpm/python/usrp_mpm/chips/ic_reg_maps/CMakeLists.txt index 1a49daef6..61b836700 100755 --- a/mpm/python/usrp_mpm/chips/ic_reg_maps/CMakeLists.txt +++ b/mpm/python/usrp_mpm/chips/ic_reg_maps/CMakeLists.txt @@ -27,19 +27,19 @@ endmacro(REG_MAPS_GEN_SOURCE) if(ENABLE_REGMAPS) # designate the file which will be used to generate all reg maps - set(REG_MAPS_GEN_SOURCE_DEPS ${UHD_HOST_ROOT}/lib/ic_reg_maps/common.py) + set(REG_MAPS_GEN_SOURCE_DEPS ${UHD_SOURCE_DIR}/lib/ic_reg_maps/common.py) # specify all reg maps you wish to generate REG_MAPS_GEN_SOURCE( - ${UHD_HOST_ROOT}/lib/ic_reg_maps/gen_lmk04816_regs.py + ${UHD_SOURCE_DIR}/lib/ic_reg_maps/gen_lmk04816_regs.py ${CMAKE_CURRENT_BINARY_DIR}/lmk04816_regs.py ) REG_MAPS_GEN_SOURCE( - ${UHD_HOST_ROOT}/lib/ic_reg_maps/gen_lmx2572_regs.py + ${UHD_SOURCE_DIR}/lib/ic_reg_maps/gen_lmx2572_regs.py ${CMAKE_CURRENT_BINARY_DIR}/lmx2572_regs.py ) REG_MAPS_GEN_SOURCE( - ${UHD_HOST_ROOT}/lib/ic_reg_maps/gen_zbx_cpld_regs.py + ${UHD_SOURCE_DIR}/lib/ic_reg_maps/gen_zbx_cpld_regs.py ${CMAKE_CURRENT_BINARY_DIR}/zbx_cpld_regs.py ) |