Advertisement
Guest User

Another ugly patch

a guest
Apr 19th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 9.67 KB | None | 0 0
  1. diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
  2. index efdd2f8d..42ba2325 100644
  3. --- a/3rdparty/CMakeLists.txt
  4. +++ b/3rdparty/CMakeLists.txt
  5. @@ -1,6 +1,6 @@
  6.  cmake_minimum_required(VERSION 3.1.0)
  7.  
  8. -if( USE_WEBENGINE )
  9. +if( IS_WEBENGINE )
  10.      include(qhttp.cmake)
  11.  endif()
  12.  include(qite/libqite/libqite.cmake)
  13. diff --git a/CMakeLists.txt b/CMakeLists.txt
  14. index 593ea132..a8a26180 100644
  15. --- a/CMakeLists.txt
  16. +++ b/CMakeLists.txt
  17. @@ -36,9 +36,7 @@ option( ONLY_PLUGINS "Build psi-plus plugins only" OFF )
  18.  option( USE_HUNSPELL "Build psi-plus with hunspell spellcheck" ON )
  19.  option( USE_ENCHANT "Build psi-plus with enchant spellcheck" OFF )
  20.  option( ENABLE_PLUGINS "Enable plugins" OFF )
  21. -option( ENABLE_WEBKIT "Enable webkit/webengine support" ON )
  22. -option( USE_WEBKIT "Use Webkit support instead of WebEngine" OFF )
  23. -option( USE_WEBENGINE "Use WebEngine support instead of Webkit" OFF )
  24. +set( CHAT_TYPE "WEBENGINE" CACHE STRING "Type of chatlog engine. WEBKIT | WEBENGINE | BASIC")
  25.  option( USE_CCACHE "Use ccache utility if found" ON )
  26.  option( VERBOSE_PROGRAM_NAME "Verbose output binary name" OFF ) #Experimental
  27.  option( USE_CRASH "Enable builtin sigsegv handling" OFF )
  28. @@ -79,43 +77,31 @@ set( GLOBAL_DEPENDS_DEBUG_MODE ON )
  29.  
  30.  set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
  31.  
  32. -#Detect QtWebEngine if enabled
  33. -if(ENABLE_WEBKIT)
  34. +set(IS_WEBKIT OFF CACHE BOOL "Use webkit. Interrnal variable")
  35. +set(IS_WEBENGINE OFF CACHE BOOL "Use webengine. Interrnal variable")
  36. +
  37. +if("${CHAT_TYPE}" STREQUAL "WEBKIT")
  38.      add_definitions(
  39.          -DWEBKIT
  40.      )
  41. -    find_package( Qt5Core REQUIRED )
  42. -    find_package( Qt5 COMPONENTS WebEngine QUIET )
  43. -    if(${Qt5Core_VERSION} VERSION_GREATER 5.6.0)
  44. -        if( Qt5WebEngine_FOUND AND (NOT USE_WEBKIT) )
  45. -            set( USE_WEBENGINE ON )
  46. -            add_definitions(
  47. -                -DWEBENGINE=1
  48. -            )
  49. -            message(STATUS "QtWebEngine - enabled")
  50. -        elseif(USE_WEBENGINE)
  51. -            message(FATAL_ERROR "USE_WEBENGINE flag is enabled but Qt5WebEngine package not found!")
  52. -        else()
  53. -            set( USE_WEBENGINE OFF )
  54. -        endif()
  55. -    endif()
  56. -    message(STATUS "Webkit - enabled")
  57. +    set(IS_WEBKIT ON)
  58. +    message(STATUS "Chatlog type - QtWebKit")
  59. +elseif("${CHAT_TYPE}" STREQUAL "WEBENGINE")
  60. +    set(IS_WEBENGINE ON)
  61. +    find_package( Qt5Core 5.6.0 REQUIRED )
  62. +    add_definitions(
  63. +        -DWEBKIT
  64. +        -DWEBENGINE=1
  65. +    )
  66. +    message(STATUS "Chatlog type - QtWebEngine")
  67. +else()
  68. +    set(IS_WEBKIT OFF)
  69. +    set(IS_WEBENGINE OFF)
  70. +    message(STATUS "Chatlog type - Basic")
  71.  endif()
  72.  
  73.  message(STATUS "SQL history - built-in since 1.4.444 version")
  74.  
  75. -if(USE_WEBENGINE AND USE_WEBKIT)
  76. -    message(FATAL_ERROR "Both flags USE_WEBENGINE and USE_WEBKIT cannot be enabled at the same time. Please disable one of them")
  77. -endif()
  78. -
  79. -if(USE_WEBENGINE AND (NOT ENABLE_WEBKIT))
  80. -    message(FATAL_ERROR "USE_WEBENGINE flag is enabled but ENABLE_WEBKIT flag is disabled. Please disable USE_WEBENGINE or enable ENABLE_WEBKIT")
  81. -endif()
  82. -
  83. -if(USE_WEBKIT AND (NOT ENABLE_WEBKIT))
  84. -    message(FATAL_ERROR "USE_WEBKIT flag is enabled but ENABLE_WEBKIT flag is disabled. Please disable USE_WEBKIT or enable ENABLE_WEBKIT")
  85. -endif()
  86. -
  87.  if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
  88.      set(ISDEBUG ON)
  89.  endif()
  90. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  91. index d3c3ac2d..005e5c98 100644
  92. --- a/src/CMakeLists.txt
  93. +++ b/src/CMakeLists.txt
  94. @@ -28,15 +28,14 @@ endif()
  95.  set(TRANSLATIONS_DIR "${PROJECT_SOURCE_DIR}/translations")
  96.  
  97.  find_package(Qt5 COMPONENTS Widgets Core Gui Xml Network Concurrent Multimedia Svg Sql REQUIRED)
  98. -if(ENABLE_WEBKIT)
  99. -    if(NOT USE_WEBENGINE)
  100. -        find_package(Qt5 COMPONENTS WebKit WebKitWidgets REQUIRED)
  101. -        set(WEBKIT_LIBS Qt5::WebKit Qt5::WebKitWidgets)
  102. -    else()
  103. -        find_package(Qt5 COMPONENTS WebEngine WebEngineWidgets WebChannel REQUIRED)
  104. -        set(WEBKIT_LIBS Qt5::WebEngine Qt5::WebEngineWidgets Qt5::WebChannel)
  105. -    endif()
  106. +if(IS_WEBKIT)
  107. +    find_package(Qt5 COMPONENTS WebKit WebKitWidgets REQUIRED)
  108. +    set(WEBKIT_LIBS Qt5::WebKit Qt5::WebKitWidgets)
  109. +elseif(IS_WEBENGINE)
  110. +    find_package(Qt5 COMPONENTS WebEngine WebEngineWidgets WebChannel REQUIRED)
  111. +    set(WEBKIT_LIBS Qt5::WebEngine Qt5::WebEngineWidgets Qt5::WebChannel)
  112.  endif()
  113. +
  114.  if(USE_KEYCHAIN)
  115.      find_package( Qt5 COMPONENTS Keychain QUIET )
  116.      if( Qt5Keychain_FOUND )
  117. @@ -81,7 +80,7 @@ set(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Network Qt5::Xml ${WEBKIT_LIBS} Qt5
  118.  if(LINUX)
  119.      list(APPEND QT_LIBRARIES Qt5::DBus Qt5::X11Extras ${LIBXCB_LIBRARIES})
  120.  endif()
  121. -if(USE_WEBENGINE)
  122. +if(IS_WEBENGINE)
  123.      list(APPEND EXTRA_LIBS qhttp)
  124.  endif()
  125.  if(APPLE)
  126. @@ -137,12 +136,10 @@ endif()
  127.  string(TIMESTAMP PSI_COMPILATION_DATE "%Y-%m-%d")
  128.  string(TIMESTAMP PSI_COMPILATION_TIME "%H:%M:%S")
  129.  
  130. -if(ENABLE_WEBKIT)
  131. -    if(NOT USE_WEBENGINE)
  132. -        set(PSI_VER_SUFFIX ", webkit")
  133. -    else()
  134. -        set(PSI_VER_SUFFIX ", webengine")
  135. -    endif()
  136. +if(IS_WEBKIT)
  137. +    set(PSI_VER_SUFFIX ", webkit")
  138. +elseif(IS_WEBENGINE)
  139. +    set(PSI_VER_SUFFIX ", webengine")
  140.  endif()
  141.  
  142.  if( NOT IS_PSIPLUS )
  143. @@ -192,7 +189,7 @@ if(APPLE)
  144.      add_subdirectory(CocoaUtilities)
  145.  endif()
  146.  
  147. -if(USE_WEBENGINE)
  148. +if(IS_WEBENGINE)
  149.      include_directories(
  150.          ${PROJECT_SOURCE_DIR}/3rdparty
  151.          ${PROJECT_SOURCE_DIR}/3rdparty/http-parser
  152. @@ -314,9 +311,9 @@ include(${PROJECT_SOURCE_DIR}/cmake/modules/fix-codestyle.cmake)
  153.  
  154.  #Experimental feature
  155.  if(VERBOSE_PROGRAM_NAME)
  156. -    if(ENABLE_WEBKIT AND (NOT USE_WEBENGINE))
  157. +    if(IS_WEBKIT)
  158.          set(VERBOSE_SUFFIX "-webkit")
  159. -    elseif(USE_WEBENGINE)
  160. +    elseif(IS_WEBENGINE)
  161.          set(VERBOSE_SUFFIX "-webengine")
  162.      endif()
  163.  endif()
  164. @@ -337,7 +334,7 @@ endif()
  165.  set(STANDARD_NUM 14)
  166.  
  167.  add_dependencies(${PROJECT_NAME} iris)
  168. -if(USE_WEBENGINE)
  169. +if(IS_WEBENGINE)
  170.      add_dependencies(${PROJECT_NAME} qhttp)
  171.  endif()
  172.  add_dependencies(${PROJECT_NAME} build_ui_files)
  173. @@ -350,7 +347,7 @@ if(WIN32 AND MSVC)
  174.          gdi32
  175.          advapi32
  176.      )
  177. -    if(USE_WEBENGINE)
  178. +    if(IS_WEBENGINE)
  179.          list(APPEND EXTRA_LIBS
  180.              imm32
  181.          )
  182. @@ -407,7 +404,7 @@ set(DOC_FILES
  183.  copy("${PROJECT_SOURCE_DIR}/certs/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/certs/" prepare-bin)
  184.  copy("${PROJECT_SOURCE_DIR}/iconsets/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/iconsets/" prepare-bin)
  185.  copy("${PROJECT_SOURCE_DIR}/sound/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sound/" prepare-bin)
  186. -if(ENABLE_WEBKIT)
  187. +if(IS_WEBKIT OR IS_WEBENGINE)
  188.      copy("${PROJECT_SOURCE_DIR}/themes/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/themes/" prepare-bin)
  189.  endif()
  190.  if(ENABLE_PLUGINS AND EXISTS ${PROJECT_SOURCE_DIR}/skins)
  191. @@ -446,7 +443,7 @@ if(LINUX)
  192.              set(PROJECT_OUTPUT_DATA_DIR "${DATA_INSTALL_DIR}/${SHARE_SUFF}")
  193.              install(FILES ${PROJECT_SOURCE_DIR}/client_icons.txt DESTINATION ${PROJECT_OUTPUT_DATA_DIR})
  194.              install(DIRECTORY ${OTHER_FILES} DESTINATION ${PROJECT_OUTPUT_DATA_DIR})
  195. -            if(ENABLE_WEBKIT)
  196. +            if(IS_WEBKIT OR IS_WEBENGINE)
  197.                  install(DIRECTORY ${PROJECT_SOURCE_DIR}/themes DESTINATION ${PROJECT_OUTPUT_DATA_DIR})
  198.              endif()
  199.              if(LANGS_EXISTS)
  200. @@ -482,7 +479,7 @@ if(HAIKU)
  201.      install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX})
  202.      install(FILES ${PROJECT_SOURCE_DIR}/client_icons.txt DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_SUFF})
  203.      install(DIRECTORY ${OTHER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_SUFF})
  204. -    if(ENABLE_WEBKIT)
  205. +    if(IS_WEBKIT OR IS_WEBENGINE)
  206.          install(DIRECTORY ${PROJECT_SOURCE_DIR}/themes DESTINATION ${CMAKE_INSTALL_PREFIX}/${SHARE_SUFF})
  207.      endif()
  208.      if(LANGS_EXISTS)
  209. @@ -495,7 +492,7 @@ if(WIN32)
  210.      if(NOT ONLY_BINARY AND INSTALL_EXTRA_FILES)
  211.          install(FILES ${PROJECT_SOURCE_DIR}/client_icons.txt DESTINATION ${CMAKE_INSTALL_PREFIX})
  212.          install(DIRECTORY ${OTHER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX})
  213. -        if(ENABLE_WEBKIT)
  214. +        if(IS_WEBKIT OR IS_WEBENGINE)
  215.              install(DIRECTORY ${PROJECT_SOURCE_DIR}/themes DESTINATION ${CMAKE_INSTALL_PREFIX})
  216.          endif()
  217.          if(LANGS_EXISTS)
  218. @@ -528,7 +525,7 @@ if(APPLE)
  219.      # end of qca hack
  220.  
  221.      # Special hack for QtWebEngineProcess executable from Homebrew
  222. -    if(USE_WEBENGINE AND HOMEBREW)
  223. +    if(IS_WEBENGINE AND HOMEBREW)
  224.          set(QtWebEngineProcess_path "Versions/5/Helpers/QtWebEngineProcess.app")
  225.          set(QtWebEngineProcess_file "${QtWebEngineProcess_path}/Contents/MacOS/QtWebEngineProcess")
  226.          set(QtWebEngineCore_path "${CLIENT_NAME}.app/Contents/Frameworks/QtWebEngineCore.framework")
  227. @@ -565,7 +562,7 @@ if(APPLE)
  228.              install(FILES ${MACOSX_ICON} DESTINATION "${PROJECT_OUTPUT_DATA_DIR}")
  229.              install(FILES ${PROJECT_SOURCE_DIR}/client_icons.txt DESTINATION "${PROJECT_OUTPUT_DATA_DIR}")
  230.              install(DIRECTORY ${OTHER_FILES} DESTINATION "${PROJECT_OUTPUT_DATA_DIR}")
  231. -            if(ENABLE_WEBKIT)
  232. +            if(IS_WEBKIT OR IS_WEBENGINE)
  233.                  install(DIRECTORY ${PROJECT_SOURCE_DIR}/themes DESTINATION "${PROJECT_OUTPUT_DATA_DIR}")
  234.              endif()
  235.              if(LANGS_EXISTS)
  236. diff --git a/src/src.cmake b/src/src.cmake
  237. index 58c31e24..4addf349 100644
  238. --- a/src/src.cmake
  239. +++ b/src/src.cmake
  240. @@ -470,8 +470,8 @@ list(APPEND SOURCES
  241.      historyimp.cpp
  242.      )
  243.  
  244. -if(ENABLE_WEBKIT)
  245. -    if(USE_WEBENGINE)
  246. +if(IS_WEBKIT OR IS_WEBENGINE)
  247. +    if(IS_WEBENGINE)
  248.          list(APPEND SOURCES
  249.              themeserver.cpp
  250.          )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement