How to install SDL_mixer 3.0.0 using CMake and Visual Studio 2022 for Desktop
- Install SDL3 using this guide: How to install SDL 3.1.10 using CMake and Visual Studio 2022 for Desktop
- Type in the browser search field: sdl_mixer github
- You will find this page: https://github.com/libsdl-org/SDL_mixer
- Note. I use this version of SDL_mixer in the guide: https://github.com/libsdl-org/SDL_mixer/tree/ebdd9cc0fe43352e33ec234f4720fd7d54a31d13
- Click on the "Code" and click on the "Download ZIP":
- Unzip the dowloaded archive
- Open the unzipped folder, click in the path bar:
- The path is selected now:
- Type cmd in the path bar:
- And press "Enter". The command prompt will be opened in the current folder:
- Note. Do not close this CMD until the end of the guide
- Type in CMD: cmake-gui:
- And press "Enter". CMake GUI will be opened:
- Copy a path to the unzipped folder and paste it to the "Where is the source code" field:
- Paste this path in the "Where to build the binaries" field and add the "/dist" to the path like this:
- Click on the "Configure" button:
- Click "Yes" to confirm that you want to create the "dist" folder:
- The "Visual Studio 17 2022" should be selected:
- Note. Such options are available:
- Click the "Finish" button:
- You see the following error, click "OK":
- Note. Configuration output:
Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
The C compiler identification is MSVC 19.42.34436.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Configuring SDL3_mixer 3.0.0
Detecting Target CPU Architecture
Detecting Target CPU Architecture - X64
Using vendored libogg
CMake Error at cmake/PrivateSdlFunctions.cmake:230 (message):
Could not find CMakeLists.txt for ogg in external/ogg.
Run the download script in the external folder, or re-configure with
-DSDLMIXER_VENDORED=OFF to use system packages.
Call Stack (most recent call first):
CMakeLists.txt:411 (sdl_check_project_in_subfolder)
Configuring incomplete, errors occurred!
You see this text above: "Run the download script in the external folder, or re-configure with -DSDLMIXER_VENDORED=OFF to use system packages."
Find "SDLMIXER_VENDORED" and switch it to "OFF":
Type sdl3_dir in the "Search" field and set a path to the SDL3 "debug/cmake" folder where SDL3 was installed:
Type types in the "Search" field:
Type Debug for the CMAKE_CONFIGURATION_TYPES variable:
Type prefix in the "Search" field:
Set this path to where you want to install SDL_mixer, for example:
Click buttons: "Configure", "Generate", and "Open Project":
Note. Output:
Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
Configuring SDL3_mixer 3.0.0
Could NOT find Ogg (missing: Ogg_LIBRARY Ogg_INCLUDE_PATH)
Could NOT find Ogg (missing: Ogg_LIBRARY Ogg_INCLUDE_PATH)
Could NOT find Opus (missing: Opus_LIBRARY Opus_INCLUDE_PATH Ogg_FOUND)
Could NOT find OpusFile (missing: OpusFile_LIBRARY OpusFile_INCLUDE_PATH Ogg_FOUND Opus_FOUND)
opusfile NOT found
Enabled ogg music: using stb_vorbis
Could NOT find gme (missing: gme_LIBRARY gme_INCLUDE_PATH)
libgme NOT found
Could NOT find libxmp (missing: libxmp_LIBRARY libxmp_INCLUDE_PATH)
libxmp NOT found
Could NOT find FluidSynth (missing: FluidSynth_LIBRARY FluidSynth_INCLUDE_PATH)
FluidSynth NOT found
Could NOT find wavpack (missing: wavpack_LIBRARY wavpack_INCLUDE_PATH)
wavpack NOT found
Looking for signal.h
Looking for signal.h - found
Looking for setbuf
Looking for setbuf - found
SDL3_mixer backends:
- enabled: vorbis_stb flac_drflac mp3_minimp3 midi_native midi_timidity wave
- disabled: sndfile opus vorbis_tremor vorbis_vorbisfile flac_libflac gme mod_modplug mod_xmp mp3_mpg123 midi_fluidsynth wavpack
Configuring done (8.0s)
Generating done (0.1s)
Visual Studio 2022 will be opened. Click "Build" > "Build Solution" or F7:
Wait for finishing of building
Note. Building output:
Build started at 11:51 AM...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>1>Checking Build System
2>------ Build started: Project: SDL3_mixer-shared, Configuration: Debug x64 ------
2>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
2>load_aiff.c
2>load_voc.c
2>load_sndfile.c
2>mp3utils.c
2>music_drflac.c
2>music_flac.c
2>music_fluidsynth.c
2>music_gme.c
2>music_minimp3.c
2>music_modplug.c
2>music_mpg123.c
2>music_nativemidi.c
2>music_ogg.c
2>music_ogg_stb.c
2>music_opus.c
2>music_timidity.c
2>music_wav.c
2>music_wavpack.c
2>music_xmp.c
2>effect_position.c
2>Generating Code...
2>Compiling...
2>effect_stereoreverse.c
2>effects_internal.c
2>mixer.c
2>music.c
2>utils.c
2>native_midi_win32.c
2>native_midi_common.c
2>common.c
2>instrum.c
2>mix.c
2>output.c
2>playmidi.c
2>readmidi.c
2>resample.c
2>tables.c
2>timidity.c
2>Generating Code...
2> Creating library E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/dist/Debug/SDL3_mixer.lib and object E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/dist/Debug/SDL3_mixer.exp
2>SDL3_mixer-shared.vcxproj -> E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13\dist\Debug\SDL3_mixer.dll
3>------ Build started: Project: playwave, Configuration: Debug x64 ------
4>------ Build started: Project: playmus, Configuration: Debug x64 ------
3>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
3>playwave.c
4>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
3>playwave.vcxproj -> E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13\dist\Debug\playwave.exe
4>playmus.c
4>playmus.vcxproj -> E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13\dist\Debug\playmus.exe
5>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
5>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
6>------ Skipped Build: Project: PACKAGE, Configuration: Debug x64 ------
6>Project not selected to build for this solution configuration
7>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
7>Project not selected to build for this solution configuration
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 2 skipped ==========
========== Build completed at 11:51 AM and took 15.368 seconds ==========
Open CMD inside of the SDL_mixer source folder
Type the installation command in CMD:
cmake --install dist
The SDL_mixer files will be copied to the installation folder
Note. Output:
E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13>cmake --install dist
-- Install configuration: "Debug"
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/lib/SDL3_mixer.lib
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/bin/SDL3_mixer.dll
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/include/SDL3_mixer/SDL_mixer.h
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/bin/SDL3_mixer.pdb
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/SDL3_mixerConfig.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/SDL3_mixerConfigVersion.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/PkgConfigHelper.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/FindFLAC.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/FindFluidSynth.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/Findgme.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/Findlibxmp.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/Findlibxmp-lite.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/Findmodplug.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/FindOgg.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/FindOpus.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/FindOpusFile.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/Findmpg123.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/FindVorbis.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/Findtremor.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/Findwavpack.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/FindSndFile.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/SDL3_mixer-shared-targets.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/cmake/SDL3_mixer-shared-targets-debug.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/lib/pkgconfig/sdl3-mixer.pc
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/debug/share/licenses/SDL3_mixer/LICENSE.txt
Do not close CMake GUI and VS to build and install the "Release" version
Installation of the "Release" version
- Type prefix in the "Search" field and change the "CMAKE_INSTALL_PREFIX" value to "release":
- Type types in the "Search" field and change "Debug" to "Release":
- Type sdl3_dir in the "Search" field and change "SDL3_DIR" from "debug" to "release":
- Click on the "Configure and "Generate" buttons:
- Note. Configuration output:
Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
Configuring SDL3_mixer 3.0.0
Could NOT find Ogg (missing: Ogg_LIBRARY Ogg_INCLUDE_PATH)
Could NOT find Ogg (missing: Ogg_LIBRARY Ogg_INCLUDE_PATH)
Could NOT find Opus (missing: Opus_LIBRARY Opus_INCLUDE_PATH Ogg_FOUND)
Could NOT find OpusFile (missing: OpusFile_LIBRARY OpusFile_INCLUDE_PATH Ogg_FOUND Opus_FOUND)
opusfile NOT found
Enabled ogg music: using stb_vorbis
Could NOT find gme (missing: gme_LIBRARY gme_INCLUDE_PATH)
libgme NOT found
Could NOT find libxmp (missing: libxmp_LIBRARY libxmp_INCLUDE_PATH)
libxmp NOT found
Could NOT find FluidSynth (missing: FluidSynth_LIBRARY FluidSynth_INCLUDE_PATH)
FluidSynth NOT found
Could NOT find wavpack (missing: wavpack_LIBRARY wavpack_INCLUDE_PATH)
wavpack NOT found
SDL3_mixer backends:
- enabled: vorbis_stb flac_drflac mp3_minimp3 midi_native midi_timidity wave
- disabled: sndfile opus vorbis_tremor vorbis_vorbisfile flac_libflac gme mod_modplug mod_xmp mp3_mpg123 midi_fluidsynth wavpack
Configuring done (2.5s)
Generating done (0.1s)
Switch to the VS window using Alt+Tab or by click on the VS in the task bar
VS asks you to reload:
Note. You see that Debug was changed to Release in the tool bar:
Click "Build" > "Build Solution" or F7:
Wait for finishing of building
Note. Output:
Build started at 5:26 PM...
1>------ Build started: Project: ZERO_CHECK, Configuration: Release x64 ------
1>1>Checking Build System
2>------ Build started: Project: SDL3_mixer-shared, Configuration: Release x64 ------
2>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
2>load_aiff.c
2>load_voc.c
2>load_sndfile.c
2>mp3utils.c
2>music_drflac.c
2>music_flac.c
2>music_fluidsynth.c
2>music_gme.c
2>music_minimp3.c
2>music_modplug.c
2>music_mpg123.c
2>music_nativemidi.c
2>music_ogg.c
2>music_ogg_stb.c
2>music_opus.c
2>music_timidity.c
2>music_wav.c
2>music_wavpack.c
2>music_xmp.c
2>effect_position.c
2>Generating Code...
2>Compiling...
2>effect_stereoreverse.c
2>effects_internal.c
2>mixer.c
2>music.c
2>utils.c
2>native_midi_win32.c
2>native_midi_common.c
2>common.c
2>instrum.c
2>mix.c
2>output.c
2>playmidi.c
2>readmidi.c
2>resample.c
2>tables.c
2>timidity.c
2>Generating Code...
2> Creating library E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/dist/Release/SDL3_mixer.lib and object E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/dist/Release/SDL3_mixer.exp
2>SDL3_mixer-shared.vcxproj -> E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13\dist\Release\SDL3_mixer.dll
3>------ Build started: Project: playwave, Configuration: Release x64 ------
4>------ Build started: Project: playmus, Configuration: Release x64 ------
3>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
3>playwave.c
4>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
3>playwave.vcxproj -> E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13\dist\Release\playwave.exe
4>playmus.c
4>playmus.vcxproj -> E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13\dist\Release\playmus.exe
5>------ Build started: Project: ALL_BUILD, Configuration: Release x64 ------
5>Building Custom Rule E:/libs/SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13/CMakeLists.txt
6>------ Skipped Build: Project: PACKAGE, Configuration: Release x64 ------
6>Project not selected to build for this solution configuration
7>------ Skipped Build: Project: INSTALL, Configuration: Release x64 ------
7>Project not selected to build for this solution configuration
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 2 skipped ==========
========== Build completed at 5:27 PM and took 23.442 seconds ==========
Open CMD inside of the SDL_mixer source folder
Type the installation command in CMD:
cmake --install dist
The SDL_mixer files will be copied to the installation folder
Note. Output:
E:\libs\SDL_mixer-ebdd9cc0fe43352e33ec234f4720fd7d54a31d13>cmake --install dist
-- Install configuration: "Release"
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/lib/SDL3_mixer.lib
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/bin/SDL3_mixer.dll
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/include/SDL3_mixer/SDL_mixer.h
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/SDL3_mixerConfig.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/SDL3_mixerConfigVersion.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/PkgConfigHelper.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/FindFLAC.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/FindFluidSynth.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/Findgme.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/Findlibxmp.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/Findlibxmp-lite.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/Findmodplug.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/FindOgg.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/FindOpus.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/FindOpusFile.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/Findmpg123.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/FindVorbis.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/Findtremor.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/Findwavpack.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/FindSndFile.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/SDL3_mixer-shared-targets.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/cmake/SDL3_mixer-shared-targets-release.cmake
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/lib/pkgconfig/sdl3-mixer.pc
-- Installing: E:/libs/sdl3_mixer-3.0.0-msvc/win/release/share/licenses/SDL3_mixer/LICENSE.txt
Next guide: Setting up SDL_mixer 3.0.0 in Visual Studio 2022 using CMake