From e4f81af337d01936376e62c5b082fe0f7e702805 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sun, 18 Sep 2022 15:24:42 -0600 Subject: [PATCH] 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. --- .github/workflows/ci.yml | 7 +++++++ test/CMakeLists.txt | 2 ++ test/install/CMakeLists.txt | 15 +++++++++++++++ test/install/Install.cpp | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 test/install/CMakeLists.txt create mode 100644 test/install/Install.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce658684..4dc68541 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 28d76201..005703c1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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 diff --git a/test/install/CMakeLists.txt b/test/install/CMakeLists.txt new file mode 100644 index 00000000..c198fba1 --- /dev/null +++ b/test/install/CMakeLists.txt @@ -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) diff --git a/test/install/Install.cpp b/test/install/Install.cpp new file mode 100644 index 00000000..51d58336 --- /dev/null +++ b/test/install/Install.cpp @@ -0,0 +1,37 @@ +#include +#include +#include + +// 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; +}