Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and improve code #17

Merged
merged 12 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
41 changes: 41 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build
on:
push:

jobs:
build-project:
strategy:
matrix:
config:
- {
os: ubuntu-latest,
cmake_options: "",
dependencies: "sudo apt update -yqq && sudo apt -yqq install libboost-dev"
}
- {
os: macos-latest,
cmake_options: "CMAKE_PREFIX_PATH=/opt/homebrew",
dependencies: "brew install boost eigen && brew link boost eigen"
}
- {
os: windows-latest,
cmake_options: "BOOST_ROOT=c:/local/boost_1_86_0",
dependencies: "choco install eigen -y --no-progress && choco install boost-msvc-14.3 -y --no-progress"
}

runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
submodules: recursive

- name: Dependencies
run: ${{ matrix.config.dependencies }}

- name: Build Project
uses: threeal/cmake-action@v2.0.0
with:
options: |
${{ matrix.config.cmake_options }}

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ build/
.vscode/
*.user
*code-workspace
.DS_Store
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "IMU_Sensor_Fusion"]
path = descriptors/IMU_Sensor_Fusion
path = 3rdparty/IMU_Sensor_Fusion
url = https://github.com/malloch/IMU_Sensor_Fusion
68 changes: 68 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.24...3.30)

project(
puara-gestures
VERSION 0.2
LANGUAGES CXX
)

### Library options ###
option(PUARA_GESTURES_ENABLE_TESTING "Enable building and running Puara gestures tests" ON)
option(PUARA_GESTURES_ENABLE_STANDALONE "Enable building and running Puara standalone" ON)

### Dependencies ###
if(POLICY CMP0167)
cmake_policy(SET CMP0167 OLD)
endif()
if(NOT TARGET Boost::headers)
find_package(Boost REQUIRED)
endif()

### Main library ###
add_library(puara_gestures
3rdparty/IMU_Sensor_Fusion/imu_orientation.h
3rdparty/IMU_Sensor_Fusion/imu_orientation.cpp

include/puara/descriptors/button.h
include/puara/descriptors/jab.h
include/puara/descriptors/roll.h
include/puara/descriptors/shake.h
include/puara/descriptors/tilt.h
include/puara/descriptors/touch.h

include/puara/utils/calibration.h
include/puara/utils/circularbuffer.h
include/puara/utils/leakyintegrator.h
include/puara/utils/maprange.h
include/puara/utils/rollingminmax.h
include/puara/utils/smooth.h
include/puara/utils/threshold.h
include/puara/utils/wrap.h

include/puara/structs.h
include/puara/gestures.h
include/puara/utils.h

src/puara_gestures.cpp
)

target_compile_definitions(puara_gestures PUBLIC $<$<BOOL:${WIN32}>:_USE_MATH_DEFINES>)
target_include_directories(puara_gestures PUBLIC include 3rdparty)
target_compile_features(puara_gestures PUBLIC cxx_std_20)
target_link_libraries(puara_gestures PUBLIC Boost::headers)

### Tests ###
if(PUARA_GESTURES_ENABLE_TESTING)
include(CTest)
add_executable(testing_roll tests/testing_roll.cpp)
add_executable(testing_tilt tests/testing_tilt.cpp)
target_compile_definitions(testing_roll PRIVATE "-DPUARA_TESTS_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/testing files\"")
target_compile_definitions(testing_tilt PRIVATE "-DPUARA_TESTS_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/testing files\"")
target_link_libraries(testing_roll PRIVATE puara_gestures)
target_link_libraries(testing_tilt PRIVATE puara_gestures)
endif()

### Example ###
if(PUARA_GESTURES_ENABLE_STANDALONE)
add_subdirectory(standalone)
endif()
87 changes: 0 additions & 87 deletions descriptors/puara-gestures.code-workspace

This file was deleted.

Loading
Loading