diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d94098b73b..4acdf4f9857 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ option(BUILD_SHARED_LIBS "Build libcaffe2.so" ON) cmake_dependent_option( CAFFE2_USE_MSVC_STATIC_RUNTIME "Using MSVC static runtime libraries" ON "NOT BUILD_SHARED_LIBS" OFF) -option(BUILD_OBSERVERS "Build performance observers/loggers in caffe2/share/observers directory" OFF) option(BUILD_TEST "Build C++ test binaries (need gtest and gbenchmark)" ON) option(USE_ACL "Use ARM Compute Library" OFF) option(USE_ASAN "Use Address Sanitizer" OFF) @@ -54,7 +53,7 @@ option(USE_NERVANA_GPU "Use Nervana GPU backend" OFF) option(USE_NNAPI "Use NNAPI" OFF) option(USE_NNPACK "Use NNPACK" ON) option(USE_NUMA "Use NUMA (only available on Linux)" ON) -option(USE_OBSERVERS "Use Observer Library" OFF) +option(USE_OBSERVERS "Use observers module." OFF) option(USE_OPENCV "Use openCV" ON) option(USE_OPENMP "Use OpenMP for parallel code" OFF) option(USE_PROF "Use profiling" OFF) @@ -254,6 +253,7 @@ if (BUILD_SHARED_LIBS) ${PROJECT_SOURCE_DIR}/cmake/public/glog.cmake ${PROJECT_SOURCE_DIR}/cmake/public/gflags.cmake ${PROJECT_SOURCE_DIR}/cmake/public/protobuf.cmake + ${PROJECT_SOURCE_DIR}/cmake/public/threads.cmake ${PROJECT_SOURCE_DIR}/cmake/public/utils.cmake DESTINATION share/cmake/Caffe2/public COMPONENT dev) @@ -269,5 +269,15 @@ endif() # ---[ Modules add_subdirectory(modules) +# ---[ Binaries +# Binaries will be built after the Caffe2 main libraries and the modules +# are built. For the binaries, they will be linked to the Caffe2 main +# libraries, as well as all the modules that are built with Caffe2 (the ones +# built in the previous Modules section above). + +if (BUILD_BINARY) + add_subdirectory(binaries) +endif() + include(cmake/Summary.cmake) caffe2_print_configuration_summary() diff --git a/caffe2/binaries/CMakeLists.txt b/binaries/CMakeLists.txt similarity index 86% rename from caffe2/binaries/CMakeLists.txt rename to binaries/CMakeLists.txt index 471b00d91a0..dafabe2c29a 100644 --- a/caffe2/binaries/CMakeLists.txt +++ b/binaries/CMakeLists.txt @@ -8,10 +8,7 @@ caffe2_binary_target("run_plan.cc") caffe2_binary_target("speed_benchmark.cc") caffe2_binary_target("split_db.cc") -if (USE_THREADS) - caffe2_binary_target("db_throughput.cc") - target_link_libraries(db_throughput ${CMAKE_THREAD_LIBS_INIT}) -endif() +caffe2_binary_target("db_throughput.cc") if (USE_CUDA) caffe2_binary_target("inspect_gpus.cc") @@ -44,7 +41,11 @@ endif() if (USE_OPENCV) caffe2_binary_target("make_image_db.cc") - target_link_libraries(make_image_db ${OpenCV_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(make_image_db ${OpenCV_LIBS}) +endif() + +if (USE_OBSERVERS) + caffe2_binary_target("caffe2_benchmark.cc") endif() # ---[ tutorials diff --git a/caffe2/share/contrib/binaries/caffe2_benchmark/caffe2_benchmark.cc b/binaries/caffe2_benchmark.cc similarity index 99% rename from caffe2/share/contrib/binaries/caffe2_benchmark/caffe2_benchmark.cc rename to binaries/caffe2_benchmark.cc index c71d73499eb..83ed1f740bb 100644 --- a/caffe2/share/contrib/binaries/caffe2_benchmark/caffe2_benchmark.cc +++ b/binaries/caffe2_benchmark.cc @@ -7,10 +7,11 @@ #include "caffe2/core/logging.h" #include "caffe2/core/operator.h" #include "caffe2/proto/caffe2.pb.h" -#include "caffe2/share/contrib/observers/observer_config.h" #include "caffe2/utils/proto_utils.h" #include "caffe2/utils/string_utils.h" +#include "observers/observer_config.h" + CAFFE2_DEFINE_string( backend, "builtin", diff --git a/caffe2/binaries/convert_caffe_image_db.cc b/binaries/convert_caffe_image_db.cc similarity index 100% rename from caffe2/binaries/convert_caffe_image_db.cc rename to binaries/convert_caffe_image_db.cc diff --git a/caffe2/binaries/convert_db.cc b/binaries/convert_db.cc similarity index 100% rename from caffe2/binaries/convert_db.cc rename to binaries/convert_db.cc diff --git a/caffe2/binaries/convert_encoded_to_raw_leveldb.cc b/binaries/convert_encoded_to_raw_leveldb.cc similarity index 100% rename from caffe2/binaries/convert_encoded_to_raw_leveldb.cc rename to binaries/convert_encoded_to_raw_leveldb.cc diff --git a/caffe2/binaries/core_overhead_benchmark.cc b/binaries/core_overhead_benchmark.cc similarity index 100% rename from caffe2/binaries/core_overhead_benchmark.cc rename to binaries/core_overhead_benchmark.cc diff --git a/caffe2/binaries/db_throughput.cc b/binaries/db_throughput.cc similarity index 100% rename from caffe2/binaries/db_throughput.cc rename to binaries/db_throughput.cc diff --git a/caffe2/binaries/inspect_gpus.cc b/binaries/inspect_gpus.cc similarity index 100% rename from caffe2/binaries/inspect_gpus.cc rename to binaries/inspect_gpus.cc diff --git a/caffe2/binaries/make_cifar_db.cc b/binaries/make_cifar_db.cc similarity index 100% rename from caffe2/binaries/make_cifar_db.cc rename to binaries/make_cifar_db.cc diff --git a/caffe2/binaries/make_image_db.cc b/binaries/make_image_db.cc similarity index 100% rename from caffe2/binaries/make_image_db.cc rename to binaries/make_image_db.cc diff --git a/caffe2/binaries/make_mnist_db.cc b/binaries/make_mnist_db.cc similarity index 100% rename from caffe2/binaries/make_mnist_db.cc rename to binaries/make_mnist_db.cc diff --git a/caffe2/binaries/predictor_verifier.cc b/binaries/predictor_verifier.cc similarity index 100% rename from caffe2/binaries/predictor_verifier.cc rename to binaries/predictor_verifier.cc diff --git a/caffe2/binaries/print_core_object_sizes.cc b/binaries/print_core_object_sizes.cc similarity index 100% rename from caffe2/binaries/print_core_object_sizes.cc rename to binaries/print_core_object_sizes.cc diff --git a/caffe2/binaries/print_registered_core_operators.cc b/binaries/print_registered_core_operators.cc similarity index 100% rename from caffe2/binaries/print_registered_core_operators.cc rename to binaries/print_registered_core_operators.cc diff --git a/caffe2/binaries/run_plan.cc b/binaries/run_plan.cc similarity index 100% rename from caffe2/binaries/run_plan.cc rename to binaries/run_plan.cc diff --git a/caffe2/binaries/run_plan_mpi.cc b/binaries/run_plan_mpi.cc similarity index 100% rename from caffe2/binaries/run_plan_mpi.cc rename to binaries/run_plan_mpi.cc diff --git a/caffe2/binaries/speed_benchmark.cc b/binaries/speed_benchmark.cc similarity index 100% rename from caffe2/binaries/speed_benchmark.cc rename to binaries/speed_benchmark.cc diff --git a/caffe2/binaries/split_db.cc b/binaries/split_db.cc similarity index 100% rename from caffe2/binaries/split_db.cc rename to binaries/split_db.cc diff --git a/caffe2/binaries/tutorial_blob.cc b/binaries/tutorial_blob.cc similarity index 100% rename from caffe2/binaries/tutorial_blob.cc rename to binaries/tutorial_blob.cc diff --git a/caffe2/binaries/zmq_feeder.cc b/binaries/zmq_feeder.cc similarity index 100% rename from caffe2/binaries/zmq_feeder.cc rename to binaries/zmq_feeder.cc diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index 94c47c83ef6..c7c60e9be5c 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt @@ -78,6 +78,7 @@ install(FILES ${PROJECT_BINARY_DIR}/caffe2/core/macros.h # Compile exposed libraries. add_library(caffe2 ${Caffe2_CPU_SRCS} $ $) +add_dependencies(caffe2 Caffe_PROTO Caffe2_PROTO) target_link_libraries(caffe2 PUBLIC ${Caffe2_PUBLIC_DEPENDENCY_LIBS}) target_link_libraries(caffe2 PRIVATE ${Caffe2_DEPENDENCY_LIBS}) target_include_directories(caffe2 INTERFACE $) @@ -262,15 +263,7 @@ if (BUILD_PYTHON) 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) + -# ---[ Any builds that should happen after the main targets should be added here. -# Binaries -if (BUILD_BINARY) - add_subdirectory(binaries) - # Benchmarking binaries require observers included in the build - # There is a linking issue that happens in some of the Windows builds. - # TODO(Yangqing): after the module redesign, enable this back. - if (BUILD_OBSERVERS AND NOT MSVC) - add_subdirectory(share/contrib/binaries) - endif() -endif() diff --git a/caffe2/share/contrib/CMakeLists.txt b/caffe2/share/contrib/CMakeLists.txt index c165e18ffbe..a8db5c0a174 100644 --- a/caffe2/share/contrib/CMakeLists.txt +++ b/caffe2/share/contrib/CMakeLists.txt @@ -1,19 +1,10 @@ -set(Caffe2_CPU_OBSERVER_SRCS) - if (USE_NNPACK) add_subdirectory(nnpack) endif() -if (BUILD_OBSERVERS) -add_subdirectory(observers) -endif() if (USE_ZSTD) add_subdirectory(zstd) endif() -if (BUILD_OBSERVERS) - add_library(Caffe2_CPU_OBSERVER STATIC ${Caffe2_CPU_OBSERVER_SRCS}) -endif() - # CPU source, test sources, binary sources set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS} PARENT_SCOPE) set(Caffe2_CPU_TEST_SRCS ${Caffe2_CPU_TEST_SRCS} PARENT_SCOPE) diff --git a/caffe2/share/contrib/binaries/CMakeLists.txt b/caffe2/share/contrib/binaries/CMakeLists.txt deleted file mode 100644 index d713324872f..00000000000 --- a/caffe2/share/contrib/binaries/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(caffe2_benchmark) diff --git a/caffe2/share/contrib/binaries/caffe2_benchmark/CMakeLists.txt b/caffe2/share/contrib/binaries/caffe2_benchmark/CMakeLists.txt deleted file mode 100644 index c5fb94abd44..00000000000 --- a/caffe2/share/contrib/binaries/caffe2_benchmark/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -caffe2_binary_target("caffe2_benchmark.cc") -caffe2_interface_library(Caffe2_CPU_OBSERVER Caffe2_CPU_OBSERVER_LINK) -target_link_libraries(caffe2_benchmark ${Caffe2_CPU_OBSERVER_LINK}) diff --git a/caffe2/share/contrib/observers/CMakeLists.txt b/caffe2/share/contrib/observers/CMakeLists.txt deleted file mode 100644 index 9fa7c429a35..00000000000 --- a/caffe2/share/contrib/observers/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(Caffe2_CPU_OBSERVER_SRCS - "${CMAKE_CURRENT_SOURCE_DIR}/net_observer_reporter_print.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/observer_config.cc" - "${CMAKE_CURRENT_SOURCE_DIR}/perf_observer.cc" - ) - -set(Caffe2_CPU_OBSERVER_SRCS ${Caffe2_CPU_OBSERVER_SRCS} PARENT_SCOPE) diff --git a/cmake/BuildVariables.cmake b/cmake/BuildVariables.cmake index 8f43facdda0..f5bb7592886 100644 --- a/cmake/BuildVariables.cmake +++ b/cmake/BuildVariables.cmake @@ -28,4 +28,9 @@ set(Caffe2_CUDA_DEPENDENCY_LIBS "") # Lists for Caffe2 public dependency libraries. These libraries will be # transitive to any libraries that depends on Caffe2. set(Caffe2_PUBLIC_DEPENDENCY_LIBS "") -set(Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS "") \ No newline at end of file +set(Caffe2_PUBLIC_CUDA_DEPENDENCY_LIBS "") + +# List of modules that is built as part of the main Caffe2 build. For all +# binary targets, such as Python and native binaries, they will be linked +# automatically with these modules. +set(Caffe2_MODULES "") \ No newline at end of file diff --git a/cmake/Caffe2Config.cmake.in b/cmake/Caffe2Config.cmake.in index 32e5b99a09d..3540d577e00 100644 --- a/cmake/Caffe2Config.cmake.in +++ b/cmake/Caffe2Config.cmake.in @@ -13,6 +13,11 @@ set(CAFFE2_VERSION "@CAFFE2_VERSION@") # Utils functions. include("${CMAKE_CURRENT_LIST_DIR}/public/utils.cmake") +# Depending on whether Caffe2 is built with threads, include threads lib. +if(@USE_THREADS@) + include("${CMAKE_CURRENT_LIST_DIR}/public/threads.cmake") +endif() + # Depending on whether Caffe2 uses gflags during compile time or # not, invoke gflags. if (@USE_GFLAGS@) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 76c4f58f43a..bc659a96cd2 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -3,8 +3,8 @@ include("cmake/ProtoBuf.cmake") # ---[ Threads if(USE_THREADS) - find_package(Threads REQUIRED) - list(APPEND Caffe2_DEPENDENCY_LIBS ${CMAKE_THREAD_LIBS_INIT}) + include(cmake/public/threads.cmake) + list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS Threads::Threads) endif() # ---[ protobuf @@ -77,10 +77,6 @@ if(USE_NNPACK) endif() endif() -if(USE_OBSERVERS) - list(APPEND Caffe2_DEPENDENCY_LIBS Caffe2_CPU_OBSERVER) -endif() - # ---[ On Android, Caffe2 uses cpufeatures library in the thread pool if (ANDROID) if (NOT TARGET cpufeatures) diff --git a/cmake/public/glog.cmake b/cmake/public/glog.cmake index bfa587df034..f719da3e1fa 100644 --- a/cmake/public/glog.cmake +++ b/cmake/public/glog.cmake @@ -41,7 +41,7 @@ else() find_path(GLOG_INCLUDE_DIR glog/logging.h PATHS ${GLOG_ROOT_DIR}) endif() - + find_library(GLOG_LIBRARY glog PATHS ${GLOG_ROOT_DIR} PATH_SUFFIXES lib lib64) diff --git a/cmake/public/protobuf.cmake b/cmake/public/protobuf.cmake index b5344dae691..fb3db6bcb87 100644 --- a/cmake/public/protobuf.cmake +++ b/cmake/public/protobuf.cmake @@ -64,7 +64,7 @@ elseif(Protobuf_FOUND OR PROTOBUF_FOUND) IMPORTED_LOCATION_DEBUG "${PROTOBUF_LITE_LIBRARY_DEBUG}") endif() endif() - + if(PROTOBUF_PROTOC_EXECUTABLE) if (NOT TARGET protobuf::protoc) add_executable(protobuf::protoc IMPORTED) diff --git a/cmake/public/threads.cmake b/cmake/public/threads.cmake new file mode 100644 index 00000000000..44c3f0ed9dc --- /dev/null +++ b/cmake/public/threads.cmake @@ -0,0 +1,18 @@ +find_package(Threads REQUIRED) +# For newer CMake, Threads::Threads is already defined. Otherwise, we will +# provide a backward compatible wrapper for Threads::Threads. +if(THREADS_FOUND AND NOT TARGET Threads::Threads) + add_library(Threads::Threads INTERFACE IMPORTED) + + if(THREADS_HAVE_PTHREAD_ARG) + set_property( + TARGET Threads::Threads + PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread") + endif() + + if(CMAKE_THREAD_LIBS_INIT) + set_property( + TARGET Threads::Threads + PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") + endif() +endif() \ No newline at end of file diff --git a/cmake/public/utils.cmake b/cmake/public/utils.cmake index 88393fec699..390629ac71c 100644 --- a/cmake/public/utils.cmake +++ b/cmake/public/utils.cmake @@ -90,5 +90,9 @@ function(caffe2_binary_target target_name_or_src) endif() add_executable(${__target} ${__srcs}) target_link_libraries(${__target} ${Caffe2_MAIN_LIBS}) + # If we have Caffe2_MODULES defined, we will also link with the modules. + if (DEFINED Caffe2_MODULES) + target_link_libraries(${__target} ${Caffe2_MODULES}) + endif() install(TARGETS ${__target} DESTINATION bin) endfunction() diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index bd3dc9e164f..477caa50c4b 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -1,4 +1,8 @@ # ---[ Add modules add_subdirectory(detectron) add_subdirectory(module_test) +add_subdirectory(observers) add_subdirectory(rocksdb) + +# Finally, set Caffe2_MODULES to parent scope. +set(Caffe2_MODULES ${Caffe2_MODULES} PARENT_SCOPE) \ No newline at end of file diff --git a/modules/module_test/module_test_dynamic.cc b/modules/module_test/module_test_dynamic.cc index 12968bc419b..32596167a37 100644 --- a/modules/module_test/module_test_dynamic.cc +++ b/modules/module_test/module_test_dynamic.cc @@ -19,7 +19,7 @@ // An explicitly defined module, testing correctness when we dynamically link a // module -CAFFE2_MODULE(caffe2_module_test_dynamic, "Dynamic module for testing."); +CAFFE2_MODULE(caffe2_module_test_dynamic, "Dynamic module only used for testing."); namespace caffe2 { diff --git a/modules/observers/CMakeLists.txt b/modules/observers/CMakeLists.txt new file mode 100644 index 00000000000..7bf872e370b --- /dev/null +++ b/modules/observers/CMakeLists.txt @@ -0,0 +1,25 @@ +if (CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO) + if (NOT USE_OBSERVERS) + return() + endif() +else() + cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + project(caffe2_observers CXX) + find_package(Caffe2 REQUIRED) + option(BUILD_SHARED_LIBS "Build shared libs." ON) +endif() + +add_library(caffe2_observers + "${CMAKE_CURRENT_SOURCE_DIR}/net_observer_reporter_print.cc" + "${CMAKE_CURRENT_SOURCE_DIR}/observer_config.cc" + "${CMAKE_CURRENT_SOURCE_DIR}/perf_observer.cc" + ) +target_link_libraries(caffe2_observers PUBLIC caffe2_library) +target_include_directories(caffe2_observers PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/..) +install(TARGETS caffe2_observers DESTINATION lib) +caffe2_interface_library(caffe2_observers caffe2_observers_library) + +if (CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO) + set(Caffe2_MODULES ${Caffe2_MODULES} caffe2_observers_library PARENT_SCOPE) +endif() + diff --git a/caffe2/share/contrib/observers/net_observer_reporter.h b/modules/observers/net_observer_reporter.h similarity index 100% rename from caffe2/share/contrib/observers/net_observer_reporter.h rename to modules/observers/net_observer_reporter.h diff --git a/caffe2/share/contrib/observers/net_observer_reporter_print.cc b/modules/observers/net_observer_reporter_print.cc similarity index 87% rename from caffe2/share/contrib/observers/net_observer_reporter_print.cc rename to modules/observers/net_observer_reporter_print.cc index f28f4917292..0094d446ffe 100644 --- a/caffe2/share/contrib/observers/net_observer_reporter_print.cc +++ b/modules/observers/net_observer_reporter_print.cc @@ -1,7 +1,7 @@ -#include "caffe2/share/contrib/observers/net_observer_reporter_print.h" +#include "observers/net_observer_reporter_print.h" #include "caffe2/core/init.h" -#include "caffe2/share/contrib/observers/observer_config.h" +#include "observers/observer_config.h" namespace caffe2 { diff --git a/caffe2/share/contrib/observers/net_observer_reporter_print.h b/modules/observers/net_observer_reporter_print.h similarity index 79% rename from caffe2/share/contrib/observers/net_observer_reporter_print.h rename to modules/observers/net_observer_reporter_print.h index 6849b8d6e52..adcb5c2f88e 100644 --- a/caffe2/share/contrib/observers/net_observer_reporter_print.h +++ b/modules/observers/net_observer_reporter_print.h @@ -1,6 +1,6 @@ #pragma once -#include "caffe2/share/contrib/observers/net_observer_reporter.h" +#include "observers/net_observer_reporter.h" namespace caffe2 { diff --git a/caffe2/share/contrib/observers/observer_config.cc b/modules/observers/observer_config.cc similarity index 85% rename from caffe2/share/contrib/observers/observer_config.cc rename to modules/observers/observer_config.cc index 880ec7b6242..c6ba6a2d370 100644 --- a/caffe2/share/contrib/observers/observer_config.cc +++ b/modules/observers/observer_config.cc @@ -1,4 +1,4 @@ -#include "caffe2/share/contrib/observers/observer_config.h" +#include "observers/observer_config.h" namespace caffe2 { diff --git a/caffe2/share/contrib/observers/observer_config.h b/modules/observers/observer_config.h similarity index 98% rename from caffe2/share/contrib/observers/observer_config.h rename to modules/observers/observer_config.h index 7c39e4d2dad..8a8a32ec62d 100644 --- a/caffe2/share/contrib/observers/observer_config.h +++ b/modules/observers/observer_config.h @@ -1,6 +1,6 @@ #pragma once -#include "caffe2/share/contrib/observers/net_observer_reporter.h" +#include "observers/net_observer_reporter.h" namespace caffe2 { diff --git a/caffe2/share/contrib/observers/perf_observer.cc b/modules/observers/perf_observer.cc similarity index 97% rename from caffe2/share/contrib/observers/perf_observer.cc rename to modules/observers/perf_observer.cc index 54a5bd67307..cd98888cc3d 100644 --- a/caffe2/share/contrib/observers/perf_observer.cc +++ b/modules/observers/perf_observer.cc @@ -1,5 +1,5 @@ -#include "caffe2/share/contrib/observers/perf_observer.h" -#include "caffe2/share/contrib/observers/observer_config.h" +#include "observers/perf_observer.h" +#include "observers/observer_config.h" #include #include "caffe2/core/common.h" diff --git a/caffe2/share/contrib/observers/perf_observer.h b/modules/observers/perf_observer.h similarity index 100% rename from caffe2/share/contrib/observers/perf_observer.h rename to modules/observers/perf_observer.h diff --git a/modules/rocksdb/CMakeLists.txt b/modules/rocksdb/CMakeLists.txt index 84fe419eeee..242423e04f7 100644 --- a/modules/rocksdb/CMakeLists.txt +++ b/modules/rocksdb/CMakeLists.txt @@ -64,5 +64,5 @@ install(TARGETS caffe2_rocksdb DESTINATION lib) # Note(jiayq): this also depends on a separate cmake move to reorg test builds # and binary builds after modules. When it is done, this note should be removed. if (CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO) - list(APPEND Caffe2_MAIN_LIBS caffe2_rocksdb) + set(Caffe2_MODULES ${Caffe2_MODULES} caffe2_rocksdb PARENT_SCOPE) endif() diff --git a/modules/rocksdb/rocksdb.cc b/modules/rocksdb/rocksdb.cc index ec6813b049c..8f21c5fc2a1 100644 --- a/modules/rocksdb/rocksdb.cc +++ b/modules/rocksdb/rocksdb.cc @@ -110,4 +110,6 @@ REGISTER_CAFFE2_DB(RocksDB, RocksDB); REGISTER_CAFFE2_DB(rocksdb, RocksDB); } // namespace db + +CAFFE2_MODULE(caffe2_rocksdb, "RocksDB implementation for caffe2::DB."); } // namespace caffe2