MainWin (Linux) Environment

If you want to compile plug-ins or shaders on Linux, you need to install gcc (version >= 2.95.2) with the appropriate support for C++ (see the Linux RedHat documentation) and Visual MainWin (Version 4.0.2).

MainWin allows you to create plug-ins or shaders that are compatible with Microsoft Visual Studio or port over existing code without making changes to it. All you need to change are the project settings. MainWin provides a tool to port the .dsp (Visual Studio project file) to Linux makefiles.

| See http://www.mainsoft.com for more information on getting MainWin for your development environment.

Once you have installed MainWin, you can use it to:

• Generate the make file.

• Include the header files.

• Compile the project.

MainWin allows you to use Microsoft Foundation Classes (MFC), Component Object Model (COM) and Active Template Library (ATL) on Linux.

| A ‘lite MainWin’ is installed when you install the XSI SDK package as part of the SDK Developer’s program. On Linux this also includes the compiler 2.95.2 (for XSI versions 2.0.3 and Orleans) and the license you need for compiling on Linux using Visual MainWin.

To set up your environment for Linux using ATL

1. At the prompt in your project directory, type:

       mwgenmake

This command finds all C and C++ files in this directory and incorporates them into the makefile it generates. Then it looks for a module definition file (.def) for the module name type (either .exe or .dll), and checks to see if the module is an MFC ActiveX control (.ocx).

2. Select the options you want, make sure the file names appear in lowercase, backup original files and click Next.

3. Select the module name in the edit box at the top of the dialog box.

4. Click the Dynamic Link Library radio button.

5. Click the checkboxes on the right side of the dialog box to add support for MFC and ATL.

6. Make sure the MFC DLL type is a regular DLL and not an Extension DLL and click Next.

7. Select the editor you want to use to edit the makefile.

| Make sure you select an editor you are comfortable with because you will have to edit the makefile.

8. Open the editor and add the following line just before the SOURCES entry:

           APP_CFLAGS :=  -I ../../../include

This tells the compiler where to look for the Softimage include files.

9. Add a # character at the beginning of the line to comment out the include $(DEPEND_FILE).

10. Close the editor.

11. From the command prompt, type the following to build and register the library:

       mwmake

To set up your environment for Linux using COM Compiler Support

1. Use the #import directive on Windows to generate the stub classes in the .tli and .tlh files.

2. Add the following to include these files in place of the .tlb file:

       #ifdef WIN32
       #import <siobjectmodel.tlb>
       #import <si3dobjectmodel.tlb>
       #import <simath.tlb>
       #else                 // We want these on Linux too.
       #include <siobjectmodel.tlh>
       #include <si3dobjectmodel.tlh>
       #include <simath.tlh>
       #endif

3. In the shell (tcsh), issue the following commands:

       source %path_to_xsi%/.xsi_2.0
       setenv XSISDK_ROOT %path_to_xsi%/XSISDK
       mwmake

| You can avoid this issue by not using the COM Compiler Support and writing straight COM code. For example, you use CComPtr<XSIApplication> instead of XSIApplicationPtr, and _bstr_t ; hr = obj->get_Name( &name ); instead of _bstr_t name = obj->Name; or obj->GetName( &name );

To clean the build

    mwmake clean