Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ cmake-build-debug
!*.toml
!Makefile
!Doxyfile
!*_resource.rc
!conanfile.py

cmake-build-debug/
.idea/
!*_resource.rc
*/internal/*

2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ install(EXPORT mtfmt-targets
NAMESPACE mtfmt::
DESTINATION mtfmt/lib/cmake/mtfmt)

install(TARGETS mtfmt)

# 测试
# enable_testing()

Expand Down
62 changes: 62 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps


class mtfmtRecipe(ConanFile):
name = "mtfmt"
version = "0.1.0"

# Optional metadata
license = "GPLv3"
author = "XiangYyang ", "HalfSweet [email protected]"
url = "https://github.com/MtFmT-Lib/mtfmt"
description = ""
topics = ("")

# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": True, "fPIC": True}

# Sources are located in the same place as this recipe, copy them to the recipe
exports_sources = "CMakeLists.txt", "src/*", "inc/*"

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")

def configure(self):
del self.settings.compiler.cppstd

if(self.settings.compiler != "msvc"):
del self.settings.compiler.libcxx

if self.options.shared:
self.options.rm_safe("fPIC")


def layout(self):
cmake_layout(self)

def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
cmake = CMake(self)
cmake.install()

def package_info(self):
self.cpp_info.libs = ["mtfmt"]