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

Jose Fonseca jfonseca at vmware.com
Wed Jan 7 12:32:28 PST 2015


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.

>   	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

>   	)
>
>   set(UTIL_GL_SOURCES
>



More information about the Piglit mailing list