-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathCMakeLists.txt
54 lines (40 loc) · 1.75 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
# Copyright: (C) 2016 iCub Facility - Fondazione Istituto Italiano di Tecnologia
# Authors: Silvio Traversaro
# CopyPolicy: Released under the terms of the GNU LGPL v2+.
cmake_minimum_required(VERSION 3.16)
project(icub-model-generator)
# Give error if add_dependencies is called on a non-existing target
if(POLICY CMP0046)
cmake_policy(SET CMP0046 NEW)
endif()
option(ICUB_MODEL_GENERATE_DH "Generate models using the model generation pipeline from Denativ Hartenberg models" ON)
option(ICUB_MODEL_GENERATE_SIMMECHANICS "Generate models using the model generation pipeline from simmechanics" ON)
option(BUILD_TESTING "Run tests for the generated models" ON)
set(BUILD_PREFIX "iCub")
if( ICUB_MODEL_GENERATE_DH )
add_subdirectory(dh)
endif()
if( ICUB_MODEL_GENERATE_SIMMECHANICS )
add_subdirectory(simmechanics)
endif()
add_custom_target(generate-models ALL)
if(TARGET generate-models-dh)
add_dependencies(generate-models generate-models-dh)
endif()
if(TARGET generate-models-simmechanics)
add_dependencies(generate-models generate-models-simmechanics)
endif()
# Logic to copy the generated models to icub-models
# We need to have the location of a YARP source dir
set(ICUB_MODELS_SOURCE_DIR "" CACHE STRING "Location of the icub-models repository source code")
add_custom_target(copy-models-to-icub-models)
add_dependencies(copy-models-to-icub-models generate-models)
add_custom_command(TARGET copy-models-to-icub-models
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/${BUILD_PREFIX}" "${ICUB_MODELS_SOURCE_DIR}/iCub"
COMMENT "Copying generated files to ${ICUB_MODELS_SOURCE_DIR}/iCub")
if (BUILD_TESTING)
include( CTest )
enable_testing()
add_subdirectory(tests)
endif()