Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility for protobuf >= 3.11 #5

Draft
wants to merge 47 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
73ab80b
Add compatibility for protobuf >= 3.11
MatthijsBurgh Nov 4, 2022
a47bf07
(actions) add GH actions
MatthijsBurgh Nov 4, 2022
8ea31b6
(actions) fix indent
MatthijsBurgh Nov 4, 2022
bc03fdd
(actions) fix syntax
MatthijsBurgh Nov 4, 2022
d7ac6e4
(actions) restore commented include
MatthijsBurgh Nov 4, 2022
e891002
(actions) need to checkout the repo
MatthijsBurgh Nov 4, 2022
e792776
(depedabot) update GH actions
MatthijsBurgh Nov 4, 2022
8aff18d
(CI) Drop python3 support
MatthijsBurgh Nov 4, 2022
dd5a41b
(actions) drop python3 support
MatthijsBurgh Nov 4, 2022
a7a85d4
(CI) drop python2 support
MatthijsBurgh Nov 4, 2022
43d007e
(CI) drop python2 support
MatthijsBurgh Nov 4, 2022
6834715
(CI)(defaults) drop python2 support
MatthijsBurgh Nov 4, 2022
4740e07
(CI)(python) drop python2 support
MatthijsBurgh Nov 4, 2022
1dcb93a
(CI)(venv) drop python2 support
MatthijsBurgh Nov 4, 2022
a122e57
(CI) don't build protobuf from source
MatthijsBurgh Nov 4, 2022
ad51b8b
(CI) install protobuf from pip
MatthijsBurgh Nov 4, 2022
182475c
(travis) fix typo
MatthijsBurgh Nov 7, 2022
685a761
Restore Makefile.config.example
MatthijsBurgh Dec 9, 2022
9fdfcc1
(actions) run on 20.04 for now
MatthijsBurgh Dec 9, 2022
c8af02b
(travis) don't install protobuf with pip
MatthijsBurgh Dec 9, 2022
238e268
(travis) install protobuf with apt-get
MatthijsBurgh Dec 9, 2022
adb68d1
(cmake) only keep conditional HDF5 find
MatthijsBurgh Dec 10, 2022
d157137
(cmake) cleanup
MatthijsBurgh Dec 10, 2022
7c1dd7b
(cmake) remove non-existing include dir var
MatthijsBurgh Dec 10, 2022
7ec98be
(travis) add some echo's
MatthijsBurgh Dec 10, 2022
de642c1
(travis) apt-get quite
MatthijsBurgh Dec 10, 2022
a8db656
(actions) fix env vars
MatthijsBurgh Dec 10, 2022
33f14ac
Fix CV flags
MatthijsBurgh Dec 10, 2022
0b76e96
Adjust makefile to python3
MatthijsBurgh Dec 10, 2022
b47133f
add CUDNN_STATUS_VERSION_MISMATCH
MatthijsBurgh Dec 10, 2022
ef9236a
(cmake) fix python vars
MatthijsBurgh Dec 10, 2022
dae8fa3
Fix linting
MatthijsBurgh Dec 10, 2022
a9790ee
(CI) move scripts
MatthijsBurgh Dec 10, 2022
9b9eea8
(actions) no need for defaults
MatthijsBurgh Dec 10, 2022
091c6c5
(actions) log env vars
MatthijsBurgh Dec 10, 2022
86babe2
Drop pydotplus
MatthijsBurgh Dec 10, 2022
851273e
(actions) load virtualenv in each step
MatthijsBurgh Dec 10, 2022
2b19ea8
Replace deprecated assertEquals by assertEqual
MatthijsBurgh Dec 10, 2022
1bbcec2
Replace deprecated assertRaisesRegexp by assertRaisesRegex
MatthijsBurgh Dec 10, 2022
8e00b9f
(actions) run ubuntu 18.04 too
MatthijsBurgh Dec 12, 2022
3fdcb57
(actions) run ubuntu 18.04 too
MatthijsBurgh Dec 12, 2022
d96e4fa
(actions) refactor matrix
MatthijsBurgh Dec 12, 2022
cb64f2a
(actions) restore build name
MatthijsBurgh Dec 12, 2022
cf0122a
(actions) fix build name
MatthijsBurgh Dec 12, 2022
d58cc3d
(ci) use `python3 -m virtualenv` to get it working in 18.04
MatthijsBurgh Dec 12, 2022
2865e6a
(actions) Also test on ubuntu 18.04 (#1)
MatthijsBurgh Dec 12, 2022
631422c
(actions) disable make job for now
MatthijsBurgh Dec 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
50 changes: 50 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI

on: [push, pull_request, workflow_dispatch]

env:
NUM_THREADS: 4

jobs:
build:
name: ${{ matrix.env.BUILD_NAME }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
# envvar defaults:
# WITH_CMAKE: false
# WITH_IO: true
# WITH_CUDA: false
# WITH_CUDNN: false
env:
# - {BUILD_NAME: default-make}
# - {BUILD_NAME: no-io-make, WITH_IO: false}
# - {BUILD_NAME: cuda-make, WITH_CUDA: true}
# - {BUILD_NAME: cudnn-make, WITH_CUDA: true, WITH_CUDNN: true}
- {BUILD_NAME: default-cmake, WITH_CMAKE: true}
- {BUILD_NAME: no-io-cmake, WITH_CMAKE: true, WITH_IO: false}
- {BUILD_NAME: cuda-cmake, WITH_CMAKE: true, WITH_CUDA: true}
- {BUILD_NAME: cudnn-cmake, WITH_CMAKE: true, WITH_CUDA: true, WITH_CUDNN: true}
env: ${{ matrix.env }}
steps:
- uses: actions/checkout@v3
- name: Install
run: |
sudo -E ./scripts/ci/install-deps.sh
./scripts/ci/setup-venv.sh ~/venv
source ~/venv/bin/activate
./scripts/ci/install-python-deps.sh
- name: Configure
run: |
source ~/venv/bin/activate
./scripts/ci/configure.sh
- name: Build
run: |
source ~/venv/bin/activate
./scripts/ci/build.sh
- name: Test
run: |
source ~/venv/bin/activate
./scripts/ci/test.sh
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ caffe_option(USE_CUDNN "Build Caffe with cuDNN library support" ON IF NOT CPU_ON
caffe_option(USE_NCCL "Build Caffe with NCCL library support" OFF)
caffe_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
caffe_option(BUILD_python "Build Python wrapper" ON)
set(python_version "2" CACHE STRING "Specify which Python version to use")
caffe_option(BUILD_matlab "Build Matlab wrapper" OFF IF UNIX OR APPLE)
caffe_option(BUILD_docs "Build documentation" ON IF UNIX OR APPLE)
caffe_option(BUILD_python_layer "Build the Caffe Python layer" ON)
Expand Down Expand Up @@ -105,7 +104,7 @@ add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/l

# ---[ pytest target
if(BUILD_python)
add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
add_custom_target(pytest COMMAND python3 -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
add_dependencies(pytest pycaffe)
endif()

Expand Down
119 changes: 119 additions & 0 deletions Makefile.config.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!

# cuDNN acceleration switch (uncomment to build with cuDNN).
# USE_CUDNN := 1

# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1

# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0
# This code is taken from https://github.com/sh1r0/caffe-android-lib
# USE_HDF5 := 0

# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
# You should not set this flag if you will be reading LMDBs with any
# possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1

# Uncomment if you're using OpenCV 3
# OPENCV_VERSION := 3

# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++

# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas

# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib

# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app

# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_LIBRARIES := boost_python3 python3.8
PYTHON_INCLUDE := /usr/include/python3.8 \
/usr/lib/python3/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
# ANACONDA_HOME := $(HOME)/anaconda
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
# $(ANACONDA_HOME)/include/python3.8 \
# $(ANACONDA_HOME)/lib/python3.8/site-packages/numpy/core/include

# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib /usr/local/lib
# PYTHON_LIB := $(ANACONDA_HOME)/lib

# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python3 -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib

# Uncomment to support layers written in Python (will link against Python libs)
# WITH_PYTHON_LAYER := 1

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib

# NCCL acceleration switch (uncomment to build with NCCL)
# https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
# USE_NCCL := 1

# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1

# N.B. both build and distribute dirs are cleared on `make clean`
BUILD_DIR := build
DISTRIBUTE_DIR := distribute

# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1

# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0

# enable pretty build (comment to see full commands)
Q ?= @
55 changes: 21 additions & 34 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ list(APPEND Caffe_LINKER_LIBS PUBLIC ${GFLAGS_LIBRARIES})
include(cmake/ProtoBuf.cmake)

# ---[ HDF5
find_package(HDF5 COMPONENTS HL REQUIRED)
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${HDF5_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS PUBLIC ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})

# This code is taken from https://github.com/sh1r0/caffe-android-lib
if(USE_HDF5)
find_package(HDF5 COMPONENTS HL REQUIRED)
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
add_definitions(-DUSE_HDF5)
endif()
Expand Down Expand Up @@ -145,46 +141,37 @@ endif()

# ---[ Python
if(BUILD_python)
if(NOT "${python_version}" VERSION_LESS "3.0.0")
# use python3
find_package(PythonInterp 3.0)
find_package(PythonLibs 3.0)
find_package(NumPy 1.7.1)
# Find the matching boost python implementation
set(version ${PYTHONLIBS_VERSION_STRING})
# use python3
find_package(Python 3 COMPONENTS Interpreter Development NumPy)
# Find the matching boost python implementation
set(version ${Python_VERSION})

STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})

while(NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
STRING( REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version} )

STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})

