Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

mfem

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Conanfile#4640

pieter-fabri started this conversation inShow and tell
Dec 24, 2024· 2 comments
Discussion options

If anyone would like to integrate MFEM through conan, here is a conanfile:

from conan import ConanFilefrom conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layoutfrom conan.tools.files import get, rmdir, copyimport osclass Package(ConanFile):    name = "mfem"    version = "4.7"    description = "Modular finite element library for scalable scientific computing"    license = "BSD-3-Clause"    url = "https://github.com/mfem/mfem"    settings = "os", "compiler", "build_type", "arch"    options = {        "shared": [True, False],        "mpi": [True, False],        "hypre": [True, False],        "metis": [True, False],        "suite_sparse": [True, False],    }    default_options = {        "shared": False,        "mpi": False,        "hypre": False,        "metis": False,        "suite_sparse": False,    }    def requirements(self):        # Add required dependencies        if self.options.mpi:            self.requires("mpi/1.0")        if self.options.hypre:            self.requires("hypre/2.23.0")        if self.options.metis:            self.requires("metis/5.1.0")        if self.options.suite_sparse:            self.requires("suite-sparse/5.10.1")    def source(self):        get(self, f"https://github.com/mfem/mfem/archive/refs/tags/v{self.version}.tar.gz", strip_root=True)    def layout(self):        cmake_layout(self)    def generate(self):        tc = CMakeToolchain(self)        tc.variables["MFEM_USE_MPI"] = "ON" if self.options.mpi else "OFF"        tc.variables["MFEM_USE_METIS"] = "ON" if self.options.metis else "OFF"        tc.variables["MFEM_USE_SUITESPARSE"] = "ON" if self.options.suite_sparse else "OFF"        tc.variables["BUILD_SHARED_LIBS"] = "ON" if self.options.shared else "OFF"        tc.generate()        deps = CMakeDeps(self)        deps.generate()    def build(self):        cmake = CMake(self)        cmake.configure()        cmake.build()    def package(self):        cmake = CMake(self)        cmake.install()        rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))        rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))        copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses"))    def package_info(self):        self.cpp_info.libs = ["mfem"]        if self.options.mpi:            self.cpp_info.defines.append("MFEM_USE_MPI")
You must be logged in to vote

Replies: 2 comments

Comment options

Thanks for sharing@pieter-fabri

You must be logged in to vote
0 replies
Comment options

Just a small remark: there is no config optionMFEM_USE_HYPRE -- the use of hypre is controlled byMFEM_USE_MPI.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
3 participants
@pieter-fabri@tzanio@v-dobrev

[8]ページ先頭

©2009-2025 Movatter.jp