include_directories(
	${UTIL_GL_INCLUDES}
	)

link_libraries(
	${UTIL_GL_LIBS}
	${OPENGL_gl_LIBRARY}
	)

IF(PIGLIT_BUILD_GLX_TESTS)
	# XXX: This is currently duplicated wherever tests
	# include "piglit-glx-util.h". Is it possible to refactor it?
	include_directories(
		${GLPROTO_INCLUDE_DIRS}
	)

	add_definitions ( -DPIGLIT_USE_GLX )
	piglit_add_library (piglitglxutil
		    piglit-shader.c
		    piglit-util-gl.c
		    piglit-glx-framework.c
		    piglit-glx-util.c
		    piglit-dispatch.c
		    piglit-dispatch-init.c
		    ${piglit_dispatch_gen_output_dir}/piglit-util-gl-enum-gen.c
	)
	target_link_libraries(piglitglxutil
		piglitutil_${piglit_target_api}
		)
	set (UTIL_GL_SOURCES
		${UTIL_GL_SOURCES}
		piglit-glx-util.c
	)
ENDIF(PIGLIT_BUILD_GLX_TESTS)

IF(PIGLIT_BUILD_WGL_TESTS)
	add_definitions ( -DPIGLIT_USE_WGL )
	piglit_add_library (piglitwglutil
		    piglit-shader.c
		    piglit-util-gl.c
		    piglit-wgl-util.c
		    piglit-dispatch.c
		    piglit-dispatch-init.c
		    ${piglit_dispatch_gen_output_dir}/piglit-util-gl-enum-gen.c
	)
	target_link_libraries(piglitwglutil
		piglitutil_${piglit_target_api}
		)
	set (UTIL_GL_SOURCES
		${UTIL_GL_SOURCES}
		piglit-wgl-util.c
	)
ENDIF(PIGLIT_BUILD_WGL_TESTS)

piglit_add_library (piglitutil_${piglit_target_api}
	${UTIL_GL_SOURCES}
)

# vim: ft=cmake:
