| 1 |
# SPDX-License-Identifier: BSD-3-Clause |
| 2 |
# Copyright Contributors to the OpenEXR Project. |
| 3 |
|
| 4 |
if("${CMAKE_PROJECT_NAME}" STREQUAL "") |
| 5 |
# If the project name is set, this is being configured as a part of |
| 6 |
# Imath. If there is no project name, it's being configured as a |
| 7 |
# standalone program linking against an already-installed Imath |
| 8 |
# library. |
| 9 |
cmake_minimum_required(VERSION 3.12) |
| 10 |
project(ImathTest) |
| 11 |
find_package(Imath) |
| 12 |
endif() |
| 13 |
|
| 14 |
add_executable(ImathTest |
| 15 |
main.cpp |
| 16 |
testBox.cpp |
| 17 |
testBoxAlgo.cpp |
| 18 |
testColor.cpp |
| 19 |
testExtractEuler.cpp |
| 20 |
testExtractSHRT.cpp |
| 21 |
testFrustum.cpp |
| 22 |
testFrustumTest.cpp |
| 23 |
testFun.cpp |
| 24 |
testInterval.cpp |
| 25 |
testInvert.cpp |
| 26 |
testJacobiEigenSolver.cpp |
| 27 |
testLineAlgo.cpp |
| 28 |
testMatrix.cpp |
| 29 |
testMiscMatrixAlgo.cpp |
| 30 |
testProcrustes.cpp |
| 31 |
testQuat.cpp |
| 32 |
testQuatSetRotation.cpp |
| 33 |
testQuatSlerp.cpp |
| 34 |
testRandom.cpp |
| 35 |
testRoots.cpp |
| 36 |
testShear.cpp |
| 37 |
testTinySVD.cpp |
| 38 |
testVec.cpp |
| 39 |
testArithmetic.cpp |
| 40 |
testBitPatterns.cpp |
| 41 |
testClassification.cpp |
| 42 |
testError.cpp |
| 43 |
testFunction.cpp |
| 44 |
testLimits.cpp |
| 45 |
testSize.cpp |
| 46 |
testToFloat.cpp |
| 47 |
testInterop.cpp |
| 48 |
testNoInterop.cpp |
| 49 |
) |
| 50 |
|
| 51 |
target_link_libraries(ImathTest Imath::Imath) |
| 52 |
set_target_properties(ImathTest PROPERTIES |
| 53 |
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 54 |
) |
| 55 |
|
| 56 |
|
| 57 |
if(NOT "${CMAKE_PROJECT_NAME}" STREQUAL "ImathTest") |
| 58 |
|
| 59 |
add_executable(ImathHalfCTest half_c_main.c) |
| 60 |
target_link_libraries(ImathHalfCTest Imath::Config) |
| 61 |
target_include_directories(ImathHalfCTest PRIVATE "../Imath") |
| 62 |
#target_compile_options(ImathHalfCTest PRIVATE -mavx2 -mf16c) |
| 63 |
if (IMATH_USE_HALF_LOOKUP_TABLE) |
| 64 |
target_link_libraries(ImathHalfCTest Imath::Imath) |
| 65 |
endif() |
| 66 |
|
| 67 |
set_target_properties(ImathHalfCTest PROPERTIES |
| 68 |
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 69 |
) |
| 70 |
add_test(NAME Imath.half_c_only COMMAND $<TARGET_FILE:ImathHalfCTest>) |
| 71 |
|
| 72 |
endif() |
| 73 |
|
| 74 |
add_executable(ImathHalfPerfTest half_perf_test.cpp) |
| 75 |
set_target_properties(ImathHalfPerfTest PROPERTIES |
| 76 |
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 77 |
) |
| 78 |
target_link_libraries(ImathHalfPerfTest Imath::Imath) |
| 79 |
add_test(NAME Imath.half_perf_test COMMAND $<TARGET_FILE:ImathHalfPerfTest>) |
| 80 |
|
| 81 |
function(DEFINE_IMATH_TESTS) |
| 82 |
foreach(curtest IN LISTS ARGN) |
| 83 |
add_test(NAME Imath.${curtest} COMMAND $<TARGET_FILE:ImathTest> ${curtest}) |
| 84 |
endforeach() |
| 85 |
endfunction() |
| 86 |
|
| 87 |
define_imath_tests( |
| 88 |
testToFloat |
| 89 |
testSize |
| 90 |
testArithmetic |
| 91 |
testNormalizedConversionError |
| 92 |
testDenormalizedConversionError |
| 93 |
testRoundingError |
| 94 |
testBitPatterns |
| 95 |
testClassification |
| 96 |
testLimits |
| 97 |
testHalfLimits |
| 98 |
testFunction |
| 99 |
testVec |
| 100 |
testColor |
| 101 |
testShear |
| 102 |
testMatrix |
| 103 |
testMiscMatrixAlgo |
| 104 |
testRoots |
| 105 |
testFun |
| 106 |
testInvert |
| 107 |
testInterval |
| 108 |
testFrustum |
| 109 |
testRandom |
| 110 |
testExtractEuler |
| 111 |
testExtractSHRT |
| 112 |
testQuat |
| 113 |
testQuatSetRotation |
| 114 |
testQuatSlerp |
| 115 |
testLineAlgo |
| 116 |
testBoxAlgo |
| 117 |
testBox |
| 118 |
testProcrustes |
| 119 |
testTinySVD |
| 120 |
testJacobiEigenSolver |
| 121 |
testFrustumTest |
| 122 |
testInterop |
| 123 |
testNoInterop |
| 124 |
) |
| 125 |
|