未验证 提交 bbcaaffd 编写于 作者: Z Zhenghai Zhang 提交者: GitHub

[CodeStyle][CINN] fix cinn codestyle cmake-lint (#54975)

上级 2e6de4ce
...@@ -32,7 +32,7 @@ function(cinn_cc_library TARGET_NAME) ...@@ -32,7 +32,7 @@ function(cinn_cc_library TARGET_NAME)
${CMAKE_CURRENT_SOURCE_DIR}/${source}.h) ${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
endif() endif()
endforeach() endforeach()
else(cinn_cc_library_SRCS) else()
if(cinn_cc_library_DEPS) if(cinn_cc_library_DEPS)
cinn_merge_static_libs(${TARGET_NAME} ${cinn_cc_library_DEPS}) cinn_merge_static_libs(${TARGET_NAME} ${cinn_cc_library_DEPS})
else() else()
...@@ -41,7 +41,7 @@ function(cinn_cc_library TARGET_NAME) ...@@ -41,7 +41,7 @@ function(cinn_cc_library TARGET_NAME)
"Please specify source files or libraries in cinn_cc_library(${TARGET_NAME} ...)." "Please specify source files or libraries in cinn_cc_library(${TARGET_NAME} ...)."
) )
endif() endif()
endif(cinn_cc_library_SRCS) endif()
if((NOT ("${TARGET_NAME}" STREQUAL "cinn_gtest_main")) if((NOT ("${TARGET_NAME}" STREQUAL "cinn_gtest_main"))
AND (NOT ("${TARGET_NAME}" STREQUAL "utils")) AND (NOT ("${TARGET_NAME}" STREQUAL "utils"))
...@@ -52,7 +52,7 @@ function(cinn_cc_library TARGET_NAME) ...@@ -52,7 +52,7 @@ function(cinn_cc_library TARGET_NAME)
(NOT ("${TARGET_NAME}" STREQUAL "cinn_gtest_main")) (NOT ("${TARGET_NAME}" STREQUAL "cinn_gtest_main"))
AND (NOT ("${TARGET_NAME}" STREQUAL "utils")) AND (NOT ("${TARGET_NAME}" STREQUAL "utils"))
AND (NOT ("${TARGET_NAME}" STREQUAL "lib"))) AND (NOT ("${TARGET_NAME}" STREQUAL "lib")))
endfunction(cinn_cc_library) endfunction()
list(APPEND CMAKE_CTEST_ARGUMENTS) list(APPEND CMAKE_CTEST_ARGUMENTS)
...@@ -116,17 +116,17 @@ function(cinn_nv_library TARGET_NAME) ...@@ -116,17 +116,17 @@ function(cinn_nv_library TARGET_NAME)
${CMAKE_CURRENT_SOURCE_DIR}/${source}.h) ${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
endif() endif()
endforeach() endforeach()
else(cinn_nv_library_SRCS) else()
if(cinn_nv_library_DEPS) if(cinn_nv_library_DEPS)
cinn_merge_static_libs(${TARGET_NAME} ${cinn_nv_library_DEPS}) cinn_merge_static_libs(${TARGET_NAME} ${cinn_nv_library_DEPS})
else() else()
message(FATAL message(FATAL
"Please specify source file or library in cinn_nv_library.") "Please specify source file or library in cinn_nv_library.")
endif() endif()
endif(cinn_nv_library_SRCS) endif()
target_link_libraries(${TARGET_NAME} Threads::Threads) target_link_libraries(${TARGET_NAME} Threads::Threads)
endif() endif()
endfunction(cinn_nv_library) endfunction()
function(cinn_nv_binary TARGET_NAME) function(cinn_nv_binary TARGET_NAME)
if(WITH_GPU) if(WITH_GPU)
...@@ -142,7 +142,7 @@ function(cinn_nv_binary TARGET_NAME) ...@@ -142,7 +142,7 @@ function(cinn_nv_binary TARGET_NAME)
common_link(${TARGET_NAME}) common_link(${TARGET_NAME})
endif() endif()
endif() endif()
endfunction(cinn_nv_binary) endfunction()
function(cinn_nv_test TARGET_NAME) function(cinn_nv_test TARGET_NAME)
if(WITH_GPU if(WITH_GPU
...@@ -184,7 +184,7 @@ function(cinn_nv_test TARGET_NAME) ...@@ -184,7 +184,7 @@ function(cinn_nv_test TARGET_NAME)
endif() endif()
remove_gflags(${TARGET_NAME}) remove_gflags(${TARGET_NAME})
endif() endif()
endfunction(cinn_nv_test) endfunction()
# Add dependency that TARGET will depend on test result of DEP, this function executes the DEP during make. # Add dependency that TARGET will depend on test result of DEP, this function executes the DEP during make.
function(add_run_test_dependency TARGET_NAME DEP_NAME) function(add_run_test_dependency TARGET_NAME DEP_NAME)
...@@ -198,8 +198,8 @@ function(add_run_test_dependency TARGET_NAME DEP_NAME) ...@@ -198,8 +198,8 @@ function(add_run_test_dependency TARGET_NAME DEP_NAME)
COMMAND cd ${CMAKE_BINARY_DIR} COMMAND cd ${CMAKE_BINARY_DIR}
DEPENDS ${DEP_NAME}) DEPENDS ${DEP_NAME})
add_dependencies(${TARGET_NAME} ${DEP_NAME} ${custom_target_name}) add_dependencies(${TARGET_NAME} ${DEP_NAME} ${custom_target_name})
endif(WITH_TESTING AND CINN_ONLY) endif()
endfunction(add_run_test_dependency) endfunction()
# find all third_party modules is used for paddle static library # find all third_party modules is used for paddle static library
# for reduce the dependency when building the inference libs. # for reduce the dependency when building the inference libs.
...@@ -214,7 +214,7 @@ function(find_fluid_thirdparties TARGET_NAME) ...@@ -214,7 +214,7 @@ function(find_fluid_thirdparties TARGET_NAME)
set(fluid_third_partys ${fluid_third_partys} ${TARGET_NAME}) set(fluid_third_partys ${fluid_third_partys} ${TARGET_NAME})
set_property(GLOBAL PROPERTY FLUID_THIRD_PARTY "${fluid_third_partys}") set_property(GLOBAL PROPERTY FLUID_THIRD_PARTY "${fluid_third_partys}")
endif() endif()
endfunction(find_fluid_thirdparties) endfunction()
function(cinn_merge_static_libs TARGET_NAME) function(cinn_merge_static_libs TARGET_NAME)
set(libs ${ARGN}) set(libs ${ARGN})
...@@ -258,7 +258,7 @@ function(cinn_merge_static_libs TARGET_NAME) ...@@ -258,7 +258,7 @@ function(cinn_merge_static_libs TARGET_NAME)
COMMAND rm "${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.a" COMMAND rm "${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.a"
COMMAND /usr/bin/libtool -static -o COMMAND /usr/bin/libtool -static -o
"${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.a" ${libfiles}) "${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.a" ${libfiles})
endif(APPLE) endif()
if(LINUX if(LINUX
)# general UNIX: use "ar" to extract objects and re-add to a common lib )# general UNIX: use "ar" to extract objects and re-add to a common lib
set(target_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.dir) set(target_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.dir)
...@@ -306,7 +306,7 @@ function(cinn_merge_static_libs TARGET_NAME) ...@@ -306,7 +306,7 @@ function(cinn_merge_static_libs TARGET_NAME)
COMMAND ${CMAKE_AR} crs ${target_LIBNAME} `find ${target_DIR} -name '*.o'` COMMAND ${CMAKE_AR} crs ${target_LIBNAME} `find ${target_DIR} -name '*.o'`
COMMAND ${CMAKE_RANLIB} ${target_LIBNAME} COMMAND ${CMAKE_RANLIB} ${target_LIBNAME}
WORKING_DIRECTORY ${target_DIR}) WORKING_DIRECTORY ${target_DIR})
endif(LINUX) endif()
if(WIN32) if(WIN32)
# windows do not support gcc/nvcc combined compiling. Use msvc lib.exe to merge libs. # windows do not support gcc/nvcc combined compiling. Use msvc lib.exe to merge libs.
...@@ -339,8 +339,8 @@ function(cinn_merge_static_libs TARGET_NAME) ...@@ -339,8 +339,8 @@ function(cinn_merge_static_libs TARGET_NAME)
lib lib
/OUT:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib${TARGET_NAME}.lib /OUT:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib${TARGET_NAME}.lib
${libfiles}) ${libfiles})
endif(WIN32) endif()
endfunction(cinn_merge_static_libs) endfunction()
# Modification of standard 'protobuf_generate_cpp()' with protobuf-lite support # Modification of standard 'protobuf_generate_cpp()' with protobuf-lite support
# Usage: # Usage:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册