From 4577f98771593b734227258528b492eae358bc15 Mon Sep 17 00:00:00 2001 From: Joaquim Casals <jcasals@iri.upc.edu> Date: Fri, 10 May 2019 16:23:10 +0200 Subject: [PATCH] Fix CMake. Left only Config file, removed FindWolf --- CMakeLists.txt | 3 - cmake_modules/Findwolf.cmake | 28 ---- cmake_modules/wolfConfig.cmake | 240 ++++++--------------------------- test/gtest_emplace.cpp | 3 +- 4 files changed, 43 insertions(+), 231 deletions(-) delete mode 100644 cmake_modules/Findwolf.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 002d23a08..67bc28cab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ SET(CMAKE_MACOSX_RPATH 1) # The project name PROJECT(wolf) - #string(COMPARE EQUAL "${CMAKE_BINARY_DIR}" "" result) #IF(result) # SET(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -605,8 +604,6 @@ INSTALL(FILES ${HDRS_SERIALIZATION} DESTINATION include/iri-algorithms/wolf/plugin_core/core/serialization) INSTALL(FILES ${HDRS_YAML} DESTINATION include/iri-algorithms/wolf/plugin_core/core/yaml) -INSTALL(FILES "${CMAKE_SOURCE_DIR}/cmake_modules/Findwolf.cmake" - DESTINATION "lib/cmake/${PROJECT_NAME}") FILE(WRITE ${PROJECT_NAME}.found "") INSTALL(FILES ${PROJECT_NAME}.found diff --git a/cmake_modules/Findwolf.cmake b/cmake_modules/Findwolf.cmake deleted file mode 100644 index 469f3372a..000000000 --- a/cmake_modules/Findwolf.cmake +++ /dev/null @@ -1,28 +0,0 @@ -#edit the following line to add the librarie's header files -FIND_PATH( - wolf_INCLUDE_DIRS - NAMES wolf.found - PATHS /usr/local/include/iri-algorithms/wolf/plugin_core) -#change INCLUDE_DIRS to its parent directory -# get_filename_component(wolf_INCLUDE_DIRS ${wolf_INCLUDE_DIRS} DIRECTORY) -MESSAGE("Found wolf include dirs: ${wolf_INCLUDE_DIRS}") - -FIND_LIBRARY( - wolf_LIBRARY - NAMES wolf - PATHS /usr/lib /usr/local/lib /usr/local/lib/iri-algorithms) - -IF (wolf_INCLUDE_DIRS AND wolf_LIBRARY) - SET(wolf_FOUND TRUE) -ENDIF (wolf_INCLUDE_DIRS AND wolf_LIBRARY) - -IF (wolf_FOUND) - IF (NOT wolf_FIND_QUIETLY) - MESSAGE(STATUS "Found wolf: ${wolf_LIBRARY}") - ENDIF (NOT wolf_FIND_QUIETLY) -ELSE (wolf_FOUND) - IF (wolf_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find wolf") - ENDIF (wolf_FIND_REQUIRED) -ENDIF (wolf_FOUND) - diff --git a/cmake_modules/wolfConfig.cmake b/cmake_modules/wolfConfig.cmake index e5021aa6c..75fffc965 100644 --- a/cmake_modules/wolfConfig.cmake +++ b/cmake_modules/wolfConfig.cmake @@ -1,82 +1,44 @@ -# This file was copied and adapted from the ceres_solver project -# http://ceres-solver.org/ +#edit the following line to add the librarie's header files +FIND_PATH( + wolf_INCLUDE_DIR + NAMES wolf.found + PATHS /usr/local/include/iri-algorithms/wolf/plugin_core) +IF(wolf_INCLUDE_DIR) + MESSAGE("Found vision include dirs: ${wolf_INCLUDE_DIR}") +ELSE(wolf_INCLUDE_DIR) + MESSAGE("Couldn't find vision include dirs") +ENDIF(wolf_INCLUDE_DIR) + +FIND_LIBRARY( + wolf_LIBRARY + NAMES libwolf.so + PATHS /usr/local/lib/iri-algorithms) +IF(wolf_LIBRARY) + MESSAGE("Found wolf lib: ${wolf_LIBRARY}") +ELSE(wolf_LIBRARY) + MESSAGE("Couldn't find wolf lib") +ENDIF(wolf_LIBRARY) + +IF (wolf_INCLUDE_DIR AND wolf_LIBRARY) + SET(wolf_FOUND TRUE) + ELSE(wolf_INCLUDE_DIR AND wolf_LIBRARY) + set(wolf_FOUND FALSE) +ENDIF (wolf_INCLUDE_DIR AND wolf_LIBRARY) + +IF (wolf_FOUND) + IF (NOT wolf_FIND_QUIETLY) + MESSAGE(STATUS "Found wolf: ${wolf_LIBRARY}") + ENDIF (NOT wolf_FIND_QUIETLY) +ELSE (wolf_FOUND) + IF (wolf_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find wolf") + ENDIF (wolf_FIND_REQUIRED) +ENDIF (wolf_FOUND) -# wolf - Windowed Localization Frames -# Copyright 2016 -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of Google Inc. nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# Authors: -# - -# Config file for wolf - Find wolf & dependencies. -# -# This file is used by CMake when find_package(wolf) is invoked and either -# the directory containing this file either is present in CMAKE_MODULE_PATH -# (if wolf was installed), or exists in the local CMake package registry if -# the wolf build directory was exported. -# -# This module defines the following variables: -# -# wolf_FOUND / wolf_FOUND: True if wolf has been successfully -# found. Both variables are set as although -# FindPackage() only references wolf_FOUND -# in Config mode, given the conventions for -# <package>_FOUND when FindPackage() is -# called in Module mode, users could -# reasonably expect to use wolf_FOUND -# instead. -# -# wolf_VERSION: Version of wolf found. -# -# wolf_INCLUDE_DIRS: Include directories for wolf and the -# dependencies which appear in the wolf public -# API and are thus required to use wolf. -# -# wolf_LIBRARIES: Libraries for wolf and all -# dependencies against which wolf was -# compiled. This will not include any optional -# dependencies that were disabled when wolf was -# compiled. -# -# The following variables are also defined for legacy compatibility -# only. Any new code should not use them as they do not conform to -# the standard CMake FindPackage naming conventions. -# -# wolf_INCLUDES = ${wolf_INCLUDE_DIRS}. - -# Called if we failed to find Ceres or any of its required dependencies, -# unsets all public (designed to be used externally) variables and reports -# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument. macro(wolf_report_not_found REASON_MSG) - # FindPackage() only references Ceres_FOUND, and requires it to be - # explicitly set FALSE to denote not found (not merely undefined). - set(wolf_FOUND FALSE) set(wolf_FOUND FALSE) - unset(wolf_INCLUDE_DIRS) + unset(wolf_INCLUDE_DIR) unset(wolf_LIBRARIES) # Reset the CMake module path to its state when this script was called. @@ -85,7 +47,7 @@ macro(wolf_report_not_found REASON_MSG) # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by # FindPackage() use the camelcase library name, not uppercase. if (wolf_FIND_QUIETLY) - message(STATUS "Failed to find wolf - " ${REASON_MSG} ${ARGN}) + message(STATUS "Failed to find wolf- " ${REASON_MSG} ${ARGN}) else (wolf_FIND_REQUIRED) message(FATAL_ERROR "Failed to find wolf - " ${REASON_MSG} ${ARGN}) else() @@ -96,126 +58,8 @@ macro(wolf_report_not_found REASON_MSG) return() endmacro(wolf_report_not_found) -# Record the state of the CMake module path when this script was -# called so that we can ensure that we leave it in the same state on -# exit as it was on entry, but modify it locally. -set(CALLERS_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) - -# Get the (current, i.e. installed) directory containing this file. -get_filename_component(wolf_CURRENT_CONFIG_DIR - "${CMAKE_CURRENT_LIST_FILE}" PATH) - -# Reset CMake module path to the installation directory of this -# script, thus we will use the FindPackage() scripts shipped with -# wolf to find wolf' dependencies, even if the user has equivalently -# named FindPackage() scripts in their project. -set(CMAKE_MODULE_PATH ${wolf_CURRENT_CONFIG_DIR}) - -# Build the absolute root install directory as a relative path -# (determined when wolf was configured & built) from the current -# install directory for this this file. This allows for the install -# tree to be relocated, after wolf was built, outside of CMake. -get_filename_component(CURRENT_ROOT_INSTALL_DIR - ${wolf_CURRENT_CONFIG_DIR}/../../../ - ABSOLUTE) -if (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR}) - wolf_report_not_found( - "wolf install root: ${CURRENT_ROOT_INSTALL_DIR}, " - "determined from relative path from wolfConfig.cmake install location: " - "${wolf_CURRENT_CONFIG_DIR}, does not exist. Either the install " - "directory was deleted, or the install tree was only partially relocated " - "outside of CMake after wolf was built.") -endif (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR}) - +if(NOT wolf_FOUND) + wolf_report_not_found("TROUBLE DUDE.") +endif(NOT wolf_FOUND) # Set the include directories for wolf (itself). -set(wolf_INCLUDE_DIR "${CURRENT_ROOT_INSTALL_DIR}/include/iri-algorithms") - -# # if (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf/wolf.h) -if (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf/plugin_core) - wolf_report_not_found( - "wolf install root: ${CURRENT_ROOT_INSTALL_DIR}, " - "determined from relative path from wolfConfig.cmake install location: " - "${wolf_CURRENT_CONFIG_DIR}, does not contain wolf headers. " - "Either the install directory was deleted, or the install tree was only " - "partially relocated outside of CMake after wolf was built.") -# endif (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf/wolf.h) -endif (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf/plugin_core) -list(APPEND wolf_INCLUDE_DIRS ${wolf_INCLUDE_DIR}/wolf/plugin_core) - -# Set the version. -set(wolf_VERSION 0.0.1) - -# Eigen. - -# Flag set during configuration and build of wolf. -set(wolf_EIGEN_VERSION @EIGEN_VERSION@) -# Append the locations of Eigen when wolf was built to the search path hints. -list(APPEND EIGEN_INCLUDE_DIR_HINTS /usr/include/eigen3) -# Search quietly to control the timing of the error message if not found. The -# search should be for an exact match, but for usability reasons do a soft -# match and reject with an explanation below. - -find_package(Eigen3 ${wolf_EIGEN_VERSION} QUIET) -# Flag set with currently found Eigen version. -set(EIGEN_VERSION @EIGEN_VERSION@) -if (EIGEN3_FOUND) - if (NOT EIGEN_VERSION VERSION_EQUAL wolf_EIGEN_VERSION) - # CMake's VERSION check in FIND_PACKAGE() will accept any version >= the - # specified version. However, only version = is supported. Improve - # usability by explaining why we don't accept non-exact version matching. - wolf_report_not_found("Found Eigen dependency, but the version of Eigen " - "found (${EIGEN_VERSION}) does not exactly match the version of Eigen " - "wolf was compiled with (${wolf_EIGEN_VERSION}). This can cause subtle " - "bugs by triggering violations of the One Definition Rule. See the " - "Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule " - "for more details") - endif () - message(STATUS "Found required wolf dependency: " - "Eigen version ${wolf_EIGEN_VERSION} in ${EIGEN3_INCLUDE_DIR}") -else (EIGEN3_FOUND) - wolf_report_not_found("Missing required wolf " - "dependency: Eigen version ${wolf_EIGEN_VERSION}, please set " - "EIGEN3_INCLUDE_DIR.") -endif (EIGEN3_FOUND) -list(APPEND wolf_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) - -# Import exported wolf targets, if they have not already been imported. -if (NOT TARGET wolf AND NOT wolf_BINARY_DIR) - include(${wolf_CURRENT_CONFIG_DIR}/wolfTargets.cmake) -endif (NOT TARGET wolf AND NOT wolf_BINARY_DIR) -# Set the expected XX_LIBRARIES variable for FindPackage(). -set(wolf_LIBRARIES wolf) - -# Set legacy library variable for backwards compatibility. -set(wolf_LIBRARY ${wolf_LIBRARIES}) - -# Make user aware of any compile flags that will be added to their targets -# which use wolf (i.e. flags exported in the wolf target). Only CMake -# versions >= 2.8.12 support target_compile_options(). -if (TARGET ${wolf_LIBRARIES} AND - NOT CMAKE_VERSION VERSION_LESS "2.8.12") - get_target_property(wolf_INTERFACE_COMPILE_OPTIONS - ${wolf_LIBRARIES} INTERFACE_COMPILE_OPTIONS) - - set(wolf_LOCATION "${CURRENT_ROOT_INSTALL_DIR}") - - # Check for -std=c++11 flags. - if (wolf_INTERFACE_COMPILE_OPTIONS MATCHES ".*std=c\\+\\+11.*") - message(STATUS "wolf version ${wolf_VERSION} detected here: " - "${wolf_LOCATION} was built with C++11. wolf target will add " - "C++11 flags to compile options for targets using it.") - endif() -endif() - -# Reset CMake module path to its state when this script was called. -set(CMAKE_MODULE_PATH ${CALLERS_CMAKE_MODULE_PATH}) - -# As we use wolf_REPORT_NOT_FOUND() to abort, if we reach this point we have -# found wolf and all required dependencies. -message(STATUS "Found wolf version: ${wolf_VERSION} installed in: ${CURRENT_ROOT_INSTALL_DIR}") - -# Set wolf_FOUND to be equivalent to wolf_FOUND, which is set to -# TRUE by FindPackage() if this file is found and run, and after which -# wolf_FOUND is not (explicitly, i.e. undefined does not count) set -# to FALSE. -set(wolf_FOUND TRUE) +set(wolf_FOUND TRUE) \ No newline at end of file diff --git a/test/gtest_emplace.cpp b/test/gtest_emplace.cpp index 8a2f6ed2c..eb4b405f4 100644 --- a/test/gtest_emplace.cpp +++ b/test/gtest_emplace.cpp @@ -137,8 +137,7 @@ TEST(Emplace, EmplaceDerived) } TEST(Emplace, Nullpointer) { - - // incomming_dummy = wolf::CaptureBase::emplace<wolf::CaptureBase>(nullptr, "DUMMY", 1.2, sensor_ptr); + CaptureBase::emplace<wolf::CaptureBase>(nullptr, "DUMMY", 1.2, nullptr); } int main(int argc, char **argv) { -- GitLab