As of MATLAB R2024b, the "compiler.package.installer" function does not accept multiple "compiler.build.Results" objects. To work around this, the specific files of the deployable components can be used with the "compiler.package.installer" function to package all the deployable components into one installer.
For the following example, a standalone application and two C++ shared libraries (DLLs) will be packaged into one installer.
- Using the "compiler.build.standaloneApplication" function, build a deployable standalone application and return a "compiler.build.Results" object named "buildResults".
>> buildResults = compiler.build.standaloneApplication(myAppFile);
- Using the appropriate "compiler.build" functions, build the other deployable software components.
>> compiler.build.cppSharedLibrary(myAppFile2, 'Interface', 'mwarray');
>> compiler.build.cppSharedLibrary(myAppFile3, 'Interface', 'mwarray');
- Open the multiple "requiredMCRProducts.txt" files generated from running the functions in the prior steps and merge their contents into one "requiredMCRProducts.txt" file.
- Create a string array variable named "fileList" that contains the file names of the deployable components to include in the installer.
>> fileList = [buildResults.Files; {'foo.dll'; 'bar.dll'}];
- Using the merged "requiredMCRProducts.txt" file from step 3 and the "fileList" variable from step 4, create an installer using the "compiler.package.installer" function. Refer to the MATLAB Compiler documentation for more information on creating an installer using files.
>> compiler.package.installer(fileList, 'requiredMCRProducts.txt', 'ApplicationName', 'MyApp');
Note that in this example, the workaround will install the standalone application but not the other deployable software components on the target machine. The other components will just be located in the same directory as the standalone application executable.