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: use pkg-config + test compile instead of Find module for detecting rpi #8052

Merged
merged 3 commits into from
Jul 28, 2023

Conversation

madebr
Copy link
Contributor

@madebr madebr commented Jul 27, 2023

  • Blind rpi fix
  • Fixes SDL_HIDAPI_LIBUSB

Fixes #8050

@slouken
Can you please test this?
I don't have a rpi configured right now, so I can't test it.

@slouken
Copy link
Collaborator

slouken commented Jul 27, 2023

-- Performing Test HAVE_RPI - Success
CMake Error at cmake/sdltargets.cmake:59 (get_property):
  get_property not given name for TARGET scope.
Call Stack (most recent call first):
  cmake/sdlchecks.cmake:1111 (sdl_generic_link_dependency)
  CMakeLists.txt:1439 (CheckRPI)

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

Much closer:

/usr/bin/ld: cannot find -lbcm_host

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

Where this is found varies by distribution, but here it's in /opt/vc/lib/libbcm_host.so

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

Adding -l/opt/vc/lib to the link line works here.

@madebr
Copy link
Contributor Author

madebr commented Jul 28, 2023

Does pkg-config bcm_host or pkg-config brcmegl work?
I'm wondering whether /opt/vc/lib/pkgconfig is in the default PKG_CONFIG_PATH.

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

It appears not to be:

$ ls /opt/vc/lib/pkgconfig
bcm_host.pc  brcmegl.pc  brcmglesv2.pc  brcmvg.pc  mmal.pc  vcsm.pc
$ pkg-config bcm_host --libs
Package bcm_host was not found in the pkg-config search path.
Perhaps you should add the directory containing `bcm_host.pc'
to the PKG_CONFIG_PATH environment variable
No package 'bcm_host' found

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

$ PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig pkg-config bcm_host --libs
-L/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm -pthread
$ PKG_CONFIG_PATH=/opt/vc/lib/pkgconfig pkg-config brcmegl --libs
-L/opt/vc/lib -lbrcmEGL -lbrcmGLESv2 -lbcm_host -lvchostif -lbcm_host -lvcos -lvchiq_arm -pthread

@madebr
Copy link
Contributor Author

madebr commented Jul 28, 2023

Can you try again? It now sets the PKG_CONFIG_PATH environment variable.

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

Looks good, thanks! Should I merge, or are you still iterating?

@madebr
Copy link
Contributor Author

madebr commented Jul 28, 2023

Looks good, thanks! Should I merge, or are you still iterating?

I think the check_c_source_compiles can be removed.

I also think SDL does not need to link to brcmegl if it turned out bcm_host.pc and brcmegl.pc were never actually used before.

Can you re-build SDL in a clean build folder?

@slouken
Copy link
Collaborator

slouken commented Jul 28, 2023

It works great!

@madebr
Copy link
Contributor Author

madebr commented Jul 28, 2023

Merging.
For completeness, this pr also renames SDL_TEST -> SDL_TEST_LIBRARY.
See 41a96c8#commitcomment-122911331

@madebr madebr merged commit e24b3e2 into libsdl-org:main Jul 28, 2023
35 checks passed
@madebr madebr deleted the cmake-rpi branch July 28, 2023 02:41
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.

Raspberry Pi build broken?
2 participants