Skip to content

Commit

Permalink
Implement internal ktxdiff tool for comparing test output files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mátyás Császár committed Jul 26, 2023
1 parent 1ae04f8 commit 12bf3c8
Show file tree
Hide file tree
Showing 7 changed files with 503 additions and 5 deletions.
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ CMAKE_DEPENDENT_OPTION( BASISU_SUPPORT_OPENCL
OFF
)

# To improve deterministic outputs enable precise floating point operations
if(MSVC)
add_compile_options(/fp:precise)
else()
add_compile_options(-ffp-contract=off)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options(-ffp-model=precise)
endif()
endif()

if(BASISU_SUPPORT_OPENCL)
find_package(OpenCL)
endif()
Expand Down Expand Up @@ -356,10 +366,11 @@ if(WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${KTX_BUILD_DIR}/$<CONFIG>>)
elseif(APPLE)
if(NOT IOS)
# Set a common RUNTIME_OUTPUT_DIR for all targets, so that
# INSTALL RPATH is functional in build directory as well.
# Set a common RUNTIME_OUTPUT_DIR and LIBRARY_OUTPUT_DIR for all targets,
# so that INSTALL RPATH is functional in build directory as well.
# BUILD_WITH_INSTALL_RPATH is necessary for working code signing.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${KTX_BUILD_DIR}/$<CONFIG>>)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${KTX_BUILD_DIR}/$<CONFIG>>)
endif()
endif()

Expand Down Expand Up @@ -955,6 +966,7 @@ else()
endif()

# Other external projects
set(FMT_SYSTEM_HEADERS ON)
add_subdirectory(other_projects/fmt)
add_subdirectory(other_projects/cxxopts)

Expand Down
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ if(KTX_FEATURE_TOOLS)

# ktx cli tool tests
if(KTX_FEATURE_TOOLS_CTS)
add_subdirectory(ktxdiff)
set(KTX_TOOLS_PATH $<TARGET_FILE:ktxtools>)
set(KTX_DIFF_PATH $<TARGET_FILE:ktxdiff>)
add_subdirectory(cts/clitests)
endif()
endif()
2 changes: 1 addition & 1 deletion tests/cts
Submodule cts updated 398 files
44 changes: 44 additions & 0 deletions tests/ktxdiff/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2022-2023 The Khronos Group Inc.
# Copyright 2022-2023 RasterGrid Kft.
# SPDX-License-Identifier: Apache-2.0


add_executable(ktxdiff
ktxdiff_main.cpp
)

set_target_properties(
ktxdiff
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
)

target_include_directories(
ktxdiff
PRIVATE
.
$<TARGET_PROPERTY:ktx,INCLUDE_DIRECTORIES>
)

target_include_directories(
ktxdiff
SYSTEM
PRIVATE
${PROJECT_SOURCE_DIR}/lib
${PROJECT_SOURCE_DIR}/other_include
)

target_link_libraries(
ktxdiff
PRIVATE
ktx
${ASTCENC_LIB_TARGET}
fmt::fmt
)

target_compile_definitions(
ktxdiff
PRIVATE
$<TARGET_PROPERTY:ktx,INTERFACE_COMPILE_DEFINITIONS>
)
Loading

0 comments on commit 12bf3c8

Please sign in to comment.