coin-or / Clp

COIN-OR Linear Programming Solver
Other
396 stars 82 forks source link

Do config.h need be created in the source tree? #230

Closed mlangiu closed 2 years ago

mlangiu commented 2 years ago

Hi,

I am currently working on some code for our deterministic global solver MAiNGO which uses CLP as a submodule. The repository setup works well for me when I'm developing on one machine only, however, I frequently need to switch between different computers and also operating systems. To avoid having to commit and pull all the time, I only cloned the repository on my main computer and synched it with the other computers via an online tool. This tool by default ignores certain hidden files and folders, so that, e.g., the .git folder and .gitignore are not synched, and as a consequnce the copies of the code on the other machines are not recognized as git repositories. While I realize that synching a git repo may not be the cleanest solution, it allows for changes in the source to be almost immediately available on the other systems, which is very convenient as it allows rapid switching and works well except for one minor issue:

When building on a secondary machine, the current setup of CLP, i.e., generating

Clp/src/config.h
CoinUtils/src/config.h

which are ignored in git repos via .gitignore, does not work for me and the files overwrite the respective versions on my main machine.

Of course I have multiple options to deal with this:

but I wonder if it wouldn't be possible (and cleaner) to generate the config.h in the build tree, only, instead of the source tree.

Kind Regards and thanks for the great work.

svigerske commented 2 years ago

The config.h files are generated in the build tree. So if you do not use the source directory also as build directory, then the source tree is not modified by a build.

mlangiu commented 2 years ago

Hmm do you know whether this was also the case for earlier versions? We're currently using CLP 1.17.0.

We also have IPOPT as a dependency and incorporate it the same way as CLP (via add_subdirectory(${PROJECT_SOURCE_DIR}/dep/${DEPENDENCY}) in our CMakeLists.txt). For IPOPT we do get a config.h file in our build folder (in {build}\dep\ipopt\IpoptConfig\include), but for CLP the files are created in {source}\dep\clp\CLP-1.17.0\... instead.

It could of course be that we've set something up wrong, if you think this is the case, I'm sorry for bothering.

svigerske commented 2 years ago

You seem to use some variant of Clp from https://git.rwth-aachen.de/avt-svt/public/thirdparty/clp, not the original Clp from coin-or/Clp. You will have to check with the avt-svt people on how their cmake setup works.

If you get https://github.com/coin-or/Clp/tree/releases/1.17.0 and run configure from a directory different from the source tree, the config.h will be created in a subdir of the one where configure was run from.

mlangiu commented 2 years ago

Ok thanks, for the info. I'll try to figure out what we're doing different.