#!/bin/sh set -e cp -r Source/UnitTest "$AUTOPKGTEST_TMP" cp Source/*.cmake "$AUTOPKGTEST_TMP" cp Source/astcenc_mathlib_softfloat.cpp "$AUTOPKGTEST_TMP" cp Source/astcenc_internal.h "$AUTOPKGTEST_TMP" cp Source/astcenc_*mathlib*.h "$AUTOPKGTEST_TMP" definitions="-DAUTOPKGTEST=1" if [ "$(dpkg-architecture -qDEB_HOST_ARCH_ENDIAN)" = "big" ] then definitions="$definitions -DASTCENC_BIG_ENDIAN=1" fi cat > "$AUTOPKGTEST_TMP/CMakeLists.txt" << EOF cmake_minimum_required(VERSION 3.13) project(astc_autopkgtest) find_package(astcenc REQUIRED) find_package(GTest REQUIRED) add_library(astcenc-static INTERFACE) target_link_libraries(astcenc-static INTERFACE astcenc::astcenc) add_library(gtest_main ALIAS GTest::gtest_main) enable_testing() add_definitions($definitions) add_subdirectory(UnitTest) EOF cat > "$AUTOPKGTEST_TMP/UnitTest/CMakeLists.txt" << EOF set(ASTCENC_ISA_SIMD native) include(cmake_core.cmake) EOF cd "$AUTOPKGTEST_TMP" mkdir _build cd _build cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . --verbose ctest --output-on-failure