1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/bin/sh
# Copyright 2016 Ghislain Antony Vaillant
#
# This file is part of the packaging testsuite for globjects.
set -e
# Presence of $ADTTMP implies that someone will handle cleanup for us, so we
# can avoid duplicating the effort (signal handling, etc.) here.
if [ -z "$ADTTMP" ]
then
echo "Required envvar \"$ADTTMP\"is not set" >&2
exit 1
fi
# Copy the upstream testsuite.
cp -a ./source/tests/* "$AUTOPKGTEST_TMP"
# Copy the upstream CMake configuration.
cp -a ./cmake "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"
# Create a standalone CMake project.
mv CMakeLists.txt CMakeLists.txt.orig
cat << EOF > CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(globjects-tests)
if (POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif ()
find_package(globjects REQUIRED)
find_package(glbinding REQUIRED)
set(META_PROJECT_NAME "globjects")
list(APPEND CMAKE_MODULE_PATH "\${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CompileOptions)
set(OPTION_BUILD_TESTS ON)
EOF
cat CMakeLists.txt.orig >> CMakeLists.txt
# Configure, build and execute.
mkdir build && cd build
cmake .. && make && make test
|