本文档翻译自:https://docs.conan.io/en/latest/reference/commands/development/package.html

    1. $ conan package [-h] [-bf BUILD_FOLDER] [-if INSTALL_FOLDER]
    2. [-pf PACKAGE_FOLDER] [-sf SOURCE_FOLDER]
    3. path

    调用您本地的conanfile.py的 “package()” 方法。
    此命令在用户空间中起作用,它将把工件从–build-folder和–source-folder文件夹复制到–package-folder文件夹。 它不会在本地缓存中创建新程序包,如果要执行此操作,请在”conan build”命令后使用 “conan create” 或 “conan export-pkg”。

    1. positional arguments:
    2. path Path to a folder containing a conanfile.py or to a
    3. recipe file e.g., my_folder/conanfile.py
    4. optional arguments:
    5. -h, --help show this help message and exit
    6. -bf BUILD_FOLDER, --build-folder BUILD_FOLDER
    7. Directory for the build process. Defaulted to the
    8. current directory. A relative path to the current
    9. directory can also be specified
    10. -if INSTALL_FOLDER, --install-folder INSTALL_FOLDER
    11. Directory containing the conaninfo.txt and
    12. conanbuildinfo.txt files (from previous 'conan
    13. install'). Defaulted to --build-folder
    14. -pf PACKAGE_FOLDER, --package-folder PACKAGE_FOLDER
    15. folder to install the package. Defaulted to the
    16. '{build_folder}/package' folder. A relative path can
    17. be specified (relative to the current directory). Also
    18. an absolute path is allowed.
    19. -sf SOURCE_FOLDER, --source-folder SOURCE_FOLDER
    20. Directory containing the sources. Defaulted to the
    21. conanfile's directory. A relative path to the current
    22. directory can also be specified

    package() 方法可能使用来自指定配置文件的设置,选项和环境变量,以及来自conanfile要求中已声明的deps_XXX_info对象的依赖项信息。
    运行conan install时,所有这些信息分别自动保存在conaninfo.txt和conanbuildinfo.txt文件中。 这些文件必须位于指定的—build-folder中。

    1. $ conan install . --build-folder=build

    Examples
    本示例说明 package() 如何在可编辑并内置于用户文件夹而不是本地缓存中的包中工作。

    1. $ conan new hello/0.1 -s
    2. $ conan install . --install-folder=build_x86 -s arch=x86
    3. $ conan build . --build-folder=build_x86
    4. $ conan package . --build-folder=build_x86 --package-folder=package_x86
    5. $ ls package/x86
    6. > conaninfo.txt conanmanifest.txt include/ lib/

    :::info Note
    本地创建的软件包仅供用户使用,不能被其他软件包直接使用,也不能上载到远程存储库。 为了使这些软件包对系统可用,必须将它们放入conan本地缓存中,这可以使用conan export-pkg命令来完成,而不是使用conan package命令:
    ::: :::info

    1. $ conan new hello/0.1 -s
    2. $ conan install . --install-folder=build_x86 -s arch=x86
    3. $ conan build . --build-folder=build_x86
    4. $ conan export-pkg . hello/0.1@user/stable --build-folder=build_x86 -s arch=x86

    :::