Skip to content

Commit

Permalink
add dependencies to the Protobuf external project
Browse files Browse the repository at this point in the history
  • Loading branch information
okapies committed Oct 15, 2018
1 parent d395001 commit 979f653
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion cmake/BuildProtobuf.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
set(PROTOBUF_VERSION_STATIC "3.6.1")
set(PROTOBUF_HASH MD5=406d5b8636576b1c86730ca5cbd1e576)

set(PROTOBUF_DIR ${CMAKE_CURRENT_BINARY_DIR}/protobuf-${PROTOBUF_VERSION_STATIC})
set(PROTOBUF_URL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION_STATIC}/protobuf-cpp-${PROTOBUF_VERSION_STATIC}.tar.gz")
set(PROTOBUF_HASH MD5=406d5b8636576b1c86730ca5cbd1e576)

# Requires `-fPIC` for linking with a shared library
set(PROTOBUF_CFLAGS "-g -O2 -fPIC")
Expand Down Expand Up @@ -34,11 +34,16 @@ set(PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARY})
set(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_DIR}/bin/protoc)
set(PROTOBUF_FOUND TRUE)

# configure protobuf::libprotobuf
add_library(protobuf::libprotobuf UNKNOWN IMPORTED)
# Note: INTERFACE_INCLUDE_DIRECTORIES can't set in this place because include/ is
# not installed during executing `cmake`
set_target_properties(protobuf::libprotobuf PROPERTIES
IMPORTED_LOCATION "${PROTOBUF_LIBRARY_STATIC}")
add_dependencies(protobuf::libprotobuf Protobuf)

# configure protobuf::protoc
add_executable(protobuf::protoc IMPORTED)
set_target_properties(protobuf::protoc PROPERTIES
IMPORTED_LOCATION "${PROTOBUF_PROTOC_EXECUTABLE}")
add_dependencies(protobuf::protoc Protobuf)
4 changes: 2 additions & 2 deletions scripts/build-menoh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ test -n "${ARG_BUILD_DIR}" || readonly ARG_BUILD_DIR="${ARG_SOURCE_DIR}/build"
test -n "${ARG_INSTALL_DIR}" || readonly ARG_INSTALL_DIR=/usr/local

if [ -n "${ARG_MKLDNN_DIR}" ]; then
OPT_MKLDNN_INCLUDE_DIR=-DMKLDNN_INCLUDE_DIR=${ARG_MKLDNN_DIR}/include
OPT_MKLDNN_LIBRARY=-DMKLDNN_LIBRARY=${ARG_MKLDNN_DIR}/lib/libmkldnn.so
readonly OPT_MKLDNN_INCLUDE_DIR=-DMKLDNN_INCLUDE_DIR=${ARG_MKLDNN_DIR}/include
readonly OPT_MKLDNN_LIBRARY=-DMKLDNN_LIBRARY=${ARG_MKLDNN_DIR}/lib/libmkldnn.so
fi

test -n "${ARG_PYTHON_EXECUTABLE}" || readonly ARG_PYTHON_EXECUTABLE=python
Expand Down

0 comments on commit 979f653

Please sign in to comment.