Package generated code in zip file for relocation
packages the code files in a compressed zip file so that you can relocate, unpack, and
rebuild them in another development environment. The list of name-value pairs is
The types of code files in the zip file include:
Source files (for example,
Header files (for example,
MAT-file that contains the build information object (
Nonbuild-related files (for example,
.dll files and
.txt informational files) required for a final executable
Build-generated binary files (for example, executable
or dynamic link library
The code generator includes the build-generated binary files (if present) in the zip file. The ignoreFileMissing property does not apply to build-generated binary files.
Use this function to relocate files. You can then recompile the files for a specific target environment or rebuild them in a development environment in which MATLAB® is not installed. By default, the function packages the files as a flat folder structure in a zip file within the code generation folder. You can customize the output by specifying name-value pairs. After relocating the zip file, use a standard zip utility to unpack the compressed file.
Because the code generated by using GPU Coder™ relies on third-party compilers, libraries to build and run the executables, the development environment that you are relocating to must also satisfy these requirements. For more information, see Installing Prerequisite Products and Setting Up the Prerequisite Products.
packNGo function can potentially modify the build information
passed in the first
packNGo argument. As part of code packaging,
packNGo can find additional files from source and include paths
recorded in the build information. When these files are found,
adds them to the build information.
After the build process is complete, you can run packNGo from the
Command Window. Use
packNGo for zip file packaging of generated code in
portzingbit.zip. Maintain the relative file hierarchy.
Change folders to the code generation folder. For example, using MATLAB
codegen/dll/zingbit, or for Simulink® code generation,
buildInfo object that describes the build.
packNGo with property settings for
cd codegen/dll/zingbit; load buildInfo.mat packNGo(buildInfo,'packType', 'hierarchical', ... 'fileName','portzingbit');
If you configure zip file packaging from the code generation pane,
the code generator uses
packNGo to output a zip file during the build
Select Code Generation > Package code and artifacts. Optionally, provide a Zip file name. To apply the changes, click OK.
Build the model. At the end of the build process, the code generator outputs the zip file. The folder structure in the zip file is hierarchical.
If you configure zip file packaging with
set_param, the code generator uses
packNGo to output
a zip file during the build process.
set_param to configure zip file packaging for model
zingbit in the file
set_param('zingbit','PostCodeGenCommand', ... 'packNGo(buildInfo);');
buildInfo— Object that provides build information
During the build process, the code generator places
in the code generation folder. This MAT-file contains the
object. The object provides information that
packNGo uses to produce
the zip file.
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
'packType'— Determines whether the primary zip file contains secondary zip files or folders
'flat', package the generated code files in a zip file as a
single, flat folder.
'hierarchical', package the generated code files
hierarchically in a primary zip file. The hierarchy contains top model, referenced
model, and shared utility folders. The function also packages the corresponding
buildInfo.mat files for the folders.
'nestedZipFiles'— Determines whether the paths for files in the secondary zip files are relative to the root folder of the primary zip file
true(default) | false
true, create a primary zip file that contains three
secondary zip files:
mlrFiles.zip — Files in your
matlabroot folder tree
sDirFiles.zip — Files in and under your code
otherFiles.zip — Required files not in the
false, create a primary zip file that contains folders, for
example, your code generation folder and
'fileName'— Specifies a file name for the primary zip file
If you do not specify the
'fileName'-value pair, the function
packages the files in a zip file named
the zip file in the code generation folder.
If you specify
'fileName' with the value,
', the function creates
in the code generation
To specify another location for the primary zip file, provide the absolute path to
'minimalHeaders'— Selects whether to include only the minimal header files
true, include only the minimal header files required to
build the code in the zip file.
false, include header files found on the include path in the
GPU Coder requires that the
'minimalHeaders' option is set to
'includeReport'— Selects whether to include the
htmlfolder for your code generation report
false, do not include the
html folder in
the zip file.
true, include the
html folder in the zip
'ignoreParseError'— Instruct packNGo not to terminate on parse errors
false, terminate on parse errors.
true, do not terminate on parse errors.
'ignoreFileMissing'— Instruct packNGo not to terminate if files are missing
false, terminate on missing file errors.
true, do not terminate on missing files errors.
The function operates on source files only, such as
*.h files. The function does not
support compile flags, defines, or makefiles.
The function does not package source files for reusable library subsystems.
Unnecessary files might be included. The function might find additional files from source paths and include paths recorded in the build information, even if those files are not used.
For GPU Coder, the function does not package example main source and header files that you generate with the default configuration settings. To package the example main files, configure code generation to generate and compile the example main function, generate your code, and then package the build files.