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 /host/python/CMakeLists.txt | |
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 'host/python/CMakeLists.txt')
-rw-r--r-- | host/python/CMakeLists.txt | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/host/python/CMakeLists.txt b/host/python/CMakeLists.txt index 8f12e3f01..212bd9e46 100644 --- a/host/python/CMakeLists.txt +++ b/host/python/CMakeLists.txt @@ -17,7 +17,7 @@ PYTHON_CHECK_MODULE( # Get include dirs include_directories(${PYTHON_INCLUDE_DIRS}) set(PYBIND11_INCLUDE_DIR - "${CMAKE_SOURCE_DIR}/lib/deps/pybind11/include" + "${UHD_SOURCE_DIR}/lib/deps/pybind11/include" CACHE STRING "Location of PyBind11 includes" @@ -31,9 +31,9 @@ execute_process( # Build pyuhd library add_library(pyuhd SHARED pyuhd.cpp - ${CMAKE_SOURCE_DIR}/lib/property_tree_python.cpp - ${CMAKE_SOURCE_DIR}/lib/device_python.cpp - ${CMAKE_SOURCE_DIR}/lib/usrp/multi_usrp_python.cpp + ${UHD_SOURCE_DIR}/lib/property_tree_python.cpp + ${UHD_SOURCE_DIR}/lib/device_python.cpp + ${UHD_SOURCE_DIR}/lib/usrp/multi_usrp_python.cpp ) # python expects extension modules with a particular suffix if(WIN32) @@ -56,7 +56,7 @@ else() endif(WIN32) target_include_directories(pyuhd PUBLIC ${PYTHON_NUMPY_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/lib + ${UHD_SOURCE_DIR}/lib ${PYBIND11_INCLUDE_DIR} ) @@ -91,7 +91,7 @@ configure_file(${SETUP_PY_IN} ${SETUP_PY}) if(ENABLE_SIM) set(MPM_DEVICE "sim") - add_subdirectory(${CMAKE_SOURCE_DIR}/../mpm/python simulator) + add_subdirectory(${UHD_SOURCE_DIR}/../mpm/python simulator) # simulator/usrp_mpm needs to be copied to usrp_mpm because setuptools only detects import packages in the working directory add_custom_target(copy_mpm_packages ALL DEPENDS usrp_mpm) add_custom_command(TARGET copy_mpm_packages @@ -142,7 +142,7 @@ if(ENABLE_SIM) ${CMAKE_CURRENT_BINARY_DIR}/simulator/usrp_mpm/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm) # Move usrp_hwd.py into usrp_mpm so that it is included in the package - configure_file(${CMAKE_SOURCE_DIR}/../mpm/python/usrp_hwd.py + configure_file(${UHD_SOURCE_DIR}/../mpm/python/usrp_hwd.py ${CMAKE_CURRENT_BINARY_DIR}/usrp_mpm/usrp_hwd.py COPYONLY) set(PYUHD_FILES ${PYUHD_FILES} copy_mpm_packages) endif(ENABLE_SIM) |