我正在尝试在我的 Windows 平台上构建 PoDoFo 库
(用作 API)。这是使用 CMake
完成的。 ReadMe
文件说明如下。不幸的是,我是 CMake 的新手,我无法从中了解很多。
Building PoDoFo on Windows
CMake 2.6.x is required for Windows. You can download it from cmake.org .
On Windows, PoDoFo may be built as either a shared or static library. Building both is not supported. By default only the shared library will be built. If you want a static library, just disable generation of the shared library with the extra argument to cmake:
-DPODOFO_BUILD_SHARED=FALSE
Handling library naming on win32
Especially on Windows it is also common for custom built libraries to have different names to those you might download as pre-built copies. CMake won't be able to find them if they're called something else unless you tell it. Use these variables to tell CMake what names to look for a library under:
•FREETYPE_LIBRARY_NAMES_DEBUG, FREETYPE_LIBRARY_NAMES_RELEASE and FREETYPE_LIBRARY_NAMES
•TIFF_LIBRARY_NAMES_DEBUG, TIFF_LIBRARY_NAMES_RELEASE and TIFF_LIBRARY_NAMES
•LIBJPEG_LIBRARY_NAMES_DEBUG, LIBJPEG_LIBRARY_NAMES_RELEASE and LIBJPEG_LIBRARY_NAMES
•ZLIB_LIBRARY_NAMES_DEBUG, ZLIB_LIBRARY_NAMES_RELEASE,ZLIB_LIBRARY_NAMES
CMake builds on Windows with MinGW
Once MinGW is set up, make sure that the MinGW "bin" directory is on your PATH, and be sure to set CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH such that CMake can find the headers and .lib files for the libraries PoDoFo requires. The GnuWin32 library packages from http://gnuwin32.sf.net/ are known to work with PoDoFo, so installing zlib, freetype, and libjpeg from there should do the trick.
To configure and build PoDoFo with a default GnuWin32 install and with MinGW already on your PATH:
md ..\podofo-debug
cd ..\podofo-debug
cmake -G "MinGW Makefiles" ..\podofo-src -DCMAKE_INCLUDE_PATH=c:\progra~1\gnuwin32\include -DCMAKE_LIBRARY_PATH=c:\progra~1\gnuwin32\lib -DPODOFO_BUILD_SHARED:BOOL=FALSE mingw32-make
我已经安装了 CMake
并下载了提到的其他库,如 freetype、zlib、libjpeg
。它们的头文件和二进制文件位于各自的文件夹中。
现在 DCMAKE_INCLUDE_PATH
和 DCMAKE_LIBRARY_PATH
应该是什么?还有什么是 "MinGW Makefiles"
?我必须提供任何额外的参数吗?
如果有人能用简单的步骤解释我该怎么做,我将不胜感激。
编辑:执行 CMAKE 时出错:
-- Ensure you cppunit installed version is at least 1.12.0
Cppunit not found. No unit tests will be built.
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPack
ageHandleStandardArgs.cmake:97 (message):
Could NOT find FREETYPE (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPackageHandleStan
dardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindFREETYPE.cmake:75 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:372 (FIND_PACKAGE)
最佳答案
要构建 PoDoFo,您需要安装 GnuWin32 , CMake, MinGW32 和 PoDoFo 来源
- 下载GetGnuWin32
- 安装到 c:\getgnuwin32
- 打开cmd.exe
- cd c:\getgnuwin32
download.bat
install.bat
然后按照@ibizaman 回答中的建议
cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="C:\gnuwin32\include" -DCMAKE_LIBRARY_PATH="C:\gnuwin32\lib" -DPODOFO_BUILD_STATIC=TRUE ..
FreeType 应与 GnuWin32 软件包一起安装
关于c++ - 使用 CMake 和 MinGW 构建 PoDoFo 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20042467/