mini_portile
mini_portile copied to clipboard
Support for projects requiring out of source cmake builds
Some projects (in my case OSRM) has prevented in-source builds. Some projects do it in order to avoid conflicts with files and otherwise keep the build data separate from source files.
It seems that mini_portile does in-source builds only. Would it be possible to at least allow configuration of the build dir?
Hi @Smarre, thanks for asking this question.
I'd like to better understand what you're asking for. Can you give me an example of a mini_portile recipe that demonstrates the problem you're describing?
Hi,
cmake has builtin support for configuring the build directory. For example considering the shorthands ”cmake .” and ”cmake ..”, former would configure the build using data from current directory and latter would be configuring with CMakeLists.txt from parent directory.
This allows a common workflow used in CMake projects:
mkdir build
cd build
cmake ..
make
This way the build files do not pollute the project directory, and also possible namespace collisions shouldn’t happen, as they may happen if built in the project tree. It also allows easy cleanup of build data: rm -r build
Due to these reasons, some projects forbids building in-source. I’ve also seen a project that only allows in-source builds for some strange reason, which is why the build type needs to be configurable in some way.
Specifically, this line https://github.com/flavorjones/mini_portile/blob/f0f6b7d447e8516cb6da649b7c80a1bca43bb330/lib/mini_portile2/mini_portile_cmake.rb#L22 is saying to build the cmake project in-source, with ”cmake .”.
Hi @Smarre,
I'm familiar with cmake allowing builds in a separate directory. I'm asking these questions to better understand your particular issue, though. Can you help me understand by providing a mini_portile recipe that demonstrates the issue you're trying to solve?
Well, the whole thing is visible here: https://github.com/Smarre/ruby-libosrm/blob/master/ext/libosrm/extconf.rb
@Smarre It looks like MiniPortile has been patched in that project. I haven't looked at the details, but I was wondering if you wanted to open a PR for the fix?
@Smarre Just poking -- if you wanted to submit a PR that fixes this for you, I'd be happy to review and collaborate!