Skip to content

Commit 40d244d

Browse files
Merge pull request #2 from julien-michot/feature/test-latest-package
Test latest package and update readme
2 parents 68db810 + 3f712fc commit 40d244d

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,28 @@ jobs:
1515
1616
- name: Build Tinyopt-example
1717
run: |-
18-
cmake ./ -B build -DBUILD_TINYOPT_TESTS=OFF
18+
cmake ./ -B build -DTINYOPT_BUILD_TESTS=OFF
19+
cmake --build build -j 4
20+
21+
linux-build-deb:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out repository code
25+
uses: actions/checkout@v4
26+
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
27+
28+
- name: Install dependencies
29+
run: |-
30+
sudo apt-get install build-essential cmake libeigen3-dev
31+
32+
- name: Install Tinyopt as a dependency
33+
run: |-
34+
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`
35+
echo $TAG
36+
wget -q --no-check-certificate https://github.com/julien-michot/tinyopt/releases/download/$TAG/tinyopt-${TAG:1}-Linux.deb
37+
sudo dpkg -i tinyopt-${TAG:1}-Linux.deb
38+
39+
- name: Build Tinyopt-example
40+
run: |-
41+
cmake ./ -B build
1942
cmake --build build -j 4

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ project(tinyopt-example VERSION 0.0.1
77
# Compiler flags
88
set(CMAKE_CXX_STANDARD 20)
99

10+
find_package(Eigen3) # Only needed if Tinyopt is not found locally
11+
1012
# Find Tinyopt, fetch it if not found
1113
find_package(Tinyopt)
1214

@@ -20,10 +22,13 @@ if (NOT Tinyopt_FOUND)
2022
GIT_SHALLOW TRUE
2123
GIT_PROGRESS TRUE
2224
)
23-
set(BUILD_TINYOPT_TESTS OFF)
25+
set(TINYOPT_BUILD_TESTS OFF)
2426
FetchContent_MakeAvailable(tinyopt)
27+
else()
28+
message("Tinyopt found at ${Tinyopt_INCLUDE_DIRS}")
2529
endif()
2630

2731
# Header-only library
2832
add_executable(example src/example.cpp)
29-
target_link_libraries(example PUBLIC tinyopt)
33+
target_link_libraries(example PUBLIC tinyopt) # PULIC when Fetched, INTERFACE otherwise...
34+
target_link_libraries(example PUBLIC Eigen3::Eigen)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ Minimal Tinyopt project
1010
set(CMAKE_CXX_STANDARD 20) # Minimum is c++17
1111
1212
find_package(Tinyopt)
13+
find_package(Eigen3) # Only needed if Tinyopt is not found locally
1314
1415
add_executable(example src/example.cpp)
1516
target_link_libraries(example PUBLIC tinyopt)
17+
target_link_libraries(example PUBLIC Eigen3::Eigen) # needed, sometimes...
1618
```
1719

1820
### Alternative using `git submodule`

0 commit comments

Comments
 (0)