conanfile.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. from conans import ConanFile, tools, CMake
  2. import os
  3. class civetwebConan(ConanFile):
  4. name = "civetweb"
  5. version = "1.10"
  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=False",
  21. "enable_ssl=True",
  22. "enable_websockets=True",
  23. "enable_cxx=True",
  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. "CIVETWEB_ENABLE_LUA" : "OFF",
  34. "CIVETWEB_ENABLE_SERVER_EXECUTABLE" : "OFF",
  35. "CIVETWEB_INSTALL_EXECUTABLE" : "OFF",
  36. "CIVETWEB_ENABLE_ASAN" : "OFF"
  37. }
  38. cmakeOpts["BUILD_SHARED_LIBS"] = self.optionBool(self.options.shared)
  39. cmakeOpts["CIVETWEB_ENABLE_SSL"] = self.optionBool(self.options.enable_ssl)
  40. cmakeOpts["CIVETWEB_ENABLE_WEBSOCKETS"] = self.optionBool(self.options.enable_websockets)
  41. cmakeOpts["CIVETWEB_ENABLE_CXX"] = self.optionBool(self.options.enable_cxx)
  42. return cmakeOpts
  43. def build(self):
  44. cmake = CMake(self)
  45. os.makedirs("./buildit")
  46. cmake.configure(defs=self.parseOptionsToCMake(), build_dir="./buildit")
  47. cmake.build()
  48. cmake.install()
  49. def package(self):
  50. # nothing to do here now
  51. pass
  52. def package_info(self):
  53. self.cpp_info.libs = tools.collect_libs(self)