Skip to content

Commit ae78854

Browse files
authored
Merge pull request #20 from aerostack2/ament_lint_auto
[as2_platform_pixhawk] Migrate to ament_lint_auto
2 parents 3a45f87 + 7d7c483 commit ae78854

File tree

17 files changed

+822
-780
lines changed

17 files changed

+822
-780
lines changed

.clang-format

Lines changed: 0 additions & 117 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# Set the minimum required CMake version
12
cmake_minimum_required(VERSION 3.5)
3+
4+
# Set the project name
25
set(PROJECT_NAME as2_platform_pixhawk)
36
project(${PROJECT_NAME})
47

@@ -7,6 +10,11 @@ if(NOT CMAKE_CXX_STANDARD)
710
set(CMAKE_CXX_STANDARD 17)
811
endif()
912

13+
# Set Release as default build type if not set
14+
if(NOT CMAKE_BUILD_TYPE)
15+
set(CMAKE_BUILD_TYPE Release)
16+
endif()
17+
1018
# find dependencies
1119
set(PROJECT_DEPENDENCIES
1220
ament_cmake
@@ -26,44 +34,65 @@ foreach(DEPENDENCY ${PROJECT_DEPENDENCIES})
2634
find_package(${DEPENDENCY} REQUIRED)
2735
endforeach()
2836

37+
# Include necessary directories
2938
include_directories(
3039
include
3140
include/${PROJECT_NAME}
32-
33-
# uncomment if using Eigen3
34-
# {EIGEN3_INCLUDE_DIRS}
3541
)
3642

43+
# Set source files
3744
set(SOURCE_CPP_FILES
3845
src/pixhawk_platform.cpp
3946
)
4047

41-
add_executable(${PROJECT_NAME}_node src/pixhawk_platform_main.cpp ${SOURCE_CPP_FILES})
42-
48+
# Create the node executable
49+
add_executable(${PROJECT_NAME}_node src/pixhawk_platform_node.cpp ${SOURCE_CPP_FILES})
4350
ament_target_dependencies(${PROJECT_NAME}_node ${PROJECT_DEPENDENCIES})
4451

45-
if(BUILD_TESTING)
46-
find_package(ament_cmake_cppcheck REQUIRED)
47-
find_package(ament_cmake_clang_format REQUIRED)
52+
# Create the library
53+
add_library(${PROJECT_NAME} STATIC ${SOURCE_CPP_FILES})
54+
ament_target_dependencies(${PROJECT_NAME} ${PROJECT_DEPENDENCIES})
4855

49-
ament_cppcheck(src/ include/ tests/)
50-
ament_clang_format(src/ include/ tests/ --config ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format)
56+
# Install the headers
57+
install(
58+
DIRECTORY include/
59+
DESTINATION include
60+
)
5161

52-
include(tests/profiling_test.cmake)
53-
include(tests/unit_test.cmake)
54-
include(tests/odom_test.cmake)
55-
endif()
62+
# Install the node executable
63+
install(TARGETS
64+
${PROJECT_NAME}_node
65+
DESTINATION lib/${PROJECT_NAME}
66+
)
67+
68+
# Install the library
69+
install(
70+
TARGETS ${PROJECT_NAME}
71+
EXPORT export_${PROJECT_NAME}
72+
ARCHIVE DESTINATION lib
73+
LIBRARY DESTINATION lib
74+
RUNTIME DESTINATION bin
75+
)
5676

77+
# Install the launch directory
5778
install(DIRECTORY
5879
launch
59-
DESTINATION share/${PROJECT_NAME})
80+
DESTINATION share/${PROJECT_NAME}
81+
)
6082

83+
# Install the config directory
6184
install(DIRECTORY
6285
config
63-
DESTINATION share/${PROJECT_NAME})
86+
DESTINATION share/${PROJECT_NAME}
87+
)
6488

65-
install(TARGETS
66-
${PROJECT_NAME}_node
67-
DESTINATION lib/${PROJECT_NAME})
89+
# Build tests if testing is enabled
90+
if(BUILD_TESTING)
91+
find_package(ament_lint_auto REQUIRED)
92+
ament_lint_auto_find_test_dependencies()
93+
94+
add_subdirectory(tests)
95+
endif()
6896

97+
# Create the ament package
6998
ament_package()

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Any contribution that you make to this repository will
2+
be under the 3-Clause BSD License, as dictated by that
3+
[license](https://opensource.org/licenses/BSD-3-Clause).

LICENSE

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
BSD 3-Clause License
2-
3-
Copyright (c) 2023, Universidad Politécnica de Madrid
4-
51
Redistribution and use in source and binary forms, with or without
62
modification, are permitted provided that the following conditions are met:
73

8-
1. Redistributions of source code must retain the above copyright notice, this
9-
list of conditions and the following disclaimer.
4+
* Redistributions of source code must retain the above copyright
5+
notice, this list of conditions and the following disclaimer.
106

11-
2. Redistributions in binary form must reproduce the above copyright notice,
12-
this list of conditions and the following disclaimer in the documentation
13-
and/or other materials provided with the distribution.
7+
* Redistributions in binary form must reproduce the above copyright
8+
notice, this list of conditions and the following disclaimer in the
9+
documentation and/or other materials provided with the distribution.
1410

15-
3. Neither the name of the copyright holder nor the names of its
16-
contributors may be used to endorse or promote products derived from
17-
this software without specific prior written permission.
11+
* Neither the name of the copyright holder nor the names of its
12+
contributors may be used to endorse or promote products derived from
13+
this software without specific prior written permission.
1814

1915
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2016
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25+
POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)