Bootstrap

Linux编译安装Netgen/NGSolve

本文记录Linux下编译安装Netgen/NGSolve的流程。

零、环境

操作系统Ubuntu 22.04.4 LTS
VS Code1.92.1
Git2.34.1
GCC11.4.0
CMake3.22.1
oneAPI2024.2.1

一、安装依赖

1.1 VS Code

下载并安装VS Code,然后安装以下插件,

Task Explorer

Output Colorizer

Git Extension Pack

Git Graph

Remote Developement

Remote X11

Code Runner

C/C++ Extension Pack

C++ TestMate

Modern Fortran

FORTRAN InstelliSense

Fortran Breakpoint Support

Python Extension Pack
C# Dev Kit

Extension Pack for Intel Software Developer Tools

Nsight Visual Studio Code Edition

二、编译安装

2.1 下载源码

git clone https://github.com/NGSolve/ngsolve.git
cd ./ngsolve
git submodule update --init external_dependencies/netgen

附录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": {
            }
        }
    ],
    "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
  },
  {
    "name": "Intel(R) oneAPI DPC++/C++ Compiler 2024.2.1",
    "compilers": {
      "C": "/opt/intel/oneapi/compiler/2024.2/bin/icx",
      "CXX": "/opt/intel/oneapi/compiler/2024.2/bin/icpx"
    },
    "isTrusted": true
  }
]

网络资料

Netgen/NGSolvehttps://ngsolve.org/

;