简体   繁体   English

使用 Code::Blocks 和 MinGW 构建 Assimp

[英]Building Assimp with Code::Blocks and MinGW

I am trying to build Assimp with Code::Blocks and MinGW as a static library.我正在尝试使用Code::BlocksMinGW构建 Assimp 作为 static 库。 I have downloaded the latest available version (5.0.1) and created a makefile for Code::Blocks using cmake-gui.我已经下载了最新的可用版本 (5.0.1) 并使用 cmake-gui 为 Code::Blocks 创建了 makefile。 I am able to open that file with Code::Blocks, but when I am trying to build it fails.我可以使用 Code::Blocks 打开该文件,但是当我尝试构建它时会失败。 Here is the complete log:这是完整的日志:

-------------- Build: all in Assimp (compiler: GNU GCC Compiler)---------------

Checking if target is up-to-date: mingw32-make.exe -q -f Makefile all
Running command: C:/PROGRA~2/CODEBL~1/MinGW/bin/mingw32-make.exe -f "C:/Users/.../assimp-5.0.1/build/Makefile" VERBOSE=1 all
"C:\Users\...\cmake-3.22.1-windows-i386\bin\cmake.exe" -S"C:\Users\...\assimp-5.0.1" -B"C:\Users\...\assimp-5.0.1\build" --check-build-system CMakeFiles\Makefile.cmake 0
Re-run cmake file: Makefile older than: C:/Users/.../cmake-3.22.1-windows-i386/share/cmake-3.22/Modules/CMakeCInformation.cmake
-- Shared libraries disabled
-- Looking for DirectX...
-- DirectX_PREFIX_PATH changed.
-- Found DirectX: C:/Program Files (x86)/CodeBlocks/MinGW/lib/libd3d9.a
-- DX lib dir: C:/Program Files (x86)/CodeBlocks/MinGW/lib
-- Looking for ZLIB...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate ZLIB
-- compiling zlib from sources
CMake Deprecation Warning at contrib/zlib/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Warning (dev) at C:/Users/.../cmake-3.22.1-windows-i386/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (rt) does
not match the name of the calling package (RT). This can lead to problems
in calling code that expects `find_package` result variables (e.g.,
`_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake-modules/FindRT.cmake:19 (find_package_handle_standard_args)
code/CMakeLists.txt:1013 (FIND_PACKAGE)
This warning is for project developers. Use -Wno-dev to suppress it.
INFO Hunter enabled or RT-extension not found. glTF import/export will be built without Open3DGC-compression.
-- Could NOT find rt (missing: RT_LIBRARY)
-- Enabled importer formats: AMF 3DS AC ASE ASSBIN 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 STEP
-- Disabled importer formats:
-- Enabled exporter formats: 3DS ASSBIN ASSXML COLLADA OBJ OPENGEX PLY FBX STL X X3D GLTF 3MF ASSJSON STEP
-- Disabled exporter formats:
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/.../assimp-5.0.1/build
"C:\Users\...\cmake-3.22.1-windows-i386\bin\cmake.exe" -E cmake_progress_start "C:\Users\...\assimp-5.0.1\build\CMakeFiles" "C:\Users\...\assimp-5.0.1\build\\CMakeFiles\progress.marks"
C:/PROGRA~2/CODEBL~1/MinGW/bin/mingw32-make.exe -f CMakeFiles\Makefile2 all
mingw32-make.exe[1]: Entering directory 'C:/Users/.../assimp-5.0.1/build'
C:/PROGRA~2/CODEBL~1/MinGW/bin/mingw32-make.exe -f contrib\zlib\CMakeFiles\zlib.dir\build.make contrib/zlib/CMakeFiles/zlib.dir/depend
mingw32-make.exe[2]: Entering directory 'C:/Users/.../assimp-5.0.1/build'
[ 1%] Generating zlib1rc.obj
cd /d C:\Users\...\ASSIMP~1.1\build\contrib\zlib && "C:\Program Files (x86)\CodeBlocks\MinGW\bin\windres.exe" -D GCC_WINDRES -I "C:/Users/.../assimp-5.0.1/contrib/zlib" -I "C:/Users/.../assimp-5.0.1/build/contrib/zlib" -o "C:/Users/.../assimp-5.0.1/build/contrib/zlib/zlib1rc.obj" -i "C:/Users/.../assimp-5.0.1/contrib/zlib/win32/zlib1.rc"
Der Befehl "C:\Program" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
C:\Program Files (x86)\CodeBlocks\MinGW\bin\windres.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
contrib\zlib\CMakeFiles\zlib.dir\build.make:72: recipe for target 'contrib/zlib/zlib1rc.obj' failed
mingw32-make.exe[2]: Leaving directory 'C:/Users/.../assimp-5.0.1/build'
CMakeFiles\Makefile2:176: recipe for target 'contrib/zlib/CMakeFiles/zlib.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'C:/Users/.../assimp-5.0.1/build'
C:/Users/.../assimp-5.0.1/build/Makefile:134: recipe for target 'all' failed
Process terminated with status 2 (0 minute(s), 11 second(s))
4 error(s), 0 warning(s) (0 minute(s), 11 second(s))

I am not really familiar with all that build stuff, but it looks like there is some problem with zlib.我对所有构建的东西都不是很熟悉,但看起来 zlib 有一些问题。 How can I fix that problem and build the library with the compiler I have?如何解决该问题并使用我拥有的编译器构建库?

I don't want to switch to msys2.我不想切换到 msys2。

Latest assimp version at this time is 5.1.6 , so it looks like you're a bit behind.目前最新的 assimp 版本是5.1.6 ,所以看起来你有点落后了。

That version builds with MinGW-w64.该版本使用 MinGW-w64 构建。 I build it using CMake and Ninja.我使用 CMake 和 Ninja 构建它。 I use the following CMake flags: -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=ON -DASSIMP_HEADERCHECK:BOOL=OFF -DASSIMP_OPT_BUILD_PACKAGES:BOOL=OFF -DSYSTEM_IRRXML:BOOL=OFF -DASSIMP_BUILD_SAMPLES:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DASSIMP_BUILD_TESTS:BOOL=OFF -DCMAKE_CXX_FLAGS:STRING="-Wno-array-bounds -Wno-alloc-size-larger-than -Wno-error=array-compare" I use the following CMake flags: -DASSIMP_BUILD_ASSIMP_TOOLS:BOOL=ON -DASSIMP_HEADERCHECK:BOOL=OFF -DASSIMP_OPT_BUILD_PACKAGES:BOOL=OFF -DSYSTEM_IRRXML:BOOL=OFF -DASSIMP_BUILD_SAMPLES:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DASSIMP_BUILD_TESTS:BOOL=OFF -DCMAKE_CXX_FLAGS:STRING="-Wno-array-bounds -Wno-alloc-size-larger-than -Wno-error=array-compare"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM