Scripts/Testing.cmake

Tue, 06 Jul 2021 10:22:49 +0300

author
cemkalyoncu
date
Tue, 06 Jul 2021 10:22:49 +0300
branch
4.x-dev
changeset 1701
b168349a931d
parent 1658
0d3227cdf96b
child 1731
b972732e8fcc
permissions
-rw-r--r--

* Image/Bitmap rotate

CMAKE_MINIMUM_REQUIRED(VERSION 3.0)



INCLUDE(${CMAKE_TESTING_DIRECTORY}/tests.cmake)

ENABLE_TESTING()

file(MAKE_DIRECTORY ${CMAKE_TESTING_DIRECTORY}/Runtime)

IF(UNIT_TESTS)
	FOREACH(file ${UnitTests})
		SET(target "UnitTest-${file}")
		
		ADD_EXECUTABLE(${target} ${CMAKE_TESTING_DIRECTORY}/Source/Unit/${file})
		
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_TESTING_DIRECTORY}/Tests/Unit")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_TESTING_DIRECTORY}/Tests/Unit")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_TESTING_DIRECTORY}/Tests/Unit")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_TESTING_DIRECTORY}/Tests/Unit")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_TESTING_DIRECTORY}/Tests/Unit")
		SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS "-DTEST -DTESTDIR=\"\\\"${CMAKE_TESTING_DIRECTORY}/Runtime\\\"\"")
		TARGET_INCLUDE_DIRECTORIES(${target} PUBLIC "${CMAKE_TESTING_DIRECTORY}/Source")
		TARGET_INCLUDE_DIRECTORIES(${target} PUBLIC "${CMAKE_SOURCE_DIR}/Source")
		TARGET_LINK_LIBRARIES(${target} Gorgon)
		
		ADD_TEST(NAME ${file} WORKING_DIRECTORY ${CMAKE_TESTING_DIRECTORY}/Runtime COMMAND  ${CMAKE_TESTING_DIRECTORY}/Tests/Unit/${target})
	ENDFOREACH()
ENDIF()

FOREACH(file ${ManualTests})
	OPTION(MANUAL_TEST_${file} "Add ${file} manual tests to your manualtest run." OFF)
ENDFOREACH()

ADD_CUSTOM_TARGET(manualtest)

FOREACH(file ${ManualTests})
	IF(MANUAL_TEST_${file})
		SET(target "ManualTest-${file}")
		
		ADD_EXECUTABLE(${target} ${CMAKE_TESTING_DIRECTORY}/Source/Manual/${file})
		
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_TESTING_DIRECTORY}/Tests/Manual")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_TESTING_DIRECTORY}/Tests/Manual")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_TESTING_DIRECTORY}/Tests/Manual")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_TESTING_DIRECTORY}/Tests/Manual")
		SET_TARGET_PROPERTIES(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_TESTING_DIRECTORY}/Tests/Manual")
		SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS "-DTEST -DTESTDIR=\"\\\"${CMAKE_TESTING_DIRECTORY}/Runtime\\\"\"")
		TARGET_INCLUDE_DIRECTORIES(${target} PUBLIC "${CMAKE_TESTING_DIRECTORY}/Source")
		TARGET_INCLUDE_DIRECTORIES(${target} PUBLIC "${CMAKE_SOURCE_DIR}/Source")
		TARGET_LINK_LIBRARIES(${target} Gorgon)
		
		ADD_CUSTOM_COMMAND(TARGET manualtest COMMAND ${CMAKE_TESTING_DIRECTORY}/Tests/Manual/${target})
	ENDIF()
ENDFOREACH()

mercurial