Skip to content
Snippets Groups Projects
Commit 4f5b06bd authored by Grégoire Kubler's avatar Grégoire Kubler Committed by Maxence Naud
Browse files

feat : added alternate build backend option + rm copying version.txt into pkg

parent 92bd3b96
No related branches found
No related tags found
1 merge request!18v0.1.3
......@@ -13,8 +13,9 @@ import toml
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
def get_project_name() -> str:
with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file :
with open(pathlib.Path().absolute() / "pyproject.toml", "r") as file:
project_toml = toml.load(file)
return project_toml["project"]["name"]
......@@ -23,8 +24,8 @@ class CMakeExtension(Extension):
def __init__(self, name):
super().__init__(name, sources=[])
class CMakeBuild(build_ext):
class CMakeBuild(build_ext):
def run(self):
# This lists the number of processors available on the machine
# The compilation will use half of them
......@@ -52,24 +53,29 @@ class CMakeBuild(build_ext):
else os.environ["AIDGE_PYTHON_BUILD_TYPE"]
)
# Impose to use the executable of the python
# used to launch setup.py to setup PythonInterp
install_path = (
os.path.join(sys.prefix, "lib", "libAidge")
if "AIDGE_INSTALL" not in os.environ
else os.environ["AIDGE_INSTALL"]
)
build_gen = (
["-G", os.environ["AIDGE_BUILD_GEN"]]
if "AIDGE_BUILD_GEN" in os.environ
else []
)
self.spawn(
[
"cmake",
*build_gen,
str(cwd),
f"-DPYTHON_EXECUTABLE={sys.executable}",
"-DTEST=OFF",
f"-DCMAKE_INSTALL_PREFIX:PATH={install_path}",
f"-DCMAKE_BUILD_TYPE={compile_type}",
"-DPYBIND=ON",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DCOVERAGE=OFF"
"-DCOVERAGE=OFF",
]
)
......@@ -94,13 +100,8 @@ class CMakeBuild(build_ext):
currentFile = os.path.join(root, file)
shutil.copy(currentFile, str(aidge_package.absolute()))
# Copy version.txt in aidge_package
os.chdir(os.path.dirname(__file__))
shutil.copy("version.txt", str(aidge_package.absolute()))
if __name__ == '__main__':
if __name__ == "__main__":
setup(
include_package_data=True,
ext_modules=[CMakeExtension(get_project_name())],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment