mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-11-29 18:39:10 +08:00
linux下使用预编译的线程安全版本hdf5依赖库,不再使用linux自带安装的非线程安全版本
This commit is contained in:
parent
eeabb584a1
commit
627583e116
10
.gitignore
vendored
10
.gitignore
vendored
@ -62,4 +62,12 @@ vs2013
|
||||
vs2015
|
||||
cover_report
|
||||
cover*.info
|
||||
*.gcno
|
||||
*.gcno
|
||||
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
|
||||
|
@ -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!");
|
||||
|
@ -39,19 +39,21 @@ 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")
|
||||
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("mysqlclient")
|
||||
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 +72,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 +125,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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
],
|
||||
},
|
||||
|
10
xmake.lua
10
xmake.lua
@ -39,18 +39,20 @@ 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"
|
||||
|
||||
add_repositories("project-repo hikyuu_extern_libs")
|
||||
if is_plat("windows") then
|
||||
add_repositories("project-repo hikyuu_extern_libs")
|
||||
-- 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)
|
||||
end
|
||||
|
||||
-- add_requires("fmt 8.1.1", {system=false, configs = {header_only = true}})
|
||||
@ -63,7 +65,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::libmysqlclient-dev", "apt::libsqlite3-dev")
|
||||
elseif is_plat("macosx") then
|
||||
add_requires("brew::hdf5")
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user