CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
75 lines
2.4 KiB
CMake
75 lines
2.4 KiB
CMake
# Copyright © Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# This module provides a CMake function to copy external header files with nested
|
|
# headers inlined, using the copy_external_header.py script to recursively
|
|
# resolve #include directives.
|
|
|
|
# Find Python3 interpreter once at module scope
|
|
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
|
|
|
function(copy_external_header)
|
|
set(options "")
|
|
set(oneValueArgs TARGET SOURCE_HEADER ROOT_INCLUDE_DIR OUTPUT_PATH COMMENT)
|
|
set(multiValueArgs "")
|
|
|
|
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
# Validate required arguments
|
|
if(NOT ARG_TARGET)
|
|
message(FATAL_ERROR "copy_external_header: TARGET argument is required")
|
|
endif()
|
|
|
|
if(NOT ARG_SOURCE_HEADER)
|
|
message(FATAL_ERROR "copy_external_header: SOURCE_HEADER argument is required")
|
|
endif()
|
|
|
|
if(NOT ARG_ROOT_INCLUDE_DIR)
|
|
message(FATAL_ERROR "copy_external_header: ROOT_INCLUDE_DIR argument is required")
|
|
endif()
|
|
|
|
if(NOT ARG_OUTPUT_PATH)
|
|
message(FATAL_ERROR "copy_external_header: OUTPUT_PATH argument is required")
|
|
endif()
|
|
|
|
# Check if source header exists
|
|
if(NOT EXISTS ${ARG_SOURCE_HEADER})
|
|
message(FATAL_ERROR "copy_external_header: Source header not found: ${ARG_SOURCE_HEADER}")
|
|
endif()
|
|
|
|
# Check if root include directory exists
|
|
if(NOT EXISTS ${ARG_ROOT_INCLUDE_DIR})
|
|
message(FATAL_ERROR "miopen_inline_header: Root include directory not found: ${ARG_ROOT_INCLUDE_DIR}")
|
|
endif()
|
|
|
|
# Set default comment if not provided
|
|
if(NOT ARG_COMMENT)
|
|
get_filename_component(HEADER_NAME ${ARG_SOURCE_HEADER} NAME)
|
|
set(ARG_COMMENT "Inlining ${HEADER_NAME} with all dependencies as C++ source")
|
|
endif()
|
|
|
|
# Get the directory of the output path to create it if needed
|
|
get_filename_component(OUTPUT_DIR ${ARG_OUTPUT_PATH} DIRECTORY)
|
|
|
|
# Create custom command to inline the header
|
|
add_custom_command(
|
|
OUTPUT ${ARG_OUTPUT_PATH}
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUT_DIR}
|
|
COMMAND ${Python3_EXECUTABLE}
|
|
${PROJECT_SOURCE_DIR}/cmake/copy_external_header.py
|
|
${ARG_SOURCE_HEADER}
|
|
${ARG_ROOT_INCLUDE_DIR}
|
|
${ARG_OUTPUT_PATH}
|
|
DEPENDS
|
|
${PROJECT_SOURCE_DIR}/cmake/copy_external_header.py
|
|
${ARG_SOURCE_HEADER}
|
|
COMMENT "${ARG_COMMENT}"
|
|
VERBATIM
|
|
)
|
|
|
|
# Create a custom target to ensure it's generated
|
|
add_custom_target(${ARG_TARGET}
|
|
DEPENDS ${ARG_OUTPUT_PATH}
|
|
)
|
|
endfunction()
|