function rtwTargetInfo(tr)
%RTWTARGETINFO Target info callback

% Copyright 2012-2023 The MathWorks, Inc.

if ~coder.make.internal.featureOn('TargetFrameworkToolchainUpgrade')
    tr.registerTargetInfo(@loc_createToolchain);
end
end

% -------------------------------------------------------------------------
% Create the ToolchainInfoRegistry entries
% -------------------------------------------------------------------------
function config = loc_createToolchain

config = coder.make.ToolchainInfoRegistry; % initialize
toolsDir = fullfile(matlabroot, 'toolbox', 'coder', 'compile', 'tools');

% -----------------------------------
% MSVC Toolchains
% -----------------------------------

if strcmpi(computer('arch'), 'win64')
    
    config(end+1)                   = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'Microsoft Visual C++ 2022 v17.0 | nmake (64-bit Windows)';
    config(end).Alias               = 'Microsoft-17.0';
    config(end).FileName            = fullfile(toolsDir, 'ms_vc_nmake_win64_v17.0.mat');
    config(end).TargetHWDeviceType  = {'*'};
    config(end).Platform            = {'win64'};

    %-----------
    config(end+1)                   = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'Microsoft Visual C++ 2019 v16.0 | nmake (64-bit Windows)';
    config(end).Alias               = 'Microsoft-16.0';
    config(end).FileName            = fullfile(toolsDir, 'ms_vc_nmake_win64_v16.0.mat');
    config(end).TargetHWDeviceType	= {'*'};
    config(end).Platform            = {'win64'};
    
    %-----------
    config(end+1)                   = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'Microsoft Visual C++ 2017 v15.0 | nmake (64-bit Windows)';
    config(end).Alias               = 'Microsoft-15.0';
    config(end).FileName            = fullfile(toolsDir, 'ms_vc_nmake_win64_v15.0.mat');
    config(end).TargetHWDeviceType  = {'*'};
    config(end).Platform            = {'win64'};
   
end

% -----------------------------------
% GNU Toolchains
% -----------------------------------

if strcmpi(computer('arch'), 'glnxa64')
    
    config(1)                       = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'GNU gcc/g++ | gmake (64-bit Linux)';
    config(end).Alias               = {'GNU-x', 'GNU gcc/g++ v4.4.x | gmake (64-bit Linux)'}; 
    config(end).FileName            = fullfile(toolsDir, 'gnu_gcc_gmake_glnxa64.mat');
    config(end).TargetHWDeviceType	= {'*'};
    config(end).Platform            = {'glnxa64'};
    
elseif strcmpi(computer('arch'), 'maci64')
    
    config(1)                       = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'Xcode with Clang | gmake (64-bit Mac)';
    config(end).Alias               = {'Apple-x', 'Clang v3.1 | gmake (64-bit Mac)'};
    config(end).FileName            = fullfile(toolsDir, 'clang_tools_gmake_maci64.mat');
    config(end).TargetHWDeviceType  = {'*'};
    config(end).Platform            = {'maci64'};

elseif strcmpi(computer('arch'), 'maca64')

    config(1)                       = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'Xcode with Clang | gmake (64-bit Mac)';
    config(end).Alias               = {'Apple-x', 'Clang v3.1 | gmake (64-bit Mac)'};
    config(end).FileName            = fullfile(toolsDir, 'clang_tools_gmake_maca64.mat');
    config(end).TargetHWDeviceType  = {'*'};
    config(end).Platform            = {'maca64'};
    
end

% -----------------------------------
% Other PC Toolchains (LCC, MinGW64)
% -----------------------------------
    
if strcmpi(computer('arch'), 'win64')
    
    config(end+1)                   = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'LCC-win64 v2.4.1 | gmake (64-bit Windows)';
    config(end).Alias               = 'LCC-x';
    config(end).FileName            = fullfile(toolsDir, 'lcc64_tools_gmake_win64_v2.4.1.mat');
    config(end).TargetHWDeviceType  = {'*'};
    config(end).Platform            = {'win64'};
    
    %-----------    
    config(end+1)                   = coder.make.ToolchainInfoRegistry;
    config(end).Name                = 'MinGW64 | gmake (64-bit Windows)';
    config(end).Alias               = {'GNU-x', 'MinGW64 v4.x | gmake (64-bit Windows)'};
    config(end).FileName            = fullfile(toolsDir, 'gnu_gcc_gmake_win64.mat');
    config(end).TargetHWDeviceType  = {'*'};
    config(end).Platform            = {'win64'};
end

% -----------------------------------
% Intel C/C++ Toolchains
% -----------------------------------
    
if strcmpi(computer('arch'), 'win64')       
    
    % Intel 20
    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel Parallel Studio XE 2020 (w/Microsoft Visual Studio 2017) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC20MSVS2017';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v20_2017.mat');
    config(end).TargetHWDeviceType  = {'*'};
    
    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel Parallel Studio XE 2020 (w/Microsoft Visual Studio 2019) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC20MSVS2019';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v20_2019.mat');
    config(end).TargetHWDeviceType  = {'*'};

    % Intel 21
    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel oneAPI 2021 (w/Microsoft Visual Studio 2017) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC21MSVS2017';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v21_2017.mat');
    config(end).TargetHWDeviceType  = {'*'};
    
    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel oneAPI 2021 (w/Microsoft Visual Studio 2019) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC21MSVS2019';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v21_2019.mat');
    config(end).TargetHWDeviceType  = {'*'};    

    % Intel 22
    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel oneAPI 2022 (w/Microsoft Visual Studio 2017) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC22MSVS2017';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v22_2017.mat');
    config(end).TargetHWDeviceType  = {'*'};
    
    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel oneAPI 2022 (w/Microsoft Visual Studio 2019) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC22MSVS2019';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v22_2019.mat');
    config(end).TargetHWDeviceType  = {'*'};    

    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel oneAPI 2022 (w/Microsoft Visual Studio 2022) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC22MSVS2022';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v22_2022.mat');
    config(end).TargetHWDeviceType  = {'*'};

    % Intel 23
    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel oneAPI 2023 (w/Microsoft Visual Studio 2019) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC23MSVS2019';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v23_2019.mat');
    config(end).TargetHWDeviceType  = {'*'};    

    config(end+1) = coder.make.ToolchainInfoRegistry;
    config(end).Name = 'Intel oneAPI 2023 (w/Microsoft Visual Studio 2022) | nmake (64-bit Windows)';                                 
    config(end).Alias = 'INTELC23MSVS2022';
    config(end).FileName = fullfile(toolsDir, 'intel_tc_nmake_win64_v23_2022.mat');
    config(end).TargetHWDeviceType  = {'*'};
       
end

% -------------------------------------------------------------------------
% ADDING A NEW ENTRY:
% 1. Copy the commented block of code below
% 2. Paste it at the bottom of the list above
% 3. Uncomment it
% 4. Fill out the required information
% -------------------------------------------------------------------------
% config(end+1)                   = coder.make.ToolchainInfoRegistry;
% config(end).Name                = <put the 'Name' property of the toolchain here>;
% config(end).FileName            = <insert the MAT file here with complete path>;
% config(end).TargetHWDeviceType  = {'*'};
% -------------------------------------------------------------------------
end

% LocalWords:  Toolchains
