Skip to content

Commit

Permalink
Add missing cmake directory and enable subfolders
Browse files Browse the repository at this point in the history
  • Loading branch information
chambbj committed Mar 17, 2021
1 parent 2f42660 commit d27357e
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 36 deletions.
41 changes: 5 additions & 36 deletions plugins/trajectory/CMakeLists.txt
@@ -1,47 +1,16 @@
project (trajectory-reconstruction)

cmake_minimum_required (VERSION 3.1.0) # This version was released 2014-12-15
set (PACKAGE_MAJOR_VERSION 1)
set (PACKAGE_MINOR_VERSION 0)
set (PACKAGE_PATCH_VERSION 0)

set (${PROJECT_NAME}_MAJOR_VERSION ${PACKAGE_MAJOR_VERSION})
set (${PROJECT_NAME}_MINOR_VERSION ${PACKAGE_MINOR_VERSION})
set (${PROJECT_NAME}_PATCH_VERSION ${PACKAGE_PATCH_VERSION})
set (PACKAGE_VERSION
${PACKAGE_MAJOR_VERSION}.${PACKAGE_MINOR_VERSION}.${PACKAGE_PATCH_VERSION})
set (${PROJECT_NAME}_VERSION ${PACKAGE_VERSION})
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)

if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
# Set a default build type for single-configuration cmake generators
# if no build type is set.
set (CMAKE_BUILD_TYPE Release)
endif ()
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)

find_package (Eigen3 REQUIRED)
set (Eigen3_LIBRARIES Eigen3::Eigen)

find_package (Ceres REQUIRED)
find_package (GeographicLib REQUIRED)
find_package (PDAL 2.0 REQUIRED CONFIG)

if (MSVC)
string (REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif ()

set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set (CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LIB_SUFFIX}")

set (PROJECT_LIBRARY_LIST LidarTrajectory)

add_subdirectory (src)
add_subdirectory (test)
add_subdirectory (filters)
add_subdirectory (resources)
add_subdirectory (cmake)
add_subdirectory (sandbox)
#add_subdirectory (sandbox)

if (WITH_TESTS)
add_subdirectory (test)
endif()
34 changes: 34 additions & 0 deletions plugins/trajectory/cmake/CMakeLists.txt
@@ -0,0 +1,34 @@
#############################################################################
# Config file generation and installation
#############################################################################

# Set where cmake will install the proj-config.cmake file
# ${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR} and @VISIONPROJ_ROOT_DIR@
# is the relative path to the root from there.
if (NOT WIN32)
set(INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}")
set (PROJECT_ROOT_DIR "../../..")
else ()
set(INSTALL_CMAKE_DIR "cmake")
set (PROJECT_ROOT_DIR "..")
endif ()

# Now create the project-config files using the .in templates in
# VisionProj/cmake
# @only means only expand @foo@ from the config template
configure_file (project-config.cmake.in
"${PROJECT_NAME_LOWER}-config.cmake" @ONLY)
configure_file (project-config-version.cmake.in
"${PROJECT_NAME_LOWER}-config-version.cmake" @ONLY)

# Install the project-config files so that other modules can find this project
install (FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}")

# Make information about the cmake targets (the library)
# available.
install (EXPORT targets
FILE "${PROJECT_NAME_LOWER}-targets.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}")
39 changes: 39 additions & 0 deletions plugins/trajectory/cmake/project-config-version.cmake.in
@@ -0,0 +1,39 @@
# Version checking for @PROJECT_NAME@

set(PACKAGE_VERSION "@PACKAGE_VERSION@")
set(PACKAGE_VERSION_MAJOR "@PACKAGE_MAJOR_VERSION@")
set(PACKAGE_VERSION_MINOR "@PACKAGE_MINOR_VERSION@")

if (NOT PACKAGE_FIND_NAME STREQUAL "@PROJECT_NAME@")
# Check package name (in particular, because of the way cmake finds
# package config files, the capitalization could easily be "wrong").
# This is necessary to ensure that the automatically generated
# variables, e.g., <package>_FOUND, are consistently spelled. Make
# this a WARNING, because this is a user error that needs to be fixed.
#
# Skip this message. It's possible the user is looking for E3D.
# message (WARNING
# "Mismatched package names: use find_package(@PROJECT_NAME@ ...) instead"
# " of find_package(${PACKAGE_FIND_NAME} ...)")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (NOT (APPLE OR CMAKE_SIZEOF_VOID_P EQUAL @CMAKE_SIZEOF_VOID_P@))
# Reject if there's a 32-bit/64-bit mismatch (not necessary with Apple
# since a multi-architecture library is built for that platform).
message (STATUS
"${CMAKE_CURRENT_LIST_FILE} unsuitable because package built with "
"sizeof(*void) = @CMAKE_SIZEOF_VOID_P@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (MSVC AND NOT MSVC_VERSION STREQUAL "@MSVC_VERSION@")
# Reject if there's a mismatch in MSVC compiler versions
message (STATUS
"${CMAKE_CURRENT_LIST_FILE} unsuitable because package built with "
"_MSC_VER = @MSVC_VERSION@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (PACKAGE_FIND_VERSION)
if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION})
set (PACKAGE_VERSION_EXACT TRUE)
elseif (${PACKAGE_FIND_VERSION} VERSION_LESS ${PACKAGE_VERSION}
AND ${PACKAGE_FIND_VERSION_MAJOR} EQUAL ${PACKAGE_VERSION_MAJOR})
set (PACKAGE_VERSION_COMPATIBLE TRUE)
endif ()
endif ()
33 changes: 33 additions & 0 deletions plugins/trajectory/cmake/project-config.cmake.in
@@ -0,0 +1,33 @@
# Configure @PROJECT_NAME@ package
#
# It defines the following variables
# @PROJECT_NAME@_FOUND - TRUE
# @PROJECT_NAME@_INCLUDE_DIRS - include directories for @PROJECT_NAME@
# @PROJECT_NAME@_LIBRARY_DIRS - library directory
# @PROJECT_NAME@_LIBRARIES - all the libraries of the components requested
# if no components specified then all found
# @PROJECT_NAME@_VERSION - @PROJECT_NAME@ library version

message (STATUS "Reading ${CMAKE_CURRENT_LIST_FILE}")
set (@PROJECT_NAME@_VERSION "@PACKAGE_VERSION@")
message (STATUS "@PROJECT_NAME@ configuration, version "
${@PROJECT_NAME@_VERSION})

# Tell the user project where to find our headers and libraries
get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
get_filename_component (PROJECT_ROOT_DIR "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE)
set (@PROJECT_NAME@_INCLUDE_DIRS "${PROJECT_ROOT_DIR}/include")
set (@PROJECT_NAME@_LIBRARY_DIRS "${PROJECT_ROOT_DIR}/lib")

include ("${_DIR}/@PROJECT_NAME_LOWER@-targets.cmake")
set (@PROJECT_NAME@_LIBRARIES @PROJECT_LIBRARY_LIST@)

set (@PROJECT_NAME@_FOUND TRUE)

# Boiler plate cmake
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (@PROJECT_NAME@ DEFAULT_MSG
@PROJECT_NAME@_LIBRARY_DIRS @PROJECT_NAME@_LIBRARIES
@PROJECT_NAME@_INCLUDE_DIRS)
mark_as_advanced (@PROJECT_NAME@_LIBRARY_DIRS @PROJECT_NAME@_LIBRARIES
@PROJECT_NAME@_INCLUDE_DIRS)

0 comments on commit d27357e

Please sign in to comment.