70 lines
2.5 KiB
Python
70 lines
2.5 KiB
Python
# 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
|
|
|
|
from conf.versions import *
|
|
|
|
|
|
class Zlib(ConanFile):
|
|
name = "zlib"
|
|
version = ZLIB_VERSION
|
|
settings = "os", "arch", "build_type", "compiler"
|
|
|
|
def requirements(self):
|
|
if self.settings.compiler == "clang":
|
|
self.requires(f"clang-bootstrap/{LLVM_VERSION}@{self.user}/{self.channel}")
|
|
elif self.settings.compiler == "gcc":
|
|
self.requires(f"gcc/latest@{self.user}/{self.channel}")
|
|
self.tool_requires(f"gcc/latest@{self.user}/{self.channel}")
|
|
|
|
self.requires(f"cmake/{CMAKE_VERSION}@{self.user}/{self.channel}")
|
|
self.requires(f"ninja/{NINJA_VERSION}@{self.user}/{self.channel}")
|
|
|
|
def source(self):
|
|
get(
|
|
self,
|
|
f"https://github.com/zlib-ng/zlib-ng/archive/{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):
|
|
cmake = CMake(self)
|
|
cmake.configure(
|
|
{"BUILD_SHARED_LIBS": False, "ZLIB_COMPAT": True},
|
|
build_script_folder=f"zlib-ng-{self.version}",
|
|
)
|
|
cmake.build()
|
|
cmake.install()
|
|
|
|
def package_info(self):
|
|
self.cpp_info.set_property("cmake_find_mode", "both")
|
|
self.cpp_info.set_property("cmake_file_name", "ZLIB")
|
|
self.cpp_info.set_property("cmake_target_name", "ZLIB::ZLIB")
|
|
self.cpp_info.set_property("pkg_config_name", "zlib")
|
|
self.cpp_info.libs = ["z"]
|
|
self.cpp_info.set_property("cmake_find_package", "ZLIB")
|
|
self.cpp_info.set_property("cmake_find_package_multi", "ZLIB")
|