Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX build error when build on windows + venv #154

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions hikyuu_pywrap/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ target("core")
-- find python include and libs directory
local pydir = os.iorun("python -c \"import sys; print(sys.executable)\"")
pydir = path.directory(pydir)
if pydir:endswith("Scripts") then
-- if venv is activated, find the real python directory
file = io.open(pydir .. "/../pyvenv.cfg", "r")
for line in file:lines() do
if string.find(line, "home =") then
-- 使用 string.gmatch 函数抽取路径
for path in string.gmatch(line, "home = (.*)") do
pydir = path
end
end
end
file:close()
end
target:add("includedirs", pydir .. "/include")
target:add("linkdirs", pydir .. "/libs")
return
Expand Down
Loading