mini_portile icon indicating copy to clipboard operation
mini_portile copied to clipboard

Support for projects requiring out of source cmake builds

Open Smarre opened this issue 7 years ago • 6 comments

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?

Smarre avatar Oct 16 '17 14:10 Smarre

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?

flavorjones avatar Nov 27 '17 17:11 flavorjones

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 .”.

Smarre avatar Nov 28 '17 09:11 Smarre

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?

flavorjones avatar Feb 05 '18 04:02 flavorjones

Well, the whole thing is visible here: https://github.com/Smarre/ruby-libosrm/blob/master/ext/libosrm/extconf.rb

Smarre avatar Feb 05 '18 09:02 Smarre

@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?

flavorjones avatar Sep 10 '23 17:09 flavorjones

@Smarre Just poking -- if you wanted to submit a PR that fixes this for you, I'd be happy to review and collaborate!

flavorjones avatar May 31 '24 18:05 flavorjones