Files
2026-07-13 12:40:42 +08:00

54 lines
1.4 KiB
CMake

set(jit_file ${PADDLE_BINARY_DIR}/paddle/phi/kernels/funcs/jit/kernels.h.tmp)
set(jit_file_final ${PADDLE_BINARY_DIR}/paddle/phi/kernels/funcs/jit/kernels.h)
file(
WRITE ${jit_file}
"// Generated by the paddle/phi/kernels/funcs/jit/CMakeLists.txt. DO NOT EDIT!\n\n"
)
file(APPEND ${jit_file} "\#pragma once\n")
file(APPEND ${jit_file} "\#include \"paddle/phi/kernels/funcs/jit/helper.h\"\n")
file(APPEND ${jit_file}
"\#include \"paddle/phi/kernels/funcs/jit/registry.h\"\n\n")
file(
GLOB jit_kernel_cc_srcs
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"*.cc")
list(REMOVE_ITEM jit_kernel_cc_srcs test.cc benchmark.cc)
collect_srcs(kernels_srcs SRCS ${jit_kernel_cc_srcs})
copy_if_different(${jit_file} ${jit_file_final})
# refer must go first
add_subdirectory(refer)
add_subdirectory(more)
if(WITH_XBYAK)
add_subdirectory(gen)
endif()
if(NOT WIN32)
cc_test(
jit_kernel_test
SRCS test.cc
DEPS phi common)
endif()
if(NOT WIN32)
set(cuda_less12_and_gcc_greater12 false)
if(DEFINED CMAKE_CUDA_COMPILER_VERSION)
if(${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 12.0)
set(cuda_less12_and_gcc_greater12 true)
endif()
endif()
if(NOT cuda_less12_and_gcc_greater12)
cc_library(
jit_kernel_benchmark
SRCS benchmark.cc
DEPS phi common)
endif()
endif()
if(WITH_TESTING AND TEST jit_kernel_test)
set_tests_properties(jit_kernel_test PROPERTIES TIMEOUT 120)
endif()