Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions meta-refkit/conf/distro/include/refkit-supported-recipes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ bsdiff@meta-swupd
busybox@core
bzip2@core
ca-certificates@core
caffe@refkit
cairo@core
cantarell-fonts@core
chrpath@core
Expand Down Expand Up @@ -115,6 +116,7 @@ gstreamer1.0-vaapi@core
gstreamer1.0@core
gzip@core
harfbuzz@core
hdf5@refkit
hello-bundle-a@iotqa
hello-bundle-b@iotqa
hello-bundle-s@iotqa
Expand Down Expand Up @@ -144,6 +146,7 @@ keymaps@core
keyutils@security-framework
kmod@core
krb5@openembedded-layer
leveldb@openembedded-layer
libarchive@core
libatomic-ops@core
libcap@core
Expand Down Expand Up @@ -193,6 +196,7 @@ linux-firmware@core
linux-intel@intel
linux-libc-headers@core
linux-yocto@core
lmdb@refkit
lowpan-tools@networking-layer
lttng-ust@core
m4@core
Expand All @@ -208,6 +212,7 @@ nettle@core
nodejs@iotweb
ocl-icd@refkit
oe-swupd-helpers@meta-swupd
openblas@refkit
opencl-headers@refkit
opencv@openembedded-layer
openjdk-8@meta-java
Expand All @@ -234,10 +239,16 @@ python-numpy@core
python-pygobject@core
python-setuptools@core
python3-dbus@core
python3-imageio@refkit
python3-nose@core
python3-numpy@core
python3-pillow@refkit
python3-protobuf@refkit
python3-pycparser@meta-python
python3-pygobject@core
python3-pyrealsense@refkit
python3-setuptools@core
python3-six@core
python3@core
python@core
read-map@iotqa
Expand All @@ -253,6 +264,7 @@ shadow@core
shared-mime-info@core
shm-util@iotqa
smack-userspace@security-smack
snappy@refkit
soletta@soletta
speex@core
speexdsp@core
Expand Down
4 changes: 4 additions & 0 deletions meta-refkit/conf/distro/include/refkit_security_flags.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ SECURITY_CFLAGS_pn-tbb = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"
SECURITY_CFLAGS_pn-protobuf = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"
SECURITY_CFLAGS_pn-glog = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"
SECURITY_CFLAGS_pn-clang = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"
SECURITY_CFLAGS_pn-python3-pillow = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"
SECURITY_CFLAGS_pn-snappy = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"
SECURITY_CFLAGS_pn-leveldb = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"
SECURITY_CFLAGS_pn-python3-pyrealsense = "${SECURITY_NO_PIE_CFLAGS} ${SECURITY_PIC_CFLAGS}"

# openjdk-8 ends up linking with "-shared -pie -fpie" in some cases (see
# hotspot/make/linux/makefiles/saproc.make) which then tries (and fails) to
Expand Down
3 changes: 3 additions & 0 deletions meta-refkit/recipes-computervision/opencv/opencv_%.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ SRC_URI_append = " \
file://0001-opencv-link-dynamically-against-OpenCL-library.patch \
"

DEPENDS_remove = "python"
DEPENDS_append = " python3"

PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,virtual/opencl-headers virtual/opencl-icd,"
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ RDEPENDS_${PN} = " \
python3-opencv \
librealsense-examples \
viennacl-examples \
caffe-imagenet-model \
python3-pyrealsense \
"
6 changes: 6 additions & 0 deletions meta-refkit/recipes-convnet/boost/boost_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PACKAGECONFIG += "python"

do_configure_append() {
sed -i "/using python : 2.7/d" ${WORKDIR}/user-config.jam
}

93 changes: 93 additions & 0 deletions meta-refkit/recipes-convnet/caffe/caffe_git.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
DESCRIPTION = "Build Caffe library for CNN using OpenBLAS lib"
AUTHOR = "Alexander Leiva <norxander@gmail.com>"
SUMMARY = "Caffe : A fast open framework for deep learning"
HOMEPAGE = "http://caffe.berkeleyvision.org/"
LICENSE = "BSD & BVLC-model-license"
PRIORITY= "optional"
SECTION = "libs"
PR = "r0"

DEPENDS = " \
boost \
openblas \
protobuf-native \
protobuf \
glog \
gflags \
hdf5 \
opencv \
lmdb \
snappy \
leveldb \
viennacl \
ocl-icd \
python3 \
python3-native \
python3-numpy-native \
"

inherit python3native

