Skip to content

Commit

Permalink
[CodeStyle][CINN] fix cinn codestyle cmake-lint (#54975)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccsuzzh authored Jun 29, 2023
1 parent 2e6de4c commit bbcaaff
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions cmake/cinn/core.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function(cinn_cc_library TARGET_NAME)
${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
endif()
endforeach()
else(cinn_cc_library_SRCS)
else()
if(cinn_cc_library_DEPS)
cinn_merge_static_libs(${TARGET_NAME} ${cinn_cc_library_DEPS})
else()
Expand All @@ -41,7 +41,7 @@ function(cinn_cc_library TARGET_NAME)
"Please specify source files or libraries in cinn_cc_library(${TARGET_NAME} ...)."
)
endif()
endif(cinn_cc_library_SRCS)
endif()

if((NOT ("${TARGET_NAME}" STREQUAL "cinn_gtest_main"))
AND (NOT ("${TARGET_NAME}" STREQUAL "utils"))
Expand All @@ -52,7 +52,7 @@ function(cinn_cc_library TARGET_NAME)
(NOT ("${TARGET_NAME}" STREQUAL "cinn_gtest_main"))
AND (NOT ("${TARGET_NAME}" STREQUAL "utils"))
AND (NOT ("${TARGET_NAME}" STREQUAL "lib")))
endfunction(cinn_cc_library)
endfunction()

list(APPEND CMAKE_CTEST_ARGUMENTS)

Expand Down Expand Up @@ -116,17 +116,17 @@ function(cinn_nv_library TARGET_NAME)
${CMAKE_CURRENT_SOURCE_DIR}/${source}.h)
endif()
endforeach()
else(cinn_nv_library_SRCS)
else()
if(cinn_nv_library_DEPS)
cinn_merge_static_libs(${TARGET_NAME} ${cinn_nv_library_DEPS})
else()
message(FATAL
"Please specify source file or library in cinn_nv_library.")
endif()
endif(cinn_nv_library_SRCS)
endif()
target_link_libraries(${TARGET_NAME} Threads::Threads)
endif()
endfunction(cinn_nv_library)
endfunction()

function(cinn_nv_binary TARGET_NAME)
if(WITH_GPU)
Expand All @@ -142,7 +142,7 @@ function(cinn_nv_binary TARGET_NAME)
common_link(${TARGET_NAME})
endif()
endif()
endfunction(cinn_nv_binary)
endfunction()

function(cinn_nv_test TARGET_NAME)
if(WITH_GPU
Expand Down Expand Up @@ -184,7 +184,7 @@ function(cinn_nv_test TARGET_NAME)
endif()
remove_gflags(${TARGET_NAME})
endif()
endfunction(cinn_nv_test)
endfunction()

# 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)
Expand All @@ -198,8 +198,8 @@ function(add_run_test_dependency TARGET_NAME DEP_NAME)
COMMAND cd ${CMAKE_BINARY_DIR}
DEPENDS ${DEP_NAME})
add_dependencies(${TARGET_NAME} ${DEP_NAME} ${custom_target_name})
endif(WITH_TESTING AND CINN_ONLY)
endfunction(add_run_test_dependency)
endif()
endfunction()

# find all third_party modules is used for paddle static library
# for reduce the dependency when building the inference libs.
Expand All @@ -214,7 +214,7 @@ function(find_fluid_thirdparties TARGET_NAME)
set(fluid_third_partys ${fluid_third_partys} ${TARGET_NAME})
set_property(GLOBAL PROPERTY FLUID_THIRD_PARTY "${fluid_third_partys}")
endif()
endfunction(find_fluid_thirdparties)
endfunction()

function(cinn_merge_static_libs TARGET_NAME)
set(libs ${ARGN})
Expand Down Expand Up @@ -258,7 +258,7 @@ function(cinn_merge_static_libs TARGET_NAME)
COMMAND rm "${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.a"
COMMAND /usr/bin/libtool -static -o
"${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.a" ${libfiles})
endif(APPLE)
endif()
if(LINUX
)# general UNIX: use "ar" to extract objects and re-add to a common lib
set(target_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.dir)
Expand Down Expand Up @@ -306,7 +306,7 @@ function(cinn_merge_static_libs TARGET_NAME)
COMMAND ${CMAKE_AR} crs ${target_LIBNAME} `find ${target_DIR} -name '*.o'`
COMMAND ${CMAKE_RANLIB} ${target_LIBNAME}
WORKING_DIRECTORY ${target_DIR})
endif(LINUX)
endif()
if(WIN32)

# windows do not support gcc/nvcc combined compiling. Use msvc lib.exe to merge libs.
Expand Down Expand Up @@ -339,8 +339,8 @@ function(cinn_merge_static_libs TARGET_NAME)
lib
/OUT:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib${TARGET_NAME}.lib
${libfiles})
endif(WIN32)
endfunction(cinn_merge_static_libs)
endif()
endfunction()

# Modification of standard 'protobuf_generate_cpp()' with protobuf-lite support
# Usage:
Expand Down

0 comments on commit bbcaaff

Please sign in to comment.