|
|
|
@ -359,6 +359,8 @@ function(cc_binary TARGET_NAME)
|
|
|
|
|
add_dependencies(${TARGET_NAME} ${cc_binary_DEPS})
|
|
|
|
|
common_link(${TARGET_NAME})
|
|
|
|
|
endif()
|
|
|
|
|
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${os_dependency_modules})
|
|
|
|
|
endfunction(cc_binary)
|
|
|
|
|
|
|
|
|
|
function(cc_test TARGET_NAME)
|
|
|
|
@ -367,18 +369,15 @@ function(cc_test TARGET_NAME)
|
|
|
|
|
set(oneValueArgs "")
|
|
|
|
|
set(multiValueArgs SRCS DEPS ARGS)
|
|
|
|
|
cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
|
add_executable(${TARGET_NAME} ${cc_test_SRCS})
|
|
|
|
|
if(WIN32)
|
|
|
|
|
list(APPEND win32_deps shlwapi)
|
|
|
|
|
if("${cc_test_DEPS};" MATCHES "python;")
|
|
|
|
|
list(REMOVE_ITEM cc_test_DEPS python)
|
|
|
|
|
list(APPEND win32_deps ${PYTHON_LIBRARIES})
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${PYTHON_LIBRARIES})
|
|
|
|
|
endif()
|
|
|
|
|
endif(WIN32)
|
|
|
|
|
add_executable(${TARGET_NAME} ${cc_test_SRCS})
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
|
|
|
|
|
if(WIN32)
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${win32_deps})
|
|
|
|
|
endif(WIN32)
|
|
|
|
|
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${cc_test_DEPS} ${os_dependency_modules} paddle_gtest_main lod_tensor memory gtest gflags glog)
|
|
|
|
|
add_dependencies(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
|
|
|
|
|
common_link(${TARGET_NAME})
|
|
|
|
|
add_test(NAME ${TARGET_NAME}
|
|
|
|
@ -451,10 +450,8 @@ function(nv_test TARGET_NAME)
|
|
|
|
|
set(multiValueArgs SRCS DEPS)
|
|
|
|
|
cmake_parse_arguments(nv_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
|
|
|
|
cuda_add_executable(${TARGET_NAME} ${nv_test_SRCS})
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
|
|
|
|
|
if(WIN32)
|
|
|
|
|
target_link_libraries(${TARGET_NAME} shlwapi)
|
|
|
|
|
endif(WIN32)
|
|
|
|
|
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog ${os_dependency_modules})
|
|
|
|
|
add_dependencies(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
|
|
|
|
|
common_link(${TARGET_NAME})
|
|
|
|
|
add_test(${TARGET_NAME} ${TARGET_NAME})
|
|
|
|
@ -541,7 +538,8 @@ function(hip_test TARGET_NAME)
|
|
|
|
|
endif()
|
|
|
|
|
add_executable(${TARGET_NAME} ${_cmake_options} ${_generated_files} ${_sources})
|
|
|
|
|
set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE HIP)
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${hip_test_DEPS} paddle_gtest_main memory gtest gflags)
|
|
|
|
|
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
|
|
|
|
|
target_link_libraries(${TARGET_NAME} ${hip_test_DEPS} paddle_gtest_main memory gtest gflags ${os_dependency_modules})
|
|
|
|
|
add_dependencies(${TARGET_NAME} ${hip_test_DEPS} paddle_gtest_main memory gtest gflags)
|
|
|
|
|
common_link(${TARGET_NAME})
|
|
|
|
|
add_test(${TARGET_NAME} ${TARGET_NAME})
|
|
|
|
|