Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
*.user
build/
.vscode/
.idea/
cmake-build-*/
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Copyright: None
License: CC0-1.0

# Project file
Files: *.pro *.pri
Files: *CMakeLists.txt *.pc.in
Copyright: None
License: CC0-1.0

Expand Down
5 changes: 0 additions & 5 deletions 3rdparty/3rdparty.pri

This file was deleted.

1 change: 0 additions & 1 deletion 3rdparty/libs/encoding/encoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @author dmryutov (dmryutov@gmail.com)
* @date 22.08.2017 -- 29.10.2017
*/
#pragma once
#include <codecvt>
#include <iostream>
#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/libs/fileext/cfb/cfb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <iomanip>
#include <sstream>

#include "encoding/encoding.cpp"
#include "encoding/encoding.hpp"
#include "tools.hpp"

#include "cfb.hpp"
Expand Down
56 changes: 0 additions & 56 deletions 3rdparty/libs/libs.pri

This file was deleted.

18 changes: 9 additions & 9 deletions 3rdparty/utils/libofd/ofd/Color.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace ofd{
uint64_t GetRefID() const {return m_refID;};
void SetRefID(uint64_t refID){m_refID = refID;};
private:
uint64_t m_refID; // 资源引用ID。缺省值0,指向文档设定的颜色空间。
uint64_t m_refID; // 资源引用ID。缺省值0,指向文档设定的颜色空间。

}; // class ColorSpace

