Skip to content
Snippets Groups Projects
Commit 36d784ae authored by Vincent Templier's avatar Vincent Templier
Browse files

Update setup.py and __init__ of aidge to include Core library

parent 95885833
No related branches found
No related tags found
No related merge requests found
import aidge.aidge_core
\ No newline at end of file
...@@ -54,45 +54,43 @@ class CMakeBuild(build_ext): ...@@ -54,45 +54,43 @@ class CMakeBuild(build_ext):
if not build_temp.exists(): if not build_temp.exists():
build_temp.mkdir(parents=True, exist_ok=True) build_temp.mkdir(parents=True, exist_ok=True)
install_temp = cwd / "install"
if not install_temp.exists():
install_temp.mkdir(parents=True, exist_ok=True)
build_lib = pathlib.Path(self.build_lib) build_lib = pathlib.Path(self.build_lib)
if not build_lib.exists(): if not build_lib.exists():
build_lib.mkdir(parents=True, exist_ok=True) build_lib.mkdir(parents=True, exist_ok=True)
os.chdir(str(build_temp)) os.chdir(str(build_temp))
self.spawn(["cmake", # Impose to use the executable of the python
f"-DCMAKE_INSTALL_PREFIX:PATH={install_temp}", # used to launch setup.py to setup PythonInterp
"-DCMAKE_BUILD_TYPE=Debug", "-DWERROR=OFF", param_py = "-DPYTHON_EXECUTABLE=" + sys.executable
"-DPYBIND=ON", str(cwd)])
self.spawn(['cmake', str(cwd), param_py])
if not self.dry_run: if not self.dry_run:
self.spawn(['make', 'all', 'install', '-j', max_jobs]) self.spawn(['make', '-j', max_jobs])
os.chdir(str(cwd)) os.chdir(str(cwd))
aidge_package = build_lib / "aidge"
# Get "aidge" package # Get "aidge" package
ext_lib = build_temp / "core" ext_lib = build_temp / "aidge" / "_Core"
# Copy all shared object files from build_temp/lib to build_lib # Copy all shared object files from build_temp/lib to build_lib
for root, _, files in os.walk(ext_lib.absolute()): for root, _, files in os.walk(ext_lib.absolute()):
for file in files: for file in files:
if file.endswith('.so'): if file.endswith('.so'):
currentFile=os.path.join(root, file) currentFile=os.path.join(root, file)
shutil.copy(currentFile, str(build_lib.absolute())) shutil.copy(currentFile, str(aidge_package.absolute()))
# Get "aidge_ref_cpp" package # Get "aidge cpu" package
ext_lib = build_temp / "module" / "backend" / "ref_cpp" # ext_lib = build_temp / "_CPU"
# Copy all shared object files from build_temp/lib to build_lib # # Copy all shared object files from build_temp/lib to build_lib
for root, _, files in os.walk(ext_lib.absolute()): # for root, _, files in os.walk(ext_lib.absolute()):
for file in files: # for file in files:
if file.endswith('.so'): # if file.endswith('.so'):
currentFile=os.path.join(root, file) # currentFile=os.path.join(root, file)
shutil.copy(currentFile, str(build_lib.absolute())) # shutil.copy(currentFile, str(aidge_package.absolute()))
if __name__ == '__main__': if __name__ == '__main__':
...@@ -106,8 +104,8 @@ if __name__ == '__main__': ...@@ -106,8 +104,8 @@ if __name__ == '__main__':
long_description="\n".join(DOCLINES[2:]), long_description="\n".join(DOCLINES[2:]),
classifiers=[c for c in CLASSIFIERS.split('\n') if c], classifiers=[c for c in CLASSIFIERS.split('\n') if c],
platforms=["Linux"], platforms=["Linux"],
#packages=find_packages(where="."), packages=find_packages(where="."),
ext_modules=[CMakeExtension('_core')], ext_modules=[CMakeExtension('Aidge')],
cmdclass={ cmdclass={
'build_ext': CMakeBuild, 'build_ext': CMakeBuild,
}, },
......
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