libigl-python-bindings icon indicating copy to clipboard operation
libigl-python-bindings copied to clipboard

[feature request] pass build options like -j8 as args to setup.py develop

Open alecjacobson opened this issue 2 years ago • 1 comments

right now, -j2 is hard-coded.

alecjacobson avatar Feb 25 '22 22:02 alecjacobson

I suggest using CMAKE_BUILD_PARALLEL_LEVEL or build_ext.parallel

# Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level
# across all generators.
if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ:
    # self.parallel is a Python 3 only way to set parallel jobs by hand
    # using -j in the build_ext call, not supported by pip or PyPA-build.
    if hasattr(self, "parallel") and self.parallel:
        # CMake 3.12+ only.
        build_args += ["-j{}".format(self.parallel)]

https://github.com/pybind/cmake_example/blob/ce0ea77878522a85da0be13cf9e425626d05827e/setup.py#L94

nodtem66 avatar Feb 26 '22 03:02 nodtem66

#164 introduced this via MAX_JOBS environment variables (matching pytorch I think). If CMAKE_BUILD_PARALLEL_LEVEL is more standard then we should use that (please submit a PR if you'd like).

alecjacobson avatar Feb 06 '23 00:02 alecjacobson