RDEPENDS_${PN} = "python3-numpy python3-imageio python3-six python3-protobuf"

LIC_FILES_CHKSUM = "file://LICENSE;md5=91d560803ea3d191c457b12834553991"

SRC_URI = " \
git://github.com/BVLC/caffe.git;branch=opencl \
http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz;name=ilsvrc12 \
http://dl.caffe.berkeleyvision.org/bvlc_reference_caffenet.caffemodel;name=caffenet \
file://0001-Allow-setting-numpy-include-dir-from-outside.patch \
file://0002-cmake-do-not-use-SYSTEM-for-non-system-include-direc.patch \
file://0003-cmake-fix-RPATHS.patch \
file://0004-config-use-Python-3.patch \
file://0005-io-change-to-imageio.patch \
file://0006-classify-demo-added-a-demo-app-for-classifying-image.patch \
"
SRCREV = "f3ba72c520165d7c403a82770370f20472685d63"

SRC_URI[ilsvrc12.md5sum] = "f963098ea0e785a968ca1eb634003a90"
SRC_URI[ilsvrc12.sha256sum] = "e35c0c1994a21f7d8ed49d01881ce17ab766743d3b0372cdc0183ff4d0dfc491"

SRC_URI[caffenet.md5sum] = "af678f0bd3cdd2437e35679d88665170"
SRC_URI[caffenet.sha256sum] = "472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0"

S = "${WORKDIR}/git"

PACKAGES += "${PN}-imagenet-model"

RDEPENDS_${PN}-imagenet-model = "${PN}"

