Setting up Your Development Environment
This section describes the XSI libraries you should link to for successful compilation.
• Windows
• Linux
Refer to the Programming mental ray guide (available on the XSI Documentation CD) for additional information about compiling shaders for various platforms.
You should start Visual Studio .NET from an XSI command prompt. This ensures that the XSI environment variables (such as XSISDK_ROOT) are inherited by Visual Studio .NET.
The Visual C++ projects (.vcproj) generated by the shader wizard use the XSISDK_ROOT environment variable to specify the locations of include files and libraries.
Project Configuration Properties
If you do not use the shader wizard to generate your Visual C++ project, then you’ll need to set the following project configuration properties.
|
Property |
Values |
|
C/C++ > General > Additional Include Directories |
$(XSISDK_ROOT)\include\ |
|
C/C++ > Code Generation > Runtime Library |
Multi-threaded DLL (/MDd) |
|
Linker > General > Additional Library Directories |
$(XSISDK_ROOT)\lib\nt-x86 $(XSISDK_ROOT)\lib\nt-x86-64 |
|
Linker > Input > Additional Dependencies |
• shader.lib |
To make the location of the include and library directories available in all projects, you can add these directories to the global VC++ Directories.
In Visual Studio .NET, click Tools > Options, expand Projects, and click VC++ Directories. In the Show directories for list, click Include files and add the $(XSISDK_ROOT)\include folder. Then, in the Show directories for list, click Library files and add the location of shader.lib.
The shader wizard generates a makefile for you:
#!/usr/bin/make # Makefile Generated by XSI Shader Wizard SRCS := MyTestShader.cpp RESULT := MyTestShader.so LIBS := -lm OBJDIR := obj OBJS := $(patsubst %.cpp,$(OBJDIR)/%.o,$(filter %.cpp,$(SRCS))) CXXFLAGS := -I $(XSISDK_ROOT)/include ifdef DEBUG CXXFLAGS += -g endif all: $(RESULT) install: $(RESULT) $(OBJDIR)/%.o: %.cpp @if [ ! -d "$(OBJDIR)" ]; then mkdir -p "$(OBJDIR)"; fi $(CXX) -c $(CXXFLAGS) $< -o $@ $(RESULT): $(OBJS) $(CXX) $(CXXFLAGS) -shared -o $@ $(OBJS) $(LIBS) clean: rm -rf $(OBJDIR) rm $(RESULT)
SOFTIMAGE|XSI v6.01