Out of Source Build

Everything about development and the OpenMW source code.
Locked
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

Out of Source Build

Post by lgromanowski »

Zini wrote: The current version of OpenMW does not support out of source builds without manual copying of files. Also the openmw base directory starts to look a bit cluttered.

Would it be okay to build/configure binaries and associated files to a bin directory instead? That should solve the out of source build problem and will help with cleanup (and probably with CPack usage, if you plan to make use of it).

If you want, I can do the required cmake modifications (was planning to get a bit more practice with cmake anyway).
nicolay wrote: I agree that the dir is a bit cluttered, and out of source builds would also be a nice feature. If you want to help with this that'd be great - my knowledge of CMake is still pretty limited.
Zini wrote: Okay. I will fork and see what I can do about it. I guess I can tackle the problem of header files not showing up in IDE projects as well.

What about handling source files via GLOB? (picking up all files with a certain extension (cpp or hpp) in a directory instead of listing them individually in the CMakeLists)? It takes away only a very tiny bit of control and makes the CMakeLists a lot simpler.
Zini wrote: Out of source build is working now. But you better wait with merging a bit more. I have a couple of other changes I want to make.
nicolay wrote: Great! Found you at http://github.com/zinnschlag/openmw (in case someone else wants to peek.) I'll wait for your go before I start fetching.
Zini wrote: Actually, I did send you a pull request a few minutes ago ;)
nicolay wrote: Thanks, merged in now. I've reverted the change of putting the executable in bin/, if it's all the same to you (unless this is critical to allow out of source builds?)

I'd rather clean up the root dir by putting all the source directories in an src/, although that might just make the cmake file more messy.
Zini wrote: Putting the executable and all associated files into the base directory shouldn't cause any problems, at least as long as you make sure all additional files are handled properly by cmake (as with plugins.cfg now).

Putting all the source-directories into another sub-directory wouldn't be a problem. All you have to do is prefix every file in the "# Local Files" section with the directory name (src/bsa_archive.cpp instead of bsa_archive.cpp) and add this line somewhere in the CMakeLists file:

include_directories("src")
Locked