neams-th-coe / cardinal

High-Fidelity Multiphysics
https://cardinal.cels.anl.gov/
Other
84 stars 39 forks source link

Suggestion to Transition Cardinal Project to CMake #896

Open ahnaf-tahmid-chowdhury opened 1 month ago

ahnaf-tahmid-chowdhury commented 1 month ago

Description

The Cardinal project currently relies on a Makefile-based build system. While this approach has served us well, I propose transitioning to CMake to improve build management, support for cross-platform development, and integration with modern IDEs.

Proposed Plan

  1. Initial Setup:

    • Create a basic CMakeLists.txt file at the root of the project to start configuring the build process.
    • Gradually convert existing Makefile logic into CMake format, ensuring each step is well-documented and thoroughly tested.
  2. Define Project Structure:

    • Structure the CMake configuration to reflect the logical organization of the project.
  3. Integrate External Dependencies:

    • Use CMake’s find_package() and ExternalProject_Add() commands to handle third-party dependencies like MOOSE, NekRS, OpenMC, etc.
aprilnovak commented 1 month ago

Hi @ahnaf-tahmid-chowdhury, I'd like to get @milljm's thoughts on this, since he may have some important insights into the make/CMake compatibility (since MOOSE relies on make but OpenMC and NekRS leverage CMake).

ahnaf-tahmid-chowdhury commented 1 month ago

I noticed that MOOSE uses autotools for configuration. In this context, we can use ExternalProject_Add to build MOOSE if the user requests it. We can also upgrade to autotools, but in that case, I am not very familiar with it, since it is also becoming old nowadays.

milljm commented 1 month ago

I am flattered, but I don't think I know enough to carry a weighted opinion either way. 😊

I believe top level packages built using CMake are easier to integrate with non CMake projects. And I know we (the MOOSE group) talked about switching to CMake in the past. Although I forget the reasons for it.

Being that @permcody knows more about autotools, I think he should weigh in.

permcody commented 1 month ago

There are a few Cmake projects that rely on MOOSE these days and work without issue. If it makes sense for Cardinal to change, then we can work with you to give you what you need from our build system. Let us know!

ahnaf-tahmid-chowdhury commented 1 month ago

We are developing a simulation lab named NukeLab that runs nuclear physics simulations and analyses effortlessly in the cloud. We are using Docker containers to serve different nuclear projects. Since Cardinal has advanced capabilities for working with CAD geometries, we are considering adding this tool to our project.

It seems that building with make takes time, so we are considering using CMake to leverage ninja as well. Additionally, it appears there is no versioning mechanism in place. Therefore, we are hoping to come up with a more robust solution to minimize future maintenance efforts.

permcody commented 1 month ago

There should be no speed difference between make and Cmake.