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.
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
Adaptor kit header files
Image Acquisition Toolbox™ engine library
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.
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
MATLAB_ROOTis your MATLAB® installation folder.
Open your copy of the makefile in any text editor.
Specify the folder where you want to create your adaptor by setting the value of the
ADAPTOR_DIRvariable. 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
Specify the location of your MATLAB installation folder by setting the value of the
MATLAB_ROOTvariable. You can specify a relative path or an absolute path.
Specify any libraries required by your hardware device's SDK by setting the value of the
LIBSvariable. 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.
Specify any include file folders required by your hardware device's SDK by setting the value of the
INCLUDE_DIRSvariable. The demo adaptor makefile already specifies the include folders required by the adaptor kit.
Specify the name you want to give your adaptor by setting the value of the
RESULTvariable. 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:
Platform Line Number Change Linux 69 Specify the name, giving it the
Macintosh 90 Specify the name, giving it the
Save the makefile.
After you create your makefile, use it to build your adaptor, as in the following example:
make -f my_makefile