[Piglit] [PATCH 1/6] cmake: Use find_package to find Waffle

Chad Versace chad.versace at linux.intel.com
Mon Nov 5 10:49:03 PST 2012


On 10/24/2012 06:11 AM, groleo at gmail.com wrote:
> From: Adrian Marius Negreanu <adrian.m.negreanu at intel.com>
> 
> * replace pkg_check_modules with find_package
> * add FindWaffle.cmake
> 
> Signed-off-by: Adrian Marius Negreanu <adrian.m.negreanu at intel.com>
> ---
> :100644 100644 2f4c213... 719cda1... M	CMakeLists.txt
> :000000 100644 0000000... 4bdfef8... A	cmake/Modules/FindWaffle.cmake
>  CMakeLists.txt                 |  6 ++---
>  cmake/Modules/FindWaffle.cmake | 57 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 60 insertions(+), 3 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 2f4c213..719cda1 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -34,7 +34,7 @@ else()
>  endif()
>  
>  if(PIGLIT_USE_WAFFLE)
> -	pkg_check_modules(WAFFLE REQUIRED waffle-1>=1.1.0)
> +	find_package(Waffle 1.1.0 REQUIRED)

This hunk will make many Linux users unhappy. Let's continue to use
pkgconfig on Linux and only use find_package on Android.

>  	if(NOT WAFFLE_FOUND)
>  		message(FATAL_ERROR "Failed to find Waffle. If Waffle is not "
> @@ -44,8 +44,8 @@ if(PIGLIT_USE_WAFFLE)
>          endif()
>  
>          add_definitions(-DPIGLIT_USE_WAFFLE)
> -	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WAFFLE_CFLAGS}")
> -	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WAFFLE_CFLAGS}")
> +	include_directories(${WAFFLE_INCLUDE_DIR})

I like replacing the modification of CFLAGS with include_directories. Just a
reminder: the variable needs to be updated to WAFFLE_INCLUDE_DIRS.

> +	link_libraries(${WAFFLE_LIBRARY})
>  endif(PIGLIT_USE_WAFFLE)

No other library in Piglit gets a global link directive like this. Instead,
individual targets, such as libpiglitutil, should list libwaffle as a dependency.

For Android's use case, does it suffice to add ${WAFFLE_LIBRARIES} to the snippet
below from tests/util/CMakeLists.txt?

set(UTIL_GL_LIBS                                                                                                                        
        piglitutil
        ${WAFFLE_LDFLAGS}
        )

> diff --git a/cmake/Modules/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
> new file mode 100644

Just a reminder: the updated FindWaffle.cmake needs importing.



More information about the Piglit mailing list