File tree Expand file tree Collapse file tree 6 files changed +33
-25
lines changed
Expand file tree Collapse file tree 6 files changed +33
-25
lines changed Original file line number Diff line number Diff line change 1- target ( " hello_mcpp " )
2- set_kind ( " binary " )
3- add_files ( " hello_mcpp.cpp " )
4- add_deps ( " llmapi " )
1+ -- TODO: fix build on macOS (12.3) libc++/println issue
2+ if not is_host ( " macosx " ) then
3+ -- xmake f --toolchain=llvm --sdk=/opt/homebrew/opt/llvm@20
4+ -- add_ldflags("-L/opt/homebrew/opt/llvm@20/lib/c++ -L/opt/homebrew/opt/llvm@20/lib/unwind -lunwind ")
55
6- target (" basic" )
7- set_kind (" binary" )
8- add_files (" basic.cpp" )
9- add_deps (" llmapi" )
6+ target (" hello_mcpp" )
7+ set_kind (" binary" )
8+ add_files (" hello_mcpp.cpp" )
9+ add_deps (" llmapi" )
10+
11+ target (" basic" )
12+ set_kind (" binary" )
13+ add_files (" basic.cpp" )
14+ add_deps (" llmapi" )
15+
16+ target (" chat" )
17+ set_kind (" binary" )
18+ add_files (" chat.cpp" )
19+ add_deps (" llmapi" )
20+ end
1021
11- target (" chat" )
12- set_kind (" binary" )
13- add_files (" chat.cpp" )
14- add_deps (" llmapi" )
1522
1623includes (" c" )
Original file line number Diff line number Diff line change 22
33#include < json.hpp>
44
5- export module nlohmann.json;
5+ // export module nlohmann.json; // workaround for module name conflict in some build systems
6+ export module mcpplibs.llmapi.nlohmann.json;
67
78export namespace nlohmann {
89 using ::nlohmann::adl_serializer;
Original file line number Diff line number Diff line change 11export module mcpplibs.llmapi;
22
3- import std;
3+ export import :url;
4+ export import :openai;
45
5- import nlohmann.json ;
6+ import std ;
67
7- import mcpplibs.llmapi.url;
8- import mcpplibs.llmapi.openai;
8+ import mcpplibs.llmapi.nlohmann.json;
99
1010namespace mcpplibs ::llmapi {
1111 export using OpenAI = openai::OpenAI;
Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ module;
22
33#include < curl/curl.h>
44
5- export module mcpplibs.llmapi.openai;
5+ export module mcpplibs.llmapi:openai;
6+
7+ export import :url;
68
79import std;
8- import nlohmann.json;
910
10- import mcpplibs.llmapi.url ;
11+ import mcpplibs.llmapi.nlohmann.json ;
1112
1213export namespace mcpplibs ::llmapi::openai {
1314
Original file line number Diff line number Diff line change 1- export module mcpplibs.llmapi. url;
1+ export module mcpplibs.llmapi: url;
22
33import std;
44
Original file line number Diff line number Diff line change @@ -7,24 +7,23 @@ add_requires("libcurl 8.11.0")
77set_languages (" c++23" )
88
99target (" llmapi" )
10- set_kind (" static " )
10+ set_kind (" moduleonly " )
1111 add_files (" src/*.cppm" , { public = true , install = true })
12- add_packages (" libcurl" )
12+ add_packages (" libcurl" , { public = true } )
1313 -- add_deps("__nlohmann_json")
1414 add_includedirs (" src/json" )
1515 add_headerfiles (" src/json/json.hpp" )
1616 add_files (" src/json/json.cppm" , { public = true })
1717 -- relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
1818 -- ld: failed to set dynamic section sizes: bad value
1919 -- collect2: error: ld returned 1 exit status
20- add_cxxflags (" -fPIC" )
20+ -- add_cxxflags("-fPIC")
2121
2222target (" llmapi_c" )
2323 -- set_kind("shared")
2424 set_kind (" static" )
2525 add_files (" src/c/llmapi.cpp" )
2626 add_deps (" llmapi" )
27- add_packages (" libcurl" )
2827 add_includedirs (" include" , { public = true })
2928 add_headerfiles (" include/llmapi.h" )
3029
You can’t perform that action at this time.
0 commit comments