sqlite3 切换至xmake repo

This commit is contained in:
fasiondog 2021-04-04 16:38:26 +08:00
parent 9d09b01f29
commit 0d5f7bf312
5 changed files with 30 additions and 12 deletions

View File

@ -6,6 +6,9 @@ target("hikyuu")
end
add_packages("fmt", "spdlog", "flatbuffers", "nng", "nlohmann_json", "cpp-httplib")
if is_plat("windows") then
add_packages("sqlite3")
end
add_includedirs("..")
@ -28,10 +31,7 @@ target("hikyuu")
end
if is_plat("windows") then
add_defines("SQLITE_API=__declspec(dllimport)")
add_defines("HKU_API=__declspec(dllexport)")
add_includedirs("../../hikyuu_extern_libs/src/sqlite3")
add_deps("sqlite3")
if is_mode("release") then
add_packages("hdf5")
else
@ -94,7 +94,30 @@ You need to specify where the boost library is via the BOOST_LIB variable!]])
after_build(function(target)
if is_plat("linux") then
os.cp("$(env BOOST_LIB)/libboost_*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
end
end
-- 不同平台的库后缀名
local lib_suffix = ".so"
if is_plat("windows") then
lib_suffix = ".dll"
elseif is_plat("macosx") then
lib_suffix = ".dylib"
end
local libdir = get_config("buildir") .. "/" .. get_config("mode") .. "/" .. get_config("plat") .. "/" .. get_config("arch") .. "/lib"
-- 将依赖的库拷贝至build的输出目录
for libname, pkg in pairs(target:pkgs()) do
local pkg_path = pkg:get("includedirs")
if pkg_path == nil then
pkg_path = pkg:get("sysincludedirs") -- xmake 2.3.9 改为了 sysincludedirs
end
if pkg_path and type(pkg_path) == "string" then
pkg_lib_dir = string.sub(pkg_path, 0, string.len(pkg_path)-7) .. "bin"
if pkg_lib_dir then
os.trycp(pkg_lib_dir .. "/*" .. lib_suffix, libdir)
end
end
end
end)
target_end()

View File

@ -20,10 +20,7 @@ target("hkuserver")
end
if is_plat("windows") then
add_defines("SQLITE_API=__declspec(dllimport)")
add_defines("HKU_API=__declspec(dllimport)")
add_includedirs("../../hikyuu_extern_libs/src/sqlite3")
add_deps("sqlite3")
add_packages("mysql")
end

@ -1 +1 @@
Subproject commit 5171f7cfebc729e2b31953c4f74a467a7494a9ad
Subproject commit 5f879f41f37ba4901c3686ab59084eaafbfda399

View File

@ -6,5 +6,5 @@ function main(target)
return
end
-- 目前什么也不做,改变 xmake install 的默认行为
-- 目前什么也不做,但需要保留,以便改变 xmake install 的默认行为
end

View File

@ -36,6 +36,7 @@ set_languages("cxx17", "C99")
add_plugindirs("./xmake_plugins")
add_requires("sqlite3", {configs = {shared=true, vs_runtime="MD", cxflags="-fPIC"}})
add_requires("fmt", {system=false, configs = {header_only = true, vs_runtime = "MD"}})
add_requires("spdlog", {system=false, configs = {header_only = true, fmt_external=true, vs_runtime = "MD"}})
add_requires("flatbuffers", {system=false, configs = {vs_runtime="MD"}})
@ -103,9 +104,6 @@ end
add_vectorexts("sse", "sse2", "sse3", "ssse3", "mmx", "avx")
if is_plat("windows") then
add_subdirs("./hikyuu_extern_libs/src/sqlite3")
end
add_subdirs("./hikyuu_cpp/hikyuu")
add_subdirs("./hikyuu_pywrap")
add_subdirs("./hikyuu_cpp/unit_test")