How to install SDL_image 3.1.1 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_image github
- You will find this page: https://github.com/libsdl-org/SDL_ttf. I use this version in the guide: https://github.com/libsdl-org/SDL_image/tree/4c9986e215a670acba3181884e99fdf6dfab823e
- Click on the "Code" and click on the "Download ZIP":
- Unzip it and open CMD inside of the unzipped folder:
- Type in CMD: cmake-gui
- CMake GUI will be opened:
- Copy a path to the unzipped folder and paste it to the "Where is the source code":
- 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 message, click "OK":
- Type: ven in the "Search" field. Uncheck the "SDLIMAGE_VENDORED" flag:
- 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 and type Debug for the CMAKE_CONFIGURATION_TYPES variable:
- Type prefix in the "Search" field and set this path to where you want to install SDL_image, 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_image 3.1.1
libavif-1.0 or compatible not found
libavif NOT found
Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
libtiff NOT found
Could NOT find webp (missing: webp_LIBRARY webp_INCLUDE_PATH webpdemux_LIBRARY webpdemux_INCLUDE_PATH)
libwebp NOT found
SDL3_image backends:
- enabled: stb bmp gif jpg lbm pcx png pnm qoi svg tga xcf xpm xv
- disabled: imageio wic avif jxl tif webp
Configuring done (1.1s)
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 1:53 AM...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>1>Checking Build System
2>------ Skipped Build: Project: uninstall, Configuration: Debug x64 ------
2>Project not selected to build for this solution configuration
3>------ Build started: Project: SDL3_image-shared, Configuration: Debug x64 ------
3>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
3>IMG.c
3>IMG_WIC.c
3>IMG_avif.c
3>IMG_bmp.c
3>IMG_gif.c
3>IMG_jpg.c
3>IMG_jxl.c
3>IMG_lbm.c
3>IMG_pcx.c
3>IMG_png.c
3>IMG_pnm.c
3>IMG_qoi.c
3>IMG_stb.c
3>IMG_svg.c
3>IMG_tga.c
3>IMG_tif.c
3>IMG_webp.c
3>IMG_xcf.c
3>IMG_xpm.c
3>IMG_xv.c
3>Generating Code...
3> Creating library E:/libs/SDL_image-main/dist/Debug/SDL3_image.lib and object E:/libs/SDL_image-main/dist/Debug/SDL3_image.exp
3>SDL3_image-shared.vcxproj -> E:\libs\SDL_image-main\dist\Debug\SDL3_image.dll
4>------ Build started: Project: showimage, Configuration: Debug x64 ------
5>------ Build started: Project: showanim, Configuration: Debug x64 ------
4>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
4>showimage.c
5>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
4>showimage.vcxproj -> E:\libs\SDL_image-main\dist\Debug\showimage.exe
5>showanim.c
5>showanim.vcxproj -> E:\libs\SDL_image-main\dist\Debug\showanim.exe
6>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
6>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
7>------ Skipped Build: Project: PACKAGE, Configuration: Debug x64 ------
7>Project not selected to build for this solution configuration
8>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------
8>Project not selected to build for this solution configuration
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 3 skipped ==========
========== Build completed at 1:53 AM and took 12.669 seconds ==========
Open CMD inside of the SDL_image source folder
Type the installation command in CMD:
cmake --install dist
The SDL_image files will be copied to the installation folder
Note. Output:
-- Install configuration: "Debug"
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/lib/SDL3_image.lib
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/bin/SDL3_image.dll
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/include/SDL3_image/SDL_image.h
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/bin/SDL3_image.pdb
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/cmake/SDL3_imageConfig.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/cmake/SDL3_imageConfigVersion.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/cmake/SDL3_image-shared-targets.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/cmake/SDL3_image-shared-targets-debug.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/lib/pkgconfig/sdl3-image.pc
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/debug/share/licenses/SDL3_image/LICENSE.txt
Installation of the "Release" version
- 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_image 3.1.1
libavif-1.0 or compatible not found
libavif NOT found
Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
libtiff NOT found
Could NOT find webp (missing: webp_LIBRARY webp_INCLUDE_PATH webpdemux_LIBRARY webpdemux_INCLUDE_PATH)
libwebp NOT found
SDL3_image backends:
- enabled: stb bmp gif jpg lbm pcx png pnm qoi svg tga xcf xpm xv
- disabled: imageio wic avif jxl tif webp
Configuring done (0.8s)
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 2:09 AM...
1>------ Build started: Project: ZERO_CHECK, Configuration: Release x64 ------
1>1>Checking Build System
2>------ Skipped Build: Project: uninstall, Configuration: Release x64 ------
2>Project not selected to build for this solution configuration
3>------ Build started: Project: SDL3_image-shared, Configuration: Release x64 ------
3>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
3>IMG.c
3>IMG_WIC.c
3>IMG_avif.c
3>IMG_bmp.c
3>IMG_gif.c
3>IMG_jpg.c
3>IMG_jxl.c
3>IMG_lbm.c
3>IMG_pcx.c
3>IMG_png.c
3>IMG_pnm.c
3>IMG_qoi.c
3>IMG_stb.c
3>IMG_svg.c
3>IMG_tga.c
3>IMG_tif.c
3>IMG_webp.c
3>IMG_xcf.c
3>IMG_xpm.c
3>IMG_xv.c
3>Generating Code...
3> Creating library E:/libs/SDL_image-main/dist/Release/SDL3_image.lib and object E:/libs/SDL_image-main/dist/Release/SDL3_image.exp
3>SDL3_image-shared.vcxproj -> E:\libs\SDL_image-main\dist\Release\SDL3_image.dll
4>------ Build started: Project: showimage, Configuration: Release x64 ------
5>------ Build started: Project: showanim, Configuration: Release x64 ------
4>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
4>showimage.c
5>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
4>showimage.vcxproj -> E:\libs\SDL_image-main\dist\Release\showimage.exe
5>showanim.c
5>showanim.vcxproj -> E:\libs\SDL_image-main\dist\Release\showanim.exe
6>------ Build started: Project: ALL_BUILD, Configuration: Release x64 ------
6>Building Custom Rule E:/libs/SDL_image-main/CMakeLists.txt
7>------ Skipped Build: Project: PACKAGE, Configuration: Release x64 ------
7>Project not selected to build for this solution configuration
8>------ Skipped Build: Project: INSTALL, Configuration: Release x64 ------
8>Project not selected to build for this solution configuration
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 3 skipped ==========
========== Build completed at 2:09 AM and took 14.747 seconds ==========
Open CMD inside of the SDL_image source folder
Type the installation command in CMD:
cmake --install dist
The SDL_image files will be copied to the installation folder
Note. Output:
E:\libs\SDL_image-main>cmake --install dist
-- Install configuration: "Release"
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/lib/SDL3_image.lib
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/bin/SDL3_image.dll
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/include/SDL3_image/SDL_image.h
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/cmake/SDL3_imageConfig.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/cmake/SDL3_imageConfigVersion.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/cmake/SDL3_image-shared-targets.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/cmake/SDL3_image-shared-targets-release.cmake
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/lib/pkgconfig/sdl3-image.pc
-- Installing: E:/libs/sdl3_image-3.1.1-msvc/win/release/share/licenses/SDL3_image/LICENSE.txt
Next guide: Setting up SDL_image 3.1.1 in Visual Studio 2022 using CMake