while(NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
STRING( REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version} )

STRING( REGEX REPLACE "[^0-9]" "" boost_py_version ${version} )
find_package(Boost 1.46 COMPONENTS "python-py${boost_py_version}")
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})

STRING( REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version} )
if("${has_more_version}" STREQUAL "")
break()
endif()
endwhile()
if(NOT Boost_PYTHON_FOUND)
find_package(Boost 1.46 COMPONENTS python)
STRING( REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version} )
if("${has_more_version}" STREQUAL "")
break()
endif()
else()
# disable Python 3 search
find_package(PythonInterp 2.7)
find_package(PythonLibs 2.7)
find_package(NumPy 1.7.1)
endwhile()
if(NOT Boost_PYTHON_FOUND)
find_package(Boost 1.46 COMPONENTS python)
endif()
if(PYTHONLIBS_FOUND AND NUMPY_FOUND AND Boost_PYTHON_FOUND)

if(Python_Interpreter_FOUND AND Python_NumPy_FOUND AND Boost_PYTHON_FOUND)
set(HAVE_PYTHON TRUE)
if(BUILD_python_layer)
list(APPEND Caffe_DEFINITIONS PRIVATE -DWITH_PYTHON_LAYER)
list(APPEND Caffe_INCLUDE_DIRS PRIVATE ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR} PUBLIC ${Boost_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS PRIVATE ${PYTHON_LIBRARIES} PUBLIC ${Boost_LIBRARIES})
list(APPEND Caffe_INCLUDE_DIRS PRIVATE ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS} PUBLIC ${Boost_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS PRIVATE ${Python_LIBRARIES} PUBLIC ${Boost_LIBRARIES})
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/Misc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
endif()

