From 5ba10417abb546046426e8243b0013b097b8d05c Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Fri, 3 Jul 2026 17:02:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=20[0086]=20=E6=92=A4=E9=94=80=E5=AF=B9=20c?= =?UTF-8?q?pr=20=E5=92=8C=20libcurl=20=E7=9A=84=20xmake.lua=20=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E5=B9=B6=E5=9C=A8=20WASM=20=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=8E=92=E9=99=A4=20CPR=20=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devel/0086.md | 3 +++ xmake.lua | 6 ++++-- xmake/packages/c/cpr/xmake.lua | 2 +- xmake/packages/l/libcurl/xmake.lua | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 devel/0086.md diff --git a/devel/0086.md b/devel/0086.md new file mode 100644 index 000000000..655028100 --- /dev/null +++ b/devel/0086.md @@ -0,0 +1,3 @@ +# [0086] 撤销对 cpr 和 libcurl 的 xmake.lua 更改并在 WASM 平台排除 CPR 依赖 +# Why? +cpr、libcurl 不支持 WASM,因此不被 wasm 构建需要,应当排除 diff --git a/xmake.lua b/xmake.lua index a60fbffb6..bdb142ea3 100644 --- a/xmake.lua +++ b/xmake.lua @@ -44,7 +44,7 @@ option("http") set_values(false, true) option_end() -if has_config("http") then +if has_config("http") and not is_plat("wasm") then add_requires("cpr") end @@ -134,7 +134,9 @@ target ("goldfish") do add_packages("argh") add_packages("nlohmann_json") add_packages("json_schema_validator") - add_packages("cpr") + if has_config("http") and not is_plat("wasm") then + add_packages("cpr") + end -- S7 configuration from original 3rdparty/s7/xmake.lua add_defines("WITH_SYSTEM_EXTRAS=0") diff --git a/xmake/packages/c/cpr/xmake.lua b/xmake/packages/c/cpr/xmake.lua index dadd085f7..9ca1bddab 100644 --- a/xmake/packages/c/cpr/xmake.lua +++ b/xmake/packages/c/cpr/xmake.lua @@ -23,7 +23,7 @@ package("cpr") end end) - on_install("linux", "macosx", "windows", "mingw@windows", "wasm", function (package) + on_install("linux", "macosx", "windows", "mingw@windows", function (package) local configs = {"-DCPR_BUILD_TESTS=OFF", "-DCPR_FORCE_USE_SYSTEM_CURL=ON", "-DCPR_USE_SYSTEM_CURL=ON"} diff --git a/xmake/packages/l/libcurl/xmake.lua b/xmake/packages/l/libcurl/xmake.lua index 6dbc3c384..7862cd968 100644 --- a/xmake/packages/l/libcurl/xmake.lua +++ b/xmake/packages/l/libcurl/xmake.lua @@ -84,7 +84,7 @@ package("libcurl") end end) - on_install("windows", "mingw", "linux", "macosx", "iphoneos", "cross", "android", "wasm", function (package) + on_install("windows", "mingw", "linux", "macosx", "iphoneos", "cross", "android", function (package) local version = package:version() local configs = {"-DBUILD_TESTING=OFF", "-DENABLE_MANUAL=OFF", "-DENABLE_CURL_MANUAL=OFF"} From ddca5e7f50b643b2d6732ba3100f0b2ddbd86487 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Fri, 3 Jul 2026 17:16:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[0086]=20=E6=B7=BB=E5=8A=A0=E6=97=A0=20http?= =?UTF-8?q?=20=E6=A8=A1=E5=9D=97=E7=9A=84=E7=BC=96=E8=AF=91=E9=80=89?= =?UTF-8?q?=E9=A1=B9=E5=B9=B6=E6=8E=92=E9=99=A4=20CPR=20=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devel/0086.md | 12 +++++++++--- src/goldfish.hpp | 4 ++++ xmake.lua | 5 ++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/devel/0086.md b/devel/0086.md index 655028100..269260679 100644 --- a/devel/0086.md +++ b/devel/0086.md @@ -1,3 +1,9 @@ -# [0086] 撤销对 cpr 和 libcurl 的 xmake.lua 更改并在 WASM 平台排除 CPR 依赖 -# Why? -cpr、libcurl 不支持 WASM,因此不被 wasm 构建需要,应当排除 +# [0086] 添加无 http 模块的编译选项并排除 CPR 依赖 +## What +1. 添加了宏 `GOLDFISH_ENABLE_HTTP` 用于条件编译 HTTP 模块 +2. 撤销了对 cpr, libcurl 的 xmake.lua 的更改 +3. 在无 HTTP 模块的条件下,排除 cpr 依赖 + +## Why? +1. 目前 goldfish 缺少 http 模块的编译选项,因此添加了相关的变量以及条件 +2. cpr、libcurl 不支持 WASM,因此不被 WASM 构建需要,应当被 WASM 排除 diff --git a/src/goldfish.hpp b/src/goldfish.hpp index e41ec51dd..c9eaff407 100644 --- a/src/goldfish.hpp +++ b/src/goldfish.hpp @@ -106,8 +106,10 @@ static string find_goldfish_library (); static vector find_function_libraries_in_load_path (s7_scheme* sc, const string& function_name); void glue_njson (s7_scheme* sc); +#ifdef GOLDFISH_ENABLE_HTTP void glue_http (s7_scheme* sc); void glue_http_async (s7_scheme* sc); +#endif void glue_liii_base64 (s7_scheme* sc); void glue_scheme_base (s7_scheme* sc); void glue_liii_hashlib (s7_scheme* sc); @@ -704,8 +706,10 @@ glue_for_community_edition (s7_scheme* sc) { glue_liii_base64 (sc); glue_scheme_base (sc); glue_njson (sc); +#ifdef GOLDFISH_ENABLE_HTTP glue_http (sc); glue_http_async (sc); +#endif } static void diff --git a/xmake.lua b/xmake.lua index bdb142ea3..42f763308 100644 --- a/xmake.lua +++ b/xmake.lua @@ -105,7 +105,10 @@ target ("goldfish") do add_files ("src/goldfish.cpp") add_files ("src/liii_subprocess.cpp") add_files ("src/liii_njson.cpp") - add_files ("src/liii_http.cpp") + if has_config("http") and not is_plat("wasm") then + add_files ("src/liii_http.cpp") + add_defines("GOLDFISH_ENABLE_HTTP") + end add_files ("src/liii_os.cpp") add_files ("src/liii_path.cpp") add_files ("src/liii_hashlib.cpp")