Add the zstd package
This commit is contained in:
parent
8c339d6e81
commit
6b4942cfb2
|
@ -0,0 +1,74 @@
|
|||
# Toolchain builder for the Serene programming language
|
||||
#
|
||||
# Copyright (c) 2019-2023 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
|
||||
from conan.tools.files import get, copy
|
||||
|
||||
from conf.versions import *
|
||||
|
||||
|
||||
class Zstd(ConanFile):
|
||||
name = "zstd"
|
||||
version = ZSTD_VERSION
|
||||
settings = "os", "arch", "build_type", "compiler"
|
||||
exports = "*.cmake"
|
||||
cmake_setup_file = "zlib_setup.cmake"
|
||||
|
||||
def requirements(self):
|
||||
self.tool_requires(f"cmake/{CMAKE_VERSION}@{self.user}/{self.channel}")
|
||||
self.tool_requires(f"ninja/{NINJA_VERSION}@{self.user}/{self.channel}")
|
||||
|
||||
def source(self):
|
||||
get(
|
||||
self,
|
||||
f"https://github.com/facebook/zstd/archive/v{self.version}.tar.gz",
|
||||
)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["BUILD_SHARED_LIBS"] = False
|
||||
tc.generate()
|
||||
deps = CMakeDeps(self)
|
||||
deps.generate()
|
||||
|
||||
def build(self):
|
||||
print("AAAA ", self.settings.compiler)
|
||||
cmake = CMake(self)
|
||||
cmake.configure(
|
||||
{
|
||||
"CMAKE_C_COMPILER": self.settings.compiler,
|
||||
"CMAKE_CXX_COMPILER": self.settings.compiler,
|
||||
"BUILD_SHARED_LIBS": False,
|
||||
"ZSTD_BUILD_STATIC": True,
|
||||
"ZSTD_BUILD_SHARED": False,
|
||||
"CMAKE_POSITION_INDEPENDENT_CODE": "ON",
|
||||
},
|
||||
build_script_folder=f"zstd-{self.version}/build/cmake/",
|
||||
)
|
||||
cmake.build()
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
# self.cpp_info.set_property("cmake_build_modules", [self.cmake_setup_file])
|
||||
self.cpp_info.set_property("cmake_find_mode", "module")
|
||||
self.cpp_info.set_property("cmake_file_name", "zstd::libzstd_static")
|
||||
self.cpp_info.set_property("cmake_target_name", "zstd::libzstd_static")
|
||||
self.cpp_info.set_property("pkg_config_name", "zstd")
|
||||
self.cpp_info.libs = ["zstd"]
|
||||
self.cpp_info.set_property("cmake_find_package", "zstd::libzstd_static")
|
||||
self.cpp_info.set_property("cmake_find_package_multi", "zstd::libzstd_static")
|
Loading…
Reference in New Issue