Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 24 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,28 @@ jobs:

- name: Build Tinyopt-example
run: |-
cmake ./ -B build -DBUILD_TINYOPT_TESTS=OFF
cmake ./ -B build -DTINYOPT_BUILD_TESTS=OFF
cmake --build build -j 4

linux-build-deb:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."

- name: Install dependencies
run: |-
sudo apt-get install build-essential cmake libeigen3-dev

- name: Install Tinyopt as a dependency
run: |-
TAG=`git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/julien-michot/tinyopt.git/ | tail --lines=1 | cut --delimiter='/' --fields=3`
echo $TAG
wget -q --no-check-certificate https://github.com/julien-michot/tinyopt/releases/download/$TAG/tinyopt-${TAG:1}-Linux.deb
sudo dpkg -i tinyopt-${TAG:1}-Linux.deb

- name: Build Tinyopt-example
run: |-
cmake ./ -B build
cmake --build build -j 4
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ project(tinyopt-example VERSION 0.0.1
# Compiler flags
set(CMAKE_CXX_STANDARD 20)

find_package(Eigen3) # Only needed if Tinyopt is not found locally

# Find Tinyopt, fetch it if not found
find_package(Tinyopt)

Expand All @@ -20,10 +22,13 @@ if (NOT Tinyopt_FOUND)
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
set(BUILD_TINYOPT_TESTS OFF)
set(TINYOPT_BUILD_TESTS OFF)
FetchContent_MakeAvailable(tinyopt)
else()
message("Tinyopt found at ${Tinyopt_INCLUDE_DIRS}")
endif()

# Header-only library
add_executable(example src/example.cpp)
target_link_libraries(example PUBLIC tinyopt)
target_link_libraries(example PUBLIC tinyopt) # PULIC when Fetched, INTERFACE otherwise...
target_link_libraries(example PUBLIC Eigen3::Eigen)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ Minimal Tinyopt project
set(CMAKE_CXX_STANDARD 20) # Minimum is c++17

find_package(Tinyopt)
find_package(Eigen3) # Only needed if Tinyopt is not found locally

add_executable(example src/example.cpp)
target_link_libraries(example PUBLIC tinyopt)
target_link_libraries(example PUBLIC Eigen3::Eigen) # needed, sometimes...
```

### Alternative using `git submodule`
Expand Down