Closed kahlenberg closed 1 week ago
Hi @kahlenberg thanks a lot for taking the time to report your issue, we appreciate it
I think this would not be a bug, but expected behaviour. The line self.requires("imgui/1.90.5", override=True)
does not create a dependency on imgui
by itself due to the override
trait, it only means that if imgui is found in the dependency graph, its version should be overriden to that one, not that this package should dependend on that version by force.
You might be looking for the force=True
trait, which does what you'd expect in this case: Create the direct dependency, and force it to be this version.
Note however that using these utilities to solve problems with the graph (if this is the case at all!) is not the recommended approach, and should only be used to temporally allow the builds to proceed while the versions get fixed in the problematic nodes in the graph :)
Hope this helps!
Hi, Thank you for answer. I removed override=True and removed and created build directory, run conan install
and conan build
again, it is still the same error.
Ok, I found it. Some imgui source files needs to be compiled with the project and source and header files need to be copied to project directory. conanfile.py:
...
def generate(self):
copy(self, "*glfw*", os.path.join(self.dependencies["imgui"].package_folder,
"res", "bindings"), os.path.join(self.source_folder, "bindings"))
copy(self, "*opengl3*", os.path.join(self.dependencies["imgui"].package_folder,
"res", "bindings"), os.path.join(self.source_folder, "bindings"))
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()
...
CMakeLists.txt:
....
# Include the directory for header files
include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/bindings)
# Find all .cpp files in the src directory
file(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/src/*.cpp)
file(GLOB IMGUI_BINDINGS_FILES ${PROJECT_SOURCE_DIR}/bindings/*.cpp)
....
add_executable(${PROJECT_NAME} ${SRC_FILES} ${IMGUI_BINDINGS_FILES})
...
Checking the recipe, we do package the files you're looking for, but are not included in the include paths by default, they are in the res
folder under the bindings
subdirectory
Checking https://github.com/ocornut/imgui/wiki/Getting-Started#setting-up-dear-imgui--backends it seems like the recipe could directly add all backend files to the include paths, we'll take a look into it, see if it makes sense to make it less suprising
Edit: Oops just saw your last message, yes! That seems like the current approach to properly use the backends, we'll see if we can ease that pain in the future :)
What is your question?
Hi, I have a CMake project with imgui, I installed all necessary packages with
conan install
and I try to build the project withconan build
, but I get errors that some header files cannot be found. When conan installs a package, does it install header files as well? Why cannot it find the header files?conanfile.py:
CMakeLists.txt:
error:
Have you read the CONTRIBUTING guide?