c++ mupdf编译

mupdf用于将pdf转化为图片

版本:/home/zjm/activemq/mupdf-1.11-source

编译 make prefix=/usr/local install
prefix后面跟的是目标目录,正常应为/usr/local/mupdf

现象:
1、无权限:用sudo
2、glfw未找到,需要自己编译glfw
编译步骤:1、在mupdf-1.11-source目录下cd ./thirdparty/glfw
2、mkdir glfw-build
cd glfw-build
cmake (glfw源码所在目录)
make
make install(可能需要sudo)
(编译时可能会遇到第三方库缺失,将错误自行百度即可)

ps:mupdf-1.11-source/thirdparty目录下包含的就是编译mupdf所用到的第三方库。我只遇到了glfw没有,若遇到别的没有,则自己进行编译。

编译结果:
/usr/local/mupdf的目录结构
├── bin
│?? ├── mujstest
│?? ├── mupdf-gl
│?? ├── mupdf-x11
│?? ├── mupdf-x11-curl
│?? ├── muraster
│?? └── mutool
├── include
│?? └── mupdf
│?? ├── fitz
│?? │?? ├── annotation.h
│?? │?? ├── archive.h
│?? │?? ├── band-writer.h
│?? │?? ├── bidi.h
│?? │?? ├── bitmap.h
│?? │?? ├── buffer.h
│?? │?? ├── colorspace.h
│?? │?? ├── compressed-buffer.h
│?? │?? ├── config.h
│?? │?? ├── context.h
│?? │?? ├── crypt.h
│?? │?? ├── device.h
│?? │?? ├── display-list.h
│?? │?? ├── document.h
│?? │?? ├── filter.h
│?? │?? ├── font.h
│?? │?? ├── function.h
│?? │?? ├── geometry.h
│?? │?? ├── getopt.h
│?? │?? ├── glyph-cache.h
│?? │?? ├── glyph.h
│?? │?? ├── hash.h
│?? │?? ├── image.h
│?? │?? ├── link.h
│?? │?? ├── outline.h
│?? │?? ├── output.h
│?? │?? ├── output-pcl.h
│?? │?? ├── output-png.h
│?? │?? ├── output-pnm.h
│?? │?? ├── output-ps.h
│?? │?? ├── output-pwg.h
│?? │?? ├── output-svg.h
│?? │?? ├── output-tga.h
│?? │?? ├── path.h
│?? │?? ├── pixmap.h
│?? │?? ├── pool.h
│?? │?? ├── separation.h
│?? │?? ├── shade.h
│?? │?? ├── store.h
│?? │?? ├── stream.h
│?? │?? ├── string-util.h
│?? │?? ├── structured-text.h
│?? │?? ├── system.h
│?? │?? ├── text.h
│?? │?? ├── track-usage.h
│?? │?? ├── transition.h
│?? │?? ├── tree.h
│?? │?? ├── ucdn.h
│?? │?? ├── util.h
│?? │?? ├── version.h
│?? │?? ├── writer.h
│?? │?? └── xml.h
│?? ├── fitz.h
│?? ├── html.h
│?? ├── memento.h
│?? ├── pdf
│?? │?? ├── annot.h
│?? │?? ├── appearance.h
│?? │?? ├── clean.h
│?? │?? ├── cmap.h
│?? │?? ├── crypt.h
│?? │?? ├── document.h
│?? │?? ├── event.h
│?? │?? ├── field.h
│?? │?? ├── font.h
│?? │?? ├── interpret.h
│?? │?? ├── javascript.h
│?? │?? ├── name-table.h
│?? │?? ├── object.h
│?? │?? ├── output-pdf.h
│?? │?? ├── page.h
│?? │?? ├── parse.h
│?? │?? ├── resource.h
│?? │?? ├── widget.h
│?? │?? └── xref.h
│?? ├── pdf.h
│?? ├── pdf-tools.h
│?? └── svg.h
├── lib
│?? ├── libmupdf.a
│?? └── libmupdfthird.a
└── share
├── doc
│?? └── mupdf
│?? ├── CHANGES
│?? ├── COPYING
│?? ├── naming.txt
│?? ├── overview.txt
│?? ├── progressive.txt
│?? ├── README
│?? ├── refcount.txt
│?? ├── thirdparty.txt
│?? └── types.txt
└── man
└── man1
├── mupdf.1
└── mutool.1
举例:
mupdf-1.11-source/docs中有个example.c的栗子,用于将pdf中的某一页转换成图片的像素矩阵并输出。
编译命令:g++ example.c -o example -I/usr/local/mupdf/include/ -L/usr/local/mupdf/lib/ -lmupdf -lmupdfthird

使用时:
INCLUDEPATH +=/usr/local/mupdf/include/
LIBS += -L/usr/local/mupdf/lib/

LIBS += -lmupdf
LIBS += -lmupdfthird

猜你喜欢

转载自blog.csdn.net/zim3oo/article/details/78219049