Building SDL3_ttf Static Library for Windows (MinGW & CMake) Сборка статической библиотеки SDL3_ttf для Windows (MinGW и CMake)
A guide to compiling SDL3_ttf source code into a static library (libSDL3_ttf.a) with FreeType support. Руководство по компиляции исходного кода SDL3_ttf в статическую библиотеку (libSDL3_ttf.a) с поддержкой FreeType.
Step 1: Download SDL3_ttf Source Code Шаг 1: Скачивание исходного кода SDL3_ttf
Download the latest SDL3_ttf source archive (.zip or .tar.gz) from the official GitHub releases page:
Скачайте последний архив с исходным кодом SDL3_ttf (.zip или .tar.gz) с официальной страницы релизов GitHub:
Download SDL3_ttf Releases Скачать релизы SDL3_ttf
Extract the downloaded archive to a convenient directory on your machine. Распакуйте скачанный архив в удобную директорию на вашем компьютере.
Step 2: Create the Build Script Шаг 2: Создание скрипта сборки
In the root directory of the extracted SDL3_ttf source folder, create an empty file named build-mingw-static.bat and paste the following content into it:
В корневой директории распакованного исходного кода SDL3_ttf создайте пустой файл build-mingw-static.bat и вставьте в него следующее содержимое:
@echo off
set FREETYPE_PATH=C:/libs/freetype-2.14.3-mingw
if not exist build-mingw-static mkdir build-mingw-static
cd build-mingw-static
if exist CMakeCache.txt del CMakeCache.txt
if exist CMakeFiles rmdir /s /q CMakeFiles
call cmake .. ^
-DSDL3_DIR="C:/libs/sdl3-3.4.16-mingw/lib/cmake/SDL3" ^
-DCMAKE_PREFIX_PATH="%FREETYPE_PATH%" ^
-DFREETYPE_INCLUDE_DIR_ft2build="%FREETYPE_PATH%/include/freetype2" ^
-DFREETYPE_INCLUDE_DIR_freetype2="%FREETYPE_PATH%/include/freetype2" ^
-DFREETYPE_LIBRARY="%FREETYPE_PATH%/lib/libfreetype.a" ^
-DBUILD_SHARED_LIBS=OFF ^
-DSDLTTF_HARFBUZZ=OFF ^
-DSDLTTF_SAMPLES=OFF ^
-DSDLTTF_VENDORED=OFF ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=C:/libs/sdl3-ttf-3.2.2-mingw ^
-G "MinGW Makefiles"
call cmake --build . --config Release --parallel 8 --target install
Step 3: Run and Compile Шаг 3: Запуск и сборка
Run build-mingw-static.bat via Command Prompt (CMD) so you can catch any potential compilation errors in the console. Once completed, your compiled static library (libSDL3_ttf.a) along with headers will be installed in the output path set by CMAKE_INSTALL_PREFIX.
Запустите build-mingw-static.bat через командную строку (CMD), чтобы вы могли увидеть возможные ошибки сборки прямо в консоли. После завершения собранная статическая библиотека (libSDL3_ttf.a) вместе с заголовочными файлами будет установлена по пути, указанному в CMAKE_INSTALL_PREFIX.
Step 4: Next Steps Шаг 4: Следующие шаги
Now that you have compiled and installed the SDL3_ttf static library, you can proceed with integrating SDL3 and SDL3_ttf: Теперь, когда вы собрали и установили статическую библиотеку SDL3_ttf, вы можете перейти к интеграции SDL3 и SDL3_ttf:
Support My Work Поддержать проект
If these tutorials helped you, consider buying me a coffee! Если эти туториалы вам помогли, вы можете поддержать автора.
Sberbank (Russia only) Сбербанк (только для РФ)
Direct transfer via phone number (Russia only) Перевод по номеру телефона (только для РФ)
USDT TRC20
Support via Cryptocurrency Поддержка криптовалютой