hikyuu2/scripts/before_run.lua
2018-09-12 01:14:16 +08:00

49 lines
2.4 KiB
Lua

import("core.project.config")
function main(target)
local targetname = target:name()
if targetname ~= "demo" and targetname ~= "unit-test" then
return
end
if "demo" == targetname then
local with_demo = config.get("with-demo")
if not with_demo then
raise("You need to config first: xmake f --with-demo=y")
end
end
if "unit-test" == targetname then
local with_test = config.get("with-unit-test")
if with_test then
print("copying test_data ...")
os.rm("$(buildir)/$(mode)/$(plat)/$(arch)/lib/test_data")
os.cp("$(projectdir)/test_data", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
else
raise("You need to config first: xmake f --with-unit-test=y")
end
end
if is_plat("windows") then
os.cp("$(env BOOST_LIB)/boost_date_time*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/boost_filesystem*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/boost_python3*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/boost_serialization*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/boost_system*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/boost_unit_test_framework*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/hdf5.pkg/lib/release/$(plat)/$(arch)/*.dll","$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/mysql.pkg/lib/release/$(plat)/$(arch)/*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
else
local boostlib = val("env BOOST_LIB")
if boostlib ~= "" then
os.cp("$(env BOOST_LIB)/libboost_date_time*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/libboost_filesystem*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/libboost_python3*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/libboost_serialization*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/libboost_system*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
os.cp("$(env BOOST_LIB)/libboost_unit_test_framework*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
end
end
end