diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 2981fc63..71fee311 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -10,112 +10,6 @@ on: - dev-* jobs: - build_tensorflow_autotools: - runs-on: ubuntu-18.04 - strategy: - matrix: - container: ["ridgerun/r2inference-ubuntu-18.04:v0.1.5", "ridgerun/r2inference-ubuntu-16.04:v0.3.1"] - container: - image: ${{ matrix.container }} - env: - CXXFLAGS: "-Werror" - steps: - - uses: actions/checkout@v2 - - name: Install backend version - run: | - tar -C /usr/local -xzf /root/r2inference/backends/tensorflow/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz - ldconfig - - name: Configure the project - run: | - CXXFLAGS="${{ env.CXXFLAGS }}" - NOCONFIGURE=1 ./autogen.sh - ./configure --disable-docs --enable-tensorflow - - name: Build library - run: make - - name: Run tests - run: make check - - name: Install library - run: | - make install - - name: Build example - env: - LD_LIBRARY_PATH: /usr/local/lib/ - run: | - cd examples/external - make - ./list-backends - build_tflite_autotools: - runs-on: ubuntu-18.04 - strategy: - matrix: - container: ["ridgerun/r2inference-ubuntu-18.04:v0.1.5"] - container: - image: ${{ matrix.container }} - env: - TENSORFLOW_PATH: /root/r2inference/backends/tflite/v2.0.1/include/tensorflow - CPPFLAGS: "-I${TENSORFLOW_PATH} -I${TENSORFLOW_PATH}/tensorflow/lite/tools/make/downloads/flatbuffers/include" - CXXFLAGS: "-Werror" - steps: - - uses: actions/checkout@v2 - - name: Install backend version - run: | - cp /root/r2inference/backends/tflite/v2.0.1/binaries/libtensorflow-lite.a /usr/local/lib/ - - name: Configure the project - run: | - CPPFLAGS="${{ env.CPPFLAGS }}" - CXXFLAGS="${{ env.CXXFLAGS }}" - ./autogen.sh --disable-docs --enable-tflite - - name: Build library - run: make - - name: Run tests - run: make check - - name: Install library - run: | - make install - - name: Build example - env: - LD_LIBRARY_PATH: /usr/local/lib/ - run: | - cd examples/external - make - ./list-backends - build_tensorflow_tflite_autotools: - runs-on: ubuntu-18.04 - strategy: - matrix: - container: ["ridgerun/r2inference-ubuntu-18.04:v0.1.5"] - container: - image: ${{ matrix.container }} - env: - TENSORFLOW_PATH: /root/r2inference/backends/tflite/v2.0.1/include/tensorflow - CPPFLAGS: "-I${TENSORFLOW_PATH} -I${TENSORFLOW_PATH}/tensorflow/lite/tools/make/downloads/flatbuffers/include" - CXXFLAGS: "-Werror" - steps: - - uses: actions/checkout@v2 - - name: Install backend version - run: | - tar -C /usr/local -xzf /root/r2inference/backends/tensorflow/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz - ldconfig - cp /root/r2inference/backends/tflite/v2.0.1/binaries/libtensorflow-lite.a /usr/local/lib/ - - name: Configure the project - run: | - CPPFLAGS="${{ env.CPPFLAGS }}" - CXXFLAGS="${{ env.CXXFLAGS }}" - ./autogen.sh --disable-docs --enable-tensorflow --enable-tflite - - name: Build library - run: make - - name: Run tests - run: make check - - name: Install library - run: | - make install - - name: Build example - env: - LD_LIBRARY_PATH: /usr/local/lib/ - run: | - cd examples/external - make - ./list-backends build_tensorflow_meson: runs-on: ubuntu-18.04 strategy: diff --git a/.gitignore b/.gitignore index 32f4e7d9..06e6d7af 100644 --- a/.gitignore +++ b/.gitignore @@ -4,35 +4,7 @@ \#* *.orig -# Autotools cruft -aclocal.m4 -autom4te.cache/ -compile -config.guess -config.h -config.h.in -config.status -config.sub -configure -install-sh -missing -Makefile -Makefile.in -depcomp -libtool -ltmain.sh -m4/ -.deps/ -.libs/ -stamp-h* -r2inference-*.pc -*.dirstamp - # Build outputs -.deps/ -.libs/ -*.la -*.lo *.o # Git conflict files @@ -41,9 +13,6 @@ r2inference-*.pc # Doxygen outputs docs/api/out/ -# Do not ignore our M4 macros -!common/m4 - # Coverage cruft RidgeRun inference library-0.1.0-coverage* aminclude_static.am @@ -77,7 +46,5 @@ cscope.out # Examples examples/external/list-backends examples/r2i/list_parameters -examples/r2i/ncsdk/inception -examples/r2i/ncsdk/tinyyolov2 examples/r2i/tensorflow/inception examples/r2i/tensorrt/yolov2 diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index fddd55ad..00000000 --- a/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -# Keep in sync with configure.ac -ACLOCAL_AMFLAGS = -I m4 -I common/m4 - -SUBDIRS = \ - r2i - -if ENABLE_TESTS -SUBDIRS += tests -endif - -if ENABLE_EXAMPLES -SUBDIRS += examples -endif - -if ENABLE_DOCS -SUBDIRS += docs -endif - -DIST_SUBDIRS = \ - $(SUBDIRS) \ - tests \ - examples \ - docs - -@CODE_COVERAGE_RULES@ - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = r2inference-@RR_PACKAGE_VERSION@.pc - -EXTRA_DIST = r2inference.pc.in diff --git a/autogen.sh b/autogen.sh deleted file mode 120000 index 89ab55cc..00000000 --- a/autogen.sh +++ /dev/null @@ -1 +0,0 @@ -common/autogen.sh \ No newline at end of file diff --git a/common/autogen.sh b/common/autogen.sh deleted file mode 100755 index 37a81ec5..00000000 --- a/common/autogen.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -# This is an autogen base script, you can use it in your git project and add -# it Ridgerun build tools support. To include it in your project, simply do: -# -# $ ln -s common/autogen.sh autogen.sh - -LOGGER_PROJECT_TAG="AUTOGEN"; . common/logger.sh - -git_dir=.git -config_file=configure.ac -project_tag=`autoconf -t 'AC_INIT:${;}*' | cut -d\; -f1` -pre_commit_hook="common/hooks/pre-commit-hook.sh" - -run_sanity_checks() -{ - #Make sure we are in project root dir - if test ! -f $config_file ; then - log_error "You are not in root project directory" - exit 1 - fi - - #check for tools - log_info "Checking for autoreconf" - which "autoreconf" >/dev/null || - { - log_error "not found! Please install the autoconf package." - exit 1 - } - - log_info "Checking for automake" - which "automake" >/dev/null || - { - log_error "not found! Please install the automake package." - exit 1 - } - - log_info "Checking for pkg-config" - which "pkg-config" >/dev/null || - { - log_error "not found! Please install the pkg-config package." - exit 1 - } -} - -install_git_hook() -{ - #checking for hook pre-installation - if ! test -d $git_dir; then - log_info "Skipping indent git hook installation: Not a git repo" - return; - fi - - if test \( -x $git_dir/hooks/pre-commit -o -L $git_dir/hooks/pre-commit \); then - log_info "Skipping indent git hook, previous hook found." - return; - fi - - log_info "Installing indent git hook" - ln -s ../../$pre_commit_hook $git_dir/hooks/pre-commit -} - -run_autoreconf() -{ - log_info "Running autoreconf..." - autoreconf -fiv || - { - log_error "Failed to run autoreconf." - exit 1 - } -} - -run_configure() -{ - if test ! -z "$NOCONFIGURE"; then - log_info "Skipping configure step, as requested" - return; - fi - log_info "Running configure with parameters $@" - ./configure $@ || - { - log_error "Failed to run configure" - exit 1 - } - - #log_info "what do you have in package? $PACKAGE." - log_info "Now type 'make' to compile $project_tag." -} - -main() -{ - run_sanity_checks - install_git_hook - run_autoreconf - run_configure $@ -} - -main $@ diff --git a/common/linters/tests.sh b/common/linters/tests.sh index bde1b60f..14773ad6 100755 --- a/common/linters/tests.sh +++ b/common/linters/tests.sh @@ -16,7 +16,7 @@ test_driver="common/rr-test-driver.py" run_tests() { - make -s check + ninja -C build test ret=$? return $ret diff --git a/common/m4/ax_code_coverage.m4 b/common/m4/ax_code_coverage.m4 deleted file mode 100644 index 6484f033..00000000 --- a/common/m4/ax_code_coverage.m4 +++ /dev/null @@ -1,264 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CODE_COVERAGE() -# -# DESCRIPTION -# -# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, -# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included -# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every -# build target (program or library) which should be built with code -# coverage support. Also defines CODE_COVERAGE_RULES which should be -# substituted in your Makefile; and $enable_code_coverage which can be -# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined -# and substituted, and corresponds to the value of the -# --enable-code-coverage option, which defaults to being disabled. -# -# Test also for gcov program and create GCOV variable that could be -# substituted. -# -# Note that all optimization flags in CFLAGS must be disabled when code -# coverage is enabled. -# -# Usage example: -# -# configure.ac: -# -# AX_CODE_COVERAGE -# -# Makefile.am: -# -# @CODE_COVERAGE_RULES@ -# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... -# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... -# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... -# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... -# -# This results in a "check-code-coverage" rule being added to any -# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module -# has been configured with --enable-code-coverage). Running `make -# check-code-coverage` in that directory will run the module's test suite -# (`make check`) and build a code coverage report detailing the code which -# was touched, then print the URI for the report. -# -# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined -# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of -# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is -# deprecated. They have the same value. -# -# This code was derived from Makefile.decl in GLib, originally licenced -# under LGPLv2.1+. -# -# LICENSE -# -# Copyright (c) 2012, 2016 Philip Withnall -# Copyright (c) 2012 Xan Lopez -# Copyright (c) 2012 Christian Persch -# Copyright (c) 2012 Paolo Borelli -# Copyright (c) 2012 Dan Winship -# Copyright (c) 2015 Bastien ROUCARIES -# -# This library is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or (at -# your option) any later version. -# -# This library is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser -# General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see . - -#serial 25 - -AC_DEFUN([AX_CODE_COVERAGE],[ - dnl Check for --enable-code-coverage - AC_REQUIRE([AC_PROG_SED]) - - # allow to override gcov location - AC_ARG_WITH([gcov], - [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], - [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], - [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) - - AC_MSG_CHECKING([whether to build with code coverage support]) - AC_ARG_ENABLE([code-coverage], - AS_HELP_STRING([--enable-code-coverage], - [Whether to enable code coverage support]),, - enable_code_coverage=no) - - AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes]) - AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) - AC_MSG_RESULT($enable_code_coverage) - - AS_IF([ test "$enable_code_coverage" = "yes" ], [ - # check for gcov - AC_CHECK_TOOL([GCOV], - [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], - [:]) - AS_IF([test "X$GCOV" = "X:"], - [AC_MSG_ERROR([gcov is needed to do coverage])]) - AC_SUBST([GCOV]) - - dnl Check if gcc is being used - AS_IF([ test "$GCC" = "no" ], [ - AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) - ]) - - AC_CHECK_PROG([LCOV], [lcov], [lcov]) - AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) - - AS_IF([ test -z "$LCOV" ], [ - AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed]) - ]) - - AS_IF([ test -z "$GENHTML" ], [ - AC_MSG_ERROR([Could not find genhtml from the lcov package]) - ]) - - dnl Build the code coverage flags - dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility - CODE_COVERAGE_CPPFLAGS="-DNDEBUG" - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_LIBS="-lgcov" - CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS" - - AC_SUBST([CODE_COVERAGE_CPPFLAGS]) - AC_SUBST([CODE_COVERAGE_CFLAGS]) - AC_SUBST([CODE_COVERAGE_CXXFLAGS]) - AC_SUBST([CODE_COVERAGE_LIBS]) - AC_SUBST([CODE_COVERAGE_LDFLAGS]) - - [CODE_COVERAGE_RULES_CHECK=' - -$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check - $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture -'] - [CODE_COVERAGE_RULES_CAPTURE=' - $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) - $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) - -@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp - $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) - @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" -'] - [CODE_COVERAGE_RULES_CLEAN=' -clean: code-coverage-clean -distclean: code-coverage-clean -code-coverage-clean: - -$(LCOV) --directory $(top_builddir) -z - -rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete -'] - ], [ - [CODE_COVERAGE_RULES_CHECK=' - @echo "Need to reconfigure with --enable-code-coverage" -'] - CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK" - CODE_COVERAGE_RULES_CLEAN='' - ]) - -[CODE_COVERAGE_RULES=' -# Code coverage -# -# Optional: -# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. -# Multiple directories may be specified, separated by whitespace. -# (Default: $(top_builddir)) -# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated -# by lcov for code coverage. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) -# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage -# reports to be created. (Default: -# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) -# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, -# set to 0 to disable it and leave empty to stay with the default. -# (Default: empty) -# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov -# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) -# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov -# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) -# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov -# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the -# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov -# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering -# lcov instance. (Default: empty) -# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov -# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) -# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the -# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) -# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml -# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) -# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore -# -# The generated report will be titled using the $(PACKAGE_NAME) and -# $(PACKAGE_VERSION). In order to add the current git hash to the title, -# use the git-version-gen script, available online. - -# Optional variables -CODE_COVERAGE_DIRECTORY ?= $(top_builddir) -CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info -CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage -CODE_COVERAGE_BRANCH_COVERAGE ?= -CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ ---rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) -CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" -CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) -CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) -CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= -CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) -CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ -$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\ ---rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) -CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) -CODE_COVERAGE_IGNORE_PATTERN ?= - -GITIGNOREFILES ?= -GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) - -code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) -code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\ - $(CODE_COVERAGE_OUTPUT_FILE); -code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) -code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\ - $(CODE_COVERAGE_IGNORE_PATTERN); -code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) -code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) -code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY); -code_coverage_quiet = $(code_coverage_quiet_$(V)) -code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) -code_coverage_quiet_0 = --quiet - -# sanitizes the test-name: replaces with underscores: dashes and dots -code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) - -# Use recursive makes in order to ignore errors during check -check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"' - -# Capture code coverage data -code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"' - -# Hook rule executed before code-coverage-capture, overridable by the user -code-coverage-capture-hook: - -'"$CODE_COVERAGE_RULES_CLEAN"' - -A''M_DISTCHECK_CONFIGURE_FLAGS ?= -A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage - -.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean -'] - - AC_SUBST([CODE_COVERAGE_RULES]) - m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])]) -]) diff --git a/common/m4/ax_cxx_compile_stdcxx.m4 b/common/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 67a9ddf2..00000000 --- a/common/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,667 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard), or '0x' for some set of C++0x features. -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016 Matthias Koeppe -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 4 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [0x], [], - [$1], [11], [], - [$1], [14], [], - [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++$1 -std=gnu++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - -dnl Test body for checking minimal C++0x support -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_0x], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_0x -) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - - -dnl Tests for minimal C++0x features - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_0x], [[ - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#else - -namespace cxx0x -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - -} // namespace cxx0x - -#endif // __cplusplus - -]]) - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_seperators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) diff --git a/common/m4/ax_cxx_compile_stdcxx_11.m4 b/common/m4/ax_cxx_compile_stdcxx_11.m4 deleted file mode 100644 index 0aadeafe..00000000 --- a/common/m4/ax_cxx_compile_stdcxx_11.m4 +++ /dev/null @@ -1,39 +0,0 @@ -# ============================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html -# ============================================================================ -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++11 -# standard; if necessary, add switches to CXX and CXXCPP to enable -# support. -# -# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX -# macro with the version set to C++11. The two optional arguments are -# forwarded literally as the second and third argument respectively. -# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for -# more information. If you want to use this macro, you also need to -# download the ax_cxx_compile_stdcxx.m4 file. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 17 - -AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) -AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) diff --git a/common/m4/ax_prog_doxygen.m4 b/common/m4/ax_prog_doxygen.m4 deleted file mode 100644 index a371f7fd..00000000 --- a/common/m4/ax_prog_doxygen.m4 +++ /dev/null @@ -1,586 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html -# =========================================================================== -# -# SYNOPSIS -# -# DX_INIT_DOXYGEN(PROJECT-NAME, [DOXYFILE-PATH], [OUTPUT-DIR], ...) -# DX_DOXYGEN_FEATURE(ON|OFF) -# DX_DOT_FEATURE(ON|OFF) -# DX_HTML_FEATURE(ON|OFF) -# DX_CHM_FEATURE(ON|OFF) -# DX_CHI_FEATURE(ON|OFF) -# DX_MAN_FEATURE(ON|OFF) -# DX_RTF_FEATURE(ON|OFF) -# DX_XML_FEATURE(ON|OFF) -# DX_PDF_FEATURE(ON|OFF) -# DX_PS_FEATURE(ON|OFF) -# -# DESCRIPTION -# -# The DX_*_FEATURE macros control the default setting for the given -# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for -# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML -# help (for MS users), 'CHI' for generating a separate .chi file by the -# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate -# output formats. The environment variable DOXYGEN_PAPER_SIZE may be -# specified to override the default 'a4wide' paper size. -# -# By default, HTML, PDF and PS documentation is generated as this seems to -# be the most popular and portable combination. MAN pages created by -# Doxygen are usually problematic, though by picking an appropriate subset -# and doing some massaging they might be better than nothing. CHM and RTF -# are specific for MS (note that you can't generate both HTML and CHM at -# the same time). The XML is rather useless unless you apply specialized -# post-processing to it. -# -# The macros mainly control the default state of the feature. The use can -# override the default by specifying --enable or --disable. The macros -# ensure that contradictory flags are not given (e.g., -# --enable-doxygen-html and --enable-doxygen-chm, -# --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each -# feature will be automatically disabled (with a warning) if the required -# programs are missing. -# -# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN -# with the following parameters: a one-word name for the project for use -# as a filename base etc., an optional configuration file name (the -# default is '$(srcdir)/Doxyfile', the same as Doxygen's default), and an -# optional output directory name (the default is 'doxygen-doc'). To run -# doxygen multiple times for different configuration files and output -# directories provide more parameters: the second, forth, sixth, etc -# parameter are configuration file names and the third, fifth, seventh, -# etc parameter are output directories. No checking is done to catch -# duplicates. -# -# Automake Support -# -# The DX_RULES substitution can be used to add all needed rules to the -# Makefile. Note that this is a substitution without being a variable: -# only the @DX_RULES@ syntax will work. -# -# The provided targets are: -# -# doxygen-doc: Generate all doxygen documentation. -# -# doxygen-run: Run doxygen, which will generate some of the -# documentation (HTML, CHM, CHI, MAN, RTF, XML) -# but will not do the post processing required -# for the rest of it (PS, PDF). -# -# doxygen-ps: Generate doxygen PostScript documentation. -# -# doxygen-pdf: Generate doxygen PDF documentation. -# -# Note that by default these are not integrated into the automake targets. -# If doxygen is used to generate man pages, you can achieve this -# integration by setting man3_MANS to the list of man pages generated and -# then adding the dependency: -# -# $(man3_MANS): doxygen-doc -# -# This will cause make to run doxygen and generate all the documentation. -# -# The following variable is intended for use in Makefile.am: -# -# DX_CLEANFILES = everything to clean. -# -# Then add this variable to MOSTLYCLEANFILES. -# -# LICENSE -# -# Copyright (c) 2009 Oren Ben-Kiki -# Copyright (c) 2015 Olaf Mandel -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 23 - -## ----------## -## Defaults. ## -## ----------## - -DX_ENV="" -AC_DEFUN([DX_FEATURE_doc], ON) -AC_DEFUN([DX_FEATURE_dot], OFF) -AC_DEFUN([DX_FEATURE_man], OFF) -AC_DEFUN([DX_FEATURE_html], ON) -AC_DEFUN([DX_FEATURE_chm], OFF) -AC_DEFUN([DX_FEATURE_chi], OFF) -AC_DEFUN([DX_FEATURE_rtf], OFF) -AC_DEFUN([DX_FEATURE_xml], OFF) -AC_DEFUN([DX_FEATURE_pdf], ON) -AC_DEFUN([DX_FEATURE_ps], ON) - -## --------------- ## -## Private macros. ## -## --------------- ## - -# DX_ENV_APPEND(VARIABLE, VALUE) -# ------------------------------ -# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen and add it -# as a substitution (but not a Makefile variable). The substitution -# is skipped if the variable name is VERSION. -AC_DEFUN([DX_ENV_APPEND], -[AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])dnl -m4_if([$1], [VERSION], [], [AC_SUBST([$1], [$2])dnl -AM_SUBST_NOTMAKE([$1])])dnl -]) - -# DX_DIRNAME_EXPR -# --------------- -# Expand into a shell expression prints the directory part of a path. -AC_DEFUN([DX_DIRNAME_EXPR], - [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) - -# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) -# ------------------------------------- -# Expands according to the M4 (static) status of the feature. -AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) - -# DX_REQUIRE_PROG(VARIABLE, PROGRAM) -# ---------------------------------- -# Require the specified program to be found for the DX_CURRENT_FEATURE to work. -AC_DEFUN([DX_REQUIRE_PROG], [ -AC_PATH_TOOL([$1], [$2]) -if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then - AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) - AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) -fi -]) - -# DX_TEST_FEATURE(FEATURE) -# ------------------------ -# Expand to a shell expression testing whether the feature is active. -AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) - -# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) -# ------------------------------------------------- -# Verify that a required features has the right state before trying to turn on -# the DX_CURRENT_FEATURE. -AC_DEFUN([DX_CHECK_DEPEND], [ -test "$DX_FLAG_$1" = "$2" \ -|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, - requires, contradicts) doxygen-DX_CURRENT_FEATURE]) -]) - -# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) -# ---------------------------------------------------------- -# Turn off the DX_CURRENT_FEATURE if the required feature is off. -AC_DEFUN([DX_CLEAR_DEPEND], [ -test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) -]) - -# DX_FEATURE_ARG(FEATURE, DESCRIPTION, -# CHECK_DEPEND, CLEAR_DEPEND, -# REQUIRE, DO-IF-ON, DO-IF-OFF) -# -------------------------------------------- -# Parse the command-line option controlling a feature. CHECK_DEPEND is called -# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), -# otherwise CLEAR_DEPEND is called to turn off the default state if a required -# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional -# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and -# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. -AC_DEFUN([DX_ARG_ABLE], [ - AC_DEFUN([DX_CURRENT_FEATURE], [$1]) - AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) - AC_ARG_ENABLE(doxygen-$1, - [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], - [--enable-doxygen-$1]), - DX_IF_FEATURE([$1], [don't $2], [$2]))], - [ -case "$enableval" in -#( -y|Y|yes|Yes|YES) - AC_SUBST([DX_FLAG_$1], 1) - $3 -;; #( -n|N|no|No|NO) - AC_SUBST([DX_FLAG_$1], 0) -;; #( -*) - AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) -;; -esac -], [ -AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) -$4 -]) -if DX_TEST_FEATURE([$1]); then - $5 - : -fi -if DX_TEST_FEATURE([$1]); then - $6 - : -else - $7 - : -fi -]) - -## -------------- ## -## Public macros. ## -## -------------- ## - -# DX_XXX_FEATURE(DEFAULT_STATE) -# ----------------------------- -AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) -AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])]) -AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) -AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) -AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) -AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) -AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) -AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) - -# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR], ...) -# -------------------------------------------------------------- -# PROJECT also serves as the base name for the documentation files. -# The default CONFIG-FILE is "$(srcdir)/Doxyfile" and OUTPUT-DOC-DIR is -# "doxygen-doc". -# More arguments are interpreted as interleaved CONFIG-FILE and -# OUTPUT-DOC-DIR values. -AC_DEFUN([DX_INIT_DOXYGEN], [ - -# Files: -AC_SUBST([DX_PROJECT], [$1]) -AC_SUBST([DX_CONFIG], ['ifelse([$2], [], [$(srcdir)/Doxyfile], [$2])']) -AC_SUBST([DX_DOCDIR], ['ifelse([$3], [], [doxygen-doc], [$3])']) -m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 4, m4_count($@), 2, - [AC_SUBST([DX_CONFIG]m4_eval(DX_i[/2]), - 'm4_default_nblank_quoted(m4_argn(DX_i, $@), - [$(srcdir)/Doxyfile])')])])dnl -m4_if(m4_eval(3 < m4_count($@)), 1, [m4_for([DX_i], 5, m4_count($@,), 2, - [AC_SUBST([DX_DOCDIR]m4_eval([(]DX_i[-1)/2]), - 'm4_default_nblank_quoted(m4_argn(DX_i, $@), - [doxygen-doc])')])])dnl -m4_define([DX_loop], m4_dquote(m4_if(m4_eval(3 < m4_count($@)), 1, - [m4_for([DX_i], 4, m4_count($@), 2, [, m4_eval(DX_i[/2])])], - [])))dnl - -# Environment variables used inside doxygen.cfg: -DX_ENV_APPEND(SRCDIR, $srcdir) -DX_ENV_APPEND(PROJECT, $DX_PROJECT) -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) - -# Doxygen itself: -DX_ARG_ABLE(doc, [generate any doxygen documentation], - [], - [], - [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) - DX_REQUIRE_PROG([DX_PERL], perl)], - [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) - -# Dot for graphics: -DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_DOT], dot)], - [DX_ENV_APPEND(HAVE_DOT, YES) - DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], - [DX_ENV_APPEND(HAVE_DOT, NO)]) - -# Man pages generation: -DX_ARG_ABLE(man, [generate doxygen manual pages], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_MAN, YES)], - [DX_ENV_APPEND(GENERATE_MAN, NO)]) - -# RTF file generation: -DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_RTF, YES)], - [DX_ENV_APPEND(GENERATE_RTF, NO)]) - -# XML file generation: -DX_ARG_ABLE(xml, [generate doxygen XML documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_XML, YES)], - [DX_ENV_APPEND(GENERATE_XML, NO)]) - -# (Compressed) HTML help generation: -DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_HHC], hhc)], - [DX_ENV_APPEND(HHC_PATH, $DX_HHC) - DX_ENV_APPEND(GENERATE_HTML, YES) - DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], - [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) - -# Separate CHI file generation. -DX_ARG_ABLE(chi, [generate doxygen separate compressed HTML help index file], - [DX_CHECK_DEPEND(chm, 1)], - [DX_CLEAR_DEPEND(chm, 1)], - [], - [DX_ENV_APPEND(GENERATE_CHI, YES)], - [DX_ENV_APPEND(GENERATE_CHI, NO)]) - -# Plain HTML pages generation: -DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], - [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], - [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], - [], - [DX_ENV_APPEND(GENERATE_HTML, YES)], - [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) - -# PostScript file generation: -DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_LATEX], latex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_DVIPS], dvips) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# PDF file generation: -DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# LaTeX generation for PS and/or PDF: -if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then - DX_ENV_APPEND(GENERATE_LATEX, YES) -else - DX_ENV_APPEND(GENERATE_LATEX, NO) -fi - -# Paper size for PS and/or PDF: -AC_ARG_VAR(DOXYGEN_PAPER_SIZE, - [a4wide (default), a4, letter, legal or executive]) -case "$DOXYGEN_PAPER_SIZE" in -#( -"") - AC_SUBST(DOXYGEN_PAPER_SIZE, "") -;; #( -a4wide|a4|letter|legal|executive) - DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) -;; #( -*) - AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) -;; -esac - -# Rules: -AS_IF([[test $DX_FLAG_html -eq 1]], -[[DX_SNIPPET_html="## ------------------------------- ## -## Rules specific for HTML output. ## -## ------------------------------- ## - -DX_CLEAN_HTML = \$(DX_DOCDIR)/html]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/html]])[ - -"]], -[[DX_SNIPPET_html=""]]) -AS_IF([[test $DX_FLAG_chi -eq 1]], -[[DX_SNIPPET_chi=" -DX_CLEAN_CHI = \$(DX_DOCDIR)/\$(PACKAGE).chi]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).chi]])["]], -[[DX_SNIPPET_chi=""]]) -AS_IF([[test $DX_FLAG_chm -eq 1]], -[[DX_SNIPPET_chm="## ------------------------------ ## -## Rules specific for CHM output. ## -## ------------------------------ ## - -DX_CLEAN_CHM = \$(DX_DOCDIR)/chm]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/chm]])[\ -${DX_SNIPPET_chi} - -"]], -[[DX_SNIPPET_chm=""]]) -AS_IF([[test $DX_FLAG_man -eq 1]], -[[DX_SNIPPET_man="## ------------------------------ ## -## Rules specific for MAN output. ## -## ------------------------------ ## - -DX_CLEAN_MAN = \$(DX_DOCDIR)/man]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/man]])[ - -"]], -[[DX_SNIPPET_man=""]]) -AS_IF([[test $DX_FLAG_rtf -eq 1]], -[[DX_SNIPPET_rtf="## ------------------------------ ## -## Rules specific for RTF output. ## -## ------------------------------ ## - -DX_CLEAN_RTF = \$(DX_DOCDIR)/rtf]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/rtf]])[ - -"]], -[[DX_SNIPPET_rtf=""]]) -AS_IF([[test $DX_FLAG_xml -eq 1]], -[[DX_SNIPPET_xml="## ------------------------------ ## -## Rules specific for XML output. ## -## ------------------------------ ## - -DX_CLEAN_XML = \$(DX_DOCDIR)/xml]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/xml]])[ - -"]], -[[DX_SNIPPET_xml=""]]) -AS_IF([[test $DX_FLAG_ps -eq 1]], -[[DX_SNIPPET_ps="## ----------------------------- ## -## Rules specific for PS output. ## -## ----------------------------- ## - -DX_CLEAN_PS = \$(DX_DOCDIR)/\$(PACKAGE).ps]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps]])[ - -DX_PS_GOAL = doxygen-ps - -doxygen-ps: \$(DX_CLEAN_PS) - -]m4_foreach([DX_i], [DX_loop], -[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).ps: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag - \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\ - rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ - \$(DX_LATEX) refman.tex; \\ - \$(DX_MAKEINDEX) refman.idx; \\ - \$(DX_LATEX) refman.tex; \\ - countdown=5; \\ - while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ - refman.log > /dev/null 2>&1 \\ - && test \$\$countdown -gt 0; do \\ - \$(DX_LATEX) refman.tex; \\ - countdown=\`expr \$\$countdown - 1\`; \\ - done; \\ - \$(DX_DVIPS) -o ../\$(PACKAGE).ps refman.dvi - -]])["]], -[[DX_SNIPPET_ps=""]]) -AS_IF([[test $DX_FLAG_pdf -eq 1]], -[[DX_SNIPPET_pdf="## ------------------------------ ## -## Rules specific for PDF output. ## -## ------------------------------ ## - -DX_CLEAN_PDF = \$(DX_DOCDIR)/\$(PACKAGE).pdf]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf]])[ - -DX_PDF_GOAL = doxygen-pdf - -doxygen-pdf: \$(DX_CLEAN_PDF) - -]m4_foreach([DX_i], [DX_loop], -[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).pdf: \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag - \$(DX_V_LATEX)cd \$(DX_DOCDIR]DX_i[)/latex; \\ - rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \\ - \$(DX_PDFLATEX) refman.tex; \\ - \$(DX_MAKEINDEX) refman.idx; \\ - \$(DX_PDFLATEX) refman.tex; \\ - countdown=5; \\ - while \$(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \\ - refman.log > /dev/null 2>&1 \\ - && test \$\$countdown -gt 0; do \\ - \$(DX_PDFLATEX) refman.tex; \\ - countdown=\`expr \$\$countdown - 1\`; \\ - done; \\ - mv refman.pdf ../\$(PACKAGE).pdf - -]])["]], -[[DX_SNIPPET_pdf=""]]) -AS_IF([[test $DX_FLAG_ps -eq 1 -o $DX_FLAG_pdf -eq 1]], -[[DX_SNIPPET_latex="## ------------------------------------------------- ## -## Rules specific for LaTeX (shared for PS and PDF). ## -## ------------------------------------------------- ## - -DX_V_LATEX = \$(_DX_v_LATEX_\$(V)) -_DX_v_LATEX_ = \$(_DX_v_LATEX_\$(AM_DEFAULT_VERBOSITY)) -_DX_v_LATEX_0 = @echo \" LATEX \" \$][@; - -DX_CLEAN_LATEX = \$(DX_DOCDIR)/latex]dnl -m4_foreach([DX_i], [m4_shift(DX_loop)], [[\\ - \$(DX_DOCDIR]DX_i[)/latex]])[ - -"]], -[[DX_SNIPPET_latex=""]]) - -AS_IF([[test $DX_FLAG_doc -eq 1]], -[[DX_SNIPPET_doc="## --------------------------------- ## -## Format-independent Doxygen rules. ## -## --------------------------------- ## - -${DX_SNIPPET_html}\ -${DX_SNIPPET_chm}\ -${DX_SNIPPET_man}\ -${DX_SNIPPET_rtf}\ -${DX_SNIPPET_xml}\ -${DX_SNIPPET_ps}\ -${DX_SNIPPET_pdf}\ -${DX_SNIPPET_latex}\ -DX_V_DXGEN = \$(_DX_v_DXGEN_\$(V)) -_DX_v_DXGEN_ = \$(_DX_v_DXGEN_\$(AM_DEFAULT_VERBOSITY)) -_DX_v_DXGEN_0 = @echo \" DXGEN \" \$<; - -.PHONY: doxygen-run doxygen-doc \$(DX_PS_GOAL) \$(DX_PDF_GOAL) - -.INTERMEDIATE: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) - -doxygen-run:]m4_foreach([DX_i], [DX_loop], - [[ \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag]])[ - -doxygen-doc: doxygen-run \$(DX_PS_GOAL) \$(DX_PDF_GOAL) - -]m4_foreach([DX_i], [DX_loop], -[[\$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag: \$(DX_CONFIG]DX_i[) \$(pkginclude_HEADERS) - \$(A""M_V_at)rm -rf \$(DX_DOCDIR]DX_i[) - \$(DX_V_DXGEN)\$(DX_ENV) DOCDIR=\$(DX_DOCDIR]DX_i[) \$(DX_DOXYGEN) \$(DX_CONFIG]DX_i[) - \$(A""M_V_at)echo Timestamp >\$][@ - -]])dnl -[DX_CLEANFILES = \\] -m4_foreach([DX_i], [DX_loop], -[[ \$(DX_DOCDIR]DX_i[)/doxygen_sqlite3.db \\ - \$(DX_DOCDIR]DX_i[)/\$(PACKAGE).tag \\ -]])dnl -[ -r \\ - \$(DX_CLEAN_HTML) \\ - \$(DX_CLEAN_CHM) \\ - \$(DX_CLEAN_CHI) \\ - \$(DX_CLEAN_MAN) \\ - \$(DX_CLEAN_RTF) \\ - \$(DX_CLEAN_XML) \\ - \$(DX_CLEAN_PS) \\ - \$(DX_CLEAN_PDF) \\ - \$(DX_CLEAN_LATEX)"]], -[[DX_SNIPPET_doc=""]]) -AC_SUBST([DX_RULES], -["${DX_SNIPPET_doc}"])dnl -AM_SUBST_NOTMAKE([DX_RULES]) - -#For debugging: -#echo DX_FLAG_doc=$DX_FLAG_doc -#echo DX_FLAG_dot=$DX_FLAG_dot -#echo DX_FLAG_man=$DX_FLAG_man -#echo DX_FLAG_html=$DX_FLAG_html -#echo DX_FLAG_chm=$DX_FLAG_chm -#echo DX_FLAG_chi=$DX_FLAG_chi -#echo DX_FLAG_rtf=$DX_FLAG_rtf -#echo DX_FLAG_xml=$DX_FLAG_xml -#echo DX_FLAG_pdf=$DX_FLAG_pdf -#echo DX_FLAG_ps=$DX_FLAG_ps -#echo DX_ENV=$DX_ENV -]) diff --git a/common/m4/rr-check-cuda.m4 b/common/m4/rr-check-cuda.m4 deleted file mode 100644 index aba89fde..00000000 --- a/common/m4/rr-check-cuda.m4 +++ /dev/null @@ -1,246 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# RR_CHECK_CUDA_GPU -# -# Checks if the system has a GPU or not. If so, this code gets some valuable -# information from the output of the deviceQuery tool present in the CUDA samples -# folder. This macro also add the compute capability to CFLAGS. -# -# If a GPU exists, this function fills variables with important information: -# -# * DRIVER_VERSION: CUDA driver version -# * RUNTIME_VERSION: CUDA runtime version -# * GLOBAL_MEMORY: Total amount of global memory -# * THREADS_BLOCK: Maximum threads per block -# * THREADS_MULTIPROC: Maximum threads per multiprocessor -# * CAPABILITY: CUDA capability major/minor version number -# -# RR_CHECK_CUDA -# -# Checks for CUDA in the default or given PREFIX location and fill the flags -# -# Checks the existance of cuda compiler (nvcc), cuda library header and -# binary (cuda.h, libcuda.so). If something isn't found, fails straight -# away. Also checks for the system's ability to run cuInit, because some -# systems may want to compile for CUDA without execution support. -# -# --with-cuda=PREFIX Sets the CUDA installation pathnd. -# Switches --with-platform to gpu. -# Default prefix is /usr/local/cuda -# -# --with-platform=[auto|cpu|gpu] Sets the desired platform for compilation. -# Default platform is auto. -# "auto" platform will search for CUDA and use -# GPU if the compilation requisites are present. -# -# Fills variables to compile CUDA: NVCC, CUDA_CFLAGS, CUDA_LIBS and CUDA_LIBDIR -# Defines CUDA compilation flag and makefile conditional: PLATFORM_IS_GPU -# -# Based on Building a CUDA Device Function Library With Autotools: -# https://tschoonj.github.io/blog/2014/05/10/building-a-cuda-device-function-library-with-autotools/ - -AC_DEFUN([RR_CHECK_CUDA_GPU], [ - check_path="$cuda_prefix/samples/1_Utilities/deviceQuery/" - file_name="deviceQuery" - - if [[ -d "$check_path" ]]; then - if [[ ! -x $check_path$file_name ]]; then - AC_MSG_ERROR([CUDA deviceQuery is needed to detect your hardware specs and it does not seems to be installed on your system. -To compile it please run: - ~$ sudo make -On your: '$check_path' directory.]) - fi - RESULT=$($check_path$file_name | grep -oP "(?<=Result = )[[^ ]]+") - if [[ "$RESULT" == "PASS" ]]; then - AC_MSG_NOTICE([GPU test result: $RESULT]) - VALID_CUDA_EXE=yes - - DRIVER_VERSION=$($check_path$file_name | grep -oP "(?<=CUDA Driver Version = ).*?(?=,)") - AC_MSG_NOTICE([Current CUDA driver version: $DRIVER_VERSION]) - - RUNTIME_VERSION=$($check_path$file_name | grep -oP "(?<=CUDA Runtime Version = ).*?(?=,)") - AC_MSG_NOTICE([Current CUDA runtime version: $RUNTIME_VERSION]) - - sort_version=$(echo "$RUNTIME_VERSION $DRIVER_VERSION" | tr " " "\n" | sort -V) - greatest_version=$(echo $sort_version | tr "\n" " " | cut -d " " -f2) - if [[[ $greatest_version == $DRIVER_VERSION ]]] && [[[ $RUNTIME_VERSION > $DRIVER_VERSION ]]]; then - AC_MSG_ERROR([The runtime version is lower than the driver version]) - else - GLOBAL_MEMORY=$($check_path$file_name | grep "global memory" | grep -oP "\(\K[[^ bytes)]]+") - AC_MSG_NOTICE([Total amount of global memory: $GLOBAL_MEMORY bytes]) - - BLOCKS_WARP=$($check_path$file_name | grep "Warp size" | grep -oP "[[0-9]]+") - AC_MSG_NOTICE([Number of blocks per warp: $BLOCKS_WARP]) - - THREADS_MULTIPROC=$($check_path$file_name | grep "threads per multiprocessor" | grep -oP "[[0-9]]+") - AC_MSG_NOTICE([Number of threads per multiprocessor: $THREADS_MULTIPROC]) - - THREADS_BLOCK=$($check_path$file_name | grep "threads per block" | grep -oP "[[0-9]]+") - AC_MSG_NOTICE([Number of threads per block: $THREADS_BLOCK]) - - CAPABILITY=$($check_path$file_name | grep "Capability" | grep -oP "[[0-9]]+.[[0-9]]+" | tr -d .) - AC_MSG_NOTICE([CUDA capability version number: $CAPABILITY]) - CUDA_CFLAGS+=" --gpu-architecture=compute_$CAPABILITY" - fi - else - VALID_CUDA_EXE=no - AC_MSG_NOTICE([GPU test result: $RESULT]) - AC_MSG_NOTICE([The system does not have GPU]) - fi - fi -]) - -AC_DEFUN([RR_CHECK_CUDA], [ - -# Provide platform preference -AC_ARG_WITH([platform], AS_HELP_STRING([--with-platform], - [Specify the platform to use: auto|cpu|gpu.]), - [with_platform=$withval],[with_platform=auto]) - -case $with_platform in - auto ) - ;; - cpu ) - ;; - gpu ) - ;; - * ) - AC_MSG_ERROR([Please specify the platform to use: auto|cpu|gpu]) ;; -esac -AC_MSG_NOTICE([Setting platform preference to: "$with_platform"]) - -# Provide CUDA path -AC_ARG_WITH([cuda], - AS_HELP_STRING([--with-cuda=PREFIX],[Prefix of your CUDA installation]), - [cuda_prefix=$withval; with_cuda="yes"], - [cuda_prefix="/usr/local/cuda"; with_cuda="no"]) - -# Setting the prefix to the default if only --with-cuda was given -if test "$with_cuda" == "yes"; then - if test "$with_platform" != "gpu"; then - with_platform=gpu - AC_MSG_NOTICE([Switched platform to "$with_platform" because --with-cuda option was provided]) - fi - if test "$withval" == "yes"; then - cuda_prefix="/usr/local/cuda" - AC_MSG_NOTICE([Setting the prefix to the default: "$cuda_prefix"]) - fi -fi - -# If platform is set to cpu there is no need to check for cuda -if test "$with_platform" != "cpu"; then - - # Checking for nvcc - if test "$with_cuda" == "no"; then - AC_PATH_PROG([NVCC], [nvcc], [no], ["$cuda_prefix/bin:$PATH"]) - else - AC_MSG_CHECKING([nvcc in $cuda_prefix/bin]) - AS_IF([test -x "$cuda_prefix/bin/nvcc"], - [NVCC="$cuda_prefix/bin/nvcc"; AC_MSG_RESULT([found])], - [NVCC=no; AC_MSG_RESULT([not found!])]) - fi - if test "$NVCC" != "no"; then - AC_DEFINE_UNQUOTED([NVCC_PATH], ["$cuda_prefix/bin/nvcc"], [Path to nvcc binary]) - # We need to add the CUDA search directories for header and lib searches - - CUDA_CFLAGS="" - - # Saving the current flags - ax_save_CFLAGS="${CFLAGS}" - ax_save_LDFLAGS="${LDFLAGS}" - - VALID_CUDA_COMPILER=yes - VALID_CUDA_EXE=yes - - # Announcing the new variables - AC_SUBST([NVCC],[$cuda_prefix/bin/nvcc]) - AC_SUBST([CUDA_INCDIR],[$cuda_prefix/include]) - AC_CHECK_FILE([$cuda_prefix/lib64],[lib64_found=yes],[lib64_found=no]) - if test "x$lib64_found" = xno ; then - AC_CHECK_FILE([$cuda_prefix/lib],[lib32_found=yes],[lib32_found=no]) - if test "x$lib32_found" = xyes ; then - AC_SUBST([CUDA_LIBDIR],[$cuda_prefix/lib]) - else - AC_MSG_WARN([Couldn't find cuda lib directory]) - VALID_CUDA_COMPILER=no - fi - else - AC_CHECK_SIZEOF([long]) - if test "x$ac_cv_sizeof_long" = "x8" ; then - AC_SUBST([CUDA_LIBDIR],[$cuda_prefix/lib64]) - CUDA_CFLAGS+=" -m64" - elif test "x$ac_cv_sizeof_long" = "x4" ; then - AC_CHECK_FILE([$cuda_prefix/lib32],[lib32_found=yes],[lib32_found=no]) - if test "x$lib32_found" = xyes ; then - AC_SUBST([CUDA_LIBDIR],[$cuda_prefix/lib]) - CUDA_CFLAGS+=" -m32" - else - AC_MSG_WARN([Couldn't find cuda lib directory]) - VALID_CUDA_COMPILER=no - fi - else - AC_MSG_ERROR([Could not determine size of long variable type]) - fi - fi - - if test "x$VALID_CUDA_COMPILER" != xno ; then - CUDA_CFLAGS+=" -I$cuda_prefix/include" - CFLAGS="-I$cuda_prefix/include $CFLAGS" - CUDA_LIBS="-L$CUDA_LIBDIR" - LDFLAGS="$CUDA_LIBS $LDFLAGS" - - # And the header and the lib - AC_CHECK_HEADER([cuda.h], [], - AC_MSG_WARN([Couldn't find cuda.h]) - VALID_CUDA_COMPILER=no - ,[#include ]) - if test "x$VALID_CUDA_COMPILER" != "xno" ; then - RR_CHECK_CUDA_GPU - fi - fi - # Returning to the original flags - CFLAGS=${ax_save_CFLAGS} - LDFLAGS=${ax_save_LDFLAGS} - else - AC_MSG_WARN([nvcc was not found in $cuda_prefix/bin]) - VALID_CUDA_COMPILER=no - fi -fi -AC_SUBST(CUDA_CFLAGS, ["$CUDA_CFLAGS -rdc=false"]) -AC_SUBST(CUDA_LIBS, ["-L$CUDA_LIBDIR -lcuda -lcudart"]) - -case $with_platform in - auto ) - AS_IF([test "x$VALID_CUDA_COMPILER" == "xyes" && test "x$VALID_CUDA_EXE" == "xyes"], - [AC_DEFINE([PLATFORM_IS_GPU], [1], [Platform is GPU.]) AC_DEFINE_UNQUOTED([THREADS], [$THREADS_MULTIPROC], [Max threads per block]) AC_DEFINE_UNQUOTED([BLOCKS], [$BLOCKS_WARP], [Max blocks per warp]) AC_MSG_NOTICE([Platform automatically set to GPU])], - [AC_MSG_NOTICE([Platform automatically set to CPU])]) - AM_CONDITIONAL([PLATFORM_IS_GPU], [test "x$VALID_CUDA_COMPILER" == "xyes" && test "x$VALID_CUDA_EXE" == "xyes"]) - ;; - gpu ) - if test "x$VALID_CUDA_COMPILER" == "xyes" ; then - AS_IF([test "x$VALID_CUDA_EXE" == "xno"], - [AC_MSG_WARN([This system can't run CUDA applications])]) - AC_DEFINE([PLATFORM_IS_GPU], [1], [Platform is GPU.]) - AC_DEFINE_UNQUOTED([THREADS], [$THREADS_MULTIPROC], [Max threads per block]) - AC_DEFINE_UNQUOTED([BLOCKS], [$BLOCKS_WARP], [Max blocks per warp]) - AM_CONDITIONAL([PLATFORM_IS_GPU], [true]) - AC_MSG_NOTICE([Platform successfully set to GPU]) - else - AC_MSG_ERROR([Could not set platform to GPU.]) - fi - ;; - cpu ) - AM_CONDITIONAL([PLATFORM_IS_GPU], [false]) - AC_MSG_NOTICE([Platform successfully set to CPU]) - ;; -esac - -]) diff --git a/common/m4/rr-code-coverage.m4 b/common/m4/rr-code-coverage.m4 deleted file mode 100644 index d2c2508b..00000000 --- a/common/m4/rr-code-coverage.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Allows the user to perform a code coverage analysis in the code -# -# RR_ENABLE_CODE_COVERAGE -# -# This macro installs a configure option to enable/disable support for code -# coverage. -# -# This macro will set the following makefile variables: -# CODE_COVERAGE_CPPFLAGS -# CODE_COVERAGE_CXXFLAGS -# CODE_COVERAGE_CFLAGS -# CODE_COVERAGE_LIBS -# -# This variables should be used to build tests and libraries in the project. -# -# Additionally, RR_CODE_COVERAGE_RULES will be defined. Typically, the top -# level makefile will expand it using @RR_CODE_COVERAGE_RULES@ -# - -AC_DEFUN([RR_ENABLE_CODE_COVERAGE],[ - AX_CODE_COVERAGE - - RR_CODE_COVERAGE_RULES="$CODE_COVERAGE_RULES" - AC_SUBST(RR_CODE_COVERAGE_RULES) - AM_SUBST_NOTMAKE(RR_CODE_COVERAGE_RULES) - - AM_CONDITIONAL([ENABLE_CODE_COVERAGE], [test x$enable_code_coverage = xyes]) -]) diff --git a/common/m4/rr-docs.m4 b/common/m4/rr-docs.m4 deleted file mode 100644 index 0549074f..00000000 --- a/common/m4/rr-docs.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Allows the user to exclude the documentation from being built -# -# RR_ENABLE_DOCS -# -# This macro installs a configure option to enable/disable support for docs -# being built. If enabled, it checks for the appropriate installation of doxygen. -# -# This macro will set the ENABLE_DOCS makefile conditional to use in -# the project. -# - -AC_DEFUN([RR_ENABLE_DOCS],[ - AC_ARG_ENABLE([docs], - AS_HELP_STRING([--disable-docs], [Disable documentation])) - - AS_IF([test "x$enable_docs" != "xno"],[ - DX_HTML_FEATURE(ON) - DX_CHM_FEATURE(OFF) - DX_CHI_FEATURE(OFF) - DX_MAN_FEATURE(OFF) - DX_RTF_FEATURE(OFF) - DX_XML_FEATURE(OFF) - DX_PDF_FEATURE(OFF) - DX_PS_FEATURE(OFF) - - define([DOXYFILE], m4_default([$2], [${top_srcdir}/common/Doxyfile])) - define([SOURCEDIR], m4_default([$1], [\${top_srcdir}])) - - DX_INIT_DOXYGEN([AC_PACKAGE_TARNAME],[DOXYFILE],[out]) - DX_ENV_APPEND(SRCDIR, [SOURCEDIR]) - - RR_DOCS_RULES=" -$DX_RULES - -RR_DOCS_CLEANFILES=\$(DX_CLEANFILES) -docs-run: doxygen-doc -" - AC_SUBST(RR_DOCS_RULES) - AM_SUBST_NOTMAKE(RR_DOCS_RULES) - - if test -z "$DX_DOXYGEN"; then - AC_MSG_ERROR([No installation of Doxygen found. In Debian based systems you may install it by running: - ~$ sudo apt-get install doxygen -Additionally, you may disable testing support by using "--disable-docs".]) - fi - ],[ - AC_MSG_NOTICE([Documentation support disabled!]) - ]) - - AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != "xno"]) -]) diff --git a/common/m4/rr-eval.m4 b/common/m4/rr-eval.m4 deleted file mode 100644 index d1cc1497..00000000 --- a/common/m4/rr-eval.m4 +++ /dev/null @@ -1,20 +0,0 @@ -dnl RR_ENABLE_EVAL - -dnl =========================================================================== -dnl RR_ENABLE_EVAL -dnl -dnl Installs a configuration option to enable/disable evaluation mode. If -dnl enabled, an EVAL macro will be defined to be used in the code. -dnl -dnl =========================================================================== -AC_DEFUN([RR_ENABLE_EVAL], -[ - dnl Allow mainainer to build eval version - AC_ARG_ENABLE(eval,[ -AS_HELP_STRING([--enable-eval], [Build the evaluation version of the plug-in (Disabled by default)]) - ]) - if test x$enable_eval = xyes; then - AC_MSG_NOTICE([Building the EVAL version of the plug-in]) - AC_DEFINE(EVAL, 1, [Define this to build the evaluation version of the plug-in]) - fi -]) diff --git a/common/m4/rr-examples.m4 b/common/m4/rr-examples.m4 deleted file mode 100644 index 2cb57e7c..00000000 --- a/common/m4/rr-examples.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Allow the user to enable/disable the construction of examples -# -# RR_ENABLE_EXAMPLES -# -# This macro installs a configure option to enable/disable support for examples -# building. -# -# This macro will set the ENABLE_EXAMPLES makefile conditional to use in -# the project. -# -AC_DEFUN([RR_ENABLE_EXAMPLES],[ - AC_ARG_ENABLE([examples], - AS_HELP_STRING([--disable-examples], [Disable project examples])) - - AS_IF([test "x$enable_examples" = "xno"],[ - AC_MSG_NOTICE([Examples disabled!]) - ]) - - AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" != "xno"]) -]) diff --git a/common/m4/rr-feature.m4 b/common/m4/rr-feature.m4 deleted file mode 100644 index 8b8b9794..00000000 --- a/common/m4/rr-feature.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Perform a check for a feature and install property to disable it -# -# RR_CHECK_FEATURE_LIB(FEATURE-NAME, FEATURE-DESCRIPTION, -# LIBRARY, TEST-FUNCTION, HEADER, OPTIONAL) -# -# This macro adds a command line argument to allow the user to enable -# or disable a feature, and if the feature is enabled, performs a supplied -# test to check if the feature is available. -# -# The test should define HAVE_ to "yes" or "no" depending -# on whether the feature is available. -# -# FEATURE-NAME is the name of the feature, and should be in -# purely upper case characters. -# FEATURE-DESCRIPTION is used to describe the feature in help text for -# the command line argument. -# LIBRARY the library name for this feature. -# TEST-FUNCTION is a function to test the library with. -# HEADER the feature header to be included. -# OPTIONAL [yes | no] Whether or not the feature is optional. - -AC_DEFUN([RR_CHECK_FEATURE_LIB],[ -FEATURE_NAME_LOWERCASE=translit([$1], A-Z, a-z) -AC_MSG_NOTICE(*** checking feature: $FEATURE_NAME_LOWERCASE ***) -RR_FEATURES_ALL="$RR_FEATURES_ALL $FEATURE_NAME_LOWERCASE" - -AC_ARG_ENABLE(translit([$1], A-Z, a-z), - [ ]builtin(format, --%-21s enable %s, enable-$FEATURE_NAME_LOWERCASE, [$2]), - [ case "${enableval}" in - yes) USE_[$1]=yes;; - no) USE_[$1]=no;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-$FEATURE_NAME_LOWERCASE) ;; - esac], - [ USE_$1=no]) # DEFAULT -PROP_NAME=--enable-$FEATURE_NAME_LOWERCASE -RR_FEATURES_ENABLE="$RR_FEATURES_ENABLE $PROP_NAME" - -if test x$USE_[$1] = xyes; then - RR_FEATURES_SELECTED="$RR_FEATURES_SELECTED $FEATURE_NAME_LOWERCASE" - HAVE_[$1]=no - AC_CHECK_LIB($3, - $4, - [HAVE_[$1]=yes], - [HAVE_[$1]=no - if test x[$6] = xno; then - AC_MSG_ERROR([Couldn't find $3]) - fi ]) - AC_CHECK_HEADER($5, - [HAVE_[$1]=yes], - [HAVE_[$1]=no - if test x[$6] = xno; then - AC_MSG_ERROR([Couldn't find $3]) - fi ]) - - if test x$HAVE_[$1] = xno; then - RR_FEATURES_NO="$RR_FEATURES_NO $FEATURE_NAME_LOWERCASE" - USE_[$1]=no - else - RR_FEATURES_YES="$RR_FEATURES_YES $FEATURE_NAME_LOWERCASE" - AC_MSG_NOTICE(*** This feature will be used: [$2]) - AC_SUBST([$1_CFLAGS], []) - AC_SUBST([$1_LIBS], [-l[$3]]) - AC_DEFINE_UNQUOTED([HAVE_$1], [1], [Support for $1 backend is enabled]) - fi -else - HAVE_[$1]=no - AC_MSG_NOTICE(*** This feature is disabled: [$2]) -fi -AM_CONDITIONAL([HAVE_$1], [test x$HAVE_[$1] = xyes]) -]) - - -# Print a summary of the features checked -# -# RR_OUTPUT_FEATURES([HEADER]) -# -# HEADER is an optional header to print alongside the summary - -AC_DEFUN([RR_OUTPUT_FEATURES], [ - - -if test "x$RR_FEATURES_SELECTED" = "x"; then - printf "configure: *** Please select the features to use with at least one of the following options:\n" - ( for i in $RR_FEATURES_ENABLE; do printf '\t'$i'\n'; done ) | sort - AC_MSG_ERROR(No features selected) -fi - -printf "**************************************************\n" -printf ifelse([$1],,'\n','**********\t'[$1]'\t\t**********\n\n') - -printf "*** Enabled features:\n\n" -( for i in $RR_FEATURES_SELECTED; do printf '\t'$i'\n'; done ) | sort -printf "\n" - -printf "*** Disabled features:\n\n" -( for i in $RR_FEATURES_ALL; do - case " $RR_FEATURES_SELECTED " in - *\ $i\ *) - ;; - *) - printf '\t'$i'\n' - ;; - esac - done ) | sort -printf "\n" -printf "*** Enabled features that will be built:" -printf "$RR_FEATURES_YES\n" | sort -printf "\n" -printf "*** Enabled features that will NOT be built:" -printf "$RR_FEATURES_NO\n" | sort -printf "\n" -printf "**************************************************\n" -]) diff --git a/common/m4/rr-gst.m4 b/common/m4/rr-gst.m4 deleted file mode 100644 index 2b307a96..00000000 --- a/common/m4/rr-gst.m4 +++ /dev/null @@ -1,29 +0,0 @@ - #Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Perform a check for a feature and install property to disable it -# -# RR_ENABLE_PLUGINDIR -# -# -# - -AC_DEFUN([RR_GST_PLUGINDIR],[ - AC_ARG_WITH([plugindir], - [AS_HELP_STRING([--with-plugindir], [Select dir for plugins])], - [plugindir=$withval], - [plugindir="\$(libdir)/gstreamer-1.0"]) - - AC_SUBST(plugindir) - GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*' - AC_SUBST(GST_PLUGIN_LDFLAGS) - AC_MSG_NOTICE(Setting GStreamer plugindir to: $plugindir) -]) - diff --git a/common/m4/rr-test.m4 b/common/m4/rr-test.m4 deleted file mode 100644 index 40dac93f..00000000 --- a/common/m4/rr-test.m4 +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Perform a check for a feature and install property to disable it -# -# RR_ENABLE_TESTS -# -# This macro installs a configure option to enable/disable support for unit -# testing. If enabled, it checks for the appropriate installation of CppUTest. -# -# This macro will set the ENABLE_TESTS makefile conditional to use in -# the project. Additionally will set TESTS_CFLAGS and TESTS_LIBS. -# - -AC_DEFUN([RR_ENABLE_TESTS],[ - AC_ARG_ENABLE([tests], - AS_HELP_STRING([--disable-tests], [Disable project testing])) - - AS_IF([test "x$enable_tests" != "xno"],[ - PKG_CHECK_MODULES([CPPUTEST],[cpputest],[ - AC_SUBST(CPPUTEST_CFLAGS) - AC_SUBST(CPPUTEST_LIBS) - ],[ - AC_MSG_ERROR([ - -No installation of CppUTest found. In Debian based systems you may install it by running: - - ~$ sudo apt-get install libcpputest-dev - -Additionally, you may disable testing support by using "--disable-tests". - - ]) - ]) - - AC_CHECK_PROGS(PYTHON_BIN,[python2.7 python],[ - AC_MSG_ERROR([No installation of Python found. In Debian based systems you may install it by running:]) - AC_MSG_ERROR([~$ sudo apt-get install python-minimal]) - AC_MSG_ERROR([Additionally, you may disable testing support by using "--disable-tests".]) - ]) - - ],[ - AC_MSG_NOTICE([Testing support disabled!]) - ]) - AC_SUBST(TESTS_CFLAGS, [$CPPUTEST_CFLAGS]) - AC_SUBST(TESTS_LIBS, [$CPPUTEST_LIBS]) - AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" != "xno"]) -]) diff --git a/common/m4/rr-version.m4 b/common/m4/rr-version.m4 deleted file mode 100644 index a42eb1f2..00000000 --- a/common/m4/rr-version.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Parses package version to extract independent semantic version numbers -# -# RR_VERSION -# -# This macro will set the RR_VERSION_MAJOR, RR_VERSION_MINOR, RR_VERSION_MICRO -# and RR_VERSION_NANO. These will be available in the code via the config.h and -# in Makefiles -# -AC_DEFUN([RR_VERSION],[ - RR_VERSION_MAJOR=`echo AC_PACKAGE_VERSION | cut -d'.' -f1` - RR_VERSION_MINOR=`echo AC_PACKAGE_VERSION | cut -d'.' -f2` - RR_VERSION_MICRO=`echo AC_PACKAGE_VERSION | cut -d'.' -f3` - RR_VERSION_NANO=`echo AC_PACKAGE_VERSION | cut -d'.' -f4` - - AC_SUBST(RR_VERSION_MAJOR) - AC_SUBST(RR_VERSION_MINOR) - AC_SUBST(RR_VERSION_MICRO) - AC_SUBST(RR_VERSION_NANO) - - AC_DEFINE_UNQUOTED([RR_VERSION_MAJOR], [$RR_VERSION_MAJOR], [Major package version]) - AC_DEFINE_UNQUOTED([RR_VERSION_MINOR], [$RR_VERSION_MINOR], [Minor package version]) - AC_DEFINE_UNQUOTED([RR_VERSION_MICRO], [$RR_VERSION_MICRO], [Micro package version]) - AC_DEFINE_UNQUOTED([RR_VERSION_NANO], [$RR_VERSION_NANO], [Nano package version]) - - RR_PACKAGE_VERSION=$RR_VERSION_MAJOR.0 - AC_SUBST([RR_PACKAGE_VERSION]) - AC_DEFINE_UNQUOTED([RR_PACKAGE_VERSION], [$RR_PACKAGE_VERSION], [Package version]) -]) diff --git a/common/m4/rr.m4 b/common/m4/rr.m4 deleted file mode 100644 index d6f938b5..00000000 --- a/common/m4/rr.m4 +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. -# -# Initializes generic flags to be used around the project, and installs -# some configure customization options -# -# RR_INIT -# -# This macro will set the following variables that should be used around the -# project -# RR_CFLAGS -# RR_CXXFLAGS -# RR_CPPFLAGS -# RR_LIBS - -AC_DEFUN([RR_INIT_FLAGS],[ - - # Dont let AC_PROG_C{C,XX} add the default -O2 -g if no C{XX}_CLAGS - # are specified. Define them to an empty string if there is no user - # defined value - : ${CFLAGS=""} - : ${CXXFLAGS=""} - - AC_PROG_CPP - AC_PROG_CC - AX_CXX_COMPILE_STDCXX_11([], [mandatory]) - - AC_ARG_WITH([profile], AS_HELP_STRING([--with-profile=release|debug|lazy], - [Specify the build profile to use: - (release: enables all optimizations) - (debug: disables all optimizations and enables debug symbols) - (lazy: same configurations as debug, but doesn't treat warnings as errors) - ]), - [with_profile=$withval],[with_profile=debug]) - - strict_flags="-Werror -Wall" - release_flags="-O3" - debug_flags="-O0 -ggdb3" - - case $with_profile in - release ) - RR_CFLAGS="$strict_flags $release_flags " - ;; - debug ) - RR_CFLAGS="$strict_flags $debug_flags " - ;; - lazy ) - RR_CFLAGS="$debug_flags " - ;; - * ) - AC_MSG_ERROR([Please specif a valid profile to use: debug|release|lazy]) - ;; - esac - - AC_MSG_NOTICE([Using profile: $with_profile]) - - RR_CXXFLAGS="$RR_CFLAGS" - RR_CPPFLAGS="-I\$(top_srcdir) -pthread" - - AC_SUBST(RR_CFLAGS) - AC_SUBST(RR_CXXFLAGS) - AC_SUBST(RR_CPPFLAGS) - AC_SUBST(RR_LIBS) -]) - -AC_DEFUN([RR_INIT],[ - AC_MSG_NOTICE([Thanks for using RidgeRun build utils!]) - - RR_INIT_FLAGS -]) diff --git a/common/makeinc/cuda.mk b/common/makeinc/cuda.mk deleted file mode 100644 index 50067e89..00000000 --- a/common/makeinc/cuda.mk +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -SUFFIXES=.cu .c - -LTNVCOMPILE=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(NVCC) $(CUDA_CFLAGS) \ - $(EXTRA_CUDA_CFLAGS) -prefer-non-pic --compiler-options -fPIC -.cu.lo: - $(LTNVCOMPILE) -c $< -o $@ diff --git a/configure.ac b/configure.ac deleted file mode 100644 index a4f6000e..00000000 --- a/configure.ac +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (C) 2018-2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -# Initialize autoconf. -AC_PREREQ([2.69]) -AC_INIT([RidgeRun inference library],[0.10.2],[https://github.com/RidgeRun/r2inference/issues],[r2inference]) - -# Initialize our build utils -RR_INIT - -# Initialize automake. -AM_INIT_AUTOMAKE([1.14 no-dist-gzip dist-xz tar-ustar foreign]) - -# Initialize libtool -LT_INIT - -# Checks for programs. -AC_PROG_LN_S - -# Allow the user to fine-tune project build -RR_ENABLE_TESTS -RR_ENABLE_EXAMPLES -RR_ENABLE_DOCS([\${top_srcdir}/r2i]) -RR_ENABLE_CODE_COVERAGE - -# Grab the project version number -RR_VERSION - -# Make sure we are trying to build the correct area -AC_CONFIG_SRCDIR([r2i/r2i.h]) - -# Keep in sync with top Makefile.am -AC_CONFIG_MACRO_DIRS([m4 common/m4]) - -# Generate a header with useful definitions -AC_CONFIG_HEADER([config.h]) - -# Set common dependencies -PKG_PROG_PKG_CONFIG -PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.0.0]) -PKG_CHECK_MODULES([GMODULE], [gmodule-2.0 >= 2.0.0]) -PKG_CHECK_MODULES([OPENCV], [opencv4 >= 4.0.0], [AM_CONDITIONAL([HAVE_OPENCV], [true])], [AM_CONDITIONAL([HAVE_OPENCV], [false])]) - -# Check for NCSDK -RR_CHECK_FEATURE_LIB(NCSDK, NCSDK Installation, - mvnc, ncGlobalSetOption, mvnc.h, no) - -RR_CHECK_FEATURE_LIB(TENSORFLOW, TensorFlow Installation, - tensorflow, TF_Version, tensorflow/c/c_api.h, no) - -AC_LANG_PUSH([C++]) - -if test x$enable_coral = xyes; then - enable_tflite=yes -fi - -RR_CHECK_FEATURE_LIB(CORAL, Coral from Google with TensorFlow lite Installation, - :libedgetpu.so.1.0, edgetpu_version, edgetpu.h, no) - -RR_CHECK_FEATURE_LIB(TFLITE, TensorFlow lite Installation, - tensorflow-lite, TfLiteTypeGetName, tensorflow/lite/model.h, no) - -# add specific LIBS for TFLITE -AC_SUBST([TFLITE_LIBS], ["$TFLITE_LIBS -pthread -ldl -lrt"]) - -RR_CHECK_FEATURE_LIB(TENSORRT, TensorRT Installation, - nvinfer, createInferBuilder_INTERNAL, NvInfer.h, no) - -# ONNXRT backend -if test x$enable_onnxrt_acl = xyes || test x$enable_onnxrt_openvino = xyes; then - enable_onnxrt=yes -fi - -RR_CHECK_FEATURE_LIB(ONNXRT, ONNX Runtime Installation, - onnxruntime, OrtGetApiBase, onnxruntime/core/session/onnxruntime_cxx_api.h, no) - -RR_CHECK_FEATURE_LIB(ONNXRT_ACL, ONNX Runtime Installation with Arm Compute Library support, - onnxruntime, OrtSessionOptionsAppendExecutionProvider_ACL, onnxruntime/core/providers/acl/acl_provider_factory.h, no) - -if test x$enable_onnxrt_acl = xyes; then - AC_CHECK_LIB(arm_compute, _init, [], [AC_MSG_ERROR(Can not find Arm Compute Library dependencies)], []) - AC_CHECK_LIB(arm_compute_core, _init, [], [AC_MSG_ERROR(Can not find Arm Compute Library dependencies)], []) - AC_CHECK_LIB(arm_compute_graph, _init, [], [AC_MSG_ERROR(Can not find Arm Compute Library dependencies)], []) - AC_SUBST([ONNXRT_ACL_LIBS], ["$ONNXRT_LIBS -larm_compute -larm_compute_core -larm_compute_graph"]) -fi - -RR_CHECK_FEATURE_LIB(ONNXRT_OPENVINO, ONNX Runtime Installation with OpenVINO support, - onnxruntime, OrtSessionOptionsAppendExecutionProvider_OpenVINO, onnxruntime/core/providers/openvino/openvino_provider_factory.h, no) - -AC_LANG_POP([C++]) - -AM_CONDITIONAL([PLATFORM_IS_GPU], [false]) -AM_COND_IF([HAVE_TENSORRT], [RR_CHECK_CUDA], []) - -# Our Include path, to be shared in multiple makefiles -AC_SUBST([R2IINCLUDEDIR],[$includedir/r2inference-$RR_PACKAGE_VERSION/]) - -# Output files, please keep in alphabetical order -AC_CONFIG_FILES([ -Makefile -docs/Makefile -docs/api/Makefile -docs/uml/Makefile -examples/Makefile -examples/r2i/Makefile -examples/r2i/coral/Makefile -examples/r2i/ncsdk/Makefile -examples/r2i/onnxrt/Makefile -examples/r2i/onnxrt_acl/Makefile -examples/r2i/onnxrt_openvino/Makefile -examples/r2i/tensorflow/Makefile -examples/r2i/tensorrt/Makefile -examples/r2i/tflite/Makefile -r2i/Makefile -r2i/coral/Makefile -r2i/ncsdk/Makefile -r2i/onnxrt/Makefile -r2i/onnxrt_acl/Makefile -r2i/onnxrt_openvino/Makefile -r2i/postprocessing/Makefile -r2i/preprocessing/Makefile -r2i/tensorflow/Makefile -r2i/tensorrt/Makefile -r2i/tflite/Makefile -r2inference-${RR_PACKAGE_VERSION}.pc:r2inference.pc.in -tests/Makefile -tests/acceptance/Makefile -tests/unit/Makefile -tests/unit/r2i/Makefile -tests/unit/r2i/ncsdk/Makefile -tests/unit/r2i/onnxrt/Makefile -tests/unit/r2i/onnxrt_openvino/Makefile -tests/unit/r2i/postprocessing/Makefile -tests/unit/r2i/preprocessing/Makefile -tests/unit/r2i/tensorflow/Makefile -tests/unit/r2i/tensorrt/Makefile -tests/unit/r2i/tflite/Makefile -]) - -AC_OUTPUT - -RR_OUTPUT_FEATURES([R2Inference]) diff --git a/docs/Makefile.am b/docs/Makefile.am deleted file mode 100644 index 9448f948..00000000 --- a/docs/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -SUBDIRS = \ - api \ - uml diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am deleted file mode 100644 index 528b885b..00000000 --- a/docs/api/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -if ENABLE_DOCS - -@RR_DOCS_RULES@ - -MOSTLYCLEANFILES=$(RR_DOCS_CLEANFILES) -all-local: docs-run - -endif # ENABLE_DOCS diff --git a/docs/uml/Makefile.am b/docs/uml/Makefile.am deleted file mode 100644 index bfa12494..00000000 --- a/docs/uml/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index aa66e523..00000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -SUBDIRS = r2i - -DIST_SUBDIRS = external diff --git a/examples/external/.gitignore b/examples/external/.gitignore deleted file mode 100644 index d50006b9..00000000 --- a/examples/external/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Don't ignore this specific makefile (all the others are autogenerated) -!Makefile \ No newline at end of file diff --git a/examples/external/Makefile b/examples/external/Makefile deleted file mode 100644 index c63c376c..00000000 --- a/examples/external/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -R2IVERSION=0.0 - -CXXFLAGS:= -std=c++11 $(shell pkg-config --cflags r2inference-$(R2IVERSION) glib-2.0 gmodule-2.0) -pthread -LIBS:=$(shell pkg-config --libs r2inference-$(R2IVERSION)) -pthread - -OUT=list-backends -SOURCES=list_backends.cc -OBJECTS=$(SOURCES:.cc=.o) - -CXX=g++ - -.PHONY: clean - -$(OUT): $(OBJECTS) - @$(CXX) -o $@ $< $(LIBS) - -%.o: %.cc - @$(CXX) -c -o $@ $(CXXFLAGS) $< - -clean: - @rm -f $(OBJECTS) $(OUT) *~ diff --git a/examples/external/README.md b/examples/external/README.md index 0118a1ec..3c6ffa4f 100644 --- a/examples/external/README.md +++ b/examples/external/README.md @@ -14,14 +14,9 @@ sudo apt install pkg-config sudo apt install g++ ``` -## Building the Examples - -``` -make -``` - ## Testing the examples ``` +cd ../../build/examples/external ./list-backends ``` diff --git a/examples/r2i/Makefile.am b/examples/r2i/Makefile.am deleted file mode 100644 index 0f2ed1c7..00000000 --- a/examples/r2i/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2018-2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -DIST_SUBDIRS = \ - coral \ - ncsdk \ - onnxrt \ - onnxrt_acl \ - onnxrt_openvino \ - tensorflow \ - tflite -SUBDIRS = - -if ENABLE_EXAMPLES - -if HAVE_CORAL -SUBDIRS += coral -endif - -if HAVE_NCSDK -SUBDIRS += ncsdk -endif - -if HAVE_ONNXRT -SUBDIRS += onnxrt -endif - -if HAVE_ONNXRT_ACL -SUBDIRS += onnxrt_acl -endif - -if HAVE_ONNXRT_OPENVINO -SUBDIRS += onnxrt_openvino -endif - -if HAVE_TENSORFLOW -SUBDIRS += tensorflow -endif - -if HAVE_TFLITE -SUBDIRS += tflite -endif - -noinst_PROGRAMS = \ - classification \ - list_parameters - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ - -Icommon/ - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -AM_LDFLAGS = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/coral/Makefile.am b/examples/r2i/coral/Makefile.am deleted file mode 100644 index 7134128e..00000000 --- a/examples/r2i/coral/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - inception \ - mobilenetssdv2 - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ - -I../common/ - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -LDADD = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/coral/inception.cc b/examples/r2i/coral/inception.cc index b87fd7be..370164b3 100644 --- a/examples/r2i/coral/inception.cc +++ b/examples/r2i/coral/inception.cc @@ -184,13 +184,15 @@ int main (int argc, char *argv[]) { } std::cout << "Predicting..." << std::endl; - auto prediction = engine->Predict (frame, error); + std::vector> predictions; + error = engine->Predict (frame, predictions); if (error.IsError ()) { std::cerr << "Engine prediction error: " << error << std::endl; exit(EXIT_FAILURE); } - PrintTopPrediction (prediction); + /* This model only has one output */ + PrintTopPrediction (predictions[0]); std::cout << "Stopping engine" << std::endl; error = engine->Stop (); diff --git a/examples/r2i/ncsdk/Makefile.am b/examples/r2i/ncsdk/Makefile.am deleted file mode 100644 index 61371961..00000000 --- a/examples/r2i/ncsdk/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2018-2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - inception \ - tinyyolov2 - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ - -I../common/ - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -AM_LDFLAGS = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/ncsdk/inception.cc b/examples/r2i/ncsdk/inception.cc deleted file mode 100644 index 0b2732f6..00000000 --- a/examples/r2i/ncsdk/inception.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* Copyright (C) 2018-2020 RidgeRun, LLC (http://www.ridgerun.com) - * All Rights Reserved. - * - * The contents of this software are proprietary and confidential to RidgeRun, - * LLC. No part of this program may be photocopied, reproduced or translated - * into another programming language without prior written consent of - * RidgeRun, LLC. The user is free to modify the source code after obtaining - * a software license from RidgeRun. All source code changes must be provided - * back to RidgeRun without any encumbrance. -*/ - -#include -#include -#include -#include -#include - -#define STB_IMAGE_IMPLEMENTATION -#include "stb_image.h" - -#define STB_IMAGE_RESIZE_IMPLEMENTATION -#include "stb_image_resize.h" - -void PrintTopPrediction (std::shared_ptr prediction) { - r2i::RuntimeError error; - int index = 0; - double max = -1; - - int num_labels = prediction->GetResultSize() / sizeof(float); - - for (int i = 0; i < num_labels; ++i) { - double current = prediction->At(i, error); - if (current > max) { - max = current; - index = i; - } - } - - std::cout << "Highest probability is label " - << index << " (" << max << ")" << std::endl; -} - -void PrintUsage() { - std::cerr << "Required arguments:" - << "-i [JPG input_image] " - << "-m [Inception NCS Model] " - << "-s [Model Input Size] \n" - << " Example:" - << " ./inception -i cat.jpg -m graph_inceptionv2_ncsdk -s 224" - << std::endl; -} - -std::unique_ptr PreProcessImage (const unsigned char *input, - int width, int height, int reqwidth, int reqheight) { - - const int channels = 3; - const int scaled_size = channels * reqwidth * reqheight; - - std::unique_ptr scaled (new unsigned char[scaled_size]); - std::unique_ptr adjusted (new float[scaled_size]); - - stbir_resize_uint8(input, width, height, 0, scaled.get(), reqwidth, - reqheight, 0, channels); - - for (int i = 0; i < scaled_size; i += channels) { - /* RGB = (RGB)*StdDev */ - adjusted[i + 0] = (static_cast(scaled[i + 0]) - 128) / 128.0; - adjusted[i + 1] = (static_cast(scaled[i + 1]) - 128) / 128.0; - adjusted[i + 2] = (static_cast(scaled[i + 2]) - 128) / 128.0; - } - - return adjusted; -} - -std::unique_ptr LoadImage(const std::string &path, int reqwidth, - int reqheight) { - int channels = 3; - int width, height, cp; - - unsigned char *img = stbi_load(path.c_str(), &width, &height, &cp, channels); - if (!img) { - std::cerr << "The picture " << path << " could not be loaded"; - return nullptr; - } - - auto ret = PreProcessImage(img, width, height, reqwidth, reqheight); - free (img); - - return ret; -} - -bool ParseArgs (int &argc, char *argv[], std::string &image_path, - std::string &model_path, int &index, int &size) { - - int option = 0; - while ((option = getopt(argc, argv, "i:m:p:s:")) != -1) { - switch (option) { - case 'i' : - image_path = optarg; - break; - case 'm' : - model_path = optarg; - break; - case 'p' : - index = std::stoi (optarg); - break; - case 's' : - size = std::stoi (optarg); - break; - default: - return false; - } - } - return true; -} - -int main (int argc, char *argv[]) { - r2i::RuntimeError error; - std::string model_path; - std::string image_path; - int Index = 0; - int size = 0; - - if (false == ParseArgs (argc, argv, image_path, model_path, Index, size)) { - PrintUsage (); - exit (EXIT_FAILURE); - } - - if (image_path.empty() || model_path.empty ()) { - PrintUsage (); - exit (EXIT_FAILURE); - } - - auto factory = r2i::IFrameworkFactory::MakeFactory(r2i::FrameworkCode::NCSDK, - error); - - if (nullptr == factory) { - std::cerr << "NCSDK backend is not built: " << error << std::endl; - exit(EXIT_FAILURE); - } - - std::cout << "Loading Model: " << model_path << std::endl; - auto loader = factory->MakeLoader (error); - auto model = loader->Load (model_path, error); - if (error.IsError ()) { - std::cerr << "Loader error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - std::cout << "Setting model to engine" << std::endl; - auto engine = factory->MakeEngine (error); - error = engine->SetModel (model); - - std::cout << "Loading image: " << image_path << std::endl; - std::unique_ptr image_data = LoadImage (image_path, size, - size); - - std::cout << "Configuring frame" << std::endl; - std::shared_ptr frame = factory->MakeFrame (error); - error = frame->Configure (image_data.get(), size, size, - r2i::ImageFormat::Id::RGB, - r2i::DataType::Id::FLOAT); - - std::cout << "Starting engine" << std::endl; - error = engine->Start (); - if (error.IsError ()) { - std::cerr << "Engine start error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - std::cout << "Predicting..." << std::endl; - auto prediction = engine->Predict (frame, error); - if (error.IsError ()) { - std::cerr << "Engine prediction error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - PrintTopPrediction (prediction); - - std::cout << "Stopping engine" << std::endl; - error = engine->Stop (); - if (error.IsError ()) { - std::cerr << "Engine stop error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - return EXIT_SUCCESS; -} diff --git a/examples/r2i/ncsdk/tinyyolov2.cc b/examples/r2i/ncsdk/tinyyolov2.cc deleted file mode 100644 index 0a644bc7..00000000 --- a/examples/r2i/ncsdk/tinyyolov2.cc +++ /dev/null @@ -1,383 +0,0 @@ -/* Copyright (C) 2018-2020 RidgeRun, LLC (http://www.ridgerun.com) - * All Rights Reserved. - * - * The contents of this software are proprietary and confidential to RidgeRun, - * LLC. No part of this program may be photocopied, reproduced or translated - * into another programming language without prior written consent of - * RidgeRun, LLC. The user is free to modify the source code after obtaining - * a software license from RidgeRun. All source code changes must be provided - * back to RidgeRun without any encumbrance. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define STB_IMAGE_IMPLEMENTATION -#include "stb_image.h" - -#define STB_IMAGE_RESIZE_IMPLEMENTATION -#include "stb_image_resize.h" - -/* Tiny YOLOV2 oputput parameters */ -/* Input image dim */ -#define DIM 416 -/* Grid dim */ -#define GRID_H 13 -#define GRID_W 13 -/* Number of classes */ -#define CLASSES 20 -/* Number of boxes per cell */ -#define BOXES 5 -/* Box dim */ -#define BOX_DIM 5 -/* Probability threshold */ -#define PROB_THRESH 0.08 -/* Intersection over union threshold */ -#define IOU_THRESH 0.30 -/* Objectness threshold */ -#define OBJ_THRESH 0.08 -/* Grid cell size in pixels */ -#define GRID_SIZE 32 - -const float box_anchors[] = -{ 1.08, 1.19, 3.42, 4.41, 6.63, 11.38, 9.42, 5.11, 16.62, 10.52 }; - -struct box { - std::string label; - double x; - double y; - double width; - double height; - double prob; -}; - -/* sigmoid approximation as a lineal function */ -static double -sigmoid (double x) { - return 1.0 / (1.0 + pow (M_E, -1.0 * x)); -} - -void Box2Pixels (box *normalized_box, int row, int col, int box) { - /* Convert box coordinates to pixels - * box position (x,y) is normalized inside each cell from 0 to 1 - * width and heigh are also normalized, but with image size as reference - * box is ordered [x_center,y_center,width,height] - */ - /* Adjust the box center according to its cell and grid dim */ - - normalized_box->x = (col + sigmoid (normalized_box->x)) * GRID_SIZE; - normalized_box->y = (row + sigmoid (normalized_box->y)) * GRID_SIZE; - - normalized_box->width = - pow (M_E, normalized_box->width) * box_anchors[2 * box] * GRID_SIZE; - normalized_box->height = - pow (M_E, normalized_box->height) * box_anchors[2 * box + 1] * GRID_SIZE; - -} - -void GetBoxesFromPrediction(std::shared_ptr prediction, - int input_image_width, int input_image_height, - std::list &boxes) { - /* - * Get all the boxes from the prediction and store them in a list - * Tiny yolo parameters: - * Grid: 13*13 - * Boxes per grid cell: 5 - * Number of classes: 20 - * Classes: ["aeroplane", "bicycle", "bird", "boat", "bottle", - * "bus", "car", "cat", "chair", "cow", "diningtable", - * "dog", "horse", "motorbike", "person", "pottedplant", - * "sheep", "sofa", "train", "tvmonitor"] - * - * Prediction structure: - * 13*13*(5+20) [x,y,w,h,objectness] for each box in the grid - */ - r2i::RuntimeError error; - int i, j, c, b; - int index; - double max_class_prob; - double cur_class_prob; - double obj_prob; - int max_class_prob_index; - - /* - * This label list is highly dependent on the way the model was trained. - * We are assumig the same labels that are used on the ncappzoo tinyyolov2 - * example. - */ - std::string labels [CLASSES] = {"aeroplane", "bicycle", "bird", "boat", - "bottle", "bus", "car", "cat", "chair", - "cow", "diningtable", "dog", "horse", - "motorbike", "person", "pottedplant", - "sheep", "sofa", "train", "tvmonitor" - }; - - for (i = 0; i < GRID_H; i++) { /* Iterate rows */ - for (j = 0; j < GRID_W; j++) { /* Iterate columns */ - for (b = 0; b < BOXES; b++) { /* Iterate boxes */ - index = ((i * GRID_W + j) * BOXES + b) * (BOX_DIM + CLASSES); - obj_prob = prediction->At (index + 4, error); - /* If the probability is over the threshold add it to the boxes list */ - if (obj_prob > OBJ_THRESH) { - max_class_prob = 0; - max_class_prob_index = 0; - for (c = 0; c < CLASSES; c++) { - cur_class_prob = prediction->At (index + BOX_DIM + c, error); - if (cur_class_prob > max_class_prob) { - max_class_prob = cur_class_prob; - max_class_prob_index = c; - } - } - - if (max_class_prob > PROB_THRESH) { - box result; - result.label = labels[max_class_prob_index]; - result.x = prediction->At (index, error); - result.y = prediction->At (index + 1, error); - result.width = prediction->At (index + 2, error); - result.height = prediction->At (index + 3, error); - result.prob = max_class_prob; - Box2Pixels(&result, i, j, b); - result.x = result.x - result.width * 0.5; - result.y = result.y - result.height * 0.5; - boxes.push_front(result); - } - } - } - } - } -} - -double IntersectionOverUnion(box box_1, box box_2) { - /* - * Evaluate the intersection-over-union for two boxes - * The intersection-over-union metric determines how close - * two boxes are to being the same box. - */ - double intersection_dim_1; - double intersection_dim_2; - double intersection_area; - double union_area; - - /* First diminsion of the intersecting box */ - intersection_dim_1 = std::min(box_1.x + box_1.width, - box_2.x + box_2.width) - - std::max(box_1.x, box_2.x); - - /* Second dimension of the intersecting box */ - intersection_dim_2 = std::min(box_1.y + box_1.height, - box_2.y + box_2.height) - - std::max(box_1.y, box_2.y); - - if ((intersection_dim_1 < 0) || (intersection_dim_2 < 0)) { - intersection_area = 0; - } else { - intersection_area = intersection_dim_1 * intersection_dim_2; - } - - union_area = box_1.width * box_1.height + box_2.width * box_2.height - - intersection_area; - return intersection_area / union_area; -} - -void RemoveDuplicatedBoxes(std::list &boxes) { - /* Remove duplicated boxes. A box is considered a duplicate if its - * intersection over union metric is above a threshold - */ - double iou; - std::list::iterator it1; - std::list::iterator it2; - - for (it1 = boxes.begin(); it1 != boxes.end(); it1++) { - for (it2 = std::next(it1); it2 != boxes.end(); it2++) { - if (it1->label == it2->label) { - iou = IntersectionOverUnion(*it1, *it2); - if (iou > IOU_THRESH) { - if (it1->prob > it2->prob) { - boxes.erase(it2--); - } else { - boxes.erase(it1--); - break; - } - } - } - } - } -} - -void PrintBox (box in_box) { - std::cout << "Box:" ; - std::cout << "[class:'" << in_box.label << "', "; - std::cout << "x:" << in_box.x << ", "; - std::cout << "y:" << in_box.y << ", "; - std::cout << "width:" << in_box.width << ", "; - std::cout << "height:" << in_box.height << ", "; - std::cout << "prob:" << in_box.prob << "]" << std::endl; -} - -void PrintTopPredictions (std::shared_ptr prediction, - int input_image_width, int input_image_height) { - /* - * Print al boxes that surpass a probability threshold (PROB_THRESH). - * Clustering is performed to remove duplicated boxes based on the - * intersection over union metric. - */ - std::list boxes; - - GetBoxesFromPrediction(prediction, input_image_width, input_image_height, - boxes); - - RemoveDuplicatedBoxes(boxes); - - /* Print all resulting boxes */ - for (box b : boxes) { - PrintBox (b); - } -} - -void PrintUsage() { - std::cerr << - "Usage: example -i [JPG input_image] -m [TinyYOLOV2 NCSDK Model] \n" - << "Example: ./tinyyolov2 -i dog.jpg -m graph_tinyyolov2_ncsdk" - << std::endl; -} - -std::unique_ptr PreProcessImage (const unsigned char *input, int width, - int height, int reqwidth, int reqheight) { - const int channels = 3; - const int scaled_size = channels * reqwidth * reqheight; - - std::unique_ptr scaled (new unsigned char[scaled_size]); - std::unique_ptr adjusted (new float[scaled_size]); - - stbir_resize_uint8(input, width, height, 0, scaled.get(), reqwidth, - reqheight, 0, channels); - - for (int i = 0; i < scaled_size; i += channels) { - adjusted[i + 0] = static_cast(scaled[i + 0]) / 255; - adjusted[i + 1] = static_cast(scaled[i + 1]) / 255; - adjusted[i + 2] = static_cast(scaled[i + 2]) / 255; - } - - return adjusted; -} - -std::unique_ptr LoadImage(const std::string &path, int reqwidth, - int reqheight, int *width, int *height) { - int channels = 3; - int cp; - - unsigned char *img = stbi_load(path.c_str(), width, height, &cp, channels); - if (!img) { - std::cerr << "The picture " << path << " could not be loaded"; - return nullptr; - } - - auto ret = PreProcessImage(img, *width, *height, reqwidth, reqheight); - free (img); - - return ret; -} - -bool ParseArgs (int &argc, char *argv[], std::string &image_path, - std::string &model_path, int &index) { - int option = 0; - - while ((option = getopt(argc, argv, "i:m:p:")) != -1) { - switch (option) { - case 'i' : - image_path = optarg; - break; - case 'm' : - model_path = optarg; - break; - case 'p' : - index = std::stoi (optarg); - break; - default: - return false; - } - } - - return true; -} - - -int main (int argc, char *argv[]) { - r2i::RuntimeError error; - std::string model_path; - std::string image_path; - int Index = 0; - int width, height; - - if (false == ParseArgs (argc, argv, image_path, model_path, Index)) { - PrintUsage (); - exit (EXIT_FAILURE); - } - - if (image_path.empty() || model_path.empty ()) { - PrintUsage (); - exit (EXIT_FAILURE); - } - - auto factory = r2i::IFrameworkFactory::MakeFactory(r2i::FrameworkCode::NCSDK, - error); - - if (nullptr == factory) { - std::cerr << "NCSDK backend is not built: " << error << std::endl; - exit(EXIT_FAILURE); - } - - std::cout << "Loading Model: " << model_path << std::endl; - auto loader = factory->MakeLoader (error); - auto model = loader->Load (model_path, error); - if (error.IsError ()) { - std::cerr << "Loader error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - std::cout << "Setting model to engine" << std::endl; - auto engine = factory->MakeEngine (error); - error = engine->SetModel (model); - - std::cout << "Loading image: " << image_path << std::endl; - std::unique_ptr image_data = LoadImage (image_path, DIM, DIM, - &width, &height); - - std::cout << "Configuring frame" << std::endl; - std::shared_ptr frame = factory->MakeFrame (error); - error = frame->Configure (image_data.get(), DIM, DIM, - r2i::ImageFormat::Id::RGB, - r2i::DataType::Id::FLOAT); - - std::cout << "Starting engine" << std::endl; - error = engine->Start (); - if (error.IsError ()) { - std::cerr << "Engine start error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - std::cout << "Predicting" << std::endl; - auto prediction = engine->Predict (frame, error); - if (error.IsError ()) { - std::cerr << "Engine prediction error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - PrintTopPredictions (prediction, width, height); - - std::cout << "Stopping engine" << std::endl; - error = engine->Stop (); - if (error.IsError ()) { - std::cerr << "Engine stop error: " << error << std::endl; - exit(EXIT_FAILURE); - } - - return EXIT_SUCCESS; -} diff --git a/examples/r2i/onnxrt/Makefile.am b/examples/r2i/onnxrt/Makefile.am deleted file mode 100644 index f52bc5fc..00000000 --- a/examples/r2i/onnxrt/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - inception - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ - -I../common/ - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -AM_LDFLAGS = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/onnxrt_acl/Makefile.am b/examples/r2i/onnxrt_acl/Makefile.am deleted file mode 100644 index eeca1ccd..00000000 --- a/examples/r2i/onnxrt_acl/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - inception - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) \ - -I../common/ - -AM_LDFLAGS = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/onnxrt_openvino/Makefile.am b/examples/r2i/onnxrt_openvino/Makefile.am deleted file mode 100644 index eeca1ccd..00000000 --- a/examples/r2i/onnxrt_openvino/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - inception - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) \ - -I../common/ - -AM_LDFLAGS = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/tensorflow/Makefile.am b/examples/r2i/tensorflow/Makefile.am deleted file mode 100644 index 3792c161..00000000 --- a/examples/r2i/tensorflow/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - inception - -if HAVE_OPENCV -noinst_PROGRAMS += tf1-object-detection-api -endif - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ - $(OPENCV_CFLAGS) \ - -I../common/ - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(OPENCV_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -AM_LDFLAGS = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(OPENCV_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/tensorrt/Makefile.am b/examples/r2i/tensorrt/Makefile.am deleted file mode 100644 index c2dc4d60..00000000 --- a/examples/r2i/tensorrt/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2018-2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - yolov2 - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ - -I../common/ - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -AM_LDFLAGS = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/tflite/Makefile.am b/examples/r2i/tflite/Makefile.am deleted file mode 100644 index 52959d6c..00000000 --- a/examples/r2i/tflite/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -AM_DEFAULT_SOURCE_EXT = .cc - -if ENABLE_EXAMPLES - -noinst_PROGRAMS = \ - inception - -AM_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) \ - -I../common/ - -AM_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -AM_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -LDADD = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(top_builddir)/r2i/libr2inference-@RR_PACKAGE_VERSION@.la - -endif # ENABLE_EXAMPLES diff --git a/examples/r2i/tflite/inception.cc b/examples/r2i/tflite/inception.cc index dd1e3cea..515271ed 100644 --- a/examples/r2i/tflite/inception.cc +++ b/examples/r2i/tflite/inception.cc @@ -182,13 +182,15 @@ int main (int argc, char *argv[]) { } std::cout << "Predicting..." << std::endl; - auto prediction = engine->Predict (frame, error); + std::vector> predictions; + error = engine->Predict (frame, predictions); if (error.IsError ()) { std::cerr << "Engine prediction error: " << error << std::endl; exit(EXIT_FAILURE); } - PrintTopPrediction (prediction); + /* This model only has one output */ + PrintTopPrediction (predictions[0]); std::cout << "Stopping engine" << std::endl; error = engine->Stop (); diff --git a/meson.build b/meson.build index f1f866f0..a9e345f9 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('r2inference', ['cpp'], default_options : ['cpp_std=c++11'], - version : '0.10.2', + version : '0.11.0', meson_version : '>= 0.50',) # Set project information @@ -76,6 +76,7 @@ if get_option('enable-tensorrt') # CUDA versions supported cuda_versions = [ '10.0', + '10.2' ] # Find CUDA version @@ -192,7 +193,7 @@ pkgconfig = import('pkgconfig') # Install git hooks python3 = import('python').find_installation() -run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') +run_command(python3, '-c', 'import shutil; shutil.copy("common/hooks/pre-commit-hook.sh", ".git/hooks/pre-commit")') # Meson will generate a header file all the entries in the configuration data object configure_file(output : 'config.h', configuration : cdata) diff --git a/r2i/Makefile.am b/r2i/Makefile.am deleted file mode 100644 index 208dced6..00000000 --- a/r2i/Makefile.am +++ /dev/null @@ -1,155 +0,0 @@ -# Copyright (C) 2018-2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -SUBDIRS = - -if HAVE_CORAL -SUBDIRS += coral -endif - -if HAVE_NCSDK -SUBDIRS += ncsdk -endif - -if HAVE_ONNXRT -SUBDIRS += onnxrt -endif - -if HAVE_ONNXRT_ACL -SUBDIRS += onnxrt_acl -endif - -if HAVE_ONNXRT_OPENVINO -SUBDIRS += onnxrt_openvino -endif - -if HAVE_TENSORFLOW -SUBDIRS += tensorflow -endif - -if HAVE_TFLITE -SUBDIRS += tflite -endif - -if HAVE_TENSORRT -SUBDIRS += tensorrt -endif - -DIST_SUBDIRS = \ - coral \ - ncsdk \ - onnxrt \ - onnxrt_acl \ - onnxrt_openvino \ - tensorflow \ - tensorrt \ - tflite - -lib_LTLIBRARIES = libr2inference-@RR_PACKAGE_VERSION@.la - -# Define a custom area for our headers -r2iincludedir = @R2IINCLUDEDIR@/r2i - -libr2inference_@RR_PACKAGE_VERSION@_la_SOURCES = \ - classification.cc \ - datatype.cc \ - detection.cc \ - iframeworkfactory.cc \ - loader.cc \ - runtimeerror.cc \ - imageformat.cc - -libr2inference_@RR_PACKAGE_VERSION@_la_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -libr2inference_@RR_PACKAGE_VERSION@_la_CFLAGS = \ - $(RR_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -libr2inference_@RR_PACKAGE_VERSION@_la_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) - -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD = \ - $(RR_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) - -r2iinclude_HEADERS = \ - classification.h \ - datatype.h \ - detection.h \ - frameworkmeta.h \ - frameworks.h \ - iengine.h \ - iframe.h \ - iframeworkfactory.h \ - iloader.h \ - imageformat.h \ - imodel.h \ - inferenceoutput.h \ - iparameters.h \ - ipostprocessing.h \ - iprediction.h \ - ipreprocessing.h \ - loader.h \ - parametermeta.h \ - r2i.h \ - runtimeerror.h - - -if HAVE_CORAL -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/coral/libcoral.la -endif - -if HAVE_NCSDK -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/ncsdk/libncsdk.la -endif - -if HAVE_ONNXRT -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/onnxrt/libonnxrt.la -endif - -if HAVE_ONNXRT_ACL -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/onnxrt_acl/libonnxrt_acl.la -endif - -if HAVE_ONNXRT_OPENVINO -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/onnxrt_openvino/libonnxrt_openvino.la -endif - -if HAVE_TENSORFLOW -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/tensorflow/libtf.la -endif - -if HAVE_TENSORRT -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/tensorrt/libtensorrt.la -endif - -if HAVE_TFLITE -libr2inference_@RR_PACKAGE_VERSION@_la_LIBADD += \ - $(top_builddir)/r2i/tflite/libtflite.la -endif - -#Build pre/post processing modules -SUBDIRS += preprocessing - -SUBDIRS += postprocessing diff --git a/r2i/coral/Makefile.am b/r2i/coral/Makefile.am deleted file mode 100644 index a55d352f..00000000 --- a/r2i/coral/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2020 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -if HAVE_CORAL - -noinst_LTLIBRARIES = libcoral.la - -# Define a custom area for our headers -tensorflowlitecoralincludedir = @R2IINCLUDEDIR@/r2i/coral - -libcoral_la_SOURCES = \ - engine.cc \ - frameworkfactory.cc - -libcoral_la_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -libcoral_la_CFLAGS = \ - $(RR_CFLAGS) \ - $(TFLITE_CFLAGS) \ - $(CORAL_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -libcoral_la_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(TFLITE_CFLAGS) \ - $(CORAL_CFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) - -libcoral_la_LIBADD = \ - $(RR_LIBS) \ - $(TFLITE_LIBS) \ - $(CORAL_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) - -tensorflowlitecoralinclude_HEADERS = \ - engine.h \ - frameworkfactory.h - -endif # HAVE_CORAL diff --git a/r2i/frameworks.h b/r2i/frameworks.h index 10bfc0a5..adb754b3 100644 --- a/r2i/frameworks.h +++ b/r2i/frameworks.h @@ -27,11 +27,6 @@ enum FrameworkCode { */ CORAL, - /** - * Intel Movidius Neural Compute software developer kit - */ - NCSDK, - /** * Open Neural Network Exchange Runtime */ diff --git a/r2i/iframeworkfactory.cc b/r2i/iframeworkfactory.cc index 905a83bc..9ea5bd19 100644 --- a/r2i/iframeworkfactory.cc +++ b/r2i/iframeworkfactory.cc @@ -16,7 +16,6 @@ #include "config.h" #include "coral/frameworkfactory.h" -#include "ncsdk/frameworkfactory.h" #include "onnxrt/frameworkfactory.h" #include "onnxrt_acl/frameworkfactory.h" #include "onnxrt_openvino/frameworkfactory.h" @@ -34,13 +33,6 @@ MakeCoralFactory (RuntimeError &error) { } #endif // HAVE_CORAL -#ifdef HAVE_NCSDK -static std::unique_ptr -MakeNcsdkFactory (RuntimeError &error) { - return std::unique_ptr (new ncsdk::FrameworkFactory); -} -#endif // HAVE_NCSDK - #ifdef HAVE_ONNXRT static std::unique_ptr MakeOnnxrtFactory(RuntimeError &error) { @@ -97,10 +89,6 @@ const std::unordered_map frameworks ({ {FrameworkCode::CORAL, MakeCoralFactory}, #endif //HAVE_CORAL -#ifdef HAVE_NCSDK - {FrameworkCode::NCSDK, MakeNcsdkFactory}, -#endif //HAVE_NCSDK - #ifdef HAVE_ONNXRT {FrameworkCode::ONNXRT, MakeOnnxrtFactory}, #endif //HAVE_ONNXRT diff --git a/r2i/ncsdk/Makefile.am b/r2i/ncsdk/Makefile.am deleted file mode 100644 index 3bc655e7..00000000 --- a/r2i/ncsdk/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) -# All Rights Reserved. -# -# The contents of this software are proprietary and confidential to RidgeRun, -# LLC. No part of this program may be photocopied, reproduced or translated -# into another programming language without prior written consent of -# RidgeRun, LLC. The user is free to modify the source code after obtaining -# a software license from RidgeRun. All source code changes must be provided -# back to RidgeRun without any encumbrance. - -if HAVE_NCSDK - -noinst_LTLIBRARIES = libncsdk.la - -# Define a custom area for our headers -ncsdkincludedir = @R2IINCLUDEDIR@/r2i/ncsdk - -libncsdk_la_SOURCES = \ - parameters.cc \ - parameteraccessors.cc \ - model.cc \ - loader.cc \ - engine.cc \ - frame.cc \ - prediction.cc \ - statuscodes.cc \ - frameworkfactory.cc - -libncsdk_la_CPPFLAGS = \ - $(RR_CPPFLAGS) \ - $(CODE_COVERAGE_CPPFLAGS) - -libncsdk_la_CFLAGS = \ - $(RR_CFLAGS) \ - $(NCSDK_CFLAGS) \ - $(CODE_COVERAGE_CFLAGS) - -libncsdk_la_CXXFLAGS = \ - $(RR_CXXFLAGS) \ - $(NCSDK_CFLAGS) \ - $(CODE_COVERAGE_CXXFLAGS) \ - $(GLIB_CFLAGS) \ - $(GMODULE_CFLAGS) - -libncsdk_la_LIBADD = \ - $(RR_LIBS) \ - $(NCSDK_LIBS) \ - $(CODE_COVERAGE_LIBS) \ - $(GLIB_LIBS) \ - $(GMODULE_LIBS) - -ncsdkinclude_HEADERS = \ - parameters.h \ - parameteraccessors.h \ - model.h \ - loader.h \ - engine.h \ - prediction.h \ - frame.h \ - frameworkfactory.h - -endif # HAVE_NCSDK diff --git a/r2i/ncsdk/engine.cc b/r2i/ncsdk/engine.cc deleted file mode 100644 index 2c0a262f..00000000 --- a/r2i/ncsdk/engine.cc +++ /dev/null @@ -1,429 +0,0 @@ -/* Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) - * All Rights Reserved. - * - * The contents of this software are proprietary and confidential to RidgeRun, - * LLC. No part of this program may be photocopied, reproduced or translated - * into another programming language without prior written consent of - * RidgeRun, LLC. The user is free to modify the source code after obtaining - * a software license from RidgeRun. All source code changes must be provided - * back to RidgeRun without any encumbrance. -*/ - -#include -#include - -#include "r2i/ncsdk/prediction.h" -#include "r2i/ncsdk/engine.h" -#include "r2i/ncsdk/frame.h" -#include "r2i/ncsdk/statuscodes.h" - -namespace r2i { -namespace ncsdk { - -Engine::Engine () : - model(nullptr), - movidius_device(nullptr), - input_buffers(nullptr), - output_buffers(nullptr), - status(Engine::Status::IDLE) { -} - -ncDeviceHandle_t *Engine::GetDeviceHandler () { - return this->movidius_device; -} - -void Engine::SetDeviceHandler (ncDeviceHandle_t *handler) { - this->movidius_device = handler; -} - -ncFifoHandle_t *Engine::GetInputFifoHandler () { - return this->input_buffers; -} - -void Engine::SetInputFifoHandler (ncFifoHandle_t *handler) { - this->input_buffers = handler; -} - -ncFifoHandle_t *Engine::GetOutputFifoHandler () { - return this->output_buffers; -} - -void Engine::SetOutputFifoHandler (ncFifoHandle_t *handler) { - this->output_buffers = handler; -} - -RuntimeError Engine::SetModel (std::shared_ptr in_model) { - - RuntimeError error; - - if (nullptr == in_model) { - error.Set (RuntimeError::Code:: NULL_PARAMETER, - "Received null model"); - return error; - } - auto model = std::dynamic_pointer_cast - (in_model); - - if (nullptr == model) { - error.Set (RuntimeError::Code::INCOMPATIBLE_MODEL, - "The provided model is not an NCSDK model"); - return error; - } - - if (nullptr != this->model) { - this->model = nullptr; - } - - this->model = model; - - return error; -} - -Engine::Status Engine::GetStatus () { - - return this->status; -} - -void Engine::SetStatus (Engine::Status new_status) { - - this->status = new_status; - return ; -} - - -RuntimeError Engine::Start () { - - ncDeviceHandle_t *device_handle; - ncGraphHandle_t *model_handle; - ncFifoHandle_t *input_buffers_ptr; - ncFifoHandle_t *output_buffers_ptr; - ncStatus_t ret; - unsigned int model_size; - std::shared_ptr model_ptr; - Status engine_status; - unsigned int descriptor_length; - RuntimeError error; - - engine_status = this->GetStatus(); - - if (Status:: START == engine_status) { - error.Set (RuntimeError::Code:: WRONG_ENGINE_STATE, - "Engine in wrong State"); - return error; - } - - if (nullptr == this->model) { - error.Set (RuntimeError::Code:: NULL_PARAMETER, - "Model not set yet"); - return error; - } - - model->Start ("NCSDK"); - - ret = ncDeviceCreate(0, &device_handle); - - if (NC_OK != ret) { - error.Set (RuntimeError::Code::INVALID_FRAMEWORK_PARAMETER, - GetStringFromStatus (ret, error)); - goto create_fail; - } - - ret = ncDeviceOpen(device_handle); - - if (NC_OK != ret ) { - error.Set (RuntimeError::Code::INVALID_FRAMEWORK_PARAMETER, - GetStringFromStatus (ret, error)); - goto open_fail; - } - - model_size = this->model->GetDataSize(); - model_ptr = this->model->GetData(); - model_handle = this->model->GetHandler(); - - ret = ncGraphAllocate(device_handle, model_handle, - model_ptr.get(), model_size); - - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - goto graph_fail; - } - - descriptor_length = sizeof(struct ncTensorDescriptor_t); - - ret = ncGraphGetOption(model_handle, NC_RO_GRAPH_INPUT_TENSOR_DESCRIPTORS, - &this->input_descriptor, &descriptor_length); - - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - goto parameters_fail; - } - - ret = ncGraphGetOption(model_handle, NC_RO_GRAPH_OUTPUT_TENSOR_DESCRIPTORS, - &this->output_descriptor, &descriptor_length); - - if (ret != NC_OK ) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - goto parameters_fail; - } - - //Do we want to keep generic Names for the fifos? - ret = ncFifoCreate("FifoIn0", NC_FIFO_HOST_WO, &input_buffers_ptr); - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - goto parameters_fail; - } - ret = ncFifoAllocate(input_buffers_ptr, device_handle, &this->input_descriptor, - 2); - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - goto input_fifo_fail; - } - ret = ncFifoCreate("FifoOut0", NC_FIFO_HOST_RO, &output_buffers_ptr); - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - goto input_fifo_fail; - } - ret = ncFifoAllocate(output_buffers_ptr, device_handle, - &this->output_descriptor, 2); - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - goto output_fifo_fail; - } - - //Save used pointers - this->SetInputFifoHandler(input_buffers_ptr); - this->SetOutputFifoHandler(output_buffers_ptr); - this->SetDeviceHandler(device_handle); - - this->SetStatus(Status::START); - - return error; - -output_fifo_fail: - ncFifoDestroy(&output_buffers_ptr); -input_fifo_fail: - ncFifoDestroy(&input_buffers_ptr); -parameters_fail: - ncGraphDestroy(&model_handle); -graph_fail: - ncDeviceClose(device_handle); -open_fail: - ncDeviceDestroy(&device_handle); -create_fail: - return error; -} - -RuntimeError Engine::Stop () { - - ncDeviceHandle_t *device_handle; - ncFifoHandle_t *input_buffers_ptr; - ncFifoHandle_t *output_buffers_ptr; - Status engine_status; - RuntimeError error; - ncStatus_t ret; - - - engine_status = this->GetStatus(); - - if ( Status:: IDLE == engine_status) { - error.Set (RuntimeError::Code:: WRONG_ENGINE_STATE, - "Engine in wrong state"); - return error; - } - - if (nullptr == this->model) { - error.Set (RuntimeError::Code:: NULL_PARAMETER, - "Model not set yet"); - return error; - } - - input_buffers_ptr = this->GetInputFifoHandler(); - output_buffers_ptr = this->GetOutputFifoHandler(); - - - ret = ncFifoDestroy(&output_buffers_ptr); - this->output_buffers = nullptr; - - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - return error; - } - - ret = ncFifoDestroy(&input_buffers_ptr); - this->input_buffers = nullptr; - - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - return error; - } - - error = this->model->Stop (); - if (RuntimeError::Code::EOK != error.GetCode ()) { - return error; - } - - device_handle = this->GetDeviceHandler(); - - ret = ncDeviceClose(device_handle); - - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - return error; - } - - ret = ncDeviceDestroy (&device_handle); - this->movidius_device = nullptr; - - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - GetStringFromStatus (ret, error)); - return error; - } - - this->SetStatus(Status::IDLE); - - return error; -} - -std::shared_ptr Engine::Predict (std::shared_ptr - in_frame, - r2i::RuntimeError &error) { - - ncStatus_t ret; - unsigned int input_data_size; - unsigned int output_data_size; - unsigned int output_data_size_byte_length; - ncFifoHandle_t *input_buffers_ptr; - ncFifoHandle_t *output_buffers_ptr; - ncGraphHandle_t *model_handle; - void *userParam; - std::shared_ptr presult; - float *result; - float *data; - Status engine_status; - r2i::ImageFormat in_format; - error.Clean (); - - std::shared_ptr prediction (new r2i::ncsdk::Prediction()); - - auto frame = std::dynamic_pointer_cast - (in_frame); - - if (nullptr == frame) { - error.Set (RuntimeError::Code::INCOMPATIBLE_MODEL, - "The provided frame is not an NCSDK frame"); - goto engine_error; - } - - engine_status = this->GetStatus(); - - if ( Status:: IDLE == engine_status) { - error.Set (RuntimeError::Code:: WRONG_ENGINE_STATE, - "Engine in wrong State"); - goto engine_error; - } - - data = static_cast(frame->GetData()); - - in_format = in_frame->GetFormat(); - input_data_size = sizeof(float) * in_frame->GetWidth() * - in_frame->GetHeight() * in_format.GetNumPlanes(); - - input_buffers_ptr = this->GetInputFifoHandler();; - output_buffers_ptr = this->GetOutputFifoHandler();; - - - ret = ncFifoWriteElem(input_buffers_ptr, (float *)data, &input_data_size, 0); - - if (NC_OK != ret) { - error.Set (RuntimeError::Code:: FRAMEWORK_ERROR, - " Failed to write element to Fifo"); - goto exit; - } - - //Queue inference - model_handle = this->model->GetHandler(); - - ret = ncGraphQueueInference(model_handle, - &input_buffers_ptr, 1, - &output_buffers_ptr, 1); - if (NC_OK != ret) { - error.Set (RuntimeError::Code:: FRAMEWORK_ERROR, - " Failed to write element to Fifo"); - goto exit; - } - - //Read Results - output_data_size_byte_length = sizeof(unsigned int); - - ret = ncFifoGetOption(output_buffers_ptr, NC_RO_FIFO_ELEMENT_DATA_SIZE, - &output_data_size, - &output_data_size_byte_length); - if (NC_OK != ret || output_data_size_byte_length != sizeof(unsigned int)) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - " Failed to get parameters"); - goto exit; - } - - presult = std::shared_ptr (static_cast (malloc ( - output_data_size)), free); - - if (nullptr == presult) { - error.Set (RuntimeError::Code::UNKNOWN_ERROR, - "Can't alloc data for inference results"); - goto engine_error; - } - - result = presult.get (); - - ret = ncFifoReadElem(output_buffers_ptr, - result, &output_data_size, - &userParam); - if (NC_OK != ret) { - error.Set (RuntimeError::Code::FRAMEWORK_ERROR, - " Read Inference result failed!"); - - goto read_error; - - } - - error = prediction->SetResult(presult, output_data_size); - if (RuntimeError::Code::EOK != error.GetCode()) { - goto exit; - } - - return prediction; - -read_error: - free(result); -exit: -engine_error: - return nullptr; - -} - -RuntimeError Engine::Predict (std::shared_ptr in_frame, - std::vector< std::shared_ptr > &predictions) { - RuntimeError error; - error.Set(RuntimeError::Code::NOT_IMPLEMENTED, - "Predict function for multiple outputs not implemented in NCSDK backend."); - return error; -} - -Engine::~Engine () { - this->Stop(); -} - -} //namespace ncsdk -} //namepsace r2i - diff --git a/r2i/ncsdk/engine.h b/r2i/ncsdk/engine.h deleted file mode 100644 index 6797784b..00000000 --- a/r2i/ncsdk/engine.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) - * All Rights Reserved. - * - * The contents of this software are proprietary and confidential to RidgeRun, - * LLC. No part of this program may be photocopied, reproduced or translated - * into another programming language without prior written consent of - * RidgeRun, LLC. The user is free to modify the source code after obtaining - * a software license from RidgeRun. All source code changes must be provided - * back to RidgeRun without any encumbrance. -*/ - -#ifndef R2I_NCSDK_ENGINE_H -#define R2I_NCSDK_ENGINE_H - -#include -#include - -namespace r2i { -namespace ncsdk { - -class Engine : public IEngine { - public: - Engine (); - - r2i::RuntimeError SetModel (std::shared_ptr in_model) override; - - r2i::RuntimeError Start () override; - - r2i::RuntimeError Stop () override; - - std::shared_ptr Predict (std::shared_ptr - in_frame, r2i::RuntimeError &error) override; - - RuntimeError Predict (std::shared_ptr in_frame, - std::vector< std::shared_ptr > &predictions) override; - - ncDeviceHandle_t *GetDeviceHandler (); - void SetDeviceHandler (ncDeviceHandle_t *handler); - - ncFifoHandle_t *GetInputFifoHandler (); - void SetInputFifoHandler (ncFifoHandle_t *handler); - - ncFifoHandle_t *GetOutputFifoHandler (); - void SetOutputFifoHandler (ncFifoHandle_t *handler); - - ~Engine (); - - enum Status { - IDLE, - START - }; - private: - std::shared_ptr model; - ncDeviceHandle_t *movidius_device; - ncFifoHandle_t *input_buffers; - ncFifoHandle_t *output_buffers; - ncTensorDescriptor_t input_descriptor; - ncTensorDescriptor_t output_descriptor; - Status GetStatus (); - void SetStatus (Status new_status); - Status status; - - -}; - -} -} -#endif //R2I_NCSDK_ENGINE_H diff --git a/r2i/ncsdk/frame.cc b/r2i/ncsdk/frame.cc deleted file mode 100644 index 1455a8c5..00000000 --- a/r2i/ncsdk/frame.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) - * All Rights Reserved. - * - * The contents of this software are proprietary and confidential to RidgeRun, - * LLC. No part of this program may be photocopied, reproduced or translated - * into another programming language without prior written consent of - * RidgeRun, LLC. The user is free to modify the source code after obtaining - * a software license from RidgeRun. All source code changes must be provided - * back to RidgeRun without any encumbrance. -*/ - -#include "r2i/ncsdk/frame.h" -#include "r2i/ncsdk/statuscodes.h" - -namespace r2i { -namespace ncsdk { - -RuntimeError Frame::Configure (void *in_data, int width, - int height, r2i::ImageFormat::Id format) { - RuntimeError error; - ImageFormat imageformat (format); - - if (nullptr == in_data) { - error.Set (RuntimeError::Code::NULL_PARAMETER, "Received a NULL data pointer"); - return error; - } - if (width <= 0) { - error.Set (RuntimeError::Code::WRONG_API_USAGE, - "Received an invalid image width"); - return error; - } - if (height <= 0) { - error.Set (RuntimeError::Code::WRONG_API_USAGE, - "Received an invalid image height"); - return error; - } - - this->frame_data = static_cast(in_data); - this->frame_width = width; - this->frame_height = height; - this->frame_format = imageformat; - - return error; -} - -void *Frame::GetData () { - return this->frame_data; -} - -int Frame::GetWidth () { - return this->frame_width; -} - -int Frame::GetHeight () { - return this->frame_height; -} - -ImageFormat Frame::GetFormat () { - return this->frame_format; -} - -DataType Frame::GetDataType () { - return r2i::DataType::Id::FLOAT; -} - -} -} diff --git a/r2i/ncsdk/frame.h b/r2i/ncsdk/frame.h deleted file mode 100644 index a8753edb..00000000 --- a/r2i/ncsdk/frame.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) - * All Rights Reserved. - * - * The contents of this software are proprietary and confidential to RidgeRun, - * LLC. No part of this program may be photocopied, reproduced or translated - * into another programming language without prior written consent of - * RidgeRun, LLC. The user is free to modify the source code after obtaining - * a software license from RidgeRun. All source code changes must be provided - * back to RidgeRun without any encumbrance. -*/ - -#ifndef R2I_NCSDK_FRAME_H -#define R2I_NCSDK_FRAME_H - -#include - -namespace r2i { -namespace ncsdk { - -class Frame : public IFrame { - public: - RuntimeError Configure (void *in_data, int width, - int height, r2i::ImageFormat::Id format) override; - - void *GetData () override; - - int GetWidth () override; - - int GetHeight () override; - - ImageFormat GetFormat () override; - - virtual DataType GetDataType () override; - - private: - float *frame_data; - int frame_width; - int frame_height; - ImageFormat frame_format; -}; - -} -} - -#endif //R2I_NCSDK_FRAME_H diff --git a/r2i/ncsdk/frameworkfactory.cc b/r2i/ncsdk/frameworkfactory.cc deleted file mode 100644 index b944767d..00000000 --- a/r2i/ncsdk/frameworkfactory.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (C) 2018 RidgeRun, LLC (http://www.ridgerun.com) - * All Rights Reserved. - * - * The contents of this software are proprietary and confidential to RidgeRun, - * LLC. No part of this program may be photocopied, reproduced or translated - * into another programming language without prior written consent of - * RidgeRun, LLC. The user is free to modify the source code after obtaining - * a software license from RidgeRun. All source code changes must be provided - * back to RidgeRun without any encumbrance. -*/ - -#include "frameworkfactory.h" - -#include "engine.h" -#include "frame.h" -#include "loader.h" -#include "parameters.h" - -namespace r2i { -namespace ncsdk { - -std::unique_ptr FrameworkFactory::MakeLoader ( - RuntimeError &error) { - error.Clean (); - - return std::unique_ptr (new Loader); -} - -std::unique_ptr FrameworkFactory::MakeEngine ( - RuntimeError &error) { - error.Clean (); - - return std::unique_ptr (new Engine); -} - -std::unique_ptr FrameworkFactory::MakeParameters ( - RuntimeError &error) { - error.Clean (); - - return std::unique_ptr (new Parameters); -} - -std::unique_ptr FrameworkFactory::MakeFrame ( - RuntimeError &error) { - error.Clean (); - - return std::unique_ptr