I have a project that already uses SDL2, sdl_image and sdl_ttf, I want to add sdl_mixer to it. My conanfile.py
looks like this:
from conan import ConanFile
class CompressorRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"
def build_requirements(self):
self.tool_requires("cmake/3.27.0")
def requirements(self):
self.requires("sdl_image/2.0.5")
self.requires("sdl_ttf/2.20.1")
#self.requires("sdl_mixer/2.0.4")
self.requires("libpng/1.6.40", override=True)
self.requires("sdl/2.26.5", override=True)
I'm installing dependencies with this command:
conan install . --output-folder=build --build=missing --profile=Debug
It runs successfully, but when I'm trying to add sdl_mixer
from commented line, it returns this error:
ERROR: Package 'sdl_mixer/2.0.4' not resolved: sdl_mixer/2.0.4: Cannot load recipe.
Error loading conanfile at 'C:\Users\username\.conan2\p\sdl_m16f68a6f39148\e\conanfile.py': Unable to load conanfile in C:\Users\username\.conan2\p\sdl_m16f68a6f39148\e\conanfile.py
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\username\.conan2\p\sdl_m16f68a6f39148\e\conanfile.py", line 1, in <module>
from conans import CMake, tools
ImportError: cannot import name 'CMake'
I've already installed cmake for python:
C:\Users\username>python -m pip install CMake
Requirement already satisfied: CMake in c:\python311\lib\site-packages (3.27.0)
And I can't import cmake from conanfile, if I change first line to from conan import ConanFile, CMake
, it returns the same ImportError: cannot import name 'CMake'
error at the first line
Also, I have already installed conan with pip with python -m pip install conan
. How can I fix this issue?