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

Packaging suggestions #256

Open
dkogan opened this issue Sep 9, 2022 · 15 comments
Open

Packaging suggestions #256

dkogan opened this issue Sep 9, 2022 · 15 comments

Comments

@dkogan
Copy link

dkogan commented Sep 9, 2022

Hi. I'm the Debian maintainer. I just released the 3.3.0 release into Debian; it's there now. Ubuntu will pick it up when they make a new release, in a month probably. Thanks for maintaining this library. I have some notes:

Thanks for maintaining this library!

@christian-rauch
Copy link
Collaborator

  • Patch 2 makes sense. But I think usually this is done with some macro that switches between OSes and compilers (e.g. support Windows).
  • Patch 5 is already integrated on master.
  • Patch 6 makes a lot of sense. I was thinking about splitting this before. @dkogan Can you send a PR for this?
  • Patch 7 I don't think we should integrate another example executable.

@dkogan
Copy link
Author

dkogan commented Sep 9, 2022 via email

@dkogan
Copy link
Author

dkogan commented Sep 9, 2022

tags.pdf

Here's the attachment from the last email. github is dumb.

@christian-rauch
Copy link
Collaborator

christian-rauch commented Sep 9, 2022

This patch is a whitelist of exports. Maybe some compilers (on Windows, say) do this in some other way than an "attribute", but you need SOMETHING tagging each exported function.

Yes, there are other OSes and compilers. That is why this has to be placed behind an if-else macro that resolves for different compilers and OSes. The library is supposed to work on multiple systems.

It's a lot of typing to do that. Can you grab the patch from the link and "git am whatever.patch"? If not, tell me, and I'll go through the motions.

You just have to put this into a branch of your GitHub fork and send a PR via the web interface. The idea was this should be reviewed in public here and not just be applied and pushed to upstream.

I'd like to suggest this sample to replace the other samples. Not only does it demonstrate the usage of the C API, it allows the library to be utilized without writing any code.

I don't fully understand what's the motivation behind this. Both current examples demonstrate the C API already. In fact, there is only a C API that is used by the C example, which reads image files from the command line, and the C++ example, which reads from a video stream via OpenCV. I am not sure what the benefit of a third example would be.

If you want to demonstrate the new "apriltag" "core library" without "apriltag-utils", I would suggest modifying the OpenCV example to only do the AprilTag detection without jpeg decoding, option parsing etc. and let OpenCV do the test. You could also modify the base example and show how both libraries ("core" and "utils") are linked at the same time.

@christian-rauch
Copy link
Collaborator

@dkogan Can you send some of your patches as individual PRs? Otherwise, I am inclined to just close this for now.

@dkogan
Copy link
Author

dkogan commented Sep 28, 2022 via email

@j-medland
Copy link
Contributor

I would be happy to provide some support to get these merged as it aligns with trying to get a vcpkg.io port that builds a library on Windows.

I had to patch in explicit DLL exports for Windows so adding export statements to the public API seems worthwhile - ditto to splitting out the detector from the other functionality.

I'll give it a go and submit a PR when I have something worth looking at.

Cheers

@dkogan
Copy link
Author

dkogan commented Sep 29, 2022 via email

@christian-rauch
Copy link
Collaborator

It's a nice thing to ship in /usr/bin/apriltag. For many use cases this alone is sufficient, and it's nice for this project to provide a ready-to-use binary. The Debian packages do this today, and it'd be good if upstream did that too

This repo already has two examples that are ready to use.

Its sources demo the thing that makes users seek out this library, and not the other stuff: nobody uses libapriltag for its option parser. It also doesn't have any heavy dependencies, not even opencv: only libfreeimage to read/write images. I.e. this sample code has a high signal-to-noise ratio, which is good since most users are likely to grab the "apriltag" guts of the code, and throw out everything else

This repo contains a couple of "extras", such as an option parse or jpeg decoder, in order to not rely on external dependencies. No one has to use these extras to use the library. I think most people use external third-party libraries to do optional parsing or image loading anyway. Therefore it makes sense to split those out into a separate library. But it is nice to have an example that does not require too many external libraries.

If we need an example that only links the "core" library without the "extras", then we should reimplement the apriltag_demo with only the "core" library and without external third/party libraries, by e.g. using the PPM image format with an implementation inside the apriltag_demo only.

@dkogan
Copy link
Author

dkogan commented Sep 29, 2022 via email

@christian-rauch
Copy link
Collaborator

This repo does not already deploy a ready-to-use binary

Can you provide details on what is missing in the apriltag_demo to be "ready-to-use"? If you compile and install this project, you will get an apriltag_demo binary that reads and processes images. What kind of test/demo program would be useful for a Debian package?

@dkogan
Copy link
Author

dkogan commented Sep 29, 2022 via email

@j-medland
Copy link
Contributor

j-medland commented Oct 7, 2022

Hello

I have been attempting to split the cmake build into two targets - apriltag and apriltag-utils. This works well but when it comes to defining the example builds, the header file includes are difficult to handle if relying on add_target_libraries to work nicely.

Mirroring the header-install directory layout in the project would mean being able to utilize the correct PUBLIC/PRIVATE scope for the include directories.

I am also proposing moving top level .c files to src to make this layout a bit more typical of other projects. Most of the header files would move to include/apriltag as they are required by the utils library.

project/
├── CMake
├── common/
│   ├── double_float_impl.h
│   ├── doubles.h
│   ├── floats.h
│   ├── g2d.c
│   ├── getopt.c
│   ├── ....
│   └── zmaxheap.c
├── example (unchanged)
├── include/
│   └── apriltag/
│       ├── common/
│       │   ├── debug_print.h
│       │   ├── g2d.h
│       │   ├── ...
│       │   └── zmaxheap.h
│       ├── apriltag_math.h
│       ├── apriltag_pose.h
│       ├── apriltag.h
│       ├── tag16h5.h
│       ├── ...
│       └── tagStandard52h13.h
└── src/
    ├── apriltag_pose.c
    ├── apriltag.c
    ├── tag16h5.c
    └── ...

Thoughts?

I can submit a PR with this soon if that is easier.

@christian-rauch
Copy link
Collaborator

Moving the files into a subfolder makes sense and I was thinking about this too before. But we do not need to split source and header files necessarily.

We should maybe also split the tag sources into a dedicated subfolder. Maybe it also makes sense to have a dedicated library for the tags? Then there would be a "core", "utils" and "tag" library since users of the apriltag do not necessarily need to use those tags, but can generate their own. We could just name the subfolders accordingly.

One nice thing would be the removal of "GLOB" and the listing of source files directly. Using globing for source files is actually discouraged by CMake, see https://cmake.org/cmake/help/latest/command/file.html#glob:

We do not recommend using GLOB to collect a list of source files from your source tree. If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake to regenerate.

@j-medland
Copy link
Contributor

Thanks for the feedback! I will try and integrate the things you suggest and update when I have some progress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants