python-libsbml icon indicating copy to clipboard operation
python-libsbml copied to clipboard

Builds on 1 CPU

Open yurivict opened this issue 2 years ago • 2 comments

The build should allow to be configured to work with multiple CPUs. There are -parallel [<jobs>] and -j [<jobs>] cmake arguments.

I've added this patch to the FreeBSD port as a workaround:

--- setup.py.orig       2023-05-25 10:49:17 UTC
+++ setup.py
@@ -248,7 +248,7 @@ class CMakeBuild(build_ext):
                              '-DWITH_LIBXML=OFF',
                          ]
                          )
-              self.spawn(['cmake', '--build', '.', '--target', 'install'] + build_args)
+              self.spawn(['cmake', '--build', '.', '-j', os.getenv('FREEBSD_MAKE_JOBS'), '--target', 'install'] + build_args)
               os.chdir(cwd)
             DEP_DIR = dep_inst_dir

@@ -297,7 +297,7 @@ class CMakeBuild(build_ext):
         os.chdir(build_temp)
         self.spawn(['cmake', SRC_DIR] + cmake_args)
         if not self.dry_run:
-            self.spawn(['cmake', '--build', '.', '--target', 'binding_python_lib'] + build_args)
+            self.spawn(['cmake', '--build', '.', '-j', os.getenv('FREEBSD_MAKE_JOBS'), '--target', 'binding_python_lib'] + build_args)

             # at this point the build should be complete, and we have all the files 
             # neeed in the temp build_folder

You can make it work in a similar way but with checking if the environment variable exists.

yurivict avatar Jul 26 '23 05:07 yurivict

could you try to set the CMAKE_BUILD_PARALLEL_LEVEL environment variable instead? if you set it to FREEBSD_MAKE_JOBS, it should default to that number.

fbergmann avatar Jul 26 '23 06:07 fbergmann

This works.

yurivict avatar Jul 26 '23 07:07 yurivict