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

CMake: developer experience improvements #297

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

amsobr
Copy link

@amsobr amsobr commented Oct 17, 2023

This PR adds some improvements related to developer experience.

The bump to CMake v3.13 enables CMake policy #CMP0077, which makes it easier to define and use configuration variables, especially when bundling lv_drivers from another project.

Other improvements include:

  • automatically linking with SDL2
  • fix a bug in install rule which would install every single *.h file from the main project tree
  • add option to altogether disable installing lib and headers, when lv_drivers are bundled in another project

Please feel free to considers these changes as you see fit.

Thanks,
António

* bump cmake minimum version to 3.13 and make it possible to use CMP0077:
  https://cmake.org/cmake/help/git-stage/policy/CMP0077.html
* starting with cmake 3.13 the behaviour of option() changed so that any
  value already set is preserved when the option() statement is reached.

Signed-off-by: António Oliveira <antonio.oliveira@konsulko.com>
* the install() statement copies all *.h files from the top level dir
  of the current project, instead of only the lv_drivers headers.
  This appears to be a typo, as the actual variable that makes sense to
  refer to the headers in the lv_drivers project files is
  CMAKE_CURRENT_SOURCE_DIR, so I changed it.
* Without this change, calling install on a project which bundles
  lv_drivers within its source tree, would copy every single .h file
  in the whole project, which can be nasty, especially with large
  codebases.

Signed-off-by: António Oliveira <antonio.oliveira@konsulko.com>
* added the option to set lv_drivers as bundled. If enabled, the install
  targets are not defined and no lv_drivers headers or objects will be
  installed, since lv_drivers will be directly linked to any of its
  dependants.
* the default behaviour is preserved.

Signed-off-by: António Oliveira <antonio.oliveira@konsulko.com>
* if lv_drivers is used with:
  #define USE_SDL 1
  The CMake option LV_DRIVERS_USE_SDL may be set to automatically find
  libsdl2 and add it to the list of link libraries

Signed-off-by: António Oliveira <antonio.oliveira@konsulko.com>
@amsobr amsobr changed the title CMake: developet experience improvements CMake: developer experience improvements Oct 18, 2023
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

Successfully merging this pull request may close these issues.

1 participant