packNGo
Package generated code in ZIP file for relocation
Description
packNGo(
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
optional.buildInfo
,Name,Value
)
The ZIP file can include these types of files:
Source files (for example,
.c
,.cu
, and.cpp
files)Header files (for example,
.h
,.cuh
, and.hpp
files)MAT-file that contains the build information object (
.mat
file)Nonbuild-related files (for example,
.dll
files and.txt
informational files) required for a final executableBuild-generated binary files (for example, executable
.exe
file or dynamic link library.dll
).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.
CMake configuration files (
CMakeLists.txt
) that you use to generate makefiles or projects for a compiler environment.
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 and 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.
The 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, packNGo
adds them to the build information.
To ensure that packNGo
finds
header files, add their paths to buildInfo
by using the
addIncludePaths
function.
Note
When generating standalone code by using the codegen
command, you can use the -package
option to
both generate code and package the code in a ZIP file in a single step.
Examples
Input Arguments
Limitations
The function operates on source files only, such as
*.c
,*.cpp
,cuh
, and*.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.
Version History
Introduced in R2006b