Linux下编译MFEM

时间:2024-11-18 21:59:09

本文记录在Linux下编译MFEM的过程。

零、环境

操作系统 Ubuntu 22.04.4 LTS
VS Code 1.92.1
Git 2.34.1
GCC 11.4.0
CMake 3.22.1
Boost 1.74.0
oneAPI 2024.2.1

一、安装依赖

二、编译代码

附录I: CMakeUserPresets.json

{
    "version": 4,
    "configurePresets": [
        {
            "name": "linux_default",
            "hidden": true,
            "displayName": "Default Linux Config",
            "description": "Default build using Unix Makefiles generator",
            "generator": "Unix Makefiles",
            "binaryDir": "${sourceDir}/out/build/${presetName}",
            "cacheVariables": {
                "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
                "CMAKE_BUILD_TYPE": "Debug"
            }
        },
        {
            "name": "linux_gcc",
            "inherits": "linux_default",
            "displayName": "linux_gcc",
            "description": "Using compilers: C = /usr/bin/gcc, CXX = /usr/bin/g++",
            "cacheVariables": {
                "CMAKE_C_COMPILER": "/usr/bin/gcc",
                "CMAKE_CXX_COMPILER": "/usr/bin/g++",
                "CMAKE_MAKE_PROGRAM": "/usr/bin/make",
                "MKL_INTERFACE": "lp64"
            },
            "environment": {
                "KRATOS_APPLICATIONS": "applications/FluidDynamicsApplication;applications/FreeSurfaceApplication"
            }
        }
    ],
    "buildPresets": [
        {
            "name": "linux_gcc",
            "displayName": "linux_gcc",
            "description": "Using compilers: C = /usr/bin/gcc, CXX = /usr/bin/g++",
            "configurePreset": "linux_gcc"
        }
    ]
}

附录II:cmake-tools-kits.json

[
  {
    "name": "GCC 11.4.0 x86_64-linux-gnu",
    "compilers": {
      "C": "/usr/bin/gcc",
      "CXX": "/usr/bin/g++"
    },
    "isTrusted": true
}

网络资料

MFEMhttps://mfem.org/