Cmake找到的Assimp Is不
在说什么之前:是的,我在此询问此处之前搜索了很长时间,因此99%的解决方案对我来说其他类似问题的解决方案对我不起作用。
我有一个使用以下库的OpenGL应用程序:
- glfw
- imgui
- glad
- STB
- assimp assimp
- glm
- filebrowser(对话框iMgui的扩展程序)
所有这些库都位于一个名为“外部”的文件夹中,每个库中的每个库中的dir中的每个库。 此外,GLFW,ASSIMP,GLM是我的存储库的git子模型,因此当我用Git Clone克隆回购时,它们会下载。
您可以更好地了解项目的结构,以查看我的 git repo 。
我的想法是使用add_subdirectories与他们自己的cmakelists进行编译,而我的主要内容如下:
cmake_minimum_required(VERSION 3.21.3)
project(Reskinner)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_VERBOSE_MAKEFILE ON)
add_executable(${PROJECT_NAME} Main.cpp)
add_subdirectory(external/glfw)
add_subdirectory(external/assimp)
add_subdirectory(external/glad)
add_subdirectory(external/imgui)
add_subdirectory(external/stb)
add_subdirectory(external/glm)
add_subdirectory(external/FileBrowser)
add_subdirectory(src)
find_package(OpenGL REQUIRED)
target_include_directories(${PROJECT_NAME}
PUBLIC external/glfw/include
PUBLIC external/assimp/include
PUBLIC external/glm
PUBLIC external
PUBLIC src
)
target_link_libraries(${PROJECT_NAME} glfw glad imgui stb glm Engine assimp FileBrowser)
该项目是在Windows上使用Visual Studio开发的,我想在Linux上编译它而不使用VisualStudio。 cmake不会给我任何错误,但是当我运行make命令时,它给了我这个错误:
#include< assimp/quaternion.h>这个名称没有文件或目录。
就像我没有将Assimp包含在CMAKE中的文件夹(但我确实如此)一样。
您是否知道如何使它起作用?我想制作一个bash脚本来安装所有所需的依赖项和工具,例如xorg-dev,build-extental,git,cmake,make等。因此,如果使用某些bash命令进行了任何简单的修复,对我来说还可以。
Before saying anything: Yes, I googled and searched for a long time before asking this here so 99% the solution of other similar questions doesn't work for me.
I have an opengl application that uses the following libraries:
- glfw
- imgui
- glad
- stb
- assimp
- glm
- filebrowser (an extension of imgui for dialog boxes)
all these libraries are in a folder called external each one in its dir.
Moreover, glfw, assimp, glm are git submodules of my repo so they're downloaded when i clone my repo with git clone --recursive mygitrepo.
You can have a better understanding of the structure of the project looking at my git repo.
My idea was to use the add_subdirectories to make them compile with their own CMakeLists and my main one looks like this:
cmake_minimum_required(VERSION 3.21.3)
project(Reskinner)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_VERBOSE_MAKEFILE ON)
add_executable(${PROJECT_NAME} Main.cpp)
add_subdirectory(external/glfw)
add_subdirectory(external/assimp)
add_subdirectory(external/glad)
add_subdirectory(external/imgui)
add_subdirectory(external/stb)
add_subdirectory(external/glm)
add_subdirectory(external/FileBrowser)
add_subdirectory(src)
find_package(OpenGL REQUIRED)
target_include_directories(${PROJECT_NAME}
PUBLIC external/glfw/include
PUBLIC external/assimp/include
PUBLIC external/glm
PUBLIC external
PUBLIC src
)
target_link_libraries(${PROJECT_NAME} glfw glad imgui stb glm Engine assimp FileBrowser)
The project was developed with visual studio on windows and I want to compile it on linux without using visualstudio. The cmake doesn't give me any errors but when i run the make command it gives me this error:
#include <assimp/quaternion.h> there's no file or directory with this name.
like i didn't put the assimp include folder in the cmake (but i did).
Do you have any idea how to make it works? I want to make a bash script to install all the dependencies and tools needed like xorg-dev, build-essential, git, cmake, make etc. So if there's any simple fix using some bash commands it's ok for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出了如何修复它。我刚刚安装了柯南,并用它来下载并找到Assimp。因此,我从“外部”文件夹中删除了Assimp,GLM,GLFW和GLAD,并添加了Conanfile.txt。
在这里conanfile.txt:
我的主要cmakelists.txt现在如下:
有些笔记对其他遇到这种麻烦的人很有用:
assimp与柯南一起使用时有一些链接问题,因为似乎没有下载下载除了您需要的一切之外,一切都适用于#include,但它在链接阶段抱怨。添加以下3行解决了问题:
set(cmake_cxx_include_what_you_use 1)
set(cmake_link_what_you_use 1)
set_property(target $ {project_name}属性internocedural_optimization true)
我有一个脚本可以在linux上安装所需的所有内容,并使用conan安装东西,启动cmake等。 > 柯南安装.. [...] 我需要conan.cmake文件,以便开始寻找conan.cmake文件的线路解决了很多问题
。
/strong> 我需要conan.cmake文件,
I figured out how to fix it. I just installed conan and used it to download and find assimp. So I removed assimp, glm, glfw and glad from 'external' folder and just added a conanfile.txt.
Here the conanfile.txt:
my main CMakeLists.txt now it's as following:
Some notes that can be usefull for other people having this troubles:
Assimp has some linking problem when used with conan because it seems that it doesn't download everything but just what you need so it works for the #include but it complains in the linking phase. Adding the following 3 rows fixed the problem:
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE 1)
set(CMAKE_LINK_WHAT_YOU_USE 1)
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
I have a script to install everything you need on linux and install the stuff with conan, launch the cmake etc.. Even if I install the conan packages with the command conan install .. [...] I need the conan.cmake file so the lines at the beginning looking for the conan.cmake files fixed a lot of problems
The shell scripts is the following:
Hope this can help you