aboutsummaryrefslogtreecommitdiffstats
path: root/host/python/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* python: cmake: Detect python virtual environmentsmattprost2022-07-201-2/+3
| | | | | | | This allows a UHD build to link to python modules installed in a virtual environment such a venv or pyenv. Signed-off-by: mattprost <matt.prost@ni.com>
* fixup! cmake: Replace distutils.sysconfig with sysconfigSteven Koo2022-01-201-22/+8
| | | | | | | | The original commit incorrectly fails the build uhd in the meta-ettus context. This uses prefix instead to get the base path. Signed-off-by: Steven Koo <steven.koo@ni.com>
* cmake: Replace distutils.sysconfig with sysconfigAaron Rossetto2022-01-141-9/+13
| | | | | | | | | | | | | | | | | | | | This commit replaces uses of distutils.sysconfig's get_python_lib() function with sysconfig's near-equivalent get_path() function to get the directory for site-specific, platform-specific files. Unfortunately, get_path() does not have a way to easily modify or strip the prefix applied to the path like get_python_lib() does, so the code must manually modify the path to get the same effect: - First, the platlib path is retrieved from the get_path() call. - Next, the default base that is used to form the pathlib path is queried via the get_config_var('base') call. - Next, the portion of the platlib path that matches the default base is stripped, and any leading path separator remaining is stripped. This fundamentally replicates the behavior of get_python_lib() with an empty prefix (i.e., the prefix positional parameter is specified as ''). - If a different prefix is desired, then the os.path.join() function is used to combine the new prefix with the stripped pathlib path, ensuring that the platform-specific path separator is used in crafting the path.
* cmake: Replace distutils with CMake for version checksAaron Rossetto2022-01-141-1/+2
| | | | | | | This commit replaces the use of distutils.version.LooseVersion() with CMake's version comparison operator, which implements relational version string checking in the same manner (i.e., comparing numeric components of a version string numerically).
* cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIRMartin Braun2021-09-101-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* mpm: add unit tests for EEPROM readersLars Amsel2021-05-311-0/+1
|
* python: Add find() to the Python APIMartin Braun2020-12-071-0/+1
| | | | | | | | | | | | This a mapping of uhd::device::find() into uhd.find() on the Python side. The uhd::device is intentionally not mapped into Python (prefer MultiUSRP or RfnocGraph instead), so the namespace is moved up one level. Example: >>> import uhd >>> # Now print the device args for all found B200s: >>> for dev_args in uhd.find("type=b200")): print(dev_args.to_string())
* python: Add access to the property_tree from PythonMartin Braun2020-10-161-0/+1
| | | | | | | Example: >>> usrp = uhd.usrp.multi_usrp("") >>> tree = usrp.get_tree() >>> print(tree.access_int("/name").get())
* python: Move multi_usrp_python to its own moduleMartin Braun2020-10-121-1/+4
| | | | | This helps with recompilation times of UHD. No functional changes.
* sim: Embed MPM into libpyuhdSamuel O'Brien2020-10-071-0/+57
| | | | | | | When ENABLE_SIM and ENABLE_PYTHON_API are set, this commit embeds MPM (Built with -DMPM_DEVICE=sim) into the pyuhd package. Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
* cmake: Use relative path to Python lib location for Windows installerAaron Rossetto2020-08-281-5/+17
|
* Remove remaining Python 2 referencesMartin Braun2020-05-071-3/+2
| | | | | | | This changes two things in all applicable files: - Remove imports from __future__ - Change default shebangs from /usr/bin/env python to /usr/bin/env python3
* python: Fix RPATH for the Python libraryMartin Braun2020-05-071-2/+23
| | | | | | | | | | | | | | | | On UNIX systems, CMake will set the RPATH of the Python library to the build directory, which is very helpful because it allows unit and other tests to be executed from within the build directory. On installation, the RPATH is removed, but only if install(TARGETS) is used, which we were not, thus resulting in incorrect RPATHs. This would surface as a bug, too. Calling uhd.get_lib_path() would always point to the build directory, thus resulting in no FPGA images being found automatically, e.g. when running a B200 through the Python API. This change installs the Python .so file separately, using the correct CMake mechanisms.
* python: Arrange file in Python module into uhd/ subdirectoryMartin Braun2020-03-101-7/+7
| | | | | | | | | | | | | | | This adds the host/python/uhd subdirectory, which will add all files that go into the actual Python module once installed. Before, all Python files were directly in host/python and got sorted into their appropriate destination folders during configuration and installation. This change doesn't change anything (Python modules will look the same as they do now), except that it makes the source tree a tad neater, but more importantly, it creates a consistent directory structure when adding submodules to the uhd module. Apart from the PyBind11-generated shared object file (which gets generated during build time), the uhd/ subdirectory in host/python exactly resembles the Python module once installed, so it's more obvious where to add new submodules and files.
* python: Set python module suffix to conform with PEP 3149.Ryan Volz2020-02-071-1/+10
| | | | | | | | | This adds the python implementation, major and minor version numbers, and any additional flags (debug, pymalloc, wide unicode) to the extension module suffix as specified in PEP 3149. Hat tip to @isuruf: https://github.com/conda-forge/staged-recipes/pull/10076#discussion_r348721448
* python: Do not link against python lib for building an extension module.Ryan Volz2020-02-071-1/+10
| | | | | | | | | | | | This fixes a segmentation fault when trying to use the python module on OSX when built with conda (unsure why it doesn't arise otherwise). Instead of linking against the python library, it is proper to not link against the library and, for OSX builds, add linker options for "-undefined" and "dynamic_lookup". This is precisely what the CMake FindPython module does for linking against the Python::Module target. See https://blog.tim-smith.us/2015/09/python-extension-modules-os-x and https://bugs.python.org/issue36721
* python: Fix internal library name (incl. suffix) to match filename.Ryan Volz2020-02-071-7/+7
| | | | | | Instead of renaming the library file, this sets the suffix in CMake so that the filename turns out as desired and also linker references know the correct name.
* rfnoc: adding RFNoC Python APIBrent Stapleton2020-01-021-0/+1
| | | | | | | | Adding Python bindings for the RFNoC API. This includes the rfnoc_graph, noc_block_base, and several other supporting classes. Templated functions are not currently supported. For example, `rfnoc_graph::get_block` can only return the basic block controller.
* cmake: Remove ENABLE_PYTHON3 flag and simplify Python detectionMartin Braun2019-05-241-1/+1
| | | | | | - Makes use of more modern find_package(Python2/3) if available - Moves almost all Python-related code to UHDPython.cmake - ENABLE_PYTHON3 is no longer necessary
* cmake: python: Remove stray message()Martin Braun2019-05-211-1/+0
|
* python: change CMake variable for library extBrent Stapleton2019-03-061-1/+1
| | | | | | | Changing the CMake variable used in determining the extension of the Python API library for better cross-platform support. Specifically, `CMAKE_SHARED_MODULE_SUFFIX` corresponds to .so for *nix and MacOS, which is the extension Python expects.
* python: cmake: Use native format for setup.pyTrung Tran2019-02-251-1/+2
| | | | | | | setuptools isn't compatible with Unix style path on Windows 10 machines. We need to convert any path before running setuptools. Signed-off-by: Trung Tran <trung.tran@ettus.com>
* python: Replace Boost.Python with PyBind11Martin Braun2019-02-221-1/+10
| | | | | | This does not change the Python API itself, but it is still a significant change. Most importantly, it removes the dependency on Boost.Python.
* cmake: Update coding style to use lowercase commandsMartin Braun2018-11-141-26/+26
| | | | | | | | | | | | | | | | | Also updates our coding style file. Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code (with GNU compliant sed): cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done > convert.sed \ && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' \ '*CMakeLists.txt' | xargs -0 gsed -i -f convert.sed && rm convert.sed (Make sure the backslashes don't get mangled!)
* python: Fixing Boost.Python initializer visibilityMarcus Müllr2018-08-031-2/+2
| | | | | | With Boost 1.64 to 1.65 (which, of course, Ubuntu LTS ships), the `PyInit_Libraryname` are invisible when one sets the default visibility to "hidden" (which is reasonable, and which we do).
* uhd: python: CMakeLists.txt change dll to pydTrung Tran2018-08-011-1/+7
| | | | To support python api installer
* python: Fixup for Python API install directoryBrent Stapleton2018-07-271-3/+15
| | | | | | | | | | The Python API should now be installed to `PREFIX/lib/pythonVER/dist-packages/uhd` where the PREFIX is set by CMake and the Python version is determined by the Python module `distutils`. This should match user expectations much more than the previous behavior. Behavior in Virtualenvs is unchanged.
* cmake: add support to make python api installer on windowsTrung Tran2018-07-131-6/+2
|
* python: Separating exposed Python data structuresPaul David2018-06-201-46/+29
| | | | | | | | | - Separating exposed Python data structures into logical sections - Exposes all of the multi_usrp API - Adds a layer of Python for documentation and adding helper methods - Adds improvements and fixes to the MultiUSRP object - Includes additional exposed data structures (like time_spec_t, etc.) - Add code to release the Python GIL during long C++ calls
* python: Initial commit of Python APIAndrej Rode2018-06-201-0/+83
Initial commit of the Python API using Boost.Python. Bind the MultiUSRP API for use in Python. Bindings intended to provide as complete coverage as possible. - Wrap most multi_usrp calls - Adding multi channel send/recv examples in examples/python - Adding setuptools support - Initial attempt at binding the UHD types and filters