conanfile.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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=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. "CIVETWEB_ENABLE_LUA" : "OFF",
  34. "CIVETWEB_ENABLE_SERVER_EXECUTABLE" : "OFF",
  35. "CIVETWEB_INSTALL_EXECUTABLE" : "OFF"
  36. }
  37. cmakeOpts["BUILD_SHARED_LIBS"] = self.optionBool(self.options.shared)
  38. cmakeOpts["CIVETWEB_ENABLE_SSL"] = self.optionBool(self.options.enable_ssl)
  39. cmakeOpts["CIVETWEB_ENABLE_WEBSOCKETS"] = self.optionBool(self.options.enable_websockets)
  40. cmakeOpts["CIVETWEB_ENABLE_CXX"] = self.optionBool(self.options.enable_cxx)
  41. return cmakeOpts
  42. def build(self):
  43. cmake = CMake(self)
  44. os.makedirs("./buildit")
  45. cmake.configure(defs=self.parseOptionsToCMake(), build_dir="./buildit")
  46. cmake.build()
  47. cmake.install()
  48. def package(self):
  49. # nothing to do here now
  50. pass
  51. def package_info(self):
  52. self.cpp_info.libs = tools.collect_libs(self)