Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds on 1 CPU #36

Open
yurivict opened this issue Jul 26, 2023 · 2 comments
Open

Builds on 1 CPU #36

yurivict opened this issue Jul 26, 2023 · 2 comments

Comments

@yurivict
Copy link

yurivict commented Jul 26, 2023

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.

@fbergmann
Copy link
Member

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.

@yurivict
Copy link
Author

This works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants