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

Address warnings, fix FreeBSD build #138

Closed
wants to merge 10 commits into from
Closed

Conversation

gtalent
Copy link

@gtalent gtalent commented Jun 1, 2024

These changes address some compiler and CMake warnings, and fixes NFDE to build properly on FreeBSD.

Copy link
Owner

@btzy btzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR.

Many of the changes here seem reasonable, but I do not understand how any of these changes are FreeBSD-specific - can you explain why they are needed for FreeBSD specifically?

  • The need to wrap the BUILD_SHARED_LIBS option in a condition sounds like something specific to either your CMake version or the way you're invoking CMake.
  • The original use of pkg_check_modules seems like something that would also work on both Linux and FreeBSD, unless FreeBSD has a weird pkg-config application.

What compiler and compile flags are you using? We should probably enable those extra flags on the CI too.

Also, I think I'll need to set up a FreeBSD CI to ensure that regressions aren't inadvertently introduced in the future.

Comment on lines +9 to +11
if(NOT DEFINED BUILD_SHARED_LIBS)
option(BUILD_SHARED_LIBS "Build a shared library instead of static" OFF)
endif()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain a bit more about what this does? Most examples on the Internet do not put option inside a if condition like this. Some GitHub Actions are configured to pass -DBUILD_SHARED_LIBS=ON, and it doesn't cause any problems with the existing code.

Also, what is making BUILD_SHARED_LIBS different from NFD_BUILD_TESTS and NFD_INSTALL below?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am not building NFDE by itself.

Here is the warning I'm getting:

CMake Warning (dev) at deps/nfde/CMakeLists.txt:9 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'BUILD_SHARED_LIBS'.
This warning is for project developers.  Use -Wno-dev to suppress it.

BUILD_SHARED_LIBS is a standard CMake variable used by a lot of different projects, though it might make sense to do that with the others as well for projects like mine that bundle NFDE.

find_package(PkgConfig REQUIRED)
# for Linux, we support GTK3 and xdg-desktop-portal
option(NFD_PORTAL "Use xdg-desktop-portal instead of GTK" OFF)
if(NOT NFD_PORTAL)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
message("Using GTK version: ${GTK3_VERSION}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this but keep the message("Using DBUS version: ${DBUS_VERSION}") message for the portal case below? This message is meant to be here so that users can see that they are using the correct backend.

Also, should we make similar modifications for configuring portals too (i.e. make the same changes for the dbus-1 package)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why I removed that message. I put it back.

@gtalent
Copy link
Author

gtalent commented Jun 2, 2024

It looks like you guys fixed the FreeBSD build sometime between my last pull and now.

@gtalent gtalent closed this Jun 2, 2024
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.

2 participants