Skip to content

Commit

Permalink
CMake refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksana Yaremchuk committed Jan 5, 2017
1 parent 26a80d4 commit 5ad009a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
31 changes: 13 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ option(GTEST "Build with Google Test framework" OFF)
# Allow to build additional modules
option(LIDAR_LOGGING "Build VLP16 Puck LiDAR logging" OFF)

if(NOT ${DISTRO_VERSION} STREQUAL "1604")
message("Precision missions, collision avoidance and pointcloud to LAS converter BETA works only on Ubuntu 16.04")
else()
option(USE_PRECISION_MISSIONS "Use DJI precision-missions library" OFF)
if(USE_PRECISION_MISSIONS)
add_definitions(-DUSE_PRECISION_MISSIONS)
include(${CMAKE_MODULE_PATH}/External_PrecisionMissions.cmake)
endif()

option(USE_COLLISION_AVOIDANCE "Use DJI collision avoidance library" OFF)
if(USE_COLLISION_AVOIDANCE)
include(${CMAKE_MODULE_PATH}/External_CollisionAvoidance.cmake)
endif()

option(USE_POINTCLOUD2LAS "Use DJI pointcloud to LAS converter library" OFF)
if(USE_POINTCLOUD2LAS)
include(${CMAKE_MODULE_PATH}/External_Pointcloud2Las.cmake)
# Use External DJI Modules
option(USE_PRECISION_MISSIONS "Use DJI precision-missions library" OFF)
option(USE_COLLISION_AVOIDANCE "Use DJI collision avoidance library" OFF)
option(USE_POINTCLOUD2LAS "Use DJI pointcloud to LAS converter library" OFF)

if(USE_PRECISION_MISSIONS OR
USE_COLLISION_AVOIDANCE OR
USE_POINTCLOUD2LAS)
if(NOT ${DISTRO_VERSION} STREQUAL "1604")
message(FATAL_ERROR "Precision missions, collision avoidance and pointcloud to LAS converter BETA works only on Ubuntu 16.04")
else()
include(${CMAKE_MODULE_PATH}/External_DJIModules.cmake)
endif()
endif()

Expand All @@ -47,7 +42,7 @@ if(GTEST)
include(${CMAKE_MODULE_PATH}/External_GTest.cmake)
endif()

if(GTEST OR USE_PRECISION_MISSIONS)
if(GTEST OR (USE_PRECISION_MISSIONS AND (${DISTRO_VERSION} STREQUAL "1604")))
include(${CMAKE_MODULE_PATH}/External_RapidJSON.cmake)
endif()

Expand Down
8 changes: 4 additions & 4 deletions contrib/DJIConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ endif()
#Detect platform - from https://gist.github.com/CoolerVoid/1781717
EXECUTE_PROCESS(
COMMAND cat /etc/lsb-release
COMMAND grep DISTRIB_RELEASE
COMMAND grep DISTRIB_DESCRIPTION
COMMAND awk -F= "{ print $2 }"
COMMAND tr "\n" " "
COMMAND sed "s/ //"
OUTPUT_VARIABLE LSB_VER
)

if( ${LSB_VER} STREQUAL "16.04")
if( ${LSB_VER} MATCHES "Ubuntu16.04 LTS")
set(DISTRO_VERSION 1604)
elseif(${LSB_VER} STREQUAL "14.04")
elseif(${LSB_VER} MATCHES "Ubuntu14.04 LTS")
set(DISTRO_VERSION 1404)
elseif(${LSB_VER} STREQUAL "18")
elseif(${LSB_VER} MATCHES "Linux Mint 18 Sarah")
set(DISTRO_VERSION 1604)
endif()

13 changes: 13 additions & 0 deletions contrib/External_DJIModules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(USE_PRECISION_MISSIONS)
add_definitions(-DUSE_PRECISION_MISSIONS)
include(${CMAKE_MODULE_PATH}/External_PrecisionMissions.cmake)
endif()

if(USE_COLLISION_AVOIDANCE)
include(${CMAKE_MODULE_PATH}/External_CollisionAvoidance.cmake)
endif()

if(USE_POINTCLOUD2LAS)
include(${CMAKE_MODULE_PATH}/External_Pointcloud2Las.cmake)
endif()

0 comments on commit 5ad009a

Please sign in to comment.