Test install interface

Skip Android, iOS, and Framework builds simply because I can't get
them to work and don't want that holding up getting the rest of the
install tests merged.

Skip the Static DRM install test because there's a bug in the install
that needs to be fixed.
This commit is contained in:
Chris Thrasher 2022-09-18 15:24:42 -06:00 committed by Lukas Dürrenberger
parent 8f54a3e97c
commit e4f81af337
4 changed files with 61 additions and 0 deletions

View File

@ -101,6 +101,13 @@ jobs:
files: ./build/coverage.out
fail_ci_if_error: true
- name: Test Install Interface
if: matrix.platform.name != 'Android' && matrix.config.name != 'Frameworks' && matrix.config.name != 'iOS' && matrix.config.name != 'Static DRM'
shell: bash
run: |
cmake -S $GITHUB_WORKSPACE/test/install -B $GITHUB_WORKSPACE/test/install/build -DSFML_ROOT=$GITHUB_WORKSPACE/install -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
cmake --build $GITHUB_WORKSPACE/test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
format:
name: Formatting on ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}

View File

@ -9,6 +9,8 @@ FetchContent_MakeAvailable(doctest)
list(APPEND CMAKE_MODULE_PATH ${doctest_SOURCE_DIR}/scripts/cmake)
include(doctest)
add_subdirectory(install)
add_library(sfml-test-main STATIC
DoctestMain.cpp
TestUtilities/SystemUtil.hpp

View File

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.16)
project(test-sfml-install CXX)
# This skips the find_package call when building via add_subdirectory since that will fail under those circumstances
# It's a CMake 3.16-compatible replacement to PROJECT_IS_TOP_LEVEL
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(NOT BUILD_SHARED_LIBS)
set(SFML_STATIC_LIBRARIES TRUE)
endif()
find_package(SFML 3.0.0 EXACT CONFIG REQUIRED COMPONENTS Graphics Network Audio)
endif()
add_executable(test-sfml-install Install.cpp)
target_link_libraries(test-sfml-install PRIVATE SFML::Graphics SFML::Network SFML::Audio)

37
test/install/Install.cpp Normal file
View File

@ -0,0 +1,37 @@
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
// Instantiate some types from each module to test for linker issues. This program is not meant be ran.
int main()
{
// Audio
sf::InputSoundFile input_sound_file;
sf::Listener listener;
sf::Music music;
sf::Sound sound;
// Graphics
sf::Color color;
sf::Font font;
sf::RenderWindow render_window;
sf::Sprite sprite;
sf::Vertex vertex;
// Network
sf::Ftp ftp;
sf::Http http;
sf::Packet packet;
sf::UdpSocket udp_socket;
// System
sf::Angle angle;
sf::FileInputStream file_input_stream;
sf::String string;
sf::Time time;
// Window
sf::Context context;
sf::VideoMode video_mode;
sf::Window window;
}