Compiling and Building Plug-Ins

This document will describe how to compile your plug-ins once you have written code so that they can be loaded and executed inside Opticks.

It is recommended that you first read Supported Compilers and Platforms if you haven't already to ensure you are using a supported platform and compiler. This document is broken into two sections. The first section, Compiling Basic Plug-Ins For Any Platform, Compiler, or Build Tool, describes the bare essentials needed to build plug-ins. The second section, Compiling Advanced Plug-Ins For Any Platform, Compiler, or Build Tool, expands on the first section by explaining the additional parts of the SDK that are needed when building more advanced plugins. Please note that you might want to take a look at our Visual Studio 2010 property sheets or the SCons configurations when setting up your plug-in build environment. Both are included in the SDK and are used to provide the build environment for the tutorial and sample plug-ins.

This document assumes that the SDK was unzipped to a location known as SDK_HOME. Wherever you see the word SDK_HOME, please expand that to be the directory where you unzipped this SDK.

NOTE: The SDK is split into separate files for each platform (Windows and Solaris), so even though this document is present in all versions of the SDK regardless of platform, you will need to have downloaded the SDK specific to your platform before proceeding with any of the recommendations in this document.

Supported Compilers and Platforms

The following platform and compiler combinations are supported when building Opticks plug-ins.
Operating SystemProcessorCompiler
Windows XP 32-bitx86Visual Studio 2010 (any edition)
Windows XP 64-bitx86Visual Studio 2010 (any edition)
Solaris 10SPARC v9Sun Studio 12

Compiling Basic Plug-Ins For Any Platform, Compiler, or Build Tool

In order to compile even the most basic of plug-ins, the following needs to have been done:
  1. Add the following SDK directories to the INCLUDE and LIB directories of your compiler as indicated in the table below. Add the listed SDK libraries in the table below to your link line when creating the .dll or .so for your plug-in.
    PlatformConfigurationArchitectureC++ Compiler/Linker SettingFull Path
    WindowsDebug32-bitINCLUDE directory
    • SDK_HOME\application\Interfaces
    • SDK_HOME\application\PlugInLib
    • SDK_HOME\application\PlugInUtilities\Interfaces
    • SDK_HOME\application\PlugInUtilities\pthreads-wrapper
    LIB directory
    • SDK_HOME\Build-Binaries-win32-debug\Lib\
    Libraries
    • PlugInLib.lib
    • PlugInUtilities.lib
    WindowsDebug64-bitINCLUDE directory
    • SDK_HOME\application\Interfaces
    • SDK_HOME\application\PlugInLib
    • SDK_HOME\application\PlugInUtilities\Interfaces
    • SDK_HOME\application\PlugInUtilities\pthreads-wrapper
    LIB directory
    • SDK_HOME\Build-Binaries-x64-debug\Lib\
    Libraries
    • PlugInLib.lib
    • PlugInUtilities.lib
    WindowsRelease32-bitINCLUDE directory
    • SDK_HOME\application\Interfaces
    • SDK_HOME\application\PlugInLib
    • SDK_HOME\application\PlugInUtilities\Interfaces
    • SDK_HOME\application\PlugInUtilities\pthreads-wrapper
    LIB directory
    • SDK_HOME\Build-Binaries-win32-release\Lib\
    Libraries
    • PlugInLib.lib
    • PlugInUtilities.lib
    WindowsRelease64-bitINCLUDE directory
    • SDK_HOME\application\Interfaces
    • SDK_HOME\application\PlugInLib
    • SDK_HOME\application\PlugInUtilities\Interfaces
    • SDK_HOME\application\PlugInUtilities\pthreads-wrapper
    LIB directory
    • SDK_HOME\Build-Binaries-x64-release\Lib\
    Libraries
    • PlugInLib.lib
    • PlugInUtilities.lib
    SolarisDebug64-bitINCLUDE directory
    • SDK_HOME/application/Interfaces
    • SDK_HOME/application/PlugInLib
    • SDK_HOME/application/PlugInUtilities/Interfaces
    • SDK_HOME/application/PlugInUtilities/pthreads-wrapper
    LIB directory
    • SDK_HOME/Build-Binaries-solaris-sparc-debug/Lib/
    Libraries
    • libPlugInLib.a
    • libPlugInUtilities.a
    SolarisRelease64-bitINCLUDE directory
    • SDK_HOME/application/Interfaces
    • SDK_HOME/application/PlugInLib
    • SDK_HOME/application/PlugInUtilities/Interfaces
    • SDK_HOME/application/PlugInUtilities/pthreads-wrapper
    LIB directory
    • SDK_HOME/Build-Binaries-solaris-sparc-release/Lib/
    Libraries
    • libPlugInLib.a
    • libPlugInUtilities.a
  2. When compiling on Windows using Visual Studio 2010, you also need to do the following:
    • You must use the same C++ runtime library that is used by Opticks when building your plug-in. See the following table for more information.
      ConfigurationRun-time LibraryIgnore Specific Libraries
      DebugMulti-threaded Debug DLL (i.e. the /MDd cmpiler flag)
      • libc.lib
      • libcmt.lib
      • msvcrt.lib
      • libcd.lib
      • libcmtd.lib
      (i.e. the /NODEFAULTLIB: linker flag)
      ReleaseMulti-threaded DLL (i.e. the /MD cmpiler flag)
      • libc.lib
      • libcmt.lib
      • libcd.lib
      • libcmtd.lib
      • msvcrtd.lib
      (i.e. the /NODEFAULTLIB: linker flag)
  3. When compiling on Solaris using Sun Studio 12, you also need to do the following:
    • You must use the STLPort library included with the compiler instead of the standard STL Library in order to properly interact with the plug-in API on Solaris. You must also build your plug-ins using the v9 architecture. See the table below for the recommended additional compiler and linker settings.
      Additional Compiler Args-library=stlport4 -m64 -xcode=pic32
      Additional Linker Args-library=stlport4 -m64 -xcode=pic32 -lnsl -ldl -lGLU -lGL -lXm -lXext -lX11 -lm
  4. Provided you are using one of the Supported Compilers and Platforms this is all you need to set to create basic plug-ins. However it is highly recommended that you read the next section, Compiling Advanced Plug-Ins For Any Platform, Compiler, or Build Tool, because it is very easy to create an "advanced plug-in" in Opticks without realizing it.

