Cmake无法正确生成简单解决方案[Windows 10]

Cmake not generating assimp solutions properly [Windows 10](Cmake无法正确生成简单解决方案[Windows 10])

本文介绍了Cmake无法正确生成简单解决方案[Windows 10]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cmake 3.15 32位

Assimp 4.1.0

你好,我在cmake和assimp方面遇到了一些困难。在过去的几天里,我一直在尝试通过cmake为CodeBlock生成一个简单的工作区。

我已尝试使用CMD和Cmake GUI方法生成解决方案,但未获得令人满意的结果。

在图形用户界面中,遵循生成项目的标准过程,然后定义适当的源路径和目标路径,并选择适当的生成器(CodeBlockMinGW生成文件)。

cmd中用于生成assimp项目的代码:

cmake -G "CodeBlocks - MinGW Makefiles" MakeLists.txt -S "source path" -B "build path"

生成文件后获取的信息日志:

-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Shared libraries enabled
-- Looking for DirectX...
-- DirectX_PREFIX_PATH changed.
-- Found DirectX: C:/MinGW/lib/libd3d9.a
-- DX lib dir: C:/MinGW/lib
-- Looking for ZLIB...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate ZLIB
-- compiling zlib from souces
CMake Deprecation Warning at contrib/zlib/CMakeLists.txt:8 (cmake_policy):
  The OLD behavior for policy CMP0048 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - not found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find rt (missing: RT_LIBRARY)
INFO RT-extension not found. glTF import/export will be built without Open3DGC-compression.
-- Enabled formats: AMF 3DS AC ASE ASSBIN ASSXML B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD
-- Disabled formats:
-- Could NOT find IL (missing: IL_LIBRARIES IL_INCLUDE_DIR)
CMake Warning at CMakeLists.txt:439 (MESSAGE):
  Build of assimp_qt_viewer is disabled.  Unsatisfied dendencies: Qt5 DevIL

-- Configuring done
-- Generating done
-- Build files have been written to: E:/Assimp

遗憾的是,该项目无法在CodeBlock中生成,生成日志如下:

Checking if target is up-to-date: mingw32-make.exe -q -f Makefile all
Running command: C:/TDM-GCC-64/bin/mingw32-make.exe -f "E:/Assimp/Makefile"  VERBOSE=1 all
"C:Program FilesCMakeincmake.exe" -SC:UsersognjeDownloadsassimp-4.1.0 -B"E:Assimp" --check-build-system CMakeFilesMakefile.cmake 0
"C:Program FilesCMakeincmake.exe" -E cmake_progress_start "E:AssimpCMakeFiles" "E:AssimpCMakeFilesprogress.marks"
C:/TDM-GCC-64/bin/mingw32-make.exe -f CMakeFilesMakefile2 all
mingw32-make.exe[1]: Entering directory 'E:/Assimp'
C:/TDM-GCC-64/bin/mingw32-make.exe -f contribzlibCMakeFileszlib.diruild.make contrib/zlib/CMakeFiles/zlib.dir/depend
mingw32-make.exe[2]: Entering directory 'E:/Assimp'
[  1%] Generating zlib1rc.obj
cd /d E:PROGRA~3PROGRA~1Assimpcontribzlib && C:MinGWinwindres.exe -D GCC_WINDRES -I C:/Users/ognje/Downloads/assimp-4.1.0/contrib/zlib -I "E:/Assimp/contrib/zlib" -o "E:/Assimp/contrib/zlib/zlib1rc.obj" -i C:/Users/ognje/Downloads/assimp-4.1.0/contrib/zlib/win32/zlib1.rc
gcc: error: i: No such file or directory
gcc: error: Assimp/contrib/zlib: No such file or directory
C:MinGWinwindres.exe: preprocessing failed.
mingw32-make.exe[2]: *** [contrib/zlib/zlib1rc.obj] Error 1
mingw32-make.exe[1]: *** [contrib/zlib/CMakeFiles/zlib.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
contribzlibCMakeFileszlib.diruild.make:60: recipe for target 'contrib/zlib/zlib1rc.obj' failed
mingw32-make.exe[2]: Leaving directory 'E:/Assimp'
CMakeFilesMakefile2:134: recipe for target 'contrib/zlib/CMakeFiles/zlib.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'E:/Assimp'
E:/Assimp/Makefile:128: recipe for target 'all' failed
Process terminated with status 2 (0 minute(s), 0 second(s))
6 error(s), 0 warning(s) (0 minute(s), 0 second(s))

免责声明:

自然地,我已经搜索并尝试了网络上针对这个特定问题的所有现有解决方案[1],但令人失望的是,这些解决方案都不起作用。老实说,我对编译和库了解不多,但在我看来,当阅读错误日志时,我会说问题源于zlib文件,对吗?有人能帮我解决这个问题吗?提前谢谢您。

推荐答案

该问题是由错误检测到的环境引起的。Zlib脚本尝试对windows-resource-Build使用以下选项:

C:MinGWinwindres.exe -D GCC_WINDRES -I C:/Users/ognje/Downloads/assimp-4.1.0/contrib/zlib -I "E:/Assimp/contrib/zlib" -o "E:/Assimp/contrib/zlib/zlib1rc.obj" -i C:/Users/ognje/Downloads/assimp-4.1.0/contrib/zlib/win32/zlib1.rc

选项-i将被标识为文件令牌:

gcc: error: i: No such file or directory

因此zlib的构建失败,因为用作参数的选项混淆了以下内容的GCC解析,在本例中是目标zlib:

gcc: error: Assimp/contrib/zlib: No such file or directory

我猜这是由于在使用您的特殊版本的mingw时,必须构建哪些代码的标识丢失所致。您可以打开一个问题报告与VeYou可以做版本的assimp你正在使用和哪个版本的GCC-在您的版本中使用。您可以在此处执行此操作:Issue-tracker of Asset-Importer-Lib Project

这篇关于Cmake无法正确生成简单解决方案[Windows 10]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Cmake无法正确生成简单解决方案[Windows 10]

基础教程推荐