# ---[ RPATH settings
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOLEAN "Use link paths for shared library rpath")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "Use link paths for shared library rpath")
set(CMAKE_MACOSX_RPATH TRUE)

list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
Expand Down
2 changes: 1 addition & 1 deletion cmake/ProtoBuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif()
if(PROTOBUF_FOUND)
# fetches protobuf version
caffe_parse_header(${PROTOBUF_INCLUDE_DIR}/google/protobuf/stubs/common.h VERION_LINE GOOGLE_PROTOBUF_VERSION)
string(REGEX MATCH "([0-9])00([0-9])00([0-9])" PROTOBUF_VERSION ${GOOGLE_PROTOBUF_VERSION})
string(REGEX MATCH "([0-9])0([0-9]*)00([0-9])" PROTOBUF_VERSION ${GOOGLE_PROTOBUF_VERSION})
set(PROTOBUF_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
unset(GOOGLE_PROTOBUF_VERSION)
endif()
Expand Down
9 changes: 4 additions & 5 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ function(caffe_print_configuration_summary)
caffe_status("Dependencies:")
caffe_status(" BLAS : " APPLE THEN "Yes (vecLib)" ELSE "Yes (${BLAS})")
caffe_status(" Boost : Yes (ver. ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION})")
caffe_status(" glog : Yes")
caffe_status(" gflags : Yes")
caffe_status(" glog : " GLOG_FOUND THEN "Yes" ELSE "No" )
caffe_status(" gflags : " GFLAGS_FOUND THEN "Yes" ELSE "No" )
caffe_status(" protobuf : " PROTOBUF_FOUND THEN "Yes (ver. ${PROTOBUF_VERSION})" ELSE "No" )
if(USE_LMDB)
caffe_status(" lmdb : " LMDB_FOUND THEN "Yes (ver. ${LMDB_VERSION})" ELSE "No")
Expand All @@ -153,9 +153,8 @@ function(caffe_print_configuration_summary)
endif()
if(HAVE_PYTHON)
caffe_status("Python:")
caffe_status(" Interpreter :" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver. ${PYTHON_VERSION_STRING})" ELSE "No")
caffe_status(" Libraries :" PYTHONLIBS_FOUND THEN "${PYTHON_LIBRARIES} (ver ${PYTHONLIBS_VERSION_STRING})" ELSE "No")
caffe_status(" NumPy :" NUMPY_FOUND THEN "${NUMPY_INCLUDE_DIR} (ver ${NUMPY_VERSION})" ELSE "No")
caffe_status(" Interpreter :" Python_EXECUTABLE THEN "${Python_EXECUTABLE} (ver. ${Python_VERSION})" ELSE "No")
caffe_status(" NumPy :" Python_NumPy_FOUND THEN "${Python_NumPy_INCLUDE_DIRS} (ver ${Python_NumPy_VERSION})" ELSE "No")
caffe_status("")
endif()
if(BUILD_matlab)
Expand Down
1 change: 0 additions & 1 deletion docker/gpu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ WORKDIR $CAFFE_ROOT
RUN cd /opt && \
git clone https://github.com/CMU-Perceptual-Computing-Lab/caffe.git && \
cd $CAFFE_ROOT && \
sed -i 's/set(python_version "2"/set(python_version "3"/g' CMakeLists.txt && \
# sed -i 's/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall")/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++11")/g' CMakeLists.txt && \
# sed -i 's/cudnn.h CUDNN_VERSION_FILE_CONTENTS/cudnn_version.h CUDNN_VERSION_FILE_CONTENTS/g' cmake/Cuda.cmake && \
mkdir build && cd build && \
Expand Down
4 changes: 4 additions & 0 deletions include/caffe/util/cudnn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ inline const char* cudnnGetErrorString(cudnnStatus_t status) {
return "CUDNN_STATUS_RUNTIME_IN_PROGRESS";
case CUDNN_STATUS_RUNTIME_FP_OVERFLOW:
return "CUDNN_STATUS_RUNTIME_FP_OVERFLOW";
#endif
#if CUDNN_VERSION_MIN(8, 0, 1)
case CUDNN_STATUS_VERSION_MISMATCH:
return "CUDNN_STATUS_VERSION_MISMATCH";
#endif
}
return "Unknown cudnn status";
Expand Down
4 changes: 2 additions & 2 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ file(GLOB_RECURSE python_srcs ${PROJECT_SOURCE_DIR}/python/*.cpp)
add_library(pycaffe SHARED ${python_srcs})
caffe_default_properties(pycaffe)
set_target_properties(pycaffe PROPERTIES PREFIX "" OUTPUT_NAME "_caffe")
target_include_directories(pycaffe PUBLIC ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
target_link_libraries(pycaffe PUBLIC ${Caffe_LINK} ${PYTHON_LIBRARIES})
target_include_directories(pycaffe PUBLIC ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS})
target_link_libraries(pycaffe PUBLIC ${Caffe_LINK} ${Python_LIBRARIES})

if(UNIX OR APPLE)
set(__linkname "${PROJECT_SOURCE_DIR}/python/caffe/_caffe.so")
Expand Down
10 changes: 1 addition & 9 deletions python/caffe/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@

from caffe.proto import caffe_pb2

"""
pydot is not supported under python 3 and pydot2 doesn't work properly.
pydotplus works nicely (pip install pydotplus)
"""
try:
# Try to load pydotplus
import pydotplus as pydot
except ImportError:
import pydot
import pydot

# Internal layer and blob styles.
LAYER_STYLE_DEFAULT = {'shape': 'record',
Expand Down
Loading