### Install libad9361-iio Python Bindings from Source Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/doc/index.rst Install the Python bindings by cloning the repository and running the setup script. This is useful for development or if you need the latest changes. ```bash git clone https://github.com/analogdevicesinc/libad9361-iio.git cd bindings/python (sudo) python3 setup.py install ``` -------------------------------- ### Create macOS Installer Package Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/CMakeLists.txt This snippet defines custom commands to build a macOS installer package (.pkg) for the libad9361 framework. It utilizes `pkgbuild` to create a component archive and `productbuild` to assemble the final installer. This is executed only when `OSX_PACKAGE` and `OSX_FRAMEWORK` are enabled. ```cmake if(OSX_PACKAGE AND OSX_FRAMEWORK) set(LIBAD9361_PKG ${CMAKE_CURRENT_BINARY_DIR}/libad9361-${VERSION}.pkg) set(LIBAD9361_TEMP_PKG ${CMAKE_CURRENT_BINARY_DIR}/libad9361-${VERSION}-temp.pkg) set(LIBAD9361_DISTRIBUTION_XML ${CMAKE_CURRENT_BINARY_DIR}/Distribution.xml) set(LIBAD9361_FRAMEWORK_DIR ${CMAKE_CURRENT_BINARY_DIR}/ad9361.framework) configure_file(Distribution.xml.cmakein ${LIBAD9361_DISTRIBUTION_XML} @ONLY) find_program(PKGBUILD_EXECUTABLE NAMES pkgbuild DOC "OSX Package builder (pkgbuild)") mark_as_advanced(PKGBUILD_EXECUTABLE) find_program(PRODUCTBUILD_EXECUTABLE NAMES productbuild DOC "OSX Package builder (productbuild)") mark_as_advanced(PRODUCTBUILD_EXECUTABLE) add_custom_command(OUTPUT ${LIBAD9361_PKG} COMMAND ${PKGBUILD_EXECUTABLE} --component ${LIBAD9361_FRAMEWORK_DIR} --identifier com.adi.ad9361 --version ${VERSION} --install-location /Library/Frameworks ${LIBAD9361_TEMP_PKG} COMMAND ${PRODUCTBUILD_EXECUTABLE} --distribution ${LIBAD9361_DISTRIBUTION_XML} ${LIBAD9361_PKG} COMMAND ${CMAKE_COMMAND} -E remove ${LIBAD9361_TEMP_PKG} DEPENDS ad9361 ${LIBAD9361_DISTRIBUTION_XML} ) if (PKGBUILD_EXECUTABLE AND PRODUCTBUILD_EXECUTABLE) add_custom_target(libad9361-pkg ALL DEPENDS ${LIBAD9361_PKG}) install(CODE "execute_process(COMMAND /usr/sbin/installer -pkg ${LIBAD9361_PKG} -target /)") else() message(WARNING "Missing pkgbuild or productbuild: OSX installer won't be created.") endif() endif() ``` -------------------------------- ### Build and Install libad9361-iio Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/README.md Standard build process using CMake, Make, and Make Install. Ensure you are using a compatible libiio version (less than v1.0). ```bash cmake ./CMakeLists.txt make sudo make install ``` -------------------------------- ### Install Python Bindings with Pip Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/README.md Use this command to install the Python bindings if you already have the core libad9361-iio library. Pip is the most convenient method. ```shell (sudo) pip install pylibad9361-iio ``` -------------------------------- ### Install libad9361-iio Python Bindings via Pip Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/doc/index.rst Install the Python bindings using pip. This is the recommended method for most users. ```bash (sudo) pip install pylibad9361 ``` -------------------------------- ### Define Uninstall Target Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/CMakeLists.txt This snippet defines a custom target named 'uninstall' which executes a CMake script to remove installed files. The script `cmake_uninstall.cmake` is generated from a template (`cmake_uninstall.cmake.in`) during the configuration phase. ```cmake set(LIBAD9361_TARGETNAME_UNINSTALL "uninstall" CACHE STRING "Name of 'uninstall' build target") add_custom_target(${LIBAD9361_TARGETNAME_UNINSTALL} "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) ``` -------------------------------- ### Add libad9361-iio Site Packages to PYTHONPATH on Linux Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/doc/index.rst On Linux systems, especially Ubuntu, the installed Python packages might not be on the default path. This command adds the site-packages directory to your PYTHONPATH environment variable. ```bash export PYTHONPATH=$PYTHONPATH:/usr/lib/python{python-version}/site-packages ``` -------------------------------- ### Configure Python Documentation Build Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/CMakeLists.txt Configures the build process for Python documentation using Sphinx if the WITH_DOC option is enabled and Sphinx is found. This involves setting up Sphinx configuration files and adding a custom command to generate HTML documentation. ```cmake if(WITH_DOC) find_program(SPHINX_EXECUTABLE NAMES sphinx-build DOC "Sphinx Documentation Builder (sphinx-doc.org)" ) if (NOT SPHINX_EXECUTABLE) message(FATAL_ERROR "Can not build python doc without sphinx-build") endif() message (STATUS "Building with Python Doc (Sphinx)") set(CMAKE_HTML_DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/html/v${LIBAD9361_VERSION_MAJOR}.${LIBAD9361_VERSION_MINOR}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py.in ${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py) add_custom_command(TARGET libad9361-py-py POST_BUILD COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_BINARY_DIR}" ${SPHINX_EXECUTABLE} -b html -n -c ${CMAKE_CURRENT_SOURCE_DIR}/doc -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees -w ${CMAKE_BINARY_DIR}/Spx_output_python ${CMAKE_CURRENT_SOURCE_DIR}/doc ${CMAKE_HTML_DEST_DIR}/python COMMENT "Generating Python binding documentation with Sphinx" VERBATIM ) endif() ``` -------------------------------- ### Enable General Packaging Options Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/CMakeLists.txt This section enables general packaging options for creating archives like .deb, .rpm, or .tar.gz via `make package`. It is disabled if `OSX_PACKAGE` is enabled to prevent empty tarballs. It also includes conditional includes for platform-specific packaging scripts. ```cmake if (NOT OSX_PACKAGE) # Support creating some basic binpkgs via `make package`. # Disabled if OSX_PACKAGE is enabled, as tarballs would # end up empty otherwise. option(ENABLE_PACKAGING "Create .deb/.rpm or .tar.gz packages via 'make package'" ON) if(ENABLE_PACKAGING) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") include(cmake/DarwinPackaging.cmake) endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") include(cmake/LinuxPackaging.cmake) endif() endif() endif() ``` -------------------------------- ### Configure Python Bindings Build Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/CMakeLists.txt Configures the build process for Python bindings if Python 3 is found. This includes copying necessary Python files and creating a custom build target. ```cmake if (Python3_FOUND) message(STATUS "Found Python: Building bindings") set(SETUP_PY_IN ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.cmakein) set(SETUP_PY ${CMAKE_CURRENT_BINARY_DIR}/setup.py) configure_file(${SETUP_PY_IN} ${SETUP_PY}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ad9361.py ${CMAKE_CURRENT_BINARY_DIR}/ad9361.py COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tasks.py ${CMAKE_CURRENT_BINARY_DIR}/tasks.py COPYONLY) add_custom_target(libad9361-py-py ALL DEPENDS ${SETUP_PY} COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} --quiet build) if(NOT SKIP_INSTALL_ALL) install(CODE "execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} install --root=\\\${ENV{DESTDIR}}/ --prefix=${CMAKE_INSTALL_PREFIX})") endif() else() message(FATAL_ERROR "Python search failed : Can not build Python bindings") endif() ``` -------------------------------- ### Conditionally Build MATLAB Bindings Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/CMakeLists.txt Includes the MATLAB subdirectory if the MATLAB_BINDINGS flag is enabled. ```cmake if (MATLAB_BINDINGS) add_subdirectory(matlab) endif() ``` -------------------------------- ### Conditionally Build Python Bindings Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/CMakeLists.txt Includes the Python subdirectory if the PYTHON_BINDINGS flag is enabled. ```cmake if (PYTHON_BINDINGS) add_subdirectory(python) endif() ``` -------------------------------- ### ad9361 Module Functions Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/doc/functions.rst The `ad9361` module provides a set of functions for interacting with the AD9361 device. These functions are directly callable by users of the library. ```APIDOC ## ad9361 Module This module contains the primary functions for controlling and configuring the AD9361 device. ### Functions - **`ad9361.function_name`**: Description of what `function_name` does. - **`ad9361.another_function`**: Description of what `another_function` does. *(Note: Specific function names and their descriptions are not provided in the source text. This is a template based on the `.. automodule:: ad9361 :members:` directive.)* ``` -------------------------------- ### Find Python 3 Interpreter Source: https://github.com/analogdevicesinc/libad9361-iio/blob/main/bindings/python/CMakeLists.txt Finds the Python 3 interpreter, requiring version 3.6 or later. Sets up variables for use in the build process. ```cmake if(${CMAKE_VERSION} VERSION_LESS "3.12.0") if(Python3_EXECUTABLE) set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) endif() find_package(PythonInterp 3.6 REQUIRED) set(Python3_FOUND ${PYTHONINTERP_FOUND}) set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) else() find_package(Python3 3.6 REQUIRED COMPONENTS Interpreter) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.