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
11 changes: 11 additions & 0 deletions devel/0747.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# [0747] 添加选项排除 goldfish

## What
在 options.lua 中添加了选项排除 goldfish 构建

## 如何测试
```
xmake f -m debug --goldfish=no
xmake b stem
```
观察无 goldfish 构建产物
4 changes: 1 addition & 3 deletions moebius/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ local moe_includedirs = {

add_requires("liii-doctest", {system=false})
add_requires("nanobench", {system=false})
add_requires("goldfish", {system=false})


target("libmoebius") do
set_kind ("static")
Expand All @@ -43,7 +41,7 @@ target("libmoebius") do
add_files(moe_files)

add_deps("liblolly")
add_packages("goldfish")
add_deps("goldfish")

add_headerfiles("Data/Convert/(*.hpp)")
add_headerfiles("Data/History/(*.hpp)")
Expand Down
79 changes: 17 additions & 62 deletions xmake/goldfish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,49 +13,19 @@
-- binary target 内联编译的那一份完全相同。不使用 set_sourcedir() 直接指向
-- 工作树(否则 package.tools.xmake 会把 port 出来的 xmake.lua 写进工作树,
-- 污染源码目录),而是在 on_install 里把源码拷贝到包缓存目录后构建。
local goldfish_src = "$(projectdir)/TeXmacs/plugins/goldfish/src"

package("goldfish")
set_homepage("https://github.com/goldfishscheme/goldfish")
set_description("Goldfish Scheme: a Scheme interpreter intended as an extension language for other applications.")

add_deps("liii-tbox")

on_load(function (package)
package:addenv("PATH", "bin")
package:add("deps", "argh v1.3.2")
end)

on_test(function (package)
assert(package:check_csnippets([[
static s7_pointer old_add; /* the original "+" function for non-string cases */
static s7_pointer old_string_append; /* same, for "string-append" */

static s7_pointer our_add(s7_scheme *sc, s7_pointer args)
{
/* this will replace the built-in "+" operator, extending it to include strings:
* (+ "hi" "ho") -> "hiho" and (+ 3 4) -> 7
*/
if ((s7_is_pair(args)) &&
(s7_is_string(s7_car(args))))
return(s7_apply_function(sc, old_string_append, args));
return(s7_apply_function(sc, old_add, args));
}
]], {includes = "s7.h"}))
end)
package_end()

target("libgoldfish") do
set_kind("$(kind)")
set_kind("static")
set_languages("c11")
add_packages("liii-tbox")
add_packages("argh", {public = true})
add_defines("WITH_SYSTEM_EXTRAS=0")
if not is_plat("wasm") then
add_defines("HAVE_OVERFLOW_CHECKS=0")
end
add_defines("WITH_WARNINGS")
add_defines("WITH_R7RS=1")
set_basename("goldfish")
set_basename("libgoldfish")
add_files(
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_continuation.c",
Expand All @@ -77,8 +47,7 @@ target("libgoldfish") do
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_string.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_vector.c"
)
add_headerfiles("$(curdir)/s7.h")
add_includedirs(".", {public = true})
add_headerfiles("$(projectdir)/TeXmacs/plugins/goldfish/src/s7.h")
if is_plat("windows") then
set_optimize("faster")
add_cxxflags("/fp:precise")
Expand All @@ -89,10 +58,9 @@ target("libgoldfish") do
end

target ("goldfish") do
set_kind("static")
set_languages("c++17")
add_deps("libgoldfish")
set_targetdir("$(projectdir)/TeXmacs/plugins/goldfish/bin/")
add_files ("$(projectdir)/TeXmacs/plugins/goldfish/src/goldfish.cpp")
add_files({
"$(projectdir)/TeXmacs/plugins/goldfish/src/liii_base64.cpp",
"$(projectdir)/TeXmacs/plugins/goldfish/src/liii_hashlib.cpp",
Expand All @@ -102,27 +70,6 @@ target ("goldfish") do
"$(projectdir)/TeXmacs/plugins/goldfish/src/liii_subprocess.cpp",
"$(projectdir)/TeXmacs/plugins/goldfish/src/scheme_base.cpp",
})
add_files({
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_continuation.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_ctables.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_dtoa.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_module.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_op_names.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_base.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_char.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_complex.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_format.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_inexact.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_predicate.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_symbol.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_write.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_bitwise.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_hash_table.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_list.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_string.c",
"$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_vector.c",
}, {languages = "c11"})
add_files({
"$(projectdir)/3rdparty/json-schema-validator/src/smtp-address-validator.cpp",
"$(projectdir)/3rdparty/json-schema-validator/src/json-schema-draft7.json.cpp",
Expand All @@ -139,7 +86,7 @@ target ("goldfish") do
"$(projectdir)/TeXmacs/plugins/goldfish/src",
"$(projectdir)/3rdparty/nlohmann_json/include",
"$(projectdir)/3rdparty/json-schema-validator/src",
})
}, {public = true})

add_defines("WITH_SYSTEM_EXTRAS=0")
if not is_plat("wasm") then
Expand All @@ -158,7 +105,15 @@ target ("goldfish") do
if not is_plat("wasm") then
add_packages("cpr")
end
add_packages("argh")
on_install(function (target)
end)
add_packages("argh", {public = true})
end

