Default to building static libraries

See https://github.com/SFML/SFML/issues/2389 for full rationale
This commit is contained in:
Chris Thrasher 2023-08-13 17:50:13 -06:00
parent 3b71bfc1d7
commit 962e6ed972
2 changed files with 5 additions and 7 deletions

View File

@ -60,7 +60,7 @@ jobs:
config: { name: OpenGL ES, flags: -DSFML_USE_MESA3D=TRUE -DBUILD_SHARED_LIBS=TRUE -DSFML_OPENGL_ES=ON } config: { name: OpenGL ES, flags: -DSFML_USE_MESA3D=TRUE -DBUILD_SHARED_LIBS=TRUE -DSFML_OPENGL_ES=ON }
type: { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=TRUE } type: { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=TRUE }
- platform: { name: Windows MinGW, os: windows-2022 } - platform: { name: Windows MinGW, os: windows-2022 }
config: { name: Static Standard Libraries, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_STATIC_STD_LIBS=TRUE } config: { name: Static Standard Libraries, flags: -GNinja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DSFML_USE_STATIC_STD_LIBS=TRUE }
- platform: { name: macOS, os: macos-12 } - platform: { name: macOS, os: macos-12 }
config: { name: Frameworks, flags: -GNinja -DSFML_BUILD_FRAMEWORKS=TRUE -DBUILD_SHARED_LIBS=TRUE } config: { name: Frameworks, flags: -GNinja -DSFML_BUILD_FRAMEWORKS=TRUE -DBUILD_SHARED_LIBS=TRUE }
- platform: { name: Android, os: ubuntu-22.04 } - platform: { name: Android, os: ubuntu-22.04 }
@ -72,7 +72,7 @@ jobs:
- platform: { name: Android, os: ubuntu-22.04 } - platform: { name: Android, os: ubuntu-22.04 }
config: { name: x86_64, flags: -GNinja -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r23b/build/cmake/android.toolchain.cmake -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 -DANDROID_PLATFORM=26 } config: { name: x86_64, flags: -GNinja -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r23b/build/cmake/android.toolchain.cmake -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 -DANDROID_PLATFORM=26 }
- platform: { name: Linux GCC, os: ubuntu-22.04 } - platform: { name: Linux GCC, os: ubuntu-22.04 }
config: { name: Static DRM, flags: -GNinja -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE } config: { name: Static DRM, flags: -GNinja -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
- platform: { name: Linux GCC, os: ubuntu-22.04 } - platform: { name: Linux GCC, os: ubuntu-22.04 }
config: { name: Shared DRM, flags: -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE } config: { name: Shared DRM, flags: -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
- platform: { name: macOS , os: macos-12 } - platform: { name: macOS , os: macos-12 }
@ -272,7 +272,7 @@ jobs:
- name: Configure - name: Configure
shell: bash shell: bash
run: cmake --preset dev -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_UNITY_BUILD=ON ${{matrix.platform.flags}} run: cmake --preset dev -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_UNITY_BUILD=ON ${{matrix.platform.flags}}
- name: Analyze Code - name: Analyze Code
shell: bash shell: bash

View File

@ -34,10 +34,8 @@ include(cmake/Config.cmake)
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs) include(GNUInstallDirs)
# add an option for choosing the build type (shared or static) # disable static libraries on Android
if(NOT SFML_OS_ANDROID) if(SFML_OS_ANDROID)
sfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build SFML as shared libraries, FALSE to build it as static libraries")
else()
set(BUILD_SHARED_LIBS TRUE) set(BUILD_SHARED_LIBS TRUE)
endif() endif()