Open JayFoxRox opened 3 years ago
I think this is partially an issue with upstream, because they also don't have an install target. There don't even seem to be rules which headers should be included or how to package them (without copying the entire source tree). It's a huge mess, but it looks like they are currently transitioning to CMake (unfortunately often using it very poorly).
However, the build-system I proposed can probably be largely be used for bundling (just find_package
won't work, because there's no way to install or package the library).
There's currently no build-system. The README recommends to copy https://github.com/Ryzee119/lvgl-sdl/blob/master/example/CMakeLists.txt
Additionally, that makefile adds a manual build-system for lvgl, which should not be necessary. This is not how CMake usually does things.
Instead, you can normally just use
add_subdirectory(${LVDRV_DIR})
which would then link those CMake build-systems together.I'd expect the example to be closer to this:
Furthermore, the SDL2 dependency only has to be added to lvgl, and if it's the right visibility (note the
PUBLIC
intarget_link_libraries
), that will have a transitive property and ensure that all users of lvgl_example will also link against SDL2. Consult CMake docs for more information.For people who don't want to bundle lvgl, all they'll have to do is to replace the
add_subdirectory
withfind_package(REQUIRED lvgl)
(or along those lines).