Codebase list libsdl2-mixer / 8c1a09f
d/tests: Verify that the pkg-config metadata has a suitable version number Simon McVittie 1 year, 7 months ago
3 changed file(s) with 24 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
5555 Files: debian/*
5656 Copyright: 2011-2013, Manuel A. Fernandez Montecelo <mafm@debian.org>
5757 2013, Felix Geyer <fgeyer@debian.org>
58 2022 Collabora Ltd.
59 License: LGPL-2.1+
58 2019-2022 Collabora Ltd.
59 License: LGPL-2.1+ and zlib/libpng
6060
6161
6262 License: zlib/libpng
0 # Copyright 2019 Collabora Ltd.
1 # SPDX-License-Identifier: Zlib
2
3 # Test use of SDL2_mixer in a CMake project by using pkg-config, as
4 # wesnoth-1.16 does.
5 cmake_minimum_required(VERSION 3.12)
6 project(test LANGUAGES C)
7 find_package(PkgConfig REQUIRED)
8 pkg_check_modules(SDL2MIXER REQUIRED SDL2_mixer>=2.0.0)
9 include_directories(SYSTEM ${SDL2MIXER_INCLUDE_DIRS})
10 add_executable(main main.c)
11 target_link_libraries(main ${SDL2MIXER_LIBRARIES})
3030 mkdir "$WORKDIR/cmake"
3131 cp ./cmake/test/CMakeLists.txt "$WORKDIR/cmake"
3232 cp ./cmake/test/main.c "$WORKDIR/cmake"
33 mkdir "$WORKDIR/cmake-pkg-config"
34 cp cmake/test/main.c "$WORKDIR/cmake-pkg-config"
35 cp debian/tests/cmake-pkg-config/CMakeLists.txt "$WORKDIR/cmake-pkg-config"
3336
3437 cd "$WORKDIR"
3538
3639 # Deliberately word-splitting pkg-config's output:
3740 # shellcheck disable=SC2046
38 "${CROSS_COMPILE}gcc" -oplaymus playmus.c $("${CROSS_COMPILE}pkg-config" --cflags --libs SDL2_mixer)
41 "${CROSS_COMPILE}gcc" -oplaymus playmus.c $("${CROSS_COMPILE}pkg-config" --cflags --libs 'SDL2_mixer >= 2.6.0')
3942 # shellcheck disable=SC2046
40 "${CROSS_COMPILE}gcc" -oplaywave playwave.c $("${CROSS_COMPILE}pkg-config" --cflags --libs SDL2_mixer)
43 "${CROSS_COMPILE}gcc" -oplaywave playwave.c $("${CROSS_COMPILE}pkg-config" --cflags --libs 'SDL2_mixer >= 2.6.0')
4144
4245 set -- xvfb-run -a
4346
5154 ninja -C cmake/_build
5255 ./cmake/_build/main_shared
5356 ./cmake/_build/main_static
57
58 mkdir cmake-pkg-config/_build
59 ( cd cmake-pkg-config/_build; cmake .. )
60 make -C cmake-pkg-config/_build
61 ./cmake-pkg-config/_build/main
5462 fi