aspect icon indicating copy to clipboard operation
aspect copied to clipboard

World builder separate cmake project

Open MFraters opened this issue 4 years ago • 4 comments

This pull request changes how the world builder is build from an directly taking to source files to using the CmakeLists.txt of the world builder itself to build it. It took a bit of work to get it to compile stabily under different circumstances, but it seems to work now.

I tested it for make (with and without precompiled headers) and ninja (with and without precompiled headers). Ninja seems to better understand what depends on what and can therefore compile more efficently than make. But it would be appreciated if several people could try to compile it on their machines to see if any issues come up.

I also added an extra policy to the world builder cmake file to prevent a warning with cmake 3.18 and a corresponding pull request has been made to the world builder (https://github.com/GeodynamicWorldBuilder/WorldBuilder/pull/206).

Although there is no direct benefit of compiling the world builder separately and linking it as a library (I suspect it might actually be slower to compile in some cases), it will have several benefits in the future including a being able to use unity builds for the world builder in aspect and linking the testers if desired. Future versions of the world builder will also probably allow for greater control over what is exactly build and not build in the world builder project through cmake flags.

MFraters avatar Aug 12 '20 08:08 MFraters

Does this work with unity builds? Do we need to set CMAKE_UNITY_BUILD for WB if ASPECT_UNITY_BUILD is on?

Yes, I actually did most of my testing with unity build.

I am confused how complicated this is and that you need special code for different platforms. Why?

The one of the problems is that I can't use a cmake subdirectory because of conflicting targets names, but even then you will need most of this code. The different platforms are due to the plugin systems within libraries. I don't think there is really a way around it, but this is literally what I use to build applications from the world builder lib and I have many tests for many different platforms in my tester setup.

On a related note, one thing I would like to ask tomorrow during morning round if, especially mac users, can try out whether this compiles for them.

Shouldn't this be a shared library?

I don't see an advantage to that. Could you explain why you think that would be better?

Testing installation of ASPECT is also something we need to do.

What do you mean? Testing whether make install works?

MFraters avatar Aug 12 '20 21:08 MFraters

What should we do with this?

bangerth avatar Apr 26 '22 18:04 bangerth

I don't really feel strongly about it. It would be nice if it would just compile the whole thing as a library (and have the tools as executables), but the current setup works fine, so I am not sure it is worth the time investment at this moment. I am happy to work on this during the hackaton if we think it is useful.

MFraters avatar Apr 26 '22 19:04 MFraters

Let's put this on the TODO list for the hackathon then!

bangerth avatar Apr 26 '22 21:04 bangerth

This was implemented in https://github.com/geodynamics/aspect/pull/5164, so closing this pull request.

MFraters avatar Jul 08 '23 23:07 MFraters