Skip to content

Commit 059892f

Browse files
committed
Removed fips support, pre-commit all
1 parent df33c01 commit 059892f

39 files changed

+536
-698
lines changed

.pre-commit-config.yaml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
# See https://pre-commit.com for more information
2-
# See https://pre-commit.com/hooks.html for more hooks
31
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.2.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.12.3
64
hooks:
7-
- id: check-added-large-files
8-
- id: check-json
9-
- id: check-merge-conflict
10-
- id: check-xml
11-
- id: check-yaml
12-
- id: end-of-file-fixer
13-
- id: mixed-line-ending
14-
- id: trailing-whitespace
5+
# Run the linter
6+
- id: ruff-check
7+
args: ["--fix", "--exit-non-zero-on-fix"]
8+
# Run the formatter.
9+
- id: ruff-format
1510

16-
- repo: https://github.com/pre-commit/mirrors-clang-format
17-
rev: v15.0.4
11+
- repo: https://github.com/pre-commit/mirrors-clang-format
12+
rev: v20.1.7
1813
hooks:
1914
- id: clang-format
20-
# Respect .clang-format if it exists, otherwise use Google
21-
args: ["--fallback-style=Google"]
15+
types_or: [c++, c]
2216

23-
# - repo: https://gitlab.com/daverona/pre-commit/cpp
24-
# rev: 0.8.0
25-
# hooks:
26-
# - id: cpplint
27-
# args: ["--filter=-build/include_order,-readability/todo"]
28-
29-
- repo: https://github.com/psf/black
30-
rev: 22.12.0
17+
# CMake formatter
18+
- repo: https://github.com/BlankSpruce/gersemi
19+
rev: 0.19.3
3120
hooks:
32-
- id: black
33-
# For now, no configuration. May want "--line-length 80"
34-
- repo: https://github.com/PyCQA/flake8
35-
rev: 6.0.0
21+
- id: gersemi
22+
23+
- repo: https://github.com/pre-commit/pre-commit-hooks
24+
rev: v5.0.0
3625
hooks:
37-
- id: flake8
38-
# pep8-naming catches camel_case violations
39-
additional_dependencies: [pep8-naming, flake8-bugbear, flake8-comprehensions]
40-
# formatting handles line-length, no reason for linter to also flag.
41-
args: [--ignore, E501]
26+
- id: check-added-large-files
27+
- id: check-case-conflict
28+
- id: check-executables-have-shebangs
29+
- id: check-json
30+
- id: check-merge-conflict
31+
- id: check-shebang-scripts-are-executable
32+
- id: check-symlinks
33+
- id: check-toml
34+
- id: check-xml
35+
- id: check-yaml
36+
- id: debug-statements
37+
- id: destroyed-symlinks
38+
- id: detect-private-key
39+
- id: end-of-file-fixer
40+
- id: fix-byte-order-marker
41+
- id: mixed-line-ending
42+
- id: trailing-whitespace
43+
args: [--markdown-linebreak-ext=md]

CMakeLists.txt

100755100644
Lines changed: 65 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,22 @@ project(liboculus)
44
# == Code common to all builds =======================================
55
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
66

