SgSummary.cmake 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #.rst:
  2. # SgSummary
  3. # ---------
  4. #
  5. # Building summary.
  6. #
  7. # Summarizes the building options and prints it on screen.
  8. # _
  9. # ___ __ _ __ _ _ _(_)
  10. # / __|/ _` |/ _` | | | | |
  11. # \__ \ (_| | (_| | |_| | |
  12. # |___/\__,_|\__, |\__,_|_|
  13. # |___/
  14. #
  15. # Cross-platform library which helps to develop web servers or frameworks.
  16. #
  17. # Copyright (C) 2016-2020 Silvio Clecio <[email protected]>
  18. #
  19. # Sagui library is free software; you can redistribute it and/or
  20. # modify it under the terms of the GNU Lesser General Public
  21. # License as published by the Free Software Foundation; either
  22. # version 2.1 of the License, or (at your option) any later version.
  23. #
  24. # Sagui library is distributed in the hope that it will be useful,
  25. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  27. # Lesser General Public License for more details.
  28. #
  29. # You should have received a copy of the GNU Lesser General Public
  30. # License along with Sagui library; if not, write to the Free Software
  31. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  32. #
  33. if(__SG_SUMMARY_INCLUDED)
  34. return()
  35. endif()
  36. set(__SG_SUMMARY_INCLUDED ON)
  37. set(_system_name "${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR}")
  38. if(NOT ${_system_name} MATCHES "${CMAKE_C_PLATFORM_ID}")
  39. string(CONCAT _system_name ${_system_name} " (${CMAKE_C_PLATFORM_ID})")
  40. endif()
  41. string(TOUPPER "${CMAKE_BUILD_TYPE}" _BUILD_TYPE)
  42. string(CONCAT _cflags "${CMAKE_C_FLAGS_${_BUILD_TYPE}}" " ${CMAKE_C_FLAGS}")
  43. string(REPLACE " " " " _cflags "${_cflags}")
  44. unset(_BUILD_TYPE)
  45. if(CMAKE_SIZEOF_VOID_P MATCHES "8")
  46. set(_build_arch "x86_64")
  47. else()
  48. set(_build_arch "i686")
  49. endif()
  50. if(CMAKE_BUILD_TYPE)
  51. set(_build_type ${CMAKE_BUILD_TYPE})
  52. else()
  53. set(_build_type "None")
  54. endif()
  55. if(BUILD_SHARED_LIBS)
  56. set(_lib_type "shared")
  57. else()
  58. set(_lib_type "static")
  59. endif()
  60. if(${_build_type} MATCHES "[Dd]ebug|DEBUG")
  61. set(_is_debug ON)
  62. endif()
  63. if(${_build_type} MATCHES "[Rr]elease|RELEASE")
  64. set(_is_release ON)
  65. endif()
  66. if(SG_HTTPS_SUPPORT)
  67. if(GNUTLS_FOUND)
  68. set(_https_support "Yes")
  69. else()
  70. set(_https_support "No (missing library: GnuTLS)")
  71. endif()
  72. else()
  73. set(_https_support "No")
  74. endif()
  75. if(SG_HTTP_COMPRESSION)
  76. set(_http_compression "Yes")
  77. else()
  78. set(_http_compression "No")
  79. endif()
  80. if(SG_PATH_ROUTING)
  81. set(_routing "Yes")
  82. else()
  83. set(_routing "No")
  84. endif()
  85. if(SG_MATH_EXPR_EVAL)
  86. set(_expr "Yes")
  87. else()
  88. set(_expr "No")
  89. endif()
  90. if(SG_BUILD_EXAMPLES)
  91. set(_build_examples "Yes")
  92. if(SG_EXAMPLES)
  93. string(CONCAT _build_examples ${_build_examples} " (${SG_EXAMPLES})")
  94. string(REPLACE ";" ", " _build_examples "${_build_examples}")
  95. endif()
  96. else()
  97. set(_build_examples "No")
  98. endif()
  99. if(SG_BUILD_HTML AND SG_GENERATE_HTML)
  100. if(_is_release)
  101. set(_build_html "Yes")
  102. else()
  103. set(_build_html "No (unavailable in build type: ${_build_type})")
  104. endif()
  105. else()
  106. set(_build_html "No")
  107. endif()
  108. if(BUILD_TESTING)
  109. if(_is_debug)
  110. set(_build_testing "Yes")
  111. if(SG_TESTS)
  112. string(CONCAT _build_testing ${_build_testing} " (${SG_TESTS})")
  113. string(REPLACE ";" ", " _build_testing "${_build_testing}")
  114. endif()
  115. else()
  116. set(_build_testing
  117. "${_build_testing} (unavailable in build type: ${_build_type})")
  118. endif()
  119. else()
  120. set(_build_testing "No")
  121. endif()
  122. if(CURL_VERSION_STRING AND CURL_LIBRARY)
  123. string(COMPARE GREATER_EQUAL ${CURL_VERSION_STRING} "7.56" _curl)
  124. if(_curl)
  125. set(_curl "Yes")
  126. else()
  127. set(_curl "No (requires 7.56 or higher)")
  128. endif()
  129. else()
  130. set(_curl "No")
  131. endif()
  132. message(
  133. "
  134. Sagui library ${VERSION} - building summary:
  135. Generator: ${CMAKE_GENERATOR}
  136. Install: ${CMAKE_INSTALL_PREFIX}
  137. System: ${_system_name}
  138. Compiler details:
  139. Executable: ${CMAKE_C_COMPILER}
  140. Version: ${CMAKE_C_COMPILER_VERSION}
  141. Machine: ${CMAKE_C_MACHINE}
  142. CFLAGS: ${_cflags}
  143. Build: ${_build_type}-${_build_arch} (${_lib_type})
  144. Additional features:
  145. HTTPS support: ${_https_support}
  146. HTTP compression: ${_http_compression}
  147. Path routing: ${_routing}
  148. Math expression evaluator: ${_expr}
  149. Examples: ${_build_examples}
  150. Docs: ${_build_html}
  151. Run tests: ${_build_testing}
  152. cURL tests: ${_curl}
  153. ")
  154. unset(_system_name)
  155. unset(_cflags)
  156. unset(_build_type)
  157. unset(_build_arch)
  158. unset(_lib_type)
  159. unset(_https_support)
  160. unset(_http_compression)
  161. unset(_routing)
  162. unset(_expr)
  163. unset(_build_examples)
  164. unset(_build_html)
  165. unset(_build_testing)
  166. unset(_curl)