[Piglit] [PATCH 05/12] cmake: cleanup PIGLIT_USE_WAFFLE builds

Emil Velikov emil.l.velikov at gmail.com
Tue Aug 12 10:18:45 PDT 2014


 - Mandating pkg-check when building with MSVC is silly.
 - Do not mess around with CMAKE_C*_FLAGS directly but use
include_directories to handle waffle's headers location.
 - Use WAFFLE_LIBRARIES over WAFFLE_LDFLAGS for linking purposes.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 CMakeLists.txt            | 18 +++++++++---------
 tests/util/CMakeLists.txt | 15 ++++++++++-----
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39fd0d1..6fc7889 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,14 +37,16 @@ else()
 endif()
 
 if(PIGLIT_USE_WAFFLE)
-	pkg_check_modules(WAFFLE REQUIRED waffle-1)
+	if (NOT MSVC)
+		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()
+		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.
 	#
@@ -62,8 +64,6 @@ if(PIGLIT_USE_WAFFLE)
 
 	add_definitions(-DPIGLIT_USE_WAFFLE)
 	add_definitions(-DWAFFLE_API_VERSION=0x0103)
-	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WAFFLE_CFLAGS}")
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WAFFLE_CFLAGS}")
 else()
 	find_package(GLUT REQUIRED)
 
diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt
index 10c5dbc..35e2215 100644
--- a/tests/util/CMakeLists.txt
+++ b/tests/util/CMakeLists.txt
@@ -25,6 +25,7 @@ set(UTIL_GL_INCLUDES
 	${UTIL_INCLUDES}
 	${GLEXT_INCLUDE_DIR}
 	${OPENGL_INCLUDE_PATH}
+	${WAFFLE_INCLUDE_DIRS}
 	)
 
 set(UTIL_GL_SOURCES
@@ -47,6 +48,11 @@ set(UTIL_GL_SOURCES
 	${CMAKE_BINARY_DIR}/tests/util/piglit-util-gl-enum-gen.c
 	)
 
+set(UTIL_GL_LIBS
+	piglitutil
+	${WAFFLE_LDFLAGS}
+	)
+
 if(PIGLIT_USE_WAFFLE)
 	list(APPEND UTIL_GL_SOURCES
 		piglit-framework-gl/piglit_fbo_framework.c
@@ -75,17 +81,16 @@ if(PIGLIT_USE_WAFFLE)
 			piglit-framework-gl/piglit_x11_framework.c
 		)
 	endif()
+
+	list(APPEND UTIL_GL_LIBS
+		${WAFFLE_LIBRARIES}
+	)
 else()
 	list(APPEND UTIL_GL_SOURCES
 		piglit-framework-gl/piglit_glut_framework.c
 	)
 endif()
 
-set(UTIL_GL_LIBS
-	piglitutil
-	${WAFFLE_LDFLAGS}
-	)
-
 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 	# One needs to have at least one hardware driver present, otherwise
 	# there is no point compiling just the dispatcher.
-- 
2.0.2



More information about the Piglit mailing list