do_install_append() {
install -d ${D}${datadir}/Caffe/models/bvlc_reference_caffenet/
install -d ${D}${datadir}/Caffe/data/ilsvrc12

install ${S}/models/bvlc_reference_caffenet/* ${D}${datadir}/Caffe/models/bvlc_reference_caffenet/
install ${WORKDIR}/synset_words.txt ${D}${datadir}/Caffe/data/ilsvrc12
install ${WORKDIR}/bvlc_reference_caffenet.caffemodel ${D}${datadir}/Caffe/models/bvlc_reference_caffenet/

# ilsvrc_2012_mean.npy is already installed at /usr/python/caffe/imagenet/ilsvrc_2012_mean.npy
}

FILES_${PN}-imagenet-model += " \
${datadir}/Caffe/models/bvlc_reference_caffenet/* \
${datadir}/Caffe/data/ilsvrc12/* \
"
FILES_${PN} += " \
${prefix}/python/* \
"
FILES_${PN}-dev = " \
${includedir} \
${datadir}/Caffe/*cmake \
${libdir}/*.so \
"

inherit cmake python-dir

EXTRA_OECMAKE = " \
-DBLAS=open \
-DPYTHON_NUMPY_INCLUDE_DIR=${STAGING_DIR_TARGET}/usr/lib/python3.5/site-packages/numpy/core/include \
-DPYTHON_EXECUTABLE=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
-DPYTHON_INCLUDE_DIRS=${STAGING_INCDIR_TARGET}/python3-native/python3.5m \
-DPYTHON_LIBRARIES=${STAGING_LIBDIR_TARGET}/python3.5 \
"

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From 3a0407e127559d2349f0217c6c5cf7751dd1aeba Mon Sep 17 00:00:00 2001
From: Ismo Puustinen <ismo.puustinen@intel.com>
Date: Tue, 25 Oct 2016 12:09:19 +0300
Subject: [PATCH 1/6] Allow setting numpy include dir from outside.

---
cmake/Modules/FindNumPy.cmake | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/cmake/Modules/FindNumPy.cmake b/cmake/Modules/FindNumPy.cmake
index a671494..38ebb32 100644
--- a/cmake/Modules/FindNumPy.cmake
+++ b/cmake/Modules/FindNumPy.cmake
@@ -16,11 +16,16 @@ unset(NUMPY_VERSION)
unset(NUMPY_INCLUDE_DIR)

if(PYTHONINTERP_FOUND)
- execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
- "import numpy as n; print(n.__version__); print(n.get_include());"
- RESULT_VARIABLE __result
- OUTPUT_VARIABLE __output
- OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(NOT DEFINED PYTHON_NUMPY_INCLUDE_DIR)
+ execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
+ "import numpy as n; print(n.__version__); print(n.get_include());"
+ RESULT_VARIABLE __result
+ OUTPUT_VARIABLE __output
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ else()
+ SET(__result 0)
+ SET(__output "1.11.0\n${PYTHON_NUMPY_INCLUDE_DIR}")
+ endif()

if(__result MATCHES 0)
string(REGEX REPLACE ";" "\\\\;" __values ${__output})
@@ -55,4 +60,3 @@ if(NUMPY_FOUND)
endif()

caffe_clear_vars(__result __output __error_value __values __ver_check __error_value)
-
--
2.9.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
From 9e698ecf0b354a87ea0bf79ee42a4e6ec09c7669 Mon Sep 17 00:00:00 2001
From: Ismo Puustinen <ismo.puustinen@intel.com>
Date: Fri, 17 Feb 2017 14:43:21 +0200
Subject: [PATCH 2/6] cmake: do not use SYSTEM for non-system include
directories.

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
---
cmake/Dependencies.cmake | 8 ++++----
cmake/ProtoBuf.cmake | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
index 00de565..0b861af 100644
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -6,7 +6,7 @@ set(Caffe_COMPILE_OPTIONS "")

# ---[ Boost
find_package(Boost 1.46 REQUIRED COMPONENTS system thread filesystem)
-include_directories(SYSTEM PUBLIC ${Boost_INCLUDE_DIR})
+include_directories(PUBLIC ${Boost_INCLUDE_DIR})
add_definitions(-DBOOST_ALL_NO_LIB)
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${Boost_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS PUBLIC ${Boost_LIBRARIES})
@@ -66,14 +66,14 @@ else()
endif()
endif()

-include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
+include_directories(${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS PUBLIC ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${HDF5_INCLUDE_DIRS})

# 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(${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${HDF5_INCLUDE_DIRS})
list(APPEND Caffe_LINKER_LIBS PUBLIC ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
add_definitions(-DUSE_HDF5)
@@ -201,7 +201,7 @@ endif()

if(USE_NCCL)
include("cmake/External/nccl.cmake")
- include_directories(SYSTEM ${NCCL_INCLUDE_DIR})
+ include_directories(${NCCL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${NCCL_LIBRARIES})
add_definitions(-DUSE_NCCL)
endif()
diff --git a/cmake/ProtoBuf.cmake b/cmake/ProtoBuf.cmake
index 2527195..dc6285b 100644
--- a/cmake/ProtoBuf.cmake
+++ b/cmake/ProtoBuf.cmake
@@ -8,7 +8,7 @@ if(MSVC)
else()
find_package( Protobuf REQUIRED )
endif()
-include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR})
+include_directories(${PROTOBUF_INCLUDE_DIR})
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${PROTOBUF_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS PUBLIC ${PROTOBUF_LIBRARIES})

--
2.9.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From 8d9b978681b7c7d5443f5503e2075b007fb460a5 Mon Sep 17 00:00:00 2001
From: Ismo Puustinen <ismo.puustinen@intel.com>
Date: Fri, 17 Feb 2017 15:35:43 +0200
Subject: [PATCH 3/6] cmake: fix RPATHS.

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
---
cmake/Misc.cmake | 4 ----
1 file changed, 4 deletions(-)

diff --git a/cmake/Misc.cmake b/cmake/Misc.cmake
index 9dd2609..2150751 100644
--- a/cmake/Misc.cmake
+++ b/cmake/Misc.cmake
@@ -28,10 +28,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install" CACHE PATH "Default install path" FORCE)
endif()

-# ---[ RPATH settings
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOLEAN "Use link paths for shared library rpath")
-set(CMAKE_MACOSX_RPATH TRUE)
-
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib __is_systtem_dir)
if(${__is_systtem_dir} STREQUAL -1)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
--
2.9.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From a2e6ed1a11500896453c346c82713dd1869368b2 Mon Sep 17 00:00:00 2001
From: Ismo Puustinen <ismo.puustinen@intel.com>
Date: Thu, 23 Feb 2017 18:01:09 +0200
Subject: [PATCH 4/6] config: use Python 3.

Upstream-status: Inappropriate

Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6f9ca6..aceb1e8 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,7 +68,7 @@ else()
caffe_option(BUILD_SHARED_LIBS "Build shared libraries" ON)
endif()
caffe_option(BUILD_python "Build Python wrapper" ON)
-set(python_version "2" CACHE STRING "Specify which Python version to use")
+set(python_version "3" CACHE STRING "Specify which Python version to use")
caffe_option(BUILD_matlab "Build Matlab wrapper" OFF)
caffe_option(BUILD_docs "Build documentation" ON IF UNIX OR APPLE)
caffe_option(BUILD_python_layer "Build the Caffe Python layer" ON)
--
2.9.3

Loading