randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.52k stars 558 forks source link

configure.py drops build.ninja in the repository root #4232

Open learn-more opened 1 month ago

learn-more commented 1 month ago

Reproduction steps (Win10, VS2022, Python 3.12):

The build.ninja is placed in the repository root instead of in the build folder

This results in some build artifacts also being dropped in the repository root (when building):

dir /B
.clang-format
.github
.gitignore
.ninja_deps
.ninja_log
botan-3.lib
botan-cli.exe
botan-test.exe
build
build.ninja
configure.py
doc
license.txt
news.rst
readme.rst
src
reneme commented 1 month ago

That's just how it has always been. You can run ./configure.py from another location (much like you would typically do with cmake), to build out-of-source:

mkdir my_build
cd my_build
../configure.py --build-tool=ninja
ninja

Another option is $(pwd)/configure.py --with-build-dir=<...>, but that seems to not work properly, if configure.py isn't called with an absolute path (i.e. the $(pwd)). I'll look into that next week.

learn-more commented 1 month ago

That's just how it has always been. You can run ./configure.py from another location (much like you would typically do with cmake), to build out-of-source:

mkdir my_build
cd my_build
../configure.py --build-tool=ninja
ninja

Another option is $(pwd)/configure.py --with-build-dir=<...>, but that seems to not work properly, if configure.py isn't called with an absolute path (i.e. the $(pwd)). I'll look into that next week.

That is quite surprising behavior, because when you specify an output dir for cmake (cmake -B build) it will put all files there, not just 'most' files.

reneme commented 1 month ago

With #4245 ./configure.py --with-build-dir= (which is the equivalent of cmake -B) should work as expected now. It should not drop any generated files into the repository root, when running .

If you invoke configure.py from a different directory (as stated above), the build won't drop anything into the repo root either. And this has been the case for a while now. As mentioned, calling the configure script from some other (empty) directory, should be a viable workaround for the broken --with-build-dir= up to and including Botan 3.5.0.

learn-more commented 1 month ago

With #4245 ./configure.py --with-build-dir= (which is the equivalent of cmake -B) should work as expected now. It should not drop any generated files into the repository root, when running .

If you invoke configure.py from a different directory (as stated above), the build won't drop anything into the repo root either. And this has been the case for a while now. As mentioned, calling the configure script from some other (empty) directory, should be a viable workaround for the broken --with-build-dir= up to and including Botan 3.5.0.

I can confirm that this does work for my case.

mkdir botan\build
pushd botan\build
python3 ../configure.py --cc=msvc --os=windows --build-tool=ninja --disable-shared-library --prefix=install
ninja install
popd

It does create a build/build folder, but other than that, the install is inside the build folder as expected so for now this works for me, thanks!

image

reneme commented 1 month ago

It does create a build/build folder, but other than that, the install is inside the build folder as expected so for now this works for me, thanks!

Yeah, the build/build folder is expected. That's just how our build system works. It uses this as hard-coded scratch space inside the custom build location you define.