Skip to content

Commit 536a688

Browse files
authored
[0726] 添加无 pdfhummus 构建选项 (#3926)
1 parent 4fd5ea3 commit 536a688

4 files changed

Lines changed: 33 additions & 7 deletions

File tree

devel/0726.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# [0726] 添加无 pdfhummus 选项
2+
3+
## What
4+
在构建脚本中添加了无 pdfhummus 的选项
5+
6+
## 如何测试
7+
```
8+
xmake f -c --pdfhummus=no
9+
xmake b stem
10+
xmake r stem
11+
```

xmake/options.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ option("qt_frontend")
2424
set_description("Build the Qt frontend (default: ImGui frontend)")
2525
option_end()
2626

27+
option("pdfhummus")
28+
set_default(true)
29+
set_description("Enable PDFHummus plugin")
30+
option_end()
31+
2732
option("mupdf")
2833
set_default(true)
2934
set_description("Enable MuPDF library")

xmake/requires.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ else
3333
end
3434
end
3535

36-
add_requires("liii-pdfhummus", {system=false,configs={libpng=true,libjpeg=true}})
37-
add_requires("freetype "..FREETYPE_VERSION, {system=false, configs={png=true}})
38-
add_requireconfs("liii-pdfhummus.freetype", {version = FREETYPE_VERSION, system = false, configs={png=true}, override=true})
36+
if has_config("pdfhummus") then
37+
add_requires("liii-pdfhummus", {system=false,configs={libpng=true,libjpeg=true}})
38+
add_requires("freetype "..FREETYPE_VERSION, {system=false, configs={png=true}})
39+
add_requireconfs("liii-pdfhummus.freetype", {version = FREETYPE_VERSION, system = false, configs={png=true}, override=true})
40+
end
3941

4042
add_requires("argh v1.3.2")
4143

xmake/targets/libmogan.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ target("libmogan") do
6262
add_files("$(projectdir)/src/Scheme/Plugins/glue_bibtex.lua", {rule = "mogan.glue"})
6363
add_files("$(projectdir)/src/Scheme/Plugins/glue_ghostscript.lua", {rule = "mogan.glue"})
6464
add_files("$(projectdir)/src/Scheme/Plugins/glue_html.lua", {rule = "mogan.glue"})
65-
add_files("$(projectdir)/src/Scheme/Plugins/glue_pdf.lua", {rule = "mogan.glue"})
6665
add_files("$(projectdir)/src/Scheme/Plugins/glue_plugin.lua", {rule = "mogan.glue"})
6766
add_files("$(projectdir)/src/Scheme/Plugins/glue_tex.lua", {rule = "mogan.glue"})
6867
add_files("$(projectdir)/src/Scheme/Plugins/glue_updater.lua", {rule = "mogan.glue"})
6968
add_files("$(projectdir)/src/Scheme/Plugins/glue_xml.lua", {rule = "mogan.glue"})
69+
if has_config("pdfhummus") then
70+
add_files("$(projectdir)/src/Scheme/Plugins/glue_pdf.lua", {rule = "mogan.glue"})
71+
end
7072
if has_config("qt_frontend") then
7173
add_files("$(projectdir)/src/Scheme/L5/glue_qt.lua", {rule = "mogan.glue"})
7274
set_configvar("QTTEXMACS", 1)
@@ -79,7 +81,9 @@ target("libmogan") do
7981
add_packages("glfw")
8082
end
8183

82-
add_packages("liii-pdfhummus")
84+
if has_config("pdfhummus") then
85+
add_packages("liii-pdfhummus")
86+
end
8387
add_packages("freetype")
8488
add_packages("goldfish")
8589
add_packages("liii-tbox")
@@ -131,7 +135,7 @@ target("libmogan") do
131135
USE_PLUGIN_BIBTEX = true,
132136
USE_PLUGIN_TEX = true,
133137
USE_PLUGIN_ISPELL = true,
134-
USE_PLUGIN_PDF = true,
138+
USE_PLUGIN_PDF = has_config("pdfhummus"),
135139
USE_PLUGIN_SPARKLE = false,
136140
USE_PLUGIN_HTML = true,
137141
USE_MUPDF_RENDERER = has_config("mupdf"),
@@ -268,7 +272,6 @@ target("libmogan") do
268272
"$(projectdir)/src/Typeset/**.cpp",
269273
"$(projectdir)/src/Plugins/Bibtex/**.cpp",
270274
"$(projectdir)/src/Plugins/Freetype/**.cpp",
271-
"$(projectdir)/src/Plugins/Pdf/**.cpp",
272275
"$(projectdir)/src/Plugins/Ghostscript/**.cpp",
273276
"$(projectdir)/src/Plugins/Ispell/**.cpp",
274277
"$(projectdir)/src/Plugins/Metafont/**.cpp",
@@ -279,6 +282,11 @@ target("libmogan") do
279282
"$(projectdir)/TeXmacs/plugins/goldfish/src/**.cpp",
280283
"$(projectdir)/3rdparty/json-schema-validator/src/**.cpp"})
281284

285+
if has_config("pdfhummus") then
286+
add_includedirs("$(projectdir)/src/Plugins/Pdf/**.hpp", {public=true})
287+
add_files("$(projectdir)/src/Plugins/Pdf/**.cpp")
288+
end
289+
282290
if has_config("qt_frontend") then
283291
add_includedirs("$(projectdir)/src/Plugins/Qt", {public=true})
284292
add_files("$(projectdir)/src/Plugins/Qt/**.cpp", "$(projectdir)/src/Plugins/Qt/**.hpp")

0 commit comments

Comments
 (0)