-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
80 lines (65 loc) · 3.07 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
cmake_minimum_required(VERSION 2.8.3)
project(parrot_arsdk)
find_package(catkin REQUIRED)
catkin_package(
CFG_EXTRAS parrot_arsdk.cmake
)
###########
## Build ##
###########
# use the build space for downloading/building the package
# we populate the results to devel/install spaces after the build
set(ARDRONESDK3_DEVEL_PATH ${CMAKE_CURRENT_BINARY_DIR}/arsdk)
set(ARDRONESDK3_PATH ${ARDRONESDK3_DEVEL_PATH}/src/ARSDKBuildUtils/out/arsdk-native/staging/usr)
# 3.14.0 patch 1
set(ARSDK_ARCHIVE arsdk_3_14_0_p1_stripped.tgz)
set(ARSDK_ARCHIVE_MD5 f73099c420dab7c1ad29a01b1df3ca3c)
# Determine the architecure of the host in a robust way
execute_process(COMMAND python ${PROJECT_SOURCE_DIR}/script/get_arch.py OUTPUT_VARIABLE BUILD_HOST_ARCH)
message(STATUS "Host architecure: ${BUILD_HOST_ARCH}")
add_custom_target(ARSDK_MKDIR
COMMAND ${CMAKE_COMMAND} -E make_directory ${ARDRONESDK3_DEVEL_PATH})
include(ExternalProject)
ExternalProject_Add(ARSDKBuildUtils
DEPENDS ARSDK_MKDIR
URL ${PROJECT_SOURCE_DIR}/sdk/${ARSDK_ARCHIVE}
URL_MD5 ${ARSDK_ARCHIVE_MD5}
PREFIX ${ARDRONESDK3_DEVEL_PATH}
CONFIGURE_COMMAND echo "No configure"
BUILD_COMMAND TARGET_ARCH=${BUILD_HOST_ARCH} ./build.sh -p arsdk-native -t build-sdk -j --no-color
INSTALL_COMMAND echo "No SDK install command"
BUILD_IN_SOURCE 1
)
add_custom_target(ARSDKPopulate ALL
COMMENT "Populating ARDroneSDK to devel space: ${ARDRONESDK3_DEVEL_PATH}"
WORKING_DIRECTORY ${ARDRONESDK3_DEVEL_PATH}/src/ARSDKBuildUtils
# Populate the build results into the devel space
COMMAND ${CMAKE_COMMAND} -E make_directory ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_INCLUDE_DESTINATION}
COMMAND cp -rp ./out/arsdk-native/staging/usr/include/* ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_INCLUDE_DESTINATION}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION}/${PROJECT_NAME}
COMMAND cp -rp ./out/arsdk-native/staging/usr/lib/* ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION}/${PROJECT_NAME}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/${PROJECT_NAME}
COMMAND cp -rp ./out/arsdk-native/staging/usr/share/* ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/${PROJECT_NAME}
#COMMAND ${CMAKE_COMMAND} -E make_directory ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/${PROJECT_NAME}
#COMMAND cp -rp ./out/Unix-base/staging/usr/bin/* ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_BIN_DESTINATION}/${PROJECT_NAME}
)
add_dependencies(ARSDKPopulate ARSDKBuildUtils)
#############
## Install ##
#############
#install(DIRECTORY ${ARDRONESDK3_PATH}/bin/
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# USE_SOURCE_PERMISSIONS
#)
install(DIRECTORY ${ARDRONESDK3_PATH}/include/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
install(DIRECTORY ${ARDRONESDK3_PATH}/lib/
DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}/parrot_arsdk
)
install(DIRECTORY ${ARDRONESDK3_PATH}/share/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY ${ARDRONESDK3_PATH}/../etc/
DESTINATION ${CATKIN_PACKAGE_ETC_DESTINATION}
)