%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TwinCAT Target for MATLAB/Simulink
% Example "SFunWrappedStaticLib"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beckhoff Automation GmbH
% 25.10.2024
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% add subfolder to MATLAB path
addpath('BuildScripts');

% build static link libraries for counfigured platforms
disp('Build libraries for counfigured platforms...');
libdir = [fileparts(which(mfilename)) '\Libraries\'];
% provide lib path, dir and modelname
BuildLibProject('LibProject\TctSample_WrappedStaticLib',libdir,'TctSmplSFunWrappedStaticLib');

% build S-Function using the static link library
disp(['Build ' mexext ' S-Function...']);
BuildSFunctionWithTctLibDependencies('TctSample_SFunLibWrapper.cpp','TctSample_WrappedStaticLib',libdir);

% finish
disp('Completed');