Remove Caffe2_MAIN_LIBS (#38408)

Summary:
Right now it is an unused alias to `torch_library` interface library
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38408

Differential Revision: D21598250

Pulled By: malfet

fbshipit-source-id: ec9a2446b94e7ea68298831212005c2c80bbc95c
This commit is contained in:
Nikita Shulga
2020-05-15 12:22:13 -07:00
committed by Facebook GitHub Bot
parent daa85cfe2e
commit dc918162b7
5 changed files with 6 additions and 18 deletions

View File

@ -20,7 +20,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.10)
endif()
# ---[ Project and semantic versioning.
project(Caffe2 CXX C)
project(Torch CXX C)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(LINUX TRUE)

View File

@ -997,11 +997,6 @@ elseif(USE_ROCM)
target_link_libraries(torch PUBLIC torch_hip_library)
endif()
list(APPEND Caffe2_MAIN_LIBS torch_library)
if(USE_TBB)
list(APPEND Caffe2_MAIN_LIBS tbb)
endif()
# Install PDB files for MSVC builds
if(MSVC AND BUILD_SHARED_LIBS)
install(FILES $<TARGET_PDB_FILE:torch_cpu> DESTINATION "${TORCH_INSTALL_LIB_DIR}" OPTIONAL)
@ -1102,7 +1097,7 @@ if(BUILD_TEST)
foreach(test_src ${Caffe2_CPU_TEST_SRCS})
get_filename_component(test_name ${test_src} NAME_WE)
add_executable(${test_name} "${test_src}")
target_link_libraries(${test_name} ${Caffe2_MAIN_LIBS} gtest_main)
target_link_libraries(${test_name} torch_library gtest_main)
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
@ -1120,7 +1115,7 @@ if(BUILD_TEST)
foreach(test_src ${Caffe2_GPU_TEST_SRCS})
get_filename_component(test_name ${test_src} NAME_WE)
cuda_add_executable(${test_name} "${test_src}")
target_link_libraries(${test_name} ${Caffe2_MAIN_LIBS} gtest_main)
target_link_libraries(${test_name} torch_library gtest_main)
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
@ -1138,7 +1133,7 @@ if(BUILD_TEST)
foreach(test_src ${Caffe2_HIP_TEST_SRCS})
get_filename_component(test_name ${test_src} NAME_WE)
add_executable(${test_name} "${test_src}")
target_link_libraries(${test_name} ${Caffe2_MAIN_LIBS} gtest_main)
target_link_libraries(${test_name} torch_library gtest_main)
target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE})
target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS})
@ -1361,6 +1356,3 @@ if(BUILD_PYTHON)
install(DIRECTORY ${CMAKE_BINARY_DIR}/caffe2 DESTINATION ${PYTHON_LIB_REL_PATH}
FILES_MATCHING PATTERN "*.py")
endif()
# Finally, set the Caffe2_MAIN_LIBS variable in the parent scope.
set(Caffe2_MAIN_LIBS ${Caffe2_MAIN_LIBS} PARENT_SCOPE)

View File

@ -22,10 +22,6 @@ set(Caffe2_GPU_TEST_SRCS)
set(Caffe2_CPU_INCLUDE)
set(Caffe2_GPU_INCLUDE)
# Caffe2_MAIN_LIBS is a list of the libraries that a dependent library should
# depend on when it links against Caffe2.
set(Caffe2_MAIN_LIBS)
# Lists for Caffe2 dependency libraries, for CPU and CUDA respectively.
set(Caffe2_DEPENDENCY_LIBS "")
set(Caffe2_CUDA_DEPENDENCY_LIBS "")

View File

@ -128,7 +128,7 @@ function(caffe2_binary_target target_name_or_src)
prepend(__srcs "${CMAKE_CURRENT_SOURCE_DIR}/" "${target_name_or_src}")
endif()
add_executable(${__target} ${__srcs})
target_link_libraries(${__target} ${Caffe2_MAIN_LIBS})
target_link_libraries(${__target} torch_library)
# If we have Caffe2_MODULES defined, we will also link with the modules.
if(DEFINED Caffe2_MODULES)
target_link_libraries(${__target} ${Caffe2_MODULES})

View File

@ -61,7 +61,7 @@ target_link_libraries(caffe2_rocksdb PRIVATE ${RocksDB_LIBRARIES})
target_include_directories(caffe2_rocksdb PRIVATE ${RocksDB_INCLUDE_DIR})
install(TARGETS caffe2_rocksdb DESTINATION lib)
# ---[ Last, Append the library to Caffe2_MAIN_LIBS, if we are building with
# ---[ Last, Append the library to Caffe2_MODULES, if we are building with
# the main repo.
# The purpose of this is that, for all binaries built in the Caffe2 main repo,
# they will be built with the first class modules that are built. As a result,