diff --git a/cmake/cinn/core.cmake b/cmake/cinn/core.cmake index 1c289528351f6..d254d867b3ec4 100644 --- a/cmake/cinn/core.cmake +++ b/cmake/cinn/core.cmake @@ -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() @@ -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")) @@ -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) @@ -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) @@ -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 @@ -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) @@ -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. @@ -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}) @@ -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) @@ -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. @@ -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: