%% 
%  BaseClasses is from Direct X 9.0 SDK 2002
%  Mex code here based on GrabBitmaps.cpp in DirectShow samples
%


other_cpps = ' VidHeader.cpp read-frame.cpp showErrMsgBox.cpp bayer.cpp';
if ispc;
    include_dirs = '-I./zlib/zlib-1.2.5';
	defines = ' -DMSWIN -DMEX_COMPILE ';
	libraries = [' ./zlib/zlib-1.2.5/contrib/vstudio/vc10/x86/ZlibStatRelease/zlibstat.lib', ...
				 ' ./zlib/zlib-1.2.5/contrib/vstudio/vc10/x64/ZlibStatRelease/zlibstat.lib', ...
                 ' ./visual-studio/x64/Release/vid_aux.lib', ' ./visual-studio/Win32/Release/vid_aux.lib'];
else
    include_dirs = '-I./zlib/zlib-1.2.5';
	defines = ' -DMEX_COMPILE ';
	libraries = ' ./zlib/zlib-1.2.5/libz.a -lpthread vid_aux.lib';
end

mex_cpps = {'vidCropMex.cpp', 'vidOpenMex.cpp', 'vidReadMex.cpp', 'vidCloseMex.cpp', 'vidWriteMex.cpp'};

for i = 1:length(mex_cpps);
	mex_str = ['mex -O ', mex_cpps{i}, ' ', defines, include_dirs, other_cpps, libraries];
	eval(mex_str);
	fprintf( 'Compiling %s\n', mex_cpps{i} );
end
