Sfoglia il codice sorgente

Python: If headeronly is set, links is not needed (#5403)

* python: If headeronly is set, links is not needed

* pybind11: add python_headeronly choice

* change code format

* remove os prefix

* remove verbose doc

* remove `return false`

* add readonly for windows and mingw

---------

Co-authored-by: zhengmy <[email protected]>
Co-authored-by: star9029 <[email protected]>
provefar 1 mese fa
parent
commit
229fa1f2d4
2 ha cambiato i file con 17 aggiunte e 10 eliminazioni
  1. 3 1
      packages/p/pybind11/xmake.lua
  2. 14 9
      packages/p/python/fetch.lua

+ 3 - 1
packages/p/pybind11/xmake.lua

@@ -21,7 +21,9 @@ package("pybind11")
     add_versions("v2.13.1", "a3c9ea1225cb731b257f2759a0c12164db8409c207ea5cf851d4b95679dda072")
 
     add_deps("cmake")
-    if is_plat("macosx") then
+    if is_plat("windows", "mingw") then
+        add_deps("python 3.x", {configs = {headeronly = false}})
+    elseif is_plat("macosx") then
         add_deps("python 3.x", {configs = {headeronly = true}})
     else
         add_deps("python 3.x")

+ 14 - 9
packages/p/python/fetch.lua

@@ -66,15 +66,20 @@ function _find_library(package, opt)
         includepath = find_path("Python.h", { path.directory(exepath), out }, { suffixes = { "include/python" .. pyver } })
     end
 
-    if libpath and includepath then
-        local result = {
-            version = version,
-            includedirs = includepath
-        }
-        if not package:config("headeronly") then
-            result.links = libpath.link
-            result.linkdirs = libpath.linkdir
-        end
+    if not includepath then
+        return
+    end
+    local result = {
+        version = version,
+        includedirs = includepath
+    }
+
+    if package:config("headeronly") then
+        return result
+    end
+    if libpath then
+        result.links = libpath.link
+        result.linkdirs = libpath.linkdir
         return result
     end
 end