sof/scripts/cmake/dist.cmake

20 lines
859 B
CMake

# depends on version.cmake
# Adds dist target
set(TARBALL_PATH_TMP "${PROJECT_BINARY_DIR}/sof-${GIT_TAG}.tar")
set(TARBALL_PATH "${PROJECT_BINARY_DIR}/sof-${GIT_TAG}.tgz")
set(TARBALL_VERSION_BINARY_PATH "${PROJECT_BINARY_DIR}/${TARBALL_VERSION_FILE_NAME}")
add_custom_target(dist
COMMAND git archive -o "${TARBALL_PATH_TMP}" HEAD
COMMAND ${CMAKE_COMMAND} -E echo "${GIT_TAG}" > "${TARBALL_VERSION_BINARY_PATH}"
COMMAND ${CMAKE_COMMAND} -E echo "${GIT_LOG_HASH}" >> "${TARBALL_VERSION_BINARY_PATH}"
COMMAND tar rf "${TARBALL_PATH_TMP}" -C "${PROJECT_BINARY_DIR}" "${TARBALL_VERSION_FILE_NAME}"
COMMAND gzip -9 < "${TARBALL_PATH_TMP}" > "${TARBALL_PATH}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMENT "Creating tarball: ${TARBALL_PATH}"
BYPRODUCTS "$TARBALL_VERSION_BINARY_PATH" "${TARBALL_PATH_TMP}" "${TARBALL_PATH}"
VERBATIM
USES_TERMINAL
)