Merge branch 'master' of https://github.com/fasiondog/hikyuu into develop

This commit is contained in:
fasiondog 2022-11-13 20:06:50 +08:00
commit 73e3a5d1c7
11 changed files with 71 additions and 51 deletions

13
.gitignore vendored
View File

@ -13,6 +13,8 @@
*.dll
*.lib
*.so
*.so.*
*.so.*.*
*.dylib
.metadata
.settings
@ -62,4 +64,13 @@ vs2013
vs2015
cover_report
cover*.info
*.gcno
*.gcno
vsxmake*
hikyuu/cpp/libhku_hdf5_cpp.so.200
hikyuu/cpp/libhku_hdf5_cpp.so.200.2.0
hikyuu/cpp/libhku_hdf5_hl_cpp.so.200
hikyuu/cpp/libhku_hdf5_hl_cpp.so.200.1.0
hikyuu/cpp/libhku_hdf5_hl.so.200
hikyuu/cpp/libhku_hdf5_hl.so.200.1.0
hikyuu/cpp/libhku_hdf5.so.200
hikyuu/cpp/libhku_hdf5.so.200.2.0

View File

@ -76,6 +76,13 @@ Linux下需安装依赖的开发软件包hdf-dev、mysqlclient。如 Ubuntu
.. code-block:: shell
sudo apt-get install -y libhdf5-dev libhdf5-serial-dev libmysqlclient-dev
6、转 Visual Studio 工程
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Windows 下,习惯用 msvc 调试的,可以使用 xmake project -k vsxmake -m "debug,release" 命令生成 VS 工程。命令执行后,会在当前目录下生成如 vsxmake2022 的子目录VS工程位于其内。
在 VS 内,可以将 demo 设为启动工程,进行调试。
编译与安装

View File

@ -30,7 +30,7 @@ public:
}
virtual bool canParallelLoad() override {
#if defined(H5_HAVE_WIN_THREADS)
#if defined(H5_HAVE_THREADSAFE)
return true;
#else
HKU_WARN("Current hdf5 library is not thread-safe!");

View File

@ -39,19 +39,17 @@ target("hikyuu")
end
if is_plat("linux") then
if os.exists("/usr/include/hdf5") then
add_includedirs("/usr/include/hdf5")
add_includedirs("/usr/include/hdf5/serial")
end
add_packages("hdf5", "mysql")
if is_arch("x86_64") then
if os.exists("/usr/lib64/mysql") then
add_linkdirs("/usr/lib64/mysql")
end
if os.exists("/usr/lib/x86_64-linux-gnu") then
add_linkdirs("/usr/lib/x86_64-linux-gnu")
add_linkdirs("/usr/lib/x86_64-linux-gnu/hdf5/serial")
end
end
add_links("sqlite3")
add_links("boost_date_time")
add_links("boost_filesystem")
add_links("boost_serialization")
add_links("boost_system")
end
if is_plat("macosx") then
@ -70,25 +68,18 @@ target("hikyuu")
add_rpathdirs("/usr/local/mysql/lib")
end
add_links("mysqlclient")
add_links("sqlite3")
add_links("boost_date_time")
add_links("boost_filesystem")
add_links("boost_serialization")
add_links("boost_system")
end
if is_plat("windows") then
-- nng 静态链接需要的系统库
add_syslinks("ws2_32", "advapi32")
end
if is_plat("linux") or is_plat("macosx") then
add_links("sqlite3")
add_links("hdf5")
add_links("hdf5_hl")
add_links("hdf5_cpp")
add_links("mysqlclient")
add_links("boost_date_time")
add_links("boost_filesystem")
add_links("boost_serialization")
add_links("boost_system")
end
-- add files
add_files("./**.cpp")
@ -130,15 +121,12 @@ You need to specify where the boost library is via the BOOST_LIB variable!]])
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
local pkg_path = pkg:installdir()
if pkg_path ~= nil then
print("copy dependents: " .. pkg_path)
os.trycp(pkg_path .. "/bin/*" .. lib_suffix, libdir)
os.trycp(pkg_path .. "/lib/*" .. lib_suffix, libdir)
os.trycp(pkg_path .. "/lib/*.so.*", libdir)
end
end
end)

View File

@ -26,12 +26,7 @@ target("hkuserver")
end
if is_plat("linux") then
if is_arch("x86_64") then
if os.exists("/usr/lib64/mysql") then
add_linkdirs("/usr/lib64/mysql")
end
add_linkdirs("/usr/lib/x86_64-linux-gnu")
end
add_packages("mysql")
end
if is_plat("macosx") then

View File

