Tools you need to install yourself:
- git
- CMake 3.24 or newer
- Conan 2 (
pip install conan) - A C++ compiler (GCC or Clang on Linux, MSVC or MinGW on Windows)
Libraries are handled by Conan. You do not need to install them manually:
- SDL2
- SDL2_image
- SDL2_ttf
- SDL2_mixer
- wxWidgets
The exact versions are pinned in conanfile.txt.
The steps are the same on every platform.
git clone https://github.com/SL-Pirate/snake
cd snake
conan profile detect --force
conan install . --build=missingNotes:
conan profile detectonly needs to run once per machine.- The first
conan installcan take a while. Conan builds any library that has no prebuilt binary for your setup. Later builds reuse the Conan cache. - The binary ends up in
build/Release/.
Run the commands above from a Developer Command Prompt for VS so Conan can find the compiler. MSVC uses a multi-config CMake generator, so the configure preset has a different name:
cmake --preset conan-default
cmake --build --preset conan-releaseA few dependencies (xorg, opengl, egl, xkeyboard-config) come from your distro's package manager, not from Conan.
conan install checks for them and lists anything that is missing. Install those packages and run it again, or let Conan install them for you:
conan install . --build=missing --output-folder=build \
-c tools.system.package_manager:mode=install \
-c tools.system.package_manager:sudo=True
cmake .. -DCMAKE_TOOLCHAIN_FILE="Release/generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE="release"
cmake --build .If gettext fails to compile, install it from your distro's package manager and tell Conan to use the system copy.
Add this to your Conan profile (~/.conan2/profiles/default):
[conf]
tools.system.package_manager:mode=true
tools.system.package_manager:sudo=True
[platform_requires]
gettext/0.26
[platform_tool_requires]
gettext/0.26Conan's wxWidgets build does not work on FreeBSD. Install wxWidgets from ports instead and tell Conan to use the system copy:
pkg install wx32-gtk3Then add this to your Conan profile (~/.conan2/profiles/default):
[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
tools.gnu:make_program=gmake
wxwidgets/*:tools.cmake.cmaketoolchain:extra_variables={"wxUSE_EPOLL_DISPATCHER": "OFF"}
[platform_tool_requires]
cmake/3.31.12
[replace_requires]
wxwidgets/*: wxwidgets/3.3.2
[platform_requires]
wxwidgets/3.3.2replace_requires swaps the version pinned in conanfile.txt for the one installed from ports.
All resources (fonts, images, sounds) are compiled into the executable. The binary runs on its own and can be copied anywhere.
./build/Release/snakeOn Windows run build\Release\snake.exe.
conan install ran fine, but compiling stops at the first #include <SDL.h>, sometimes with wxWidgets headers missing too.
This means CMake was configured with a build type that Conan did not generate for. Conan's CMake files only fill in the dependency targets when CMAKE_BUILD_TYPE matches the configuration you installed (Release by default). Any other value is accepted without complaint: find_package still reports success, but the targets carry no include paths or libraries, so the headers are never found.
Check what your build directory was configured with:
grep CMAKE_BUILD_TYPE build/CMakeCache.txtIf it is not Release (a typo, a paste cut short by your terminal, or Debug without a matching conan install -s build_type=Debug), reconfigure. The simplest fix is the preset, which sets the build type for you:
cmake --preset conan-release
cmake --build --preset conan-releaseIf you prefer the manual commands from the Linux section, pass -DCMAKE_BUILD_TYPE=Release explicitly. Re-running configure overwrites the cached value, so there is no need to delete the build directory.




