我如何为已编译的 MATLAB 创建一个安装程序,要求用户接受我们的许可条款?

How can I create an installer for compiled MATLAB which requests that a user accept our licence terms?

我正在用 MATLAB 编写程序分发给 Windows 用户。我正在使用带有 MATLAB 版本 r2014a 的 MATLAB 编译器来创建程序。我可以使用 MATLAB 应用程序编译器创建一个 Windows 安装程序,它可以正常工作。

但是,我希望安装程序要求我的用户在安装软件之前查看并接受许可协议。 MATLAB 安装程序不提供这种可能性。

任何人都可以建议另一种方法来打包我编译的 MATLAB 应用程序吗?我会接受一个二级安装程序,其中第一个安装程序提供许可条款,然后解压缩 MATLAB 安装程序,在第二个安装阶段需要 运行。单相解决方案显然会更好。

您可以使用 inno setup (a free installer for windows) and inno script studio(用于编辑安装程序脚本的第三方界面)。

Inno setup 还允许用 pascal 语言编写自定义代码,因此您甚至可以在开始安装之前检查目标机器上是否安装了 matlab runtime:

[Code]
function IsMCR90Installed : Boolean;
begin
    Result := RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\MathWorks\MATLAB Runtime.0');
end;

function InitializeSetup(): Boolean;
begin
    Result := true;

    if (not IsMCR90Installed) then
    begin
        MsgBox('This setup requires the Matlab Component runtime v9.0.'#13'Please install the Matlab Component Runtime and run this setup again.', mbError, MB_OK) ;
        Result:=false;
        Exit;
    end;
end;

注意:对于单阶段安装,您只能使用 inno setup 部署由 matlab 编译器创建的可执行文件。

编辑

要使用 inno setup 添加许可证页面,只需在安装程序脚本的 [Setup] 部分中设置指向许可证文本的指针。有关详细信息,请参阅 http://www.jrsoftware.org/ishelp/index.php?topic=setup_licensefile

如果要显示每种语言的自定义文本,另请参阅 。