@ -9,15 +9,21 @@ package("hdf5")
"https://gitee.com/fasiondog/hikyuu/releases/download/1.1.9/hdf5-$(version)-win-x64.zip")
add_versions("1.12.2", "388d455c917b153f3410e8ca0c857ee37a575d859a70ecb6e16d4fb43b1d201c")
add_versions("1.10.4", "253b23baada1d9c86cb4424595eba366b6844c384a5e0aafebf0893a1148f25f")
elseif is_plat("linux") then
add_urls("https://github.com/fasiondog/hikyuu/releases/download/1.1.9/hdf5-$(version)-linux-x64.zip",
"https://gitee.com/fasiondog/hikyuu/releases/download/1.1.9/hdf5-$(version)-linux-x64.zip")
add_versions("1.12.2", "8a6b571168481fba273e1f0c7838d417f38222b5d93250388d2ddff5ff7f2611")
end
on_load(function (package)
on_load("windows", "linux", function (package)
package:add("defines", "H5_BUILT_AS_DYNAMIC_LIB")
end)
on_install("windows", function (package)
on_install("windows", "linux", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
os.cp("bin", package:installdir())
if package:is_plat("windows") then
os.cp("bin", package:installdir())
end
end)

View File

@ -7,6 +7,7 @@ package("hdf5_D")
if is_plat("windows") then
add_urls("https://github.com/fasiondog/hikyuu/releases/download/1.1.9/hdf5_D-$(version)-win-x64.zip",
"https://gitee.com/fasiondog/hikyuu/releases/download/1.1.9/hdf5_D-$(version)-win-x64.zip")
add_versions("1.12.2", "6ea3ab5a4b0bb0f48eaef28cfe747ac5c072c06519a4888c1a59cfaf75399049")
add_versions("1.10.4", "5b1bd27e054f885bf9cac0beffcacbe180e251c5d8c12c0652a96055f2784b46")
end

View File

@ -7,11 +7,17 @@ package("mysql")
add_urls("https://github.com/fasiondog/hikyuu/releases/download/1.1.9/mysql-$(version)-win-x64.zip",
"https://gitee.com/fasiondog/hikyuu/attach_files/935339/download/mysql-$(version)-win-x64.zip")
add_versions("8.0.21", "de21694aa230a00b52b28babbce9bb150d990ba1f539edf8d193586dce3844ae")
elseif is_plat("linux") then
add_urls("https://github.com/fasiondog/hikyuu/releases/download/1.1.9/mysql-$(version)-linux-x86_64.zip",
"https://gitee.com/fasiondog/hikyuu/releases/download/1.1.9/mysql-$(version)-linux-x86_64.zip")
add_versions("8.0.31", "d739f5ddeaf1b4674a6863a965e4e85f2d038b5c0699a5bfbf2338d267b31658")
end
on_install("windows", function (package)
on_install("windows", "linux", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
os.cp("bin", package:installdir())
if package:is_plat("windows") then
os.cp("bin", package:installdir())
end
end)

View File

@ -115,8 +115,8 @@ target("core")
os.cp(target:targetdir() .. '/core.so', dst_dir)
os.cp(target:targetdir() .. '/libhikyuu.dylib', dst_dir)
else
os.cp(target:targetdir() .. '/core.so', dst_dir)
os.cp(target:targetdir() .. '/libhikyuu.so', dst_dir)
os.trycp(target:targetdir() .. '/*.so', dst_dir)
os.trycp(target:targetdir() .. '/*.so.*', dst_dir)
end
os.cp("$(env BOOST_LIB)/boost_date_time*.dll", dst_dir)

View File

@ -102,7 +102,7 @@ setup(
'': [
'*.rst', '*.pyd', '*.ini', '*.sql', '*.properties', '*.xml',
'LICENSE.txt', '*.dll', '*.exe', '*.ico', '*.so', '*.dylib',
'*.qm', 'libboost_serialization*',
'*.so.*', '*.qm', 'libboost_serialization*',
'libboost_python{}*'.format(py_version)
],
},

View File

@ -39,18 +39,24 @@ end
-- set language: C99, c++ standard
set_languages("cxx17", "C99")
add_plugindirs("./xmake_plugins")
local hdf5_version = "1.12.2"
local mysql_version = "8.0.21"
local mysql_version = "8.0.31"
if is_plat("windows") then
add_repositories("project-repo hikyuu_extern_libs")
mysql_version = "8.0.21"
end
add_repositories("project-repo hikyuu_extern_libs")
if is_plat("windows") then
-- add_repositories("project-repo hikyuu_extern_libs")
if is_mode("release") then
add_requires("hdf5 " .. hdf5_version)
else
add_requires("hdf5_D " .. hdf5_version)
end
add_requires("mysql " .. mysql_version)
elseif is_plat("linux") then
add_requires("hdf5 " .. hdf5_version)
add_requires("mysql " .. mysql_version)
end
-- add_requires("fmt 8.1.1", {system=false, configs = {header_only = true}})
@ -63,7 +69,7 @@ add_requires("cpp-httplib", {system=false})
add_requires("zlib", {system=false})
if is_plat("linux") and linuxos.name() == "ubuntu" then
add_requires("apt::libhdf5-dev", "apt::libmysqlclient-dev", "apt::libsqlite3-dev")
add_requires("apt::libsqlite3-dev")
elseif is_plat("macosx") then
add_requires("brew::hdf5")
else