[Piglit] [PATCH 4/4] cmake: Use waffle PackageConfig instead of pkg-find.

Dylan Baker baker.dylan.c at gmail.com
Wed Jan 7 14:21:17 PST 2015


On Wednesday, January 07, 2015 08:32:28 PM Jose Fonseca wrote:
> On 07/01/15 20:00, Dylan Baker wrote:
> > From: Dylan Baker <dylanx.c.baker at intel.com>
> >
> > This patch changes the behavior find_pkg for waffle to use a config file
> > pkg-config.
> >
> > Config files are like pkgconfig files, but instead of being a linux
> > specific solution they are a cmake specific solution.
> > ---
> >   CMakeLists.txt            | 37 +------------------------------------
> >   tests/util/CMakeLists.txt |  2 +-
> >   2 files changed, 2 insertions(+), 37 deletions(-)
> >
> > diff --git a/CMakeLists.txt b/CMakeLists.txt
> > index 8cf046d..7944ac1 100644
> > --- a/CMakeLists.txt
> > +++ b/CMakeLists.txt
> > @@ -42,42 +42,7 @@ else()
> >   endif()
> >
> >   if(PIGLIT_USE_WAFFLE)
> > -	if (NOT WIN32)
> > -		pkg_check_modules(Waffle REQUIRED waffle-1)
> > -
> > -		if(NOT Waffle_FOUND)
> > -			message(FATAL_ERROR "Failed to find Waffle. If Waffle"
> > -			"is not packaged for your distribution, you can get "
> > -			"it at http://www.waffle-gl.org."
> > -		)
> > -		endif()
> > -
> > -		# Check the installed waffle version.
> > -		#
> > -		# We cannot reliably check the version with pkg_check_modules(), but
> > -		# instead must check the version manually as below. The problem is that,
> > -		# if one passes a required version to pkg_check_modules(), CMake
> > -		# validates the required version at most once for the lifetime of the
> > -		# source tree.  If someone changes the required version by editing the
> > -		# CMakeLists, CMake fails to detect the new requirement.
> > -		set(Waffle_REQUIRED_VERSION "1.5.0")
> > -		if(Waffle_VERSION VERSION_LESS Waffle_REQUIRED_VERSION)
> > -			message(FATAL_ERROR "Found waffle-${Waffle_VERSION}, but "
> > -			"piglit requires waffle-${Waffle_REQUIRED_VERSION}")
> > -		endif()
> > -	else ()
> > -		find_path(Waffle_INCLUDE_DIRS waffle.h)
> > -        find_library(Waffle_LIBRARIES waffle-1)
> > -		if(Waffle_INCLUDE_DIRS AND Waffle_LIBRARIES)
> > -			set(Waffle_FOUND TRUE)
> > -		else()
> > -			message(FATAL_ERROR "Failed to find Waffle. Get and build Waffle from "
> > -				"http://www.waffle-gl.org and set Waffle_INCLUDE_DIRS and "
> > -				"Waffle_LIBRARIES variables accordingly."
> > -			)
> > -		endif()
> > -	endif ()
> > -
> > +    find_package(Waffle 1.5.0 CONFIG REQUIRED)
> 
> It looks like your editor is replacing tabs with four-spaces.  I think 
> this might make the code look mis-aligned for everybody that uses 
> 8-spaces tabs, which tends to be the default.

You are correct, I default to using 4 spaces and no tabs in all of my
projects, so that's my editors default. I've corrected that for piglit's
cmake.

I've also fixed all of the whitespace locally.

> 
> >   	add_definitions(-DPIGLIT_USE_WAFFLE)
> >   	add_definitions(-DWAFFLE_API_VERSION=0x0103)
> >   else()
> > diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
> > index d1141bf..680b9f5 100644
> > --- a/tests/util/CMakeLists.txt
> > +++ b/tests/util/CMakeLists.txt
> > @@ -29,7 +29,7 @@ set(UTIL_GL_INCLUDES
> >   	${UTIL_INCLUDES}
> >   	${GLEXT_INCLUDE_DIR}
> >   	${OPENGL_INCLUDE_PATH}
> > -	${Waffle_INCLUDE_DIRS}
> > +    ${Waffle_INCLUDE_DIRS}
> 
> Same here.
> 
> Otherwise looks OK.  Same for the rest of the series.  I haven't had the 
> chance of testing this on Windows, but I don't expect to be troublesome. 
> If anything pops up I can deal with it later.
> 
> 
> Jose

Thanks Jose, I'll wait to see if anyone else has comments.

> 
> >   	)
> >
> >   set(UTIL_GL_SOURCES
> >
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150107/70f60a8f/attachment.sig>


More information about the Piglit mailing list