mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-11-30 02:48:57 +08:00
update
This commit is contained in:
parent
6023e84817
commit
029bd68252
@ -91,12 +91,12 @@ package("boost")
|
||||
linkname = "boost_" .. libname
|
||||
end
|
||||
if libname == "python" then
|
||||
if (not package:is_cross()) and package:config("use_system_pythone") then
|
||||
linkname = linkname .. get_system_python_versin()
|
||||
if package:is_cross() or (not package:config("use_system_python")) then
|
||||
linkname = linkname .. package:config("python_version"):gsub("%p+", "")
|
||||
else
|
||||
linkname = linkname .. package:config("python_version")
|
||||
linkname = linkname .. get_system_python_versin():gsub("%p+", "")
|
||||
end
|
||||
end
|
||||
end
|
||||
if package:config("multi") then
|
||||
linkname = linkname .. "-mt"
|
||||
end
|
||||
@ -125,6 +125,9 @@ package("boost")
|
||||
package:add("links", get_linkname(package, lib))
|
||||
end
|
||||
else
|
||||
print("*************************")
|
||||
print(get_linkname(package, libname))
|
||||
print("*************************")
|
||||
package:add("links", get_linkname(package, libname))
|
||||
end
|
||||
end
|
||||
@ -136,15 +139,25 @@ package("boost")
|
||||
-- linux 下当前环境如果安装了 anaconda,这里依赖 python 会导致被连接到 anaconda 的 libstdc++
|
||||
-- 造成单元测试链接失败(包括 xmake 的 on_test 失败),强制在当前环境下不依赖 python,由程序自己链接
|
||||
if package:config("python") then
|
||||
if package:is_cross() then
|
||||
package:add("deps", "python " .. package:config("python_version") .. ".x")
|
||||
elseif (not package:config("use_system_python")) then
|
||||
local sys_pyver = get_system_python_versin()
|
||||
local pyver = package:config("python_version")
|
||||
if sys_pyver ~= pyver then
|
||||
package:add("deps", "python " .. package:config("python_version") .. ".x")
|
||||
end
|
||||
if not package:config("shared") then
|
||||
print(package:config("shared"))
|
||||
package:add("defines", "BOOST_PYTHON_STATIC_LIB")
|
||||
end
|
||||
if package:is_cross() or (not package:config("use_system_python")) then
|
||||
package:add("deps", "python " .. package:config("python_version") .. ".x")
|
||||
else
|
||||
package:add("deps", "python " .. get_system_python_versin() .. ".x")
|
||||
end
|
||||
|
||||
-- if package:is_cross() then
|
||||
-- package:add("deps", "python " .. package:config("python_version") .. ".x")
|
||||
-- elseif (not package:config("use_system_python")) then
|
||||
-- local sys_pyver = get_system_python_versin()
|
||||
-- local pyver = package:config("python_version")
|
||||
-- if sys_pyver ~= pyver then
|
||||
-- package:add("deps", "python " .. package:config("python_version") .. ".x")
|
||||
-- end
|
||||
-- end
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -44,35 +44,35 @@ target("core")
|
||||
|
||||
add_rpathdirs("$ORIGIN", "$ORIGIN/lib", "$ORIGIN/../lib")
|
||||
|
||||
on_load(function(target)
|
||||
-- detect installed python3
|
||||
import("lib.detect.find_tool")
|
||||
local python = assert(find_tool("python3", {version = true}), "python not found, please install it first! note: python version must > 3.0")
|
||||
assert(python.version > "3", python.version .. " python version must > 3.0, please use python3.0 or later!")
|
||||
local pyver = python.version:match("%d+.%d+")
|
||||
if (get_config("use_system_python") or pyver == get_config("pyver")) and not is_plat("cross") then
|
||||
if is_plat("windows") then
|
||||
local pydir = os.iorun(python.program .. " -c \"import sys; print(sys.executable)\"")
|
||||
pydir = path.directory(pydir)
|
||||
target:add("includedirs", pydir .. "/include")
|
||||
target:add("linkdirs", pydir .. "/libs")
|
||||
target:add("links", "boost_python"..pyvergsub("%p+", "").."-mt")
|
||||
return
|
||||
else
|
||||
if is_plat("macosx") then
|
||||
local libdir = os.iorun("python3-config --prefix"):trim() .. "/lib"
|
||||
target:add("linkdirs", libdir)
|
||||
target:add("links", "python" .. pyver)
|
||||
end
|
||||
-- on_load(function(target)
|
||||
-- -- detect installed python3
|
||||
-- import("lib.detect.find_tool")
|
||||
-- local python = assert(find_tool("python3", {version = true}), "python not found, please install it first! note: python version must > 3.0")
|
||||
-- assert(python.version > "3", python.version .. " python version must > 3.0, please use python3.0 or later!")
|
||||
-- local pyver = python.version:match("%d+.%d+")
|
||||
-- if (get_config("use_system_python") or pyver == get_config("pyver")) and not is_plat("cross") then
|
||||
-- if is_plat("windows") then
|
||||
-- local pydir = os.iorun(python.program .. " -c \"import sys; print(sys.executable)\"")
|
||||
-- pydir = path.directory(pydir)
|
||||
-- target:add("includedirs", pydir .. "/include")
|
||||
-- target:add("linkdirs", pydir .. "/libs")
|
||||
-- target:add("links", "boost_python"..pyvergsub("%p+", "").."-mt")
|
||||
-- return
|
||||
-- else
|
||||
-- if is_plat("macosx") then
|
||||
-- local libdir = os.iorun("python3-config --prefix"):trim() .. "/lib"
|
||||
-- target:add("linkdirs", libdir)
|
||||
-- target:add("links", "python" .. pyver)
|
||||
-- end
|
||||
|
||||
-- get python include directory.
|
||||
local pydir = try { function () return os.iorun("python3-config --includes"):trim() end }
|
||||
assert(pydir, "python3-config not found!")
|
||||
target:add("cxflags", pydir)
|
||||
target:add("links", "boost_python"..pyver:gsub("%p+", "").."-mt")
|
||||
end
|
||||
end
|
||||
end)
|
||||
-- -- get python include directory.
|
||||
-- local pydir = try { function () return os.iorun("python3-config --includes"):trim() end }
|
||||
-- assert(pydir, "python3-config not found!")
|
||||
-- target:add("cxflags", pydir)
|
||||
-- target:add("links", "boost_python"..pyver:gsub("%p+", "").."-mt")
|
||||
-- end
|
||||
-- end
|
||||
-- end)
|
||||
|
||||
after_build(function(target)
|
||||
if is_plat("macosx") then
|
||||
|
10
xmake.lua
10
xmake.lua
@ -62,7 +62,6 @@ elseif is_plat("macosx") then
|
||||
add_requires("brew::hdf5")
|
||||
end
|
||||
|
||||
|
||||
add_requires("boost " .. boost_version, {system=false,
|
||||
configs = {
|
||||
shared=is_plat("windows") and true or false,
|
||||
@ -76,6 +75,8 @@ add_requires("boost " .. boost_version, {system=false,
|
||||
use_system_python = get_config("use_system_python"),
|
||||
}})
|
||||
|
||||
add_requireconfs("boost.python", {override = true, configs = {shared = true}})
|
||||
|
||||
-- add_requires("fmt 8.1.1", {system=false, configs = {header_only = true}})
|
||||
add_requires("spdlog", {system=false, configs = {header_only = true, fmt_external=true, vs_runtime = "MD"}})
|
||||
add_requireconfs("spdlog.fmt", {override = true, version = "8.1.1", configs = {header_only = true}})
|
||||
@ -92,9 +93,10 @@ set_objectdir("$(buildir)/$(mode)/$(plat)/$(arch)/.objs")
|
||||
set_targetdir("$(buildir)/$(mode)/$(plat)/$(arch)/lib")
|
||||
|
||||
-- modifed to use boost static library, except boost.python, serialization
|
||||
if is_plat("windows") then
|
||||
add_defines("BOOST_ALL_DYN_LINK")
|
||||
end
|
||||
-- if is_plat("windows") then
|
||||
-- add_defines("BOOST_ALL_DYN_LINK")
|
||||
-- end
|
||||
add_defines("BOOST_ALL_DYN_LINK")
|
||||
|
||||
-- is release now
|
||||
if is_mode("release") then
|
||||
|
Loading…
Reference in New Issue
Block a user