Wiki

This version (09 Sep 2019 13:50) was approved by ASuciu.

What is libm2k?

A C++ library for interfacing with the ADALM-2000.

How to build it?

Building on Linux

Dependencies

Install git, cmake, swig, python:

~$ sudo apt-get install git cmake swig g++ python3-dev python3-setuptools
Build and install libiio. Instructions can be found here.

Install libm2k

Build and install libm2k:

~$ git clone https://github.com/analogdevicesinc/libm2k.git
~$ cd libm2k
~/libm2k$ mkdir build
~/libm2k$ cd build
~/libm2k/build$ cmake -DENABLE_EXCEPTIONS=TRUE ../
~/libm2k/build$ make
~/libm2k/build$ sudo make install

Building on OSX

Dependencies

Install git, cmake, swig and python:

~$ brew install git cmake g++ swig python3

Download and install libiio.

Install libm2k

Build and install libm2k:

~$ git clone https://github.com/analogdevicesinc/libm2k.git
~$ cd libm2k
~/libm2k$ mkdir build
~/libm2k$ cd build
~/libm2k/build$ cmake -DENABLE_EXCEPTIONS=TRUE ../
~/libm2k/build$ make
~/libm2k/build$ sudo make install

Building on Windows

Get the latest installer from here.

Dependencies

  • libiio
    • Download the libiio zip from this page.
    • Choose a location and extract libiio.
  • CMake
  • Swig
    • Download the SWIG zip from this page.
    • Choose a location and extract SWIG.
  • Python3
    • Download and install Python3 from the official page.
    • Set path to program files or C:\Python37.

Install libm2k

  1. Clone libm2k or download zip and extract it.
  2. Use the CMake-gui and open libm2k/CMakeLists.txt. At startup, select platform x64.
  3. Press the Configure button. Some of the parameters will be set to their correct value.
  4. Browse the location where you extracted libiio and set IIO_LIBRARIES to libiio/MS64/libiio.lib and IIO_INCLUDE_DIRS libiio/include.
  5. Press the Configure button again.
  6. Set the PYTHON_EXECUTABLE to have the python install folder (C:/Python37/python.exe).
  7. Press the Configure button again.
  8. Browse the location where you extracted SWIG and the SWIG_DIR to that location.
  9. Press the Configure button again.
  10. If no errors, click Generate button in CMake-gui
  11. Click Open Project in CMake-gui - this will open Visual Studio.


Build solution in visual studio

If you want to install the library in the system:

  1. Open a Command Prompt in the libiio folder and copy all the .dll files in C:\Windows\System32.
  2. Open a Command Prompt in the build folder and copy libm2k.dll in C:\Windows\System32.
  3. In the build folder run pip install wheel and python setup.py bdist_wheel in order to build and install the Python Bindings.


C# bindings

  1. The C# bindings are built by default. In order to disable them, set ENABLE_CSHARP=OFF in the CMake configuration.
  2. In order to use the C# bindings, you need to copy the following dlls in your build folder: libm2k-sharp.dll and libm2k-sharp-cxx-wrap.dll . These can be found in C:\Program Files\Common Files\libm2k if you installed libm2k using the system installer. Otherwise, you can download the latest archive from appveyor: Appveyor artifacts and get the dlls from there.
  3. Add libm2k-sharp.dll as a reference in your project.
  4. Check the examples from the source code.

Documentation

API reference

An automatically generated documentation of the API can be found here: https://analogdevicesinc.github.io/libm2k/annotated.html.

libm2k.txt · Last modified: 09 Sep 2019 11:01 by TeoPeri