set(MODULE_NAME graphics)

set(PLATFORM_UNIT_TEST_FILES)

set(OpenGL_GL_PREFERENCE "GLVND")
find_package(OpenGL QUIET)
if (OpenGL_FOUND)
	set(PLATFORM_UNIT_TEST_FILES
		TestOpenGlRendering.cpp
		)
endif()


if(WIN32)
	list(APPEND PLATFORM_UNIT_TEST_FILES 
		TestD2DOffScreenRendering.cpp
	)
	set(UI_TEST_FILES 
		TestDirectXRendering.cpp
		TestD2DRendering.cpp
		)
endif()

set(UNIT_TEST_FILES 
    TestRasterizer.cpp
	TestTextRendering.cpp
    ${PLATFORM_UNIT_TEST_FILES}
    )

set(UNIT_TEST_TARGET_NAME ${MODULE_NAME}_unit_tests)
add_executable(${UNIT_TEST_TARGET_NAME} ${CMAKE_SOURCE_DIR}/test/test_runner.cpp ${UNIT_TEST_FILES})
target_link_libraries(${UNIT_TEST_TARGET_NAME} PUBLIC test_utils graphics client)
set_property(TARGET ${UNIT_TEST_TARGET_NAME} PROPERTY FOLDER test/${MODULE_NAME})


set(UI_TEST_TARGET_NAME ${MODULE_NAME}_ui_tests)
add_executable(${UI_TEST_TARGET_NAME} WIN32 ${CMAKE_SOURCE_DIR}/test/ui_test_runner.cpp ${UI_TEST_FILES})
target_link_libraries(${UI_TEST_TARGET_NAME} PUBLIC test_utils graphics client)
set_property(TARGET ${UI_TEST_TARGET_NAME} PROPERTY FOLDER test/${MODULE_NAME})


