Building SDL3 Static Library for Windows (MinGW & CMake) Сборка статической библиотеки SDL3 для Windows (MinGW и CMake)
A guide to compiling SDL3 source code into a static library (libSDL3.a) for Windows using MinGW and CMake. Руководство по компиляции исходного кода SDL3 в статическую библиотеку (libSDL3.a) для Windows с помощью MinGW и CMake.
Step 1: Download SDL3 Source Code Шаг 1: Скачивание исходного кода SDL3
Download the latest SDL3 source archive (.zip or .tar.gz) from the official GitHub releases page:
Скачайте последний архив с исходным кодом SDL3 (.zip или .tar.gz) с официальной страницы релизов GitHub:
Download SDL3 Releases Скачать релизы SDL3
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 source folder, create an empty file named build-mingw-static.bat and paste the following content into it:
В корневой директории распакованного исходного кода SDL3 создайте пустой файл build-mingw-static.bat и вставьте в него следующее содержимое:
@echo off
if not exist build-mingw-static mkdir build-mingw-static
cd build-mingw-static
:: Clean old cache if it exists
if exist CMakeCache.txt del CMakeCache.txt
if exist CMakeFiles rmdir /s /q CMakeFiles
cmake .. ^
-G "MinGW Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=C:/libs/sdl3-3.4.16-mingw ^
-DBUILD_SHARED_LIBS=OFF ^
-DSDL_SHARED=OFF ^
-DSDL_STATIC=ON ^
-DSDL_TESTS=OFF ^
-DSDL_EXAMPLES=OFF
cmake --build . --config Release --parallel 8 --target install
CMAKE_INSTALL_PREFIX path according to your target installation directory.
Убедитесь, что путь к CMAKE_INSTALL_PREFIX соответствует вашей целевой директории установки.
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.a along with header files will be installed in the output path set by CMAKE_INSTALL_PREFIX.
Запустите build-mingw-static.bat через командную строку (CMD), чтобы вы могли увидеть возможные ошибки сборки прямо в консоли. После завершения собранная статическая библиотека libSDL3.a вместе с заголовочными файлами будет установлена по пути, указанному в CMAKE_INSTALL_PREFIX.
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 Поддержка криптовалютой