Expand All @@ -78,7 +78,7 @@ namespace ofd{
ColorRGB() : Red(0), Green(0), Blue(0){
}
ColorRGB(uint32_t r, uint32_t g, uint32_t b):
Red(r), Green(g), Blue(b){
Red(r), Green(g), Blue(b){
}

std::tuple<double, double, double> GetRGB() const{
Expand Down Expand Up @@ -217,7 +217,7 @@ namespace ofd{
// 取出相应索引的预定义颜色用来绘制。索引从0开始。
uint32_t Alpha; // 颜色透明度,在0-255之间取值。默认值为255,表示完全不透明。

// TODO
// TODO
// Pattern; // 底纹 标准 P34 页,Page.xsd。
// AxialShd; // 轴向渐变 标准 P36 页,Page.xsd。
// RadialShd; // 径向渐变 标准 P40 页,Page.xsd。
Expand All @@ -243,20 +243,20 @@ namespace ofd{
bool m_bUsePalette; // 使用颜色空间调色板标志

}; // class Color
#define COLOR_BLACK ofd::Color::Instance(0,0,0)
#define COLOR_WHITE ofd::Color::Instance(255,255,255)
#define COLOR_BLACK ofd::Color::Instance(0,0,0)
#define COLOR_WHITE ofd::Color::Instance(255,255,255)
#define COLOR_TRANSPARENT ofd::Color::Instance(0,0,0,nullptr, 0)
#define COLOR_RED ofd::Color::Instance(255,0,0)
#define COLOR_GREEN ofd::Color::Instance(0,255,0)
#define COLOR_BLUE ofd::Color::Instance(0,0,255)
#define COLOR_RED ofd::Color::Instance(255,0,0)
#define COLOR_GREEN ofd::Color::Instance(0,255,0)
#define COLOR_BLUE ofd::Color::Instance(0,0,255)

// ======== struct ColorStop_t ========
typedef struct _ColorStop {

ColorPtr Color;
double Offset;

_ColorStop(ColorPtr color, double offset) :
_ColorStop(ColorPtr color, double offset) :
Color(color), Offset(offset){
}

Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/utils/libofd/utils/zip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ bool Zip::ImplCls::AddDir(const std::string &dirName) {
// **************** class Zip ****************

Zip::Zip(){
m_impl = make_unique<Zip::ImplCls>(this);
m_impl = std::make_unique<Zip::ImplCls>(this);
}

Zip::~Zip(){
Expand Down
56 changes: 0 additions & 56 deletions 3rdparty/utils/utils.pri

This file was deleted.

32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.16)
project(docparser VERSION 1.0.0 LANGUAGES CXX)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 在顶层CMakeLists.txt中添加
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)

# 安全编译选项
add_compile_options(-fstack-protector-strong -D_FORTITY_SOURCE=1 -fvisibility=hidden)
add_link_options(-z noexecstack -pie -fPIC)

# 设置安装路径
include(GNUInstallDirs)

# 查找依赖包
find_package(PkgConfig REQUIRED)
pkg_check_modules(DEPS REQUIRED
poppler-cpp
libzip
pugixml
freetype2
libxml-2.0
uuid
tinyxml2
)

# 添加子目录
add_subdirectory(src)
27 changes: 20 additions & 7 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ pkgdesc='A document parser library ported from document2html'
arch=('x86_64' 'aarch64')
url="https://github.com/linuxdeepin/docparser"
license=('GPL3')
depends=('poppler' 'libzip' 'pugixml' 'tinyxml2')
makedepends=('qt5-tools')
depends=(
'poppler'
'libzip'
'pugixml'
'freetype2'
'libxml2'
'util-linux-libs' # for uuid
'tinyxml2'
)
makedepends=(
'cmake'
'pkg-config'
)
conflicts=('docparser')
provides=('docparser')
groups=('deepin-git')
Expand All @@ -19,12 +30,14 @@ source=("${sourcetars[@]}")
b2sums=('SKIP')

build() {
cd $sourcedir
qmake-qt5 PREFIX=/usr
make
cd $sourcedir
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=None
cmake --build build
}

package() {
cd $sourcedir
make INSTALL_ROOT="$pkgdir" install
cd $sourcedir
DESTDIR="$pkgdir" cmake --install build
}
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
docparser (1.0.13) unstable; urgency=medium

* Remove Qt
* Use CMake
* Use C++17

-- Zhang Sheng <zhangsheng@uniontech.com> Fri, 27 Dec 2024 14:06:31 +0800

docparser (1.0.12) unstable; urgency=medium

* update to 1.0.12
Expand Down
3 changes: 1 addition & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ Section: libdevel
Priority: optional
Maintainer: deepin <packages@deepin.com>
Build-Depends:
cmake,
debhelper (>= 11),
qtbase5-dev,
qt5-qmake,
pkg-config,
libpoppler-cpp-dev,
libzip-dev,
Expand Down
3 changes: 0 additions & 3 deletions docparser.pro

This file was deleted.

82 changes: 82 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 收集源文件
file(GLOB_RECURSE SRC_FILES_MAIN
"${CMAKE_CURRENT_SOURCE_DIR}/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)

file(GLOB_RECURSE SRC_FILES_3RDPARTY_LIBS
"${CMAKE_SOURCE_DIR}/3rdparty/libs/*.cpp"
"${CMAKE_SOURCE_DIR}/3rdparty/libs/*.hpp"
"${CMAKE_SOURCE_DIR}/3rdparty/libs/*.h"

)

file(GLOB_RECURSE SRC_FILES_3RDPARTY_UTILS
"${CMAKE_SOURCE_DIR}/3rdparty/utils/*.cpp"
"${CMAKE_SOURCE_DIR}/3rdparty/utils/*.cc"
"${CMAKE_SOURCE_DIR}/3rdparty/utils/*.h"
)

# 创建源文件列表
set(SRC_FILES
${SRC_FILES_MAIN}
${SRC_FILES_3RDPARTY_LIBS}
${SRC_FILES_3RDPARTY_UTILS}
)

# 移除重复的源文件
list(REMOVE_DUPLICATES SRC_FILES)

# 打印源文件列表,用于调试
message(STATUS "Source files:")
foreach(SOURCE_FILE ${SRC_FILES})
message(STATUS " ${SOURCE_FILE}")
endforeach()

# 创建库目标
add_library(docparser SHARED
${SRC_FILES}
)

# 设置目标属性
target_include_directories(docparser
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/docparser>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/3rdparty/libs
${CMAKE_SOURCE_DIR}/3rdparty/utils/libofd
${DEPS_INCLUDE_DIRS}
)

target_link_libraries(docparser
PRIVATE
${DEPS_LIBRARIES}
)

# 安装目标
install(TARGETS docparser
EXPORT docparser-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# 安装头文件
install(FILES
docparser.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/docparser
)

# 生成并安装 pkg-config 文件
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/docparser.pc.in
${CMAKE_CURRENT_BINARY_DIR}/docparser.pc
@ONLY
)

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/docparser.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
Loading