7-
if( FIPS_CONFIG AND NOT FIPS_IMPORT )
8-
get_filename_component(FIPS_ROOT_DIR "../fips" ABSOLUTE)
9-
include("${FIPS_ROOT_DIR}/cmake/fips.cmake")
10-
11-
fips_setup()
12-
13-
find_package( Boost REQUIRED COMPONENTS system )
14-
find_package( g3log REQUIRED)
15-
16-
#== fips-specific section ==========================================
17-
add_compile_options(-std=c++17)
18-
19-
## Set global include paths
20-
fips_include_directories(
21-
${CMAKE_CURRENT_SOURCE_DIR}/include
22-
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty
23-
)
24-
25-
## Verbose output about ASIO handlers
26-
#add_definitions( -DBOOST_ASIO_ENABLE_HANDLER_TRACKING )
27-
28-
fips_add_subdirectory("lib/")
29-
30-
if( NOT FIPS_IMPORT )
31-
add_subdirectory("tools/")
32-
endif()
33-
34-
if( FIPS_UNITTESTS )
35-
add_subdirectory( test/ )
36-
endif()
37-
38-
fips_finish()
39-
40-
else()
41-
42-
# ROS build, determine which version...
43-
find_package(ros_environment REQUIRED)
44-
set(ROS_VERSION $ENV{ROS_VERSION})
45-
46-
set(oculus_SRCS
47-
lib/DataRx.cpp
48-
lib/SonarConfiguration.cpp
49-
lib/SonarStatus.cpp
50-
lib/StatusRx.cpp
51-
lib/SonarPlayer.cpp
52-
lib/OculusMessageHandler.cpp
53-
lib/SimpleFireMessage.cpp
54-
lib/IoServiceThread.cpp )
55-
56-
57-
if(${ROS_VERSION} EQUAL 2)
7+
# ROS build, determine which version...
8+
find_package(ros_environment REQUIRED)
9+
set(ROS_VERSION $ENV{ROS_VERSION})
10+
11+
set(oculus_SRCS
12+
lib/DataRx.cpp
13+
lib/SonarConfiguration.cpp
14+
lib/SonarStatus.cpp
15+
lib/StatusRx.cpp
16+
lib/SonarPlayer.cpp
17+
lib/OculusMessageHandler.cpp
18+
lib/SimpleFireMessage.cpp
19+
lib/IoServiceThread.cpp
20+
)
21+
22+
if(${ROS_VERSION} EQUAL 2)
5823
# == ament/ROS2 section =================================
5924

6025
find_package(ament_cmake REQUIRED)
@@ -65,45 +30,37 @@ else()
6530
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6631
add_compile_options(-std=c++17)
6732

68-
include_directories(
69-
include
70-
thirdparty
71-
)
33+
include_directories(include thirdparty)
7234

7335
add_library(oculus SHARED ${oculus_SRCS})
74-
target_link_libraries(oculus
75-
Boost::system
76-
g3log_ros::g3log
77-
)
78-
ament_target_dependencies(oculus Boost g3log_ros)
36+
target_link_libraries(oculus PUBLIC Boost::system g3log_ros::g3log_ros)
7937

8038
install(
81-
TARGETS oculus
82-
EXPORT export_${PROJECT_NAME}
83-
ARCHIVE DESTINATION lib
84-
LIBRARY DESTINATION lib
85-
RUNTIME DESTINATION bin
39+
TARGETS oculus
40+
EXPORT export_${PROJECT_NAME}
41+
ARCHIVE DESTINATION lib
42+
LIBRARY DESTINATION lib
43+
RUNTIME DESTINATION bin
8644
)
8745

8846
install(
89-
DIRECTORY include/${PROJECT_NAME}/ thirdparty/
90-
DESTINATION include
91-
FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h"
92-
PATTERN ".git" EXCLUDE
47+
DIRECTORY include/${PROJECT_NAME}/ thirdparty/
48+
DESTINATION include
49+
FILES_MATCHING
50+
PATTERN "*.hpp"
51+
PATTERN "*.h"
52+
PATTERN ".git" EXCLUDE
9353
)
9454

9555
ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET)
9656
ament_export_include_directories(include)
9757
ament_export_libraries(oculus)
9858

9959
ament_package()
100-
101-
elseif(${ROS_VERSION} EQUAL 1)
102-
60+
elseif(${ROS_VERSION} EQUAL 1)
10361
# Catkin/ROS1 section =====
104-
find_package( catkin REQUIRED COMPONENTS
105-
g3log_ros )
106-
find_package( Boost REQUIRED COMPONENTS system)
62+
find_package(catkin REQUIRED COMPONENTS g3log_ros)
63+
find_package(Boost REQUIRED COMPONENTS system)
10764

