mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
parent
f3869b4e03
commit
b03ba9023e
|
|
@ -282,6 +282,9 @@ if(BUILD_CAFFE2)
|
|||
add_subdirectory(caffe/proto)
|
||||
endif()
|
||||
|
||||
# ---[ Shared build
|
||||
add_subdirectory(c10)
|
||||
|
||||
# ---[ Main build
|
||||
add_subdirectory(caffe2)
|
||||
|
||||
|
|
|
|||
50
c10/CMakeLists.txt
Normal file
50
c10/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
project(c10 CXX C)
|
||||
|
||||
set(LIB_SOURCES
|
||||
dummy.cpp
|
||||
)
|
||||
|
||||
set(TEST_SOURCES
|
||||
dummy_test.cpp
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
# TODO Also add some warning options that MSVC can understand
|
||||
set(WARNING_OPTIONS "")
|
||||
else()
|
||||
set(WARNING_OPTIONS
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wold-style-cast
|
||||
-Wno-missing-braces
|
||||
-Wcast-align
|
||||
-Wcast-qual
|
||||
-Wctor-dtor-privacy
|
||||
-Wdisabled-optimization
|
||||
-Wformat=2
|
||||
-Winit-self
|
||||
-Wmissing-include-dirs
|
||||
-Woverloaded-virtual
|
||||
-Wredundant-decls
|
||||
-Wshadow
|
||||
-Wsign-promo
|
||||
-Wstrict-overflow=5
|
||||
-fdiagnostics-show-option
|
||||
-Wconversion
|
||||
-Wpedantic
|
||||
-Wno-gnu-zero-variadic-macro-arguments
|
||||
-Wundef
|
||||
-Werror
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(${PROJECT_NAME} OBJECT ${LIB_SOURCES})
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE ${WARNING_OPTIONS})
|
||||
|
||||
if(BUILD_TEST)
|
||||
add_executable(${PROJECT_NAME}_test ${TEST_SOURCES} $<TARGET_OBJECTS:${PROJECT_NAME}>)
|
||||
add_test(NAME ${PROJECT_NAME}_test COMMAND $<TARGET_FILE:${PROJECT_NAME}_test>)
|
||||
target_compile_options(${PROJECT_NAME}_test PRIVATE ${WARNING_OPTIONS})
|
||||
target_link_libraries(${PROJECT_NAME}_test gtest_main)
|
||||
install(TARGETS ${PROJECT_NAME}_test DESTINATION test)
|
||||
endif()
|
||||
3
c10/dummy.cpp
Normal file
3
c10/dummy.cpp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
// This is going to be replaced with actual c10 files
|
||||
|
||||
#include <c10/dummy.h>
|
||||
3
c10/dummy.h
Normal file
3
c10/dummy.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
// This is going to be replaced with actual c10 files
|
||||
6
c10/dummy_test.cpp
Normal file
6
c10/dummy_test.cpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <c10/dummy.h>
|
||||
|
||||
TEST(DummyTest, dummy) {
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
|
@ -175,6 +175,7 @@ if(BUILD_CAFFE2)
|
|||
endif()
|
||||
|
||||
# Compile exposed libraries.
|
||||
list(APPEND Caffe2_CPU_SRCs $<TARGET_OBJECTS:c10>)
|
||||
add_library(caffe2 ${Caffe2_CPU_SRCS})
|
||||
if (BUILD_CAFFE2)
|
||||
caffe2_interface_library(caffe2_protos caffe2_protos_whole)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ if(BUILD_TEST)
|
|||
set(gtest_force_shared_crt ON)
|
||||
endif()
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest)
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googletest/include)
|
||||
include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googletest/include)
|
||||
|
||||
# We will not need to test benchmark lib itself.
|
||||
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing as we don't need it.")
|
||||
|
|
@ -674,7 +674,6 @@ if (BUILD_ATEN)
|
|||
if (USE_CUDA)
|
||||
list(APPEND Caffe2_CUDA_DEPENDENCY_LIBS aten_op_header_gen)
|
||||
endif()
|
||||
include_directories(${PROJECT_BINARY_DIR}/caffe2/contrib/aten/aten/src/ATen)
|
||||
include_directories(${PROJECT_BINARY_DIR}/caffe2/contrib/aten)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user