Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crengine: add markdown support using md4c #1969

Merged
merged 2 commits into from
Nov 30, 2024
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 cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ declare_project(
libunibreak
libwebp
lunasvg
md4c
utf8proc
zlib
zstd
Expand Down Expand Up @@ -321,6 +322,9 @@ declare_project(thirdparty/luasocket DEPENDS luajit)
# lunasvg
declare_project(thirdparty/lunasvg EXCLUDE_FROM_ALL)

# md4c
declare_project(thirdparty/md4c EXCLUDE_FROM_ALL)

# minizip
declare_project(thirdparty/minizip EXCLUDE_FROM_ALL)

Expand Down
4 changes: 4 additions & 0 deletions thirdparty/cmake_modules/koreader_thirdparty_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ target_link_libraries(
libpng::png16
libwebp::webpdemux
lunasvg::lunasvg
md4c::html
srell::srell
utf8proc::utf8proc
zlib::z
Expand Down Expand Up @@ -154,6 +155,9 @@ endif()
# lunasvg
declare_dependency(lunasvg::lunasvg MONOLIBTIC lunasvg)

# md4c
declare_dependency(md4c::html STATIC md4c-html md4c)

# mupdf
set(LIBRARIES m)
if(ANDROID)
Expand Down
1 change: 1 addition & 0 deletions thirdparty/kpvcrlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ add_library(crengine STATIC
${CRE_DIR}/src/lvtinydom.cpp
${CRE_DIR}/src/lvxml.cpp
${CRE_DIR}/src/mathml.cpp
${CRE_DIR}/src/mdfmt.cpp
${CRE_DIR}/src/odtfmt.cpp
${CRE_DIR}/src/odxutil.cpp
${CRE_DIR}/src/pdbfmt.cpp
Expand Down
1 change: 1 addition & 0 deletions thirdparty/kpvcrlib/crsetup.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define CHM_SUPPORT_ENABLED 1
#define CR3_ANTIWORD_PATCH 1
#define ENABLE_ANTIWORD 1
#define USE_MD4C 1

/// I18N
#define CR_EMULATE_GETTEXT 1
Expand Down
19 changes: 19 additions & 0 deletions thirdparty/md4c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
list(APPEND PATCH_FILES cmake_tweaks.patch)

list(APPEND CMAKE_ARGS
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DBUILD_SHARED_LIBS=FALSE
)

list(APPEND BUILD_CMD COMMAND ninja)

list(APPEND INSTALL_CMD COMMAND ${CMAKE_COMMAND} --install .)

external_project(
DOWNLOAD URL 8ead909cfe31884295e81e2eee32bac9
https://github.com/mity/md4c/archive/refs/tags/release-0.5.2.tar.gz
PATCH_FILES ${PATCH_FILES}
CMAKE_ARGS ${CMAKE_ARGS}
BUILD_COMMAND ${BUILD_CMD}
INSTALL_COMMAND ${INSTALL_CMD}
)
9 changes: 9 additions & 0 deletions thirdparty/md4c/cmake_tweaks.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- i/CMakeLists.txt
+++ w/CMakeLists.txt
@@ -1,5 +1,5 @@

-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
project(MD4C C)

set(MD_VERSION_MAJOR 0)