We are currently kind of duplicating the same FindGStreamer-Foo.cmake file whenever a new GStreamer plugin needs to be found. Besides this approach not scaling very well, it relies on pkg-config for version checking, uses the LibFindMacros package that we should deprecate and all the find files could be merged into one, with users using the COMPONENTS feature of the FIND_PACKAGE() call to find the desired plugins.
Created attachment 140667 [details] Patch
Comment on attachment 140667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=140667&action=review > Source/cmake/FindGStreamer.cmake:50 > +# _pc_name is the component's pkg-config name (eg. "gstreamer-0.10", or "gstreamer-video-0.10"). Maybe _pkgconfig_name is a more descriptive name for this argument? > Source/cmake/FindGStreamer.cmake:92 > +IF (GSTREAMER_INCLUDE_DIRS) > + IF (EXISTS "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h") > + FILE (READ "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h" GSTREAMER_VERSION_CONTENTS) > + > + STRING(REGEX MATCH "#define +GST_VERSION_MAJOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}") > + SET(GSTREAMER_VERSION_MAJOR "${CMAKE_MATCH_1}") > + > + STRING(REGEX MATCH "#define +GST_VERSION_MINOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}") > + SET(GSTREAMER_VERSION_MINOR "${CMAKE_MATCH_1}") > + > + STRING(REGEX MATCH "#define +GST_VERSION_MICRO +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}") > + SET(GSTREAMER_VERSION_MICRO "${CMAKE_MATCH_1}") > + > + SET(GSTREAMER_VERSION "${GSTREAMER_VERSION_MAJOR}.${GSTREAMER_VERSION_MINOR}.${GSTREAMER_VERSION_MICRO}") > + ENDIF () > +ENDIF () This code is almost identical to code in FindCairo.cmake. Can we extract the common code into a shared function?
Comment on attachment 140667 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=140667&action=review >> Source/cmake/FindGStreamer.cmake:92 >> +ENDIF () > > This code is almost identical to code in FindCairo.cmake. Can we extract the common code into a shared function? I'm unsure about how to do that -- the regular expressions here and in FindCairo.cmake are slightly different, for example (gstreamer uses "#define FOO_MAJOR (0)" and cairo uses "#define FOO_MAJOR 0", and making the ()s optional might not be very future-proof).
Created attachment 140718 [details] Use a better name for _pc_name
(In reply to comment #3) > (From update of attachment 140667 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=140667&action=review > > >> Source/cmake/FindGStreamer.cmake:92 > >> +ENDIF () > > > > This code is almost identical to code in FindCairo.cmake. Can we extract the common code into a shared function? > > I'm unsure about how to do that -- the regular expressions here and in FindCairo.cmake are slightly different, for example (gstreamer uses "#define FOO_MAJOR (0)" and cairo uses "#define FOO_MAJOR 0", and making the ()s optional might not be very future-proof). Thanks for taking a look. The code you have in this patch is sufficient.
Committed r116453: <http://trac.webkit.org/changeset/116453>