scikit-build
scikit-build copied to clipboard
Support out-of-source build
I'm trying to make an out of source build. but I can't set the build path. It's always builds to the directory, _skbuild.
I've tried using --bdist-dir c:\some\other\path\on\my\system when generating a wheel but this seems to be ignored.
Thanks for the report.
The option --bdist-dir
is not supported yet.
It's always builds to the directory, _skbuild.
If that helps, in the next release, build directory will be like _skbuild/platform-X.Y
where platform
and X.Y
matches the python version used to build the wheel.
See http://scikit-build.readthedocs.io/en/latest/changes.html#next-release
I notices that. Unfortunately, it doesn't help me in my case.
In the meantime, is it possible to create _skbuild as a subdirectory inside the default "build" folder just like the other Python build system do, for consistency.
In the meantime, is it possible to create _skbuild as a subdirectory inside the default "build" folder just like the other Python build system do, for consistency.
Good idea
The following code would have to be updated along with the tests:
https://github.com/scikit-build/scikit-build/blob/d5fa09fb28caddad73f7a7f141969cdda28266b4/skbuild/constants.py#L10-L13
Would be great if you could contribute a patch.
it doesn't help me in my case.
Now to support --bdist-dir
, you would have to update _parse_setuptools_arguments
and update the variable SKBUILD_DIR
referenced above.
https://github.com/scikit-build/scikit-build/blob/d5fa09fb28caddad73f7a7f141969cdda28266b4/skbuild/setuptools_wrap.py#L117-L144
Also, could you describe your use case ?
Waiting this feature is implemented, that would help identify a workaround and/or update the documentation.
Good idea. I'll take a look and see if I can write and contribute a patch.
For my use case... I'm using my main CMake script to call python setup.py as a custom_target to generate a bdist wheel with compiled extensions.
Basically my workflow:
- Run my main CMakelists which executes Python on my setup.py as a custom target with the flags so that they build and destination folders reside in the CMAKE_BINARY_DIR
- Scikit build uses the CMakeLists.txt to build and link my c++ extension.
- A Wheel in generated.
- I use that wheel as part of my larger project or do whatever with it.
This works very well for the most part, except when I'm using CMake directly, I want to keep my source tree clean while having all binary and generated files placed into another directory located elsewhere. If I have to wipe everything out and start a build over from scratch, I can just delete the projects build folder and start again . This workflow hasn't been a problem with setuptools based projects with the correct flags set. However, since the current version of Scikit Build always generates a build folder in the same folder as the source, I have to manually clean it up. It's not a huge deal but it can sometimes be annoying if I forget.
with setuptools based projects with the correct flags set
Are you only using --bdist-dir
? Or are you also specifying flags like --egg-base
, --dist-dir
, ... ?
Would it work for you with scikit-build accept a parameter named --skbuild-dir=/path/to/skbuild
?
You could then ensure the source tree remains clean by specifying --skbuild-dir
, --egg-base
and --dist-dir
To simplify, we could also have --egg-base
automatically set if --skbuild-dir
is provided.
I’m only creating a bdist wheel and an sdist. I’ve never used —egg-base.
Thanks for clarifying.
I mentioned —egg-base
because without specifying it, a directory ending with .egg-info
is always created in the source directory.
To ensure the source directory remains untouched, based on my experiment it needs to be specified when building wheels.
I am expecting this feature also. In my case, there are three python (conda) environments (py3.6, py3.6, py3.7) and there is a need to use skbuild to install cpp/py code in all these envi's. But the generated _skbuild dir will be the same if the python versions are the same.
Thanks.
I'm also running into a use case where having the ability to override "_skbuild" would be useful.
I'm building manylinux2010 wheels, so the docker container ends up writing to _skbuild
with root permissions. I currently work around this by simply changing the permissions of the _skbuild folder inside docker, but it would be nice if I could simply tell scikit-build to write the build files to a different directory. (of course I could always copy the source directory somewhere do all the docker build there and selectively copy things back, but I think a scikit-build option might be cleaner)
Ugly, but you can monkey patch this with something like:
import skbuild.constants
def SKBUILD_DIR():
return os.path.join(
"/tmp",
"{}-{}".format(skbuild.constants._SKBUILD_PLAT_NAME, '.'.join(map(str, sys.version_info[:2]))),
)