.. meta::
  :description: ROCm CMake
  :keywords: ROCm, Cmake, library, api, AMD

.. _rocmcreatepackage:

****************************************************
ROCMCreatePackage
****************************************************

Commands
--------

.. cmake:command:: rocm_create_package

.. code-block:: cmake

    rocm_create_package(
        NAME <name>
        [DESCRIPTION <description>]
        [SECTION <section>]
        [MAINTAINER <maintainer>]
        [LDCONFIG_DIR <lib-directory>]
        [PREFIX <path>]
        [LDCONFIG]
        [HEADER_ONLY]
    )

Sets up CPack packaging, including installing the license file to the correct location and component.
If the license file is not specified, also attempts to locate a LICENSE, LICENSE.md, or LICENSE.txt file in `CMAKE_SOURCE_DIR`.

If the CPACK_GENERATOR has not been specified then if ROCM_PKGTYPE is set
then use that to set it, otherwise probe the system to see what
programs are available.

.. cmake:command:: rocm_package_add_rpm_dependencies

.. code-block:: cmake

    rocm_package_add_rpm_dependencies(
        [QUIET]
        [COMPONENT <component>]
        [DEPENDS <dependencies>...]
        [SHARED_DEPENDS <dependencies>...]
        [STATIC_DEPENDS <dependencies>...]
    )

Sets up the RPM package for a component to depend on some other packages, possibly versioned.
The dependencies should be listed in RPM format (e.g. `foo > 0.3` or `bar = 1.0`). Will warn if the package has already been created, unless QUIET is specified.

.. cmake:command:: rocm_package_add_deb_dependencies

.. code-block:: cmake

    rocm_package_add_deb_dependencies(
        [QUIET]
        [COMPONENT <component>]
        [DEPENDS <dependencies>...]
        [SHARED_DEPENDS <dependencies>...]
        [STATIC_DEPENDS <dependencies>...]
    )

Sets up the deb package for a component to depend on some other packages, possibly versioned.
The dependencies may be listed in RPM format (e.g. `foo > 0.3` or `bar = 1.0`), and will automatically be converted to the DEB formatting. Will warn if the package has already been created, unless QUIET is specified.

.. cmake:command:: rocm_package_add_dependencies

.. code-block:: cmake

    rocm_package_add_dependencies(
        [QUIET]
        [COMPONENT <component>]
        [DEPENDS <dependencies>...]
        [SHARED_DEPENDS <dependencies>...]
        [STATIC_DEPENDS <dependencies>...]
    )

A convenience function wrapping both ``rocm_package_add_rpm_dependencies`` and ``rocm_package_add_deb_dependencies``.
The dependencies must be listed in RPM format (e.g. ``foo > 0.3`` or ``bar = 1.0``), and will automatically be converted to the DEB formatting. Will warn if the package has already been created, unless QUIET is specified.

.. cmake:command:: rocm_package_setup_component

.. code-block:: cmake

    rocm_package_setup_component(
        <component-name>
        [PACKAGE_NAME <package-name>]
        [LIBRARY_NAME <library-name>]
        [PARENT <parent>]
        [DEPENDS
            [COMMON <common-dependencies>...]
            [RPM <rpm-dependencies>...]
            [DEB <deb-dependencies>...]
            [COMPONENT <component-dependencies>...]
        ]
    )

Set up a component for packaging. Sets the package name, and adds dependencies as appropriate.
Component dependencies are where the package generated by component A depends on the package generated by component B. In order to ensure that these dependencies correctly use the generated package names, these dependencies are not fully added until the packages are generated.

