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

[package] sdl/2.0.18: cmake defines changed upstream #8607

Closed
tomazos opened this issue Jan 2, 2022 · 3 comments · Fixed by #8609
Closed

[package] sdl/2.0.18: cmake defines changed upstream #8607

tomazos opened this issue Jan 2, 2022 · 3 comments · Fixed by #8609
Labels
bug Something isn't working

Comments

@tomazos
Copy link

tomazos commented Jan 2, 2022

The cmake defines that upstream SDL uses have been changed in a recent version (mainly to include SDL_ prefix, but that isn't consistent), so the ones that recipes/sdl/all/conanfile.py uses in _configure_make no longer work as of at least 2.0.18.

Package and Environment Details

  • Package Name/Version: sdl/2.0.18
  • Operating System+version: All
  • Compiler+version: All

Here is a rough patch to demonstrate some of the needed changes. (I discovered this from cmakes warning about unused defines). I guess to do this properly the maintainer would need to make it conditional on SDL version which names to use.


     def _configure_cmake(self):
         if not self._cmake:
             self._cmake = CMake(self)
                 self._cmake.definitions["HAVE_LIBC"] = True
             self._cmake.definitions["SDL_SHARED"] = self.options.shared
             self._cmake.definitions["SDL_STATIC"] = not self.options.shared
-            self._cmake.definitions["VIDEO_OPENGL"] = self.options.opengl
-            self._cmake.definitions["VIDEO_OPENGLES"] = self.options.opengles
-            self._cmake.definitions["VIDEO_VULKAN"] = self.options.vulkan
+            self._cmake.definitions["SDL_OPENGL"] = self.options.opengl
+            self._cmake.definitions["SDL_OPENGLES"] = self.options.opengles
+            self._cmake.definitions["SDL_VULKAN"] = self.options.vulkan
             if self.settings.os == "Linux":
                 # See https://github.com/bincrafters/community/issues/696
                 self._cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1
 
-                self._cmake.definitions["ALSA"] = self.options.alsa
+                self._cmake.definitions["SDL_ALSA"] = self.options.alsa
                 if self.options.alsa:
-                    self._cmake.definitions["ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared
+#                    self._cmake.definitions["SDL_ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared
+                    self._cmake.definitions["SDL_ALSA_SHARED"] = False
                     self._cmake.definitions["HAVE_ASOUNDLIB_H"] = True
                     self._cmake.definitions["HAVE_LIBASOUND"] = True
-                self._cmake.definitions["JACK"] = self.options.jack
+                self._cmake.definitions["SDL_JACK"] = self.options.jack
                 if self.options.jack:
-                    self._cmake.definitions["JACK_SHARED"] = self.deps_cpp_info["jack"].shared
-                self._cmake.definitions["ESD"] = self.options.esd
+                    self._cmake.definitions["SDL_JACK_SHARED"] = self.deps_cpp_info["jack"].shared
+                self._cmake.definitions["SDL_ESD"] = self.options.esd
                 if self.options.esd:
-                    self._cmake.definitions["ESD_SHARED"] = self.deps_cpp_info["esd"].shared
-                self._cmake.definitions["PULSEAUDIO"] = self.options.pulse
+                    self._cmake.definitions["SDL_ESD_SHARED"] = self.deps_cpp_info["esd"].shared
+                self._cmake.definitions["SDL_PULSEAUDIO"] = self.options.pulse
                 if self.options.pulse:
-                    self._cmake.definitions["PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared
-                self._cmake.definitions["SNDIO"] = self.options.sndio
+#                    self._cmake.definitions["SDL_PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared
+                    self._cmake.definitions["SDL_PULSEAUDIO_SHARED"] = False
+
+                self._cmake.definitions["SDL_SNDIO"] = self.options.sndio
                 if self.options.sndio:
-                    self._cmake.definitions["SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared
-                self._cmake.definitions["NAS"] = self.options.nas
+                    self._cmake.definitions["SDL_SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared
+                self._cmake.definitions["SDL_NAS"] = self.options.nas
                 if self.options.nas:
                     cmake_extra_ldflags += ["-lXau"]  # FIXME: SDL sources doesn't take into account transitive dependencies
                     cmake_required_includes += [os.path.join(self.deps_cpp_info["nas"].rootpath, str(it)) for it in self.deps_cpp_info["nas"].includedirs]
-                    self._cmake.definitions["NAS_SHARED"] = self.options["nas"].shared
-                self._cmake.definitions["VIDEO_X11"] = self.options.x11
+                    self._cmake.definitions["SDL_NAS_SHARED"] = self.options["nas"].shared
+                self._cmake.definitions["SDL_X11"] = self.options.x11
                 if self.options.x11:
                     self._cmake.definitions["HAVE_XEXT_H"] = True
-                self._cmake.definitions["VIDEO_X11_XCURSOR"] = self.options.xcursor
+                self._cmake.definitions["SDL_X11_XCURSOR"] = self.options.xcursor
                 if self.options.xcursor:
                     self._cmake.definitions["HAVE_XCURSOR_H"] = True
-                self._cmake.definitions["VIDEO_X11_XINERAMA"] = self.options.xinerama
+                self._cmake.definitions["SDL_X11_XINERAMA"] = self.options.xinerama
                 if self.options.xinerama:
                     self._cmake.definitions["HAVE_XINERAMA_H"] = True
-                self._cmake.definitions["VIDEO_X11_XINPUT"] = self.options.xinput
+                self._cmake.definitions["SDL_X11_XINPUT"] = self.options.xinput
                 if self.options.xinput:
                     self._cmake.definitions["HAVE_XINPUT_H"] = True
-                self._cmake.definitions["VIDEO_X11_XRANDR"] = self.options.xrandr
+                self._cmake.definitions["SDL_X11_XRANDR"] = self.options.xrandr
                 if self.options.xrandr:
                     self._cmake.definitions["HAVE_XRANDR_H"] = True
-                self._cmake.definitions["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver
+                self._cmake.definitions["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver
                 if self.options.xscrnsaver:
                     self._cmake.definitions["HAVE_XSS_H"] = True
-                self._cmake.definitions["VIDEO_X11_XSHAPE"] = self.options.xshape
+                self._cmake.definitions["SDL_X11_XSHAPE"] = self.options.xshape
                 if self.options.xshape:
                     self._cmake.definitions["HAVE_XSHAPE_H"] = True
-                self._cmake.definitions["VIDEO_X11_XVM"] = self.options.xvm
+                self._cmake.definitions["SDL_X11_XVM"] = self.options.xvm
                 if self.options.xvm:
                     self._cmake.definitions["HAVE_XF86VM_H"] = True
-                self._cmake.definitions["VIDEO_WAYLAND"] = self.options.wayland
+                self._cmake.definitions["SDL_WAYLAND"] = self.options.wayland
                 if self.options.wayland:
                     # FIXME: Otherwise 2.0.16 links with system wayland (from egl/system requirement)
                     cmake_extra_ldflags += ["-L{}".format(os.path.join(self.deps_cpp_info["wayland"].rootpath, it)) for it in self.deps_cpp_info["wayland"].libdirs]
-                    self._cmake.definitions["WAYLAND_SHARED"] = self.options["wayland"].shared
-                    self._cmake.definitions["WAYLAND_SCANNER_1_15_FOUND"] = 1  # FIXME: Check actual build-requires version
+                    self._cmake.definitions["SDL_WAYLAND_SHARED"] = self.options["wayland"].shared
+                    self._cmake.definitions["SDL_WAYLAND_SCANNER_1_15_FOUND"] = 1  # FIXME: Check actual build-requires version
 
-                self._cmake.definitions["VIDEO_DIRECTFB"] = self.options.directfb
-                self._cmake.definitions["VIDEO_RPI"] = self.options.video_rpi
+                self._cmake.definitions["SDL_DIRECTFB"] = self.options.directfb
+                self._cmake.definitions["SDL_RPI"] = self.options.video_rpi
                 self._cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind
             elif self.settings.os == "Windows":
-                self._cmake.definitions["DIRECTX"] = self.options.directx
+                self._cmake.definitions["SDL_DIRECTX"] = self.options.directx
 
             # Add extra information collected from the deps
             self._cmake.definitions["EXTRA_LDFLAGS"] = " ".join(cmake_extra_ldflags)

@tomazos tomazos added the bug Something isn't working label Jan 2, 2022
@tomazos
Copy link
Author

tomazos commented Jan 2, 2022

Also there was some problem with self.deps_cpp_info["libalsa"].shared, it wasn't coming out a bool for some reason, so when you set it to False it didn't work. Same for self.deps_cpp_info["pulseaudio"].shared. This is unrelated to the above, and I think they never worked.

@tomazos tomazos changed the title [package] sdl/2.0.18: cmake defines changed [package] sdl/2.0.18: cmake defines changed upstream Jan 2, 2022
@SpaceIm
Copy link
Contributor

SpaceIm commented Jan 2, 2022

Indeed, good catch. Fixed in #8609

Also there was some problem with self.deps_cpp_info["libalsa"].shared, it wasn't coming out a bool for some reason, so when you set it to False it didn't work. Same for self.deps_cpp_info["pulseaudio"].shared. This is unrelated to the above, and I think they never worked.

It's surprising, maybe a regression in conan client? I'm pretty sure it used to return bool.

@tomazos
Copy link
Author

tomazos commented Jan 3, 2022

I can't remember what the type was, but you can reproduce it in the cmake config output. It had like ALSA_SHARED = <some python type>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants