conanfile.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. from conans import ConanFile, tools, CMake
  2. import os
  3. class civetwebConan(ConanFile):
  4. name = "civetweb"
  5. version = "1.9.1"
  6. license = "MIT"
  7. url = "https://github.com/civetweb/civetweb"
  8. description = "Embedded C/C++ web server"
  9. settings = "os", "compiler", "build_type", "arch"
  10. exports_sources = "*"
  11. requires = "OpenSSL/1.0.2@conan/stable"
  12. generators = "cmake"
  13. options = {
  14. "shared" : [True, False],
  15. "enable_ssl" : [True, False],
  16. "enable_websockets" : [True, False],
  17. "enable_cxx" : [True, False]
  18. }
  19. default_options = (
  20. "shared=True",
  21. "enable_ssl=True",
  22. "enable_websockets=True",
  23. "enable_cxx=False",
  24. )
  25. def optionBool(self, b):
  26. if b:
  27. return "ON"
  28. else:
  29. return "OFF"
  30. def parseOptionsToCMake(self):
  31. cmakeOpts = {
  32. "CIVETWEB_BUILD_TESTING" : "OFF"
  33. }
  34. cmakeOpts["BUILD_SHARED_LIBS"] = self.optionBool(self.options.shared)
  35. cmakeOpts["CIVETWEB_ENABLE_SSL"] = self.optionBool(self.options.enable_ssl)
  36. cmakeOpts["CIVETWEB_ENABLE_WEBSOCKETS"] = self.optionBool(self.options.enable_websockets)
  37. cmakeOpts["CIVETWEB_ENABLE_CXX"] = self.optionBool(self.options.enable_cxx)
  38. return cmakeOpts
  39. def build(self):
  40. cmake = CMake(self)
  41. os.makedirs("./buildit")
  42. cmake.configure(defs=self.parseOptionsToCMake(), build_dir="./buildit")
  43. cmake.build()
  44. cmake.install()
  45. def package(self):
  46. # nothing to do here now
  47. pass
  48. def package_info(self):
  49. self.cpp_info.libs = tools.collect_libs(self)