Compiling Advanced Plug-Ins For Any Platform, Compiler, or Build Tool

In general, the SDK is split into the following parts:

The Interfaces provide the majority of the API that plug-ins can use to interact with Opticks. The PlugInLib provides the scaffolding code that is linked into your binary that allows Opticks to recognize it as a plug-in. The PlugInLib also provides base classes, known as shells, that you can subclass when creating your own plug-ins. The PlugInUtilities provide a number of utility classes that simplify the use of the more advanced APIs made available in Interfaces. In addition, the PlugInUtilities are compiled directly into your plug-in as a static library. As seen above creating a basic plug-in only requires using these three parts of the SDK. See Compiling Basic Plug-Ins For Any Platform, Compiler, or Build Tool for details on the compiler and linker settings for using these three parts of the SDK.

The HdfPlugInLib is a very specialized utility library. This utility library simplifies the creation of importers that read from HDF4 or HDF5 formatted files. You can see http://hdf.ncsa.uiuc.edu/ for details on HDF4 or HDF5. If you are not writing an importer for HDF4 or HDF5 files, you will not need to use this part of the SDK.

The NitfPlugInLib is a very specialized utility library. This utility library allows a plug-in developer to build custom TRE parsers that will be used by Opticks when loading NITF (National Imagery Transmission Format) files. You can see http://en.wikipedia.org/wiki/National_Imagery_Transmission_Format for more details on NITF. If you have a NITF file that you would like to load into Opticks, but Opticks does not recognize the TRE, you can use the NitfPlugInLib to write a custom TRE parser that will load the data from the TRE into Opticks. If you don't need to write a custom TRE parser for a NITF file, you will not need to use this part of the SDK.

If you are using any of these more advanced parts of the SDK, see below for the compiler and linker settings.

When compiling more advanced plug-ins you may need to compile and link against certain third-party libraries. Using certain parts of our SDK requires compiling and linking against the following third-party libraries: Xerces, xqilla, Boost, pthreads, Qt, ehs, ossim, Hdf4, and Hdf5. We provide pre-built binaries of all necessary third-party libraries on the Opticks website at https://opticks.ballforge.net/. Please see Acquiring and using 3rd party libraries for more details on acquiring those dependencies and then compiling and linking against them.


Software Development Kit - Opticks 4.9.1 Build 16498