You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

conanfile.py 1.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from conans import ConanFile, CMake, tools
  2. class JsonclibConan(ConanFile):
  3. name = "json-c"
  4. version = "0.13"
  5. description = "JSON-C - A JSON implementation in C"
  6. topics = ("conan", "json-c", "json", "encoding", "decoding", "manipulation")
  7. url = "https://github.com/elear-solutions/json-c"
  8. license = "<Put the package license here>"
  9. generators = "cmake"
  10. settings = "os", "compiler", "build_type", "arch"
  11. options = {
  12. "shared": [True, False],
  13. "fPIC": [True, False]
  14. }
  15. default_options = {key: False for key in options.keys()}
  16. default_options ["shared"] = False
  17. default_options ["fPIC"] = True
  18. def config_options(self):
  19. if self.settings.os == "Windows":
  20. del self.options.fPIC
  21. def configure(self):
  22. del self.settings.compiler.libcxx
  23. del self.settings.compiler.cppstd
  24. def _configure_cmake(self):
  25. if tools.cross_building(self.settings) and self.settings.os != "Windows":
  26. host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch))
  27. tools.replace_in_file("../CMakeLists.txt",
  28. "execute_process(COMMAND ./configure ",
  29. "execute_process(COMMAND ./configure --host %s " % host)
  30. cmake = CMake(self)
  31. cmake.configure(source_folder=".")
  32. return cmake
  33. def build(self):
  34. cmake = self._configure_cmake()
  35. cmake.build()
  36. cmake.install()
  37. def package(self):
  38. self.copy("*.h", dst="include/json-c", src="package/include/json-c")
  39. self.copy("*", dst="lib", src="package/lib", keep_path=False)
  40. def package_info(self):
  41. self.cpp_info.libs = [ "json-c" ]