function ret = addSysLibs(h,varargin)
% ADDSYSLIBS The addSysLibs function adds specified system libs to
% the model's build information. Simulink Coder stores the system libs in
% a vector. The function adds the names to the end of the vector in the
% order that you specify them.
%    
% Argument    description
% buildinfo   Build information handle returned by RTW.Buildinfo.
%
% filenames   A character array or cell array of character arrays that
%             specifies names of syslibs to be added to the build
%             information. The function adds the names to the end of a
%             vector in the order that you specify them.
%             The function removes duplicate entries that
%               - Already exist in the source file vector
%               - Have a path that matches the path of a matching filename
%             A duplicate entry consists of an exact match of a path string and
%             corresponding filename.
%
% paths       (optional) A character array or cell array of character arrays
%             that specifies paths to the syslib. The function adds the
%             paths to the end of a vector in the order that you specify
%             them. If you specify a single path as a character array, the
%             function uses that path for all files.
%
% groups      (optional) A character array or cell array of character arrays
%             that groups specified source files
%
% example 1:
%   myModelBuildInfo = RTW.BuildInfo;
%   addSysLibs(myModelBuildInfo, 'mwutil', '', 'Drivers');
%
% example 1:
%   myModelBuildInfo = RTW.BuildInfo;
%   addSysyLibs(myModelBuildInfo,..
%                  {'mwutil' 'ut'},... 
%                  {'matlab/bin/win64' 'matlab/bin/win64'});
%
% Please refer to the documentation for more information.
%

% Copyright 2012-2019 The MathWorks, Inc.

    [ret, paths] = h.addFiles('syslib', varargin{:});
    
    if ~isempty(ret)
        h.addPaths('syslib',paths,'Automatic');
    end
end
