Documentation Center

  • Trial Software
  • Product Updates

Contents

Setting up a Build Environment on Linux and Macintosh Systems

Setting up the build environment on Linux and Macintosh systems involves specifying the include file paths, library path, and libraries to link against to create an adaptor. See Required Libraries and Include Files for Adaptor Development for a list of the files and paths you need.

The adaptor kit includes a makefile that builds the adaptor kit demo adaptor on Linux and Macintosh systems. You can use this demo makefile, with only slight modifications, to create a makefile that builds your own adaptor. See Creating a Makefile Based on the Demo Adaptor Makefile for more information.

Required Libraries and Include Files for Adaptor Development

The following table lists the include file paths required to build an adaptor on Linux and Macintosh systems.

    Note   You must also specify the location of the header files and libraries required by your device's SDK. Read the documentation that came with the device's SDK to get this information.

Header Files and Libraries

Location

Adaptor kit header files

$(MATLAB)/toolbox/imaq/imaqadaptors/kit/include[a]

Image Acquisition Toolbox™ engine library

Linux: $(MATLAB)/bin/<ARCH>/libmwimaqmex.so

Mac: $(MATLAB)/bin/<ARCH>/libmwimaqmex.dylib

[a] MATLAB is an environment variable that contains the name of your MATLAB installation folder.

Creating a Makefile Based on the Demo Adaptor Makefile

To create a makefile to build your adaptor based on the demo adaptor makefile, follow these instructions.

  1. Make a copy of the adaptor kit demo makefile and put it in your adaptor development folder. For example, if your adaptor development folder is /home/my_folder/my_adaptor, you might execute this command at the system prompt:

    cd /home/my_folder/my_adaptor
    
    cp $(MATLAB_ROOT)/toolbox/imaq/imaqadaptors/kit/demo/makefile my_makefile

    where MATLAB_ROOT is your MATLAB installation folder.

  2. Open your copy of the makefile in any text editor.

  3. Specify the folder where you want to create your adaptor by setting the value of the ADAPTOR_DIR variable. By default, the demo adaptor makefile puts the adaptor in a subfolder of your development folder called build, but you can put your adaptor in any folder. When you are finished creating your adaptor, register it with the Image Acquisition Toolbox by using the imaqregister function.

  4. Specify the location of your MATLAB installation folder by setting the value of the MATLAB_ROOT variable. You can specify a relative path or an absolute path.

  5. Specify any libraries required by your hardware device's SDK by setting the value of the LIBS variable. The demo adaptor makefile already specifies the library required by the adaptor kit: libmwimaqmex. The makefile drops the "lib" prefix and the platform-specific file extension, such as .so, for these libraries because the linker does not require them.

  6. Specify any include file folders required by your hardware device's SDK by setting the value of the INCLUDE_DIRS variable. The demo adaptor makefile already specifies the include folders required by the adaptor kit.

  7. Specify the name you want to give your adaptor by setting the value of the RESULT variable. The makefile builds the demo adaptor, so it uses the naming convention for a MathWorks adaptor, using the "mw" prefix. Do not use this convention for the name of your adaptor. The line you modify depends on your development platform:

    PlatformLine NumberChange
    Linux69Specify the name, giving it the .so file extension.
    Macintosh90Specify the name, giving it the .dylib file extension.

  8. Save the makefile.

After you create your makefile, use it to build your adaptor, as in the following example:

make -f my_makefile
Was this topic helpful?