|
1 | 1 | cmake_minimum_required(VERSION 2.8.3) |
2 | 2 | project(march_hardware) |
3 | 3 |
|
4 | | -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") |
| 4 | +add_compile_options(-std=c++11) |
5 | 5 |
|
6 | 6 | find_package(catkin REQUIRED COMPONENTS |
7 | | - code_coverage |
8 | | - roscpp |
9 | | - roslint |
10 | | - rostest |
11 | | - ) |
| 7 | + code_coverage |
| 8 | + roscpp |
| 9 | + roslint |
| 10 | + rostest |
| 11 | + soem |
| 12 | +) |
12 | 13 |
|
13 | 14 | catkin_package( |
14 | | - INCLUDE_DIRS |
15 | | - include |
16 | | - CATKIN_DEPENDS |
17 | | - roscpp |
18 | | - LIBRARIES |
19 | | - march_hardware |
| 15 | + INCLUDE_DIRS include |
| 16 | + CATKIN_DEPENDS |
| 17 | + roscpp |
| 18 | + soem |
| 19 | + LIBRARIES ${PROJECT_NAME} |
20 | 20 | ) |
21 | 21 |
|
22 | | -# Roslinter |
23 | 22 | set(ROSLINT_CPP_OPTS "--filter=-build/include,-build/header_guard,-runtime/references" "--linelength=120") |
24 | 23 |
|
25 | 24 | file(GLOB_RECURSE lintfiles |
26 | | - "src/*.cpp" |
27 | | - "include/*.h" |
28 | | - ) |
| 25 | + "src/*.cpp" |
| 26 | + "include/*.h" |
| 27 | +) |
29 | 28 |
|
30 | 29 | roslint_cpp(${lintfiles}) |
31 | 30 |
|
32 | 31 |
|
33 | 32 | include_directories( |
34 | | - include |
35 | | - soem |
36 | | - ${catkin_INCLUDE_DIRS} |
| 33 | + include |
| 34 | + ${catkin_INCLUDE_DIRS} |
| 35 | + ${soem_INCLUDE_DIRS}/soem |
37 | 36 | ) |
38 | 37 |
|
39 | 38 | install(DIRECTORY include/${PROJECT_NAME}/ |
40 | | - DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
41 | | - FILES_MATCHING PATTERN "*.h" |
42 | | - PATTERN ".svn" EXCLUDE) |
43 | | - |
44 | | - |
45 | | -file(GLOB SOEM_SRC |
46 | | - soem/*.h |
47 | | - soem/*.c |
48 | | - ) |
| 39 | + DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} |
| 40 | +) |
49 | 41 |
|
50 | | -add_library(march_hardware |
51 | | - ${SOEM_SRC} |
52 | | - include/${PROJECT_NAME}/ActuationMode.h |
53 | | - include/${PROJECT_NAME}/PowerDistributionBoard.h |
54 | | - include/${PROJECT_NAME}/IMotionCubeTargetState.h |
55 | | - include/${PROJECT_NAME}/EtherCAT/EthercatIO.h |
56 | | - include/${PROJECT_NAME}/EtherCAT/EthercatMaster.h |
57 | | - include/${PROJECT_NAME}/EtherCAT/EthercatSDO.h |
58 | | - include/${PROJECT_NAME}/AngleConversions.h |
59 | | - include/${PROJECT_NAME}/Encoder.h |
60 | | - include/${PROJECT_NAME}/IMotionCube.h |
61 | | - include/${PROJECT_NAME}/IMotionCubeState.h |
62 | | - include/${PROJECT_NAME}/Joint.h |
63 | | - include/${PROJECT_NAME}/MarchRobot.h |
64 | | - include/${PROJECT_NAME}/NetDriverOffsets.h |
65 | | - include/${PROJECT_NAME}/Slave.h |
66 | | - include/${PROJECT_NAME}/TemperatureGES.h |
67 | | - include/${PROJECT_NAME}/TemperatureSensor.h |
68 | | - include/${PROJECT_NAME}/LowVoltage.h |
69 | | - include/${PROJECT_NAME}/HighVoltage.h |
70 | | - include/${PROJECT_NAME}/BootShutdownOffsets.h |
71 | | - include/${PROJECT_NAME}/PDOmap.h |
72 | | - src/PowerDistributionBoard.cpp |
73 | | - src/EtherCAT/EthercatIO.cpp |
74 | | - src/EtherCAT/EthercatMaster.cpp |
75 | | - src/EtherCAT/EthercatSDO.cpp |
76 | | - src/LowVoltage.cpp |
77 | | - src/HighVoltage.cpp |
78 | | - src/Encoder.cpp |
79 | | - src/IMotionCube.cpp |
80 | | - src/Joint.cpp |
81 | | - src/IMotionCubeTargetState.cpp |
82 | | - src/MarchRobot.cpp |
83 | | - src/TemperatureGES.cpp |
84 | | - src/PDOmap.cpp |
85 | | - ) |
| 42 | +add_library(${PROJECT_NAME} |
| 43 | + include/${PROJECT_NAME}/ActuationMode.h |
| 44 | + include/${PROJECT_NAME}/AngleConversions.h |
| 45 | + include/${PROJECT_NAME}/BootShutdownOffsets.h |
| 46 | + include/${PROJECT_NAME}/Encoder.h |
| 47 | + include/${PROJECT_NAME}/EtherCAT/EthercatIO.h |
| 48 | + include/${PROJECT_NAME}/EtherCAT/EthercatMaster.h |
| 49 | + include/${PROJECT_NAME}/EtherCAT/EthercatSDO.h |
| 50 | + include/${PROJECT_NAME}/HighVoltage.h |
| 51 | + include/${PROJECT_NAME}/IMotionCube.h |
| 52 | + include/${PROJECT_NAME}/IMotionCubeState.h |
| 53 | + include/${PROJECT_NAME}/IMotionCubeTargetState.h |
| 54 | + include/${PROJECT_NAME}/Joint.h |
| 55 | + include/${PROJECT_NAME}/LowVoltage.h |
| 56 | + include/${PROJECT_NAME}/MarchRobot.h |
| 57 | + include/${PROJECT_NAME}/NetDriverOffsets.h |
| 58 | + include/${PROJECT_NAME}/PDOmap.h |
| 59 | + include/${PROJECT_NAME}/PowerDistributionBoard.h |
| 60 | + include/${PROJECT_NAME}/Slave.h |
| 61 | + include/${PROJECT_NAME}/TemperatureGES.h |
| 62 | + include/${PROJECT_NAME}/TemperatureSensor.h |
| 63 | + src/Encoder.cpp |
| 64 | + src/EtherCAT/EthercatIO.cpp |
| 65 | + src/EtherCAT/EthercatMaster.cpp |
| 66 | + src/EtherCAT/EthercatSDO.cpp |
| 67 | + src/HighVoltage.cpp |
| 68 | + src/IMotionCube.cpp |
| 69 | + src/IMotionCubeTargetState.cpp |
| 70 | + src/Joint.cpp |
| 71 | + src/LowVoltage.cpp |
| 72 | + src/MarchRobot.cpp |
| 73 | + src/PDOmap.cpp |
| 74 | + src/PowerDistributionBoard.cpp |
| 75 | + src/TemperatureGES.cpp |
| 76 | +) |
86 | 77 |
|
87 | | -target_link_libraries(march_hardware ${catkin_LIBRARIES}) |
| 78 | +target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES}) |
88 | 79 |
|
89 | 80 | add_executable(slave_count_check check/SlaveCount.cpp) |
90 | | -target_link_libraries(slave_count_check march_hardware) |
| 81 | +target_link_libraries(slave_count_check ${PROJECT_NAME}) |
91 | 82 |
|
92 | | -install(TARGETS march_hardware |
93 | | - ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
94 | | - LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
95 | | - RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}) |
| 83 | +install(TARGETS ${PROJECT_NAME} |
| 84 | + ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
| 85 | + LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} |
| 86 | +) |
| 87 | + |
| 88 | +install(TARGETS slave_count_check |
| 89 | + RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} |
| 90 | +) |
96 | 91 |
|
97 | 92 | ## Add gtest based cpp test target and link libraries |
98 | 93 | if (CATKIN_ENABLE_TESTING) |
99 | 94 |
|
100 | 95 | if(ENABLE_COVERAGE_TESTING) |
101 | 96 | include(CodeCoverage) |
102 | | - APPEND_COVERAGE_COMPILER_FLAGS() |
| 97 | + append_coverage_compiler_flags() |
103 | 98 | endif() |
104 | 99 |
|
105 | 100 | add_rostest_gmock(${PROJECT_NAME}-test |
106 | | - test/march4cpp.test |
107 | | - test/TestRunner.cpp |
108 | | - test/TestEncoder.cpp |
109 | | - test/TestIMotionCube.cpp |
110 | | - test/TestTemperatureGES.cpp |
111 | | - test/TestJoint.cpp |
112 | | - test/TestPDOmap.cpp |
113 | | - test/TestBootShutdownOffsets.cpp |
114 | | - test/TestNetDriverOffsets.cpp |
115 | | - test/TestNetMonitorOffsets.cpp |
116 | | - test/TestLowVoltage.cpp |
117 | | - test/TestHighVoltage.cpp |
118 | | - test/TestPowerDistributionBoard.cpp |
119 | | - test/mocks/MockTemperatureGES.cpp |
120 | | - test/mocks/MockTemperatureSensor.cpp |
121 | | - test/mocks/MockEncoder.cpp |
122 | | - test/mocks/MockIMotionCube.cpp |
123 | | - test/mocks/MockJoint.cpp |
124 | | - ) |
125 | | - target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES} march_hardware gtest) |
| 101 | + test/march4cpp.test |
| 102 | + test/TestRunner.cpp |
| 103 | + test/TestEncoder.cpp |
| 104 | + test/TestIMotionCube.cpp |
| 105 | + test/TestTemperatureGES.cpp |
| 106 | + test/TestJoint.cpp |
| 107 | + test/TestPDOmap.cpp |
| 108 | + test/TestBootShutdownOffsets.cpp |
| 109 | + test/TestNetDriverOffsets.cpp |
| 110 | + test/TestNetMonitorOffsets.cpp |
| 111 | + test/TestLowVoltage.cpp |
| 112 | + test/TestHighVoltage.cpp |
| 113 | + test/TestPowerDistributionBoard.cpp |
| 114 | + test/mocks/MockTemperatureGES.cpp |
| 115 | + test/mocks/MockTemperatureSensor.cpp |
| 116 | + test/mocks/MockEncoder.cpp |
| 117 | + test/mocks/MockIMotionCube.cpp |
| 118 | + test/mocks/MockJoint.cpp |
| 119 | + ) |
| 120 | + target_link_libraries(${PROJECT_NAME}-test ${catkin_LIBRARIES} ${PROJECT_NAME} gtest) |
126 | 121 |
|
127 | 122 | if(ENABLE_COVERAGE_TESTING) |
128 | 123 | set(COVERAGE_EXCLUDES "*/${PROJECT_NAME}/test*" "*/${PROJECT_NAME}/soem*") |
129 | 124 | add_code_coverage( |
130 | | - NAME ${PROJECT_NAME}_coverage |
131 | | - DEPENDS tests |
| 125 | + NAME ${PROJECT_NAME}_coverage |
| 126 | + DEPENDS tests |
132 | 127 | ) |
133 | 128 | endif() |
134 | 129 | endif () |
0 commit comments