target ("goldfish-bin") do
set_kind("binary")
add_deps("goldfish")
set_basename("goldfish")
add_packages("liii-tbox")
add_packages("argh", {public = true})
set_targetdir("$(projectdir)/TeXmacs/plugins/goldfish/bin/")
add_files ("$(projectdir)/TeXmacs/plugins/goldfish/src/goldfish.cpp")
end
5 changes: 5 additions & 0 deletions xmake/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ option("pdfhummus")
set_description("Enable PDFHummus plugin")
option_end()

option("goldfish")
set_default(true)
set_description("Enable Goldfish plugin")
option_end()

option("mupdf")
set_default(true)
set_description("Enable MuPDF library")
Expand Down
1 change: 0 additions & 1 deletion xmake/requires.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
-- It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
-- in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.

add_requires("goldfish", {system=false})
add_requires("liii-tbox", {system=false})
if not is_plat("wasm") then
add_requires("cpr", {system=false})
Expand Down
12 changes: 3 additions & 9 deletions xmake/targets/libmogan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ target("libmogan") do

add_deps("libmoebius")
add_deps("liblolly")
add_deps("goldfish")
if has_config("qt_frontend") then
add_deps("QWKCore", "QWKWidgets")
add_rules("qt.static")
Expand Down Expand Up @@ -85,7 +86,6 @@ target("libmogan") do
add_packages("liii-pdfhummus")
end
add_packages("freetype")
add_packages("goldfish")
add_packages("liii-tbox")
if not is_plat("wasm") then
add_packages("cpr")
Expand Down Expand Up @@ -247,10 +247,7 @@ target("libmogan") do
"$(projectdir)/src/Mogan/TemplateCenter",
"$(projectdir)/src/Mogan/Telemetry",
"$(projectdir)/TeXmacs/include",
"$(builddir)/glue",
"$(projectdir)/TeXmacs/plugins/goldfish/src/",
"$(projectdir)/3rdparty/nlohmann_json/include",
"$(projectdir)/3rdparty/json-schema-validator/src"
"$(builddir)/glue"
}, {public = true})

add_files({
Expand Down Expand Up @@ -278,9 +275,7 @@ target("libmogan") do
"$(projectdir)/src/Plugins/Tex/**.cpp",
"$(projectdir)/src/Plugins/Xml/**.cpp",
"$(projectdir)/src/Plugins/Html/**.cpp",
"$(projectdir)/src/Plugins/Updater/**.cpp",
"$(projectdir)/TeXmacs/plugins/goldfish/src/**.cpp",
"$(projectdir)/3rdparty/json-schema-validator/src/**.cpp"})
"$(projectdir)/src/Plugins/Updater/**.cpp",})

if has_config("pdfhummus") then
add_includedirs("$(projectdir)/src/Plugins/Pdf/**.hpp", {public=true})
Expand All @@ -298,7 +293,6 @@ target("libmogan") do
add_files("$(projectdir)/src/Plugins/Qt/moganqml.qrc")
else
add_files("$(projectdir)/src/Plugins/ImGui/**.cpp")
remove_files("$(projectdir)/TeXmacs/plugins/goldfish/src/liii_http.cpp")
end

if is_plat("macosx") then
Expand Down
6 changes: 4 additions & 2 deletions xmake/targets/stem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ local stem_files = {
}

target("stem") do
add_deps("goldfish")
if is_plat("windows") and is_mode("release") then
add_deps("liii_windows_icon")
end
Expand Down Expand Up @@ -121,11 +120,14 @@ target("stem") do
add_frameworks("QtQml", "QtQuick", "QtBodymovin")
end

add_packages("goldfish")
add_packages("mupdf")
if not has_config("qt_frontend") and not is_plat("wasm") then -- WASM GLFW is in EMCC
add_packages("glfw")
end
if has_config("goldfish") then
add_deps("goldfish-bin")
end
add_deps("goldfish")
add_deps("liblolly")
add_deps("libmogan")
add_deps("libmoebius")
Expand Down
8 changes: 6 additions & 2 deletions xmake/tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ function add_target_cpp_test(filepath, dep1, dep2)
if not is_plat("windows") then
add_syslinks("pthread")
end
add_packages("goldfish")
if has_config("goldfish") then
add_deps("goldfish")
end
add_packages("liii-pdfhummus")

add_includedirs({"$(builddir)", "tests/Base"})
Expand Down Expand Up @@ -78,7 +80,9 @@ function add_target_cpp_bench(filepath, dep)
if not is_plat("windows") then
add_syslinks("pthread")
end
add_packages("goldfish")
if has_config("goldfish") then
add_deps("goldfish")
end
add_packages("liii-pdfhummus")

add_includedirs({"$(builddir)", "tests/Base"})
Expand Down
2 changes: 2 additions & 0 deletions xmake/vars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ libstem_headers = {
"$(builddir)/glue",
"$(projectdir)/TeXmacs/include",
"$(projectdir)/TeXmacs/plugins/goldfish/src",
"$(projectdir)/3rdparty/nlohmann_json/include",
"$(projectdir)/3rdparty/json-schema-validator/src"
}

libstem_srcs = {
Expand Down
Loading