Skip to content

Commit

Permalink
windows下HDF5, mysql改用下载依赖包的方式
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Jan 5, 2022
1 parent 1940ca1 commit d0c8262
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 18 deletions.
21 changes: 21 additions & 0 deletions hikyuu_extern_libs/packages/h/hdf5/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package("hdf5")

set_homepage("https://www.hdfgroup.org/solutions/hdf5/")
set_description("High-performance data management and storage suite")
set_license("BSD-3-Clause")

if is_plat("windows") then
add_urls("https://gitee.com/fasiondog/hikyuu/attach_files/935347/download/hdf5-$(version)-win-x64.zip")
add_versions("1.10.4", "253b23baada1d9c86cb4424595eba366b6844c384a5e0aafebf0893a1148f25f")
end

on_load(function (package)
package:add("defines", "H5_BUILT_AS_DYNAMIC_LIB")
end)

on_install("windows", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
os.cp("bin", package:installdir())
end)

21 changes: 21 additions & 0 deletions hikyuu_extern_libs/packages/h/hdf5_D/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package("hdf5_D")

set_homepage("https://www.hdfgroup.org/solutions/hdf5/")
set_description("High-performance data management and storage suite")
set_license("BSD-3-Clause")

if is_plat("windows") then
add_urls("https://gitee.com/fasiondog/hikyuu/attach_files/935348/download/hdf5_D-$(version)-win-x64.zip")
add_versions("1.10.4", "5b1bd27e054f885bf9cac0beffcacbe180e251c5d8c12c0652a96055f2784b46")
end

on_load("windows", function (package)
package:add("defines", "H5_BUILT_AS_DYNAMIC_LIB")
end)

on_install("windows", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
os.cp("bin", package:installdir())
end)

16 changes: 16 additions & 0 deletions hikyuu_extern_libs/packages/m/mysql/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package("mysql")

set_homepage("https://dev.mysql.com/doc/refman/5.7/en/")
set_description("Open source relational database management system.")

if is_plat("windows") then
add_urls("https://gitee.com/fasiondog/hikyuu/attach_files/935339/download/mysql-$(version)-win-x64.zip")
add_versions("8.0.21", "de21694aa230a00b52b28babbce9bb150d990ba1f539edf8d193586dce3844ae")
end

on_install("windows", function (package)
os.cp("include", package:installdir())
os.cp("lib", package:installdir())
os.cp("bin", package:installdir())
end)

12 changes: 1 addition & 11 deletions hikyuu_pywrap/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ target("core")
local dst_dir = "$(projectdir)/hikyuu/cpp/"
if is_plat("windows") then
os.cp(target:targetdir() .. '/core.pyd', dst_dir)
os.cp(target:targetdir() .. '/hikyuu.dll', dst_dir)
os.cp(target:targetdir() .. '/sqlite3.dll', dst_dir)
os.cp(target:targetdir() .. '/*.dll', dst_dir)
elseif is_plat("macosx") then
os.cp(target:targetdir() .. '/core.so', dst_dir)
os.cp(target:targetdir() .. '/libhikyuu.dylib', dst_dir)
Expand All @@ -135,15 +134,6 @@ target("core")
os.cp("$(env BOOST_LIB)/libboost_python3*.dylib", dst_dir)
os.cp("$(env BOOST_LIB)/libboost_serialization*.dylib", dst_dir)
os.cp("$(env BOOST_LIB)/libboost_system*.dylib", dst_dir)

if is_plat("windows") then
if is_mode("release") then
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/hdf5.pkg/lib/$(mode)/$(plat)/$(arch)/*.dll", dst_dir)
else
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/hdf5_D.pkg/lib/$(mode)/$(plat)/$(arch)/*.dll", dst_dir)
end
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/mysql.pkg/lib/$(mode)/$(plat)/$(arch)/*.dll", dst_dir)
end
end)


6 changes: 0 additions & 6 deletions scripts/before_run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ function main(target)

if is_plat("windows") then
os.cp("$(env BOOST_LIB)/boost_*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
if is_mode("release") then
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/hdf5.pkg/lib/$(mode)/$(plat)/$(arch)/*.dll","$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
else
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/hdf5_D.pkg/lib/$(mode)/$(plat)/$(arch)/*.*","$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
end
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/mysql.pkg/lib/$(mode)/$(plat)/$(arch)/*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
end

--if is_plat("linux") then
Expand Down
13 changes: 12 additions & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ set_languages("cxx17", "C99")

add_plugindirs("./xmake_plugins")

local hdf5_version = "1.10.4"
local mysql_version = "8.0.21"
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)
end

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"}})
Expand Down Expand Up @@ -86,7 +98,6 @@ end

-- for the windows platform (msvc)
if is_plat("windows") then
add_packagedirs("./hikyuu_extern_libs/pkg")
-- add some defines only for windows
add_defines("NOCRYPT", "NOGDI")
add_cxflags("-EHsc", "/Zc:__cplusplus", "/utf-8")
Expand Down

0 comments on commit d0c8262

Please sign in to comment.