File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[build-system ]
2- requires = [" setuptools" ]
2+ requires = [" setuptools>=64 " ]
33build-backend = " setuptools.build_meta"
44
55[project ]
Original file line number Diff line number Diff line change 11add_rules (" mode.debug" , " mode.release" )
22add_requires (" boost" , {configs = {stacktrace = true }})
3- add_requires (" pybind11" )
43
54-- Define color codes
65local GREEN = ' \27 [0;32m'
@@ -570,7 +569,26 @@ target("_infinicore")
570569
571570 set_default (false )
572571 add_rules (" python.library" , {soabi = true })
573- add_packages (" pybind11" )
572+ -- Use the active Python environment; xmake's pybind11 package self-test
573+ -- links libpython and breaks when Python is built as a static library.
574+ on_load (function (target )
575+ local script = table.concat ({
576+ " import sysconfig" ,
577+ " import pybind11" ,
578+ " print(sysconfig.get_path('include'))" ,
579+ " print(pybind11.get_include())" ,
580+ }, " ; " )
581+
582+ local includedirs = os .iorunv (" python3" , {" -c" , script })
583+ assert (includedirs ~= " " , " pybind11 is required in the active Python environment to build the Python bindings" )
584+
585+ for _ , includedir in ipairs (includedirs :split (" \n " )) do
586+ includedir = includedir :trim ()
587+ if includedir ~= " " and includedir ~= " None" then
588+ target :add (" includedirs" , includedir )
589+ end
590+ end
591+ end )
574592 set_languages (" cxx17" )
575593
576594 add_deps (" infinicore_cpp_api" )
You can’t perform that action at this time.
0 commit comments