-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate build system from QMake to CMake
- Remove all QMake project files (.pro and .pri) - Add CMakeLists.txt for CMake build system - Update include paths in source files - Update .gitignore for CMake related directories - Add cmake as build dependency in debian/control Log:
- Loading branch information
1 parent
4068c07
commit 1ebc2a7
Showing
13 changed files
with
139 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
*.user | ||
build/ | ||
.vscode/ | ||
.idea/ | ||
cmake-build-*/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
* @author dmryutov ([email protected]) | ||
* @date 22.08.2017 -- 29.10.2017 | ||
*/ | ||
#pragma once | ||
#include <codecvt> | ||
#include <iostream> | ||
#include <sstream> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(docparser VERSION 1.0.0 LANGUAGES CXX) | ||
|
||
# 设置C++标准 | ||
set(CMAKE_CXX_STANDARD 11) | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ Section: libdevel | |
Priority: optional | ||
Maintainer: deepin <[email protected]> | ||
Build-Depends: | ||
cmake, | ||
debhelper (>= 11), | ||
qtbase5-dev, | ||
qt5-qmake, | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
prefix=@CMAKE_INSTALL_PREFIX@ | ||
exec_prefix=${prefix} | ||
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ | ||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ | ||
|
||
Name: docparser | ||
Description: document parse library | ||
Version: @PROJECT_VERSION@ | ||
Libs: -L${libdir} -ldocparser | ||
Cflags: -I${includedir} |
Oops, something went wrong.