10865
catkin_package(
10966
CATKIN_DEPENDS g3log_ros
@@ -113,48 +70,48 @@ else()
11370

11471
add_compile_options(-std=c++14)
11572

116-
add_library(liboculus
117-
${oculus_SRCS})
73+
add_library(liboculus ${oculus_SRCS})
11874

119-
include_directories(liboculus
120-
include
121-
thirdparty
122-
${catkin_INCLUDE_DIRS}
123-
)
75+
include_directories(liboculus include thirdparty ${catkin_INCLUDE_DIRS})
12476

125-
target_link_libraries(liboculus
126-
${catkin_LIBRARIES}
127-
)
77+
target_link_libraries(liboculus ${catkin_LIBRARIES})
12878

129-
install(TARGETS liboculus
130-
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
131-
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
132-
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
79+
install(
80+
TARGETS liboculus
81+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
82+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
83+
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
13384
)
13485

13586
## Install headers
136-
install(DIRECTORY include/${PROJECT_NAME}/ thirdparty/
137-
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
138-
FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h"
139-
PATTERN ".git" EXCLUDE)
87+
install(
88+
DIRECTORY include/${PROJECT_NAME}/ thirdparty/
89+
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
90+
FILES_MATCHING
91+
PATTERN "*.hpp"
92+
PATTERN "*.h"
93+
PATTERN ".git" EXCLUDE
94+
)
14095

141-
if (CATKIN_ENABLE_TESTING)
142-
add_definitions(-DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/test/data")
143-
include_directories( test/data/ )
96+
if(CATKIN_ENABLE_TESTING)
97+
add_definitions(
98+
-DTEST_DATA_PATH="${CMAKE_CURRENT_SOURCE_DIR}/test/data"
99+
)
100+
include_directories(test/data/)
144101

145-
file(GLOB oculus_test_SRCS
146-
test/unit/*cpp )
102+
file(GLOB oculus_test_SRCS test/unit/*cpp)
147103

148-
catkin_add_gtest(oculus_test ${oculus_test_SRCS})
104+
catkin_add_gtest(oculus_test ${oculus_test_SRCS})
149105

150-
target_link_libraries(oculus_test ${catkin_LIBRARIES}
151-
liboculus
152-
Boost::system )
106+
target_link_libraries(
107+
oculus_test
108+
${catkin_LIBRARIES}
109+
liboculus
110+
Boost::system
111+
)
153112
endif()
154-
155-
else()
156-
message("Unsure what sort of build to do. Not in a FIPS, ROS1 or ROS2 environment")
157-
endif()
158-
159-
113+
else()
114+
message(
115+
"Unsure what sort of build to do. Not in a ROS1 or ROS2 environment"
116+
)
160117
endif()

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ This is a hybrid repository:
2727

2828
* We primarily build in ROS1 or ROS2, though there are no ROS dependencies in the code. We hope the code is still useful for others looking to talk to the Oculus. It is implemented as a hybrid package which should build successfully in either a ROS1 "catkin" or ROS2 "colcon" workspace.
2929

30-
* Historically, the repo has also supported the [fips](http://floooh.github.io/fips/) C++ dependency management tool. To build with fips: `./fips build`
30+
* [fips](http://floooh.github.io/fips/) support has been removed from this branch.
3131

3232
The primary dependency is on [g3log](https://github.com/KjellKod/g3log).
3333
* If using either ROS1 or ROS2, there are two options:
3434
* clone [g3log_ros](https://gitlab.com/apl-ocean-engineering/g3log_ros) into your workspace's `src/` directory
3535
* use the provided `liboculus.rosinstall` file: `cd <catkin_ws>/src`; `vcs import --input liboculus/liboculus.repos`. The `main` branch of `g3log_ros` is also a ROS1-ROS2 hybrid.
36-
* It will be handled automagically if using fips.
3736

3837
The (optional) test suite also requires Googletest and the (also optional)
39-
binary `oc_client` requires [CLI11](https://github.com/CLIUtils/CLI11),
40-
both of which are also handled by fips.
38+
binary `oc_client` requires [CLI11](https://github.com/CLIUtils/CLI11).
4139

4240
Internally, the ethernet interface uses
4341
[Boost::asio](https://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio.html).

cmake/FindOculusSDK.cmake

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010

1111
find_package(PkgConfig)
1212

13-
SET(TRIAL_PATHS
14-
$ENV{OCULUS_DIR}
15-
${OCULUS_DIR}
16-
)
13+
set(TRIAL_PATHS $ENV{OCULUS_DIR} ${OCULUS_DIR})
1714

18-
find_path(OCULUS_SDK_ROOT Oculus/Oculus.h
19-
HINTS ${TRIAL_PATHS}
20-
DOC "Location OCULUS SDK"
21-
)
15+
find_path(
16+
OCULUS_SDK_ROOT
17+
Oculus/Oculus.h
18+
HINTS ${TRIAL_PATHS}
19+
DOC "Location OCULUS SDK"
20+
)
2221

2322
find_package_handle_standard_args(OCULUS_SDK DEFAULT_MSG OCULUS_SDK_ROOT)

fips

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

fips.yml

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

0 commit comments

Comments
 (0)