Wiki

This version (25 Apr 2022 16:17) was approved by Robin Getz.The Previously approved version (30 May 2016 10:30) is available.Diff

Building libiio in Visual Studio

Unless you really, really want to - don't do this. There are pre-compiled binaries available for end users to use in their projects. If you are struggling with the binaries - ask/complain. It's the only way we understand what users are looking for.

You shouldn't really need to follow any of these instructions - the instructions are mainly there for libiio developers wanting to keeps some notes, so they remember how to do things.

Build from the GUI

  • Launch CMake, and specify the location of the source code, and the directory where the build will occur.
    Enable the Grouped and Advanced options (optional).
  • Then click on Configure.
    CMake will ask you what generator to use for the project. Select Use default native compilers and the generator that matches your version of Visual Studio.
  • CMake will most likely throw an error, as the libxml2 library is not in the compiler's default search paths:
  • Set the correct paths to LIBXML2_INCLUDE_DIR, LIBXML2_LIBRARIES and LIBXML2_XMLLINT_EXECUTABLE as shown below. Then, click again on Configure; the errors should disappear.
  • Click on Generate.
    Now, CMake generated a Visual Studio solution file in the build directory, named “iio.sln”. You can open this file with Visual Studio to build the project.

Build from the command line

C:\Users\rgetz\Documents\GitHub\libiio\build>cmake -DWITH_USB_BACKEND=OFF -DWITH_SERIAL_BACKEND=OFF -DLIBXML2_LIBRARIES=“C:\\deps\\libiio-win-deps\\libs\\64\\libxml2.lib” -DLIBXML2_INCLUDE_DIR=“C:depslibiio-win-depsincludelibxml2”  -DLOG_LEVEL=Debug ..

C:\Users\rgetz\Documents\GitHub\libiio\build>cmake --build . --config Release

C:\Users\rgetz\Documents\GitHub\libiio\build>copy .\Release\* .\tests\Release\

To test something in a loop (over and over again)

C:\Users\rgetz\Documents\GitHub\libiio\build>FOR /L %L IN (0,0,1) DO @(.\tests\Release\iio_attr.exe -S)

resources/tools-software/linux-software/building_libiio_for_windows.txt · Last modified: 25 Apr 2022 16:17 by Robin Getz