Advertisement
KukuRuzo

cmake changes

Apr 5th, 2024
1,307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 28.45 KB | None | 0 0
  1. diff --git a/cmake/modules/psi-cmake-functions.cmake b/cmake/modules/psi-cmake-functions.cmake
  2. new file mode 100644
  3. index 00000000..b8fb3836
  4. --- /dev/null
  5. +++ b/cmake/modules/psi-cmake-functions.cmake
  6. @@ -0,0 +1,123 @@
  7. +cmake_minimum_required(VERSION 3.10.0)
  8. +
  9. +#detect MXE ervironment
  10. +macro(check_MXE RESULT)
  11. +    set(_USE_MXE OFF)
  12. +    if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
  13. +        string(TOLOWER ${CMAKE_TOOLCHAIN_FILE} TOOLCHAIN_FILE)
  14. +        string(REGEX MATCH "mxe-conf" MXE_DETECTED "${TOOLCHAIN_FILE}")
  15. +        if(MXE_DETECTED)
  16. +            message(STATUS "MXE environment detected")
  17. +            set(_USE_MXE ON)
  18. +            message(STATUS "MXE toolchain: ${CMAKE_TOOLCHAIN_FILE}")
  19. +            message(STATUS "MXE root path: ${CMAKE_PREFIX_PATH}")
  20. +            if(IS_WEBENGINE)
  21. +                message(FATAL_ERROR "Webengine is not available in MXE. Please set the CHAT_TYPE variable to Webkit or Basic")
  22. +            endif()
  23. +        endif()
  24. +    endif()
  25. +    set(${RESULT} ${_USE_MXE})
  26. +endmacro()
  27. +
  28. +
  29. +# Copy a list of files from one directory to another. Only full paths.
  30. +function(copy SOURCE DEST TARGET)
  31. +    if(EXISTS ${SOURCE})
  32. +        set(OUT_TARGET_FILE "${CMAKE_BINARY_DIR}/${TARGET}.cmake")
  33. +
  34. +        string(REGEX REPLACE "\\\\+" "/" DEST "${DEST}")
  35. +        string(REGEX REPLACE "\\\\+" "/" SOURCE "${SOURCE}")
  36. +
  37. +        if(NOT TARGET ${TARGET})
  38. +            file(REMOVE "${OUT_TARGET_FILE}")
  39. +            add_custom_target(${TARGET} COMMAND ${CMAKE_COMMAND} -P "${OUT_TARGET_FILE}")
  40. +        endif()
  41. +
  42. +        if(IS_DIRECTORY ${SOURCE})
  43. +            # copy directory
  44. +            file(GLOB_RECURSE FILES "${SOURCE}/*")
  45. +            get_filename_component(SOURCE_DIR_NAME ${SOURCE} NAME)
  46. +
  47. +            foreach(FILE ${FILES})
  48. +                file(RELATIVE_PATH REL_PATH ${SOURCE} ${FILE})
  49. +                set(REL_PATH "${SOURCE_DIR_NAME}/${REL_PATH}")
  50. +                get_filename_component(REL_PATH ${REL_PATH} DIRECTORY)
  51. +                set(DESTIN "${DEST}/${REL_PATH}")
  52. +
  53. +                string(REGEX REPLACE "/+" "/" DESTIN ${DESTIN})
  54. +                string(REGEX REPLACE "/+" "/" FILE ${FILE})
  55. +
  56. +                file(APPEND
  57. +                    "${OUT_TARGET_FILE}"
  58. +                    "file(INSTALL \"${FILE}\" DESTINATION \"${DESTIN}\" USE_SOURCE_PERMISSIONS)\n")
  59. +            endforeach()
  60. +        else()
  61. +            string(REPLACE "//" "/" DEST ${DEST})
  62. +            if(DEST MATCHES "/$")
  63. +                set(DIR "${DEST}")
  64. +                string(REGEX REPLACE "^(.+)/$" "\\1" DIR ${DIR})
  65. +            else()
  66. +                # need to copy and rename
  67. +                get_filename_component(DIR ${DEST} DIRECTORY)
  68. +                get_filename_component(FILENAME ${DEST} NAME)
  69. +                get_filename_component(SOURCE_FILENAME ${SOURCE} NAME)
  70. +            endif()
  71. +            file(APPEND
  72. +                "${OUT_TARGET_FILE}"
  73. +                "file(INSTALL \"${SOURCE}\" DESTINATION \"${DIR}\" USE_SOURCE_PERMISSIONS)\n")
  74. +            if(DEFINED FILENAME)
  75. +                file(APPEND
  76. +                    "${OUT_TARGET_FILE}"
  77. +                    "file(RENAME \"${DIR}/${SOURCE_FILENAME}\" \"${DIR}/${FILENAME}\")\n")
  78. +            endif()
  79. +        endif()
  80. +    endif()
  81. +endfunction()
  82. +
  83. +#Copy default iconsets to build directory and add jisp files to prepare-bin target
  84. +function(prepare_iconsets ACTION)
  85. +    file(GLOB_RECURSE all_iconsets "${PROJECT_SOURCE_DIR}/iconsets/*")
  86. +    message(STATUS "Processing iconsets for ${ACTION}")
  87. +    foreach(_ITEM ${all_iconsets})
  88. +        get_filename_component(FNAME ${_ITEM} NAME)
  89. +        file(RELATIVE_PATH FREL ${PROJECT_SOURCE_DIR} ${_ITEM})
  90. +        get_filename_component(FDIR ${FREL} DIRECTORY)
  91. +        if(NOT ${ACTION} STREQUAL "prepare-bin")
  92. +            if("${_ITEM}" MATCHES ".*/default/.*" AND (NOT "${_ITEM}" MATCHES ".*/system/default/icondef.xml"))
  93. +                configure_file(${_ITEM} "${CMAKE_CURRENT_BINARY_DIR}/${FDIR}/${FNAME}" COPYONLY)
  94. +            endif()
  95. +        else()
  96. +            if(NOT "${_ITEM}" MATCHES ".*/default/.*|.*README")
  97. +                copy(${_ITEM} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${FDIR}/${FNAME}" ${ACTION})
  98. +            endif()
  99. +        endif()
  100. +        unset(_ITEM)
  101. +        unset(FNAME)
  102. +        unset(FREL)
  103. +        unset(FDIR)
  104. +    endforeach()
  105. +endfunction()
  106. +
  107. +if(WIN32)
  108. +    function(compile_rc_file RC_FILE_NAME RC_OUTPUT_NAME)
  109. +        if(NOT MSVC)
  110. +            set(CMD_ARG
  111. +                --include=${CMAKE_CURRENT_SOURCE_DIR}
  112. +                --input=${RC_FILE_NAME}
  113. +                --output=${RC_OUTPUT_NAME}
  114. +        )
  115. +        else()
  116. +            set(CMD_ARG
  117. +                /fo
  118. +                ${RC_OUTPUT_NAME}
  119. +                ${RC_FILE_NAME}
  120. +            )
  121. +        endif()
  122. +        add_custom_command(OUTPUT ${RC_OUTPUT_NAME}
  123. +            COMMAND ${CMAKE_RC_COMPILER}
  124. +            ARGS ${CMD_ARG}
  125. +            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/win32
  126. +            VERBATIM
  127. +        )
  128. +    endfunction()
  129. +endif()
  130. diff --git a/CMakeLists.txt b/CMakeLists.txt
  131. index e96f3bb0..10850866 100644
  132. --- a/CMakeLists.txt
  133. +++ b/CMakeLists.txt
  134. @@ -19,6 +19,11 @@ else()
  135.      message(STATUS "===Building Psi===")
  136.  endif()
  137.  
  138. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
  139. +
  140. +include(psi-cmake-functions)
  141. +include(policyRules)
  142. +
  143.  # Define LINUX on Linux like as WIN32 on Windows and APPLE on macOS
  144.  if(UNIX AND NOT (APPLE OR HAIKU))
  145.      set(LINUX ON)
  146. @@ -37,13 +42,16 @@ foreach(submodule ${SBM_LIST})
  147.      endif()
  148.  endforeach()
  149.  
  150. +# Detect MXE cross-compilation
  151. +check_MXE(DEFAULT_USE_MXE)
  152. +
  153.  set( DEFAULT_BUNDLED_QCA OFF )
  154. -if (APPLE OR ((MSVC OR USE_MXE) OR BUNDLED_IRIS_ALL))
  155. +if (APPLE OR ((MSVC OR DEFAULT_USE_MXE) OR BUNDLED_IRIS_ALL))
  156.      set( DEFAULT_BUNDLED_QCA ON )
  157.  endif()
  158.  
  159.  set( DEFAULT_BUNDLED_USRSCTP OFF )
  160. -if (APPLE OR ((MSVC OR USE_MXE) OR BUNDLED_IRIS_ALL))
  161. +if (APPLE OR ((MSVC OR DEFAULT_USE_MXE) OR BUNDLED_IRIS_ALL))
  162.      set( DEFAULT_BUNDLED_USRSCTP ON )
  163.  endif()
  164.  
  165. @@ -79,7 +87,7 @@ endif()
  166.  
  167.  # Cross-compilation and native builds for MS Windows
  168.  option( ENABLE_PORTABLE "Create portable version of Psi+ for MS Windows" OFF )
  169. -option( USE_MXE "Use MXE (cross-compilation build environment for MS Windows)" OFF )
  170. +option( USE_MXE "Use MXE (cross-compilation build environment for MS Windows)" ${DEFAULT_USE_MXE} )
  171.  
  172.  # Other systems
  173.  if(LINUX)
  174. @@ -112,10 +120,6 @@ endif()
  175.  
  176.  set( GLOBAL_DEPENDS_DEBUG_MODE ON )
  177.  
  178. -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
  179. -
  180. -include(policyRules)
  181. -
  182.  set(IS_WEBKIT OFF CACHE INTERNAL "Use webkit. Internal variable")
  183.  set(IS_WEBENGINE OFF CACHE INTERNAL "Use webengine. Internal variable")
  184.  string(TOLOWER "${CHAT_TYPE}" LCHAT_TYPE)
  185. @@ -176,20 +180,8 @@ if(USE_CRASH)
  186.      add_definitions(-DUSE_CRASH)
  187.  endif()
  188.  
  189. -# Detect MXE cross-compilation
  190. -if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
  191. -    string(TOLOWER ${CMAKE_TOOLCHAIN_FILE} TOOLCHAIN_FILE)
  192. -    string(REGEX MATCH "mxe-conf" MXE_DETECTED "${TOOLCHAIN_FILE}")
  193. -    if(MXE_DETECTED)
  194. -        message(STATUS "MXE environment detected")
  195. -        set(USE_MXE ON)
  196. -        message(STATUS "MXE toolchain: ${CMAKE_TOOLCHAIN_FILE}")
  197. -        message(STATUS "MXE root path: ${CMAKE_PREFIX_PATH}")
  198. -        if(IS_WEBENGINE)
  199. -            message(FATAL_ERROR "Webengine is not available in MXE. Please set the CHAT_TYPE variable to Webkit or Basic")
  200. -        endif()
  201. -        set(BUNDLED_IRIS_ALL ON)
  202. -    endif()
  203. +if(USE_MXE)
  204. +    set(BUNDLED_IRIS_ALL ON)
  205.  endif()
  206.  
  207.  # For GNU/Linux and *BSD systems:
  208. @@ -289,60 +281,6 @@ if(IRIS_BUNDLED_QCA)
  209.      add_definitions(-DQCA_STATIC)
  210.  endif()
  211.  
  212. -# Copy a list of files from one directory to another. Only full paths.
  213. -function(copy SOURCE DEST TARGET)
  214. -    if(EXISTS ${SOURCE})
  215. -        set(OUT_TARGET_FILE "${CMAKE_BINARY_DIR}/${TARGET}.cmake")
  216. -
  217. -        string(REGEX REPLACE "\\\\+" "/" DEST "${DEST}")
  218. -        string(REGEX REPLACE "\\\\+" "/" SOURCE "${SOURCE}")
  219. -
  220. -        if(NOT TARGET ${TARGET})
  221. -            file(REMOVE "${OUT_TARGET_FILE}")
  222. -            add_custom_target(${TARGET} COMMAND ${CMAKE_COMMAND} -P "${OUT_TARGET_FILE}")
  223. -        endif()
  224. -
  225. -        if(IS_DIRECTORY ${SOURCE})
  226. -            # copy directory
  227. -            file(GLOB_RECURSE FILES "${SOURCE}/*")
  228. -            get_filename_component(SOURCE_DIR_NAME ${SOURCE} NAME)
  229. -
  230. -            foreach(FILE ${FILES})
  231. -                file(RELATIVE_PATH REL_PATH ${SOURCE} ${FILE})
  232. -                set(REL_PATH "${SOURCE_DIR_NAME}/${REL_PATH}")
  233. -                get_filename_component(REL_PATH ${REL_PATH} DIRECTORY)
  234. -                set(DESTIN "${DEST}/${REL_PATH}")
  235. -
  236. -                string(REGEX REPLACE "/+" "/" DESTIN ${DESTIN})
  237. -                string(REGEX REPLACE "/+" "/" FILE ${FILE})
  238. -
  239. -                file(APPEND
  240. -                    "${OUT_TARGET_FILE}"
  241. -                    "file(INSTALL \"${FILE}\" DESTINATION \"${DESTIN}\" USE_SOURCE_PERMISSIONS)\n")
  242. -            endforeach()
  243. -        else()
  244. -            string(REPLACE "//" "/" DEST ${DEST})
  245. -            if(DEST MATCHES "/$")
  246. -                set(DIR "${DEST}")
  247. -                string(REGEX REPLACE "^(.+)/$" "\\1" DIR ${DIR})
  248. -            else()
  249. -                # need to copy and rename
  250. -                get_filename_component(DIR ${DEST} DIRECTORY)
  251. -                get_filename_component(FILENAME ${DEST} NAME)
  252. -                get_filename_component(SOURCE_FILENAME ${SOURCE} NAME)
  253. -            endif()
  254. -            file(APPEND
  255. -                "${OUT_TARGET_FILE}"
  256. -                "file(INSTALL \"${SOURCE}\" DESTINATION \"${DIR}\" USE_SOURCE_PERMISSIONS)\n")
  257. -            if(DEFINED FILENAME)
  258. -                file(APPEND
  259. -                    "${OUT_TARGET_FILE}"
  260. -                    "file(RENAME \"${DIR}/${SOURCE_FILENAME}\" \"${DIR}/${FILENAME}\")\n")
  261. -            endif()
  262. -        endif()
  263. -    endif()
  264. -endfunction()
  265. -
  266.  if(USE_CCACHE)
  267.      # Configure CCache if available
  268.      find_program(CCACHE_PATH ccache DOC "Path to ccache")
  269. diff --git a/cmake/modules/FindEnchant.cmake b/cmake/modules/FindEnchant.cmake
  270. index ae13f34a..99bc91b8 100644
  271. --- a/cmake/modules/FindEnchant.cmake
  272. +++ b/cmake/modules/FindEnchant.cmake
  273. @@ -73,6 +73,8 @@ find_library(
  274.      ${PC_Enchant_LIBRARY_DIRS}
  275.      ${Enchant_ROOT}/lib
  276.      ${Enchant_ROOT}/bin
  277. +    ${Enchant_DIR}/lib
  278. +    ${Enchant_DIR}/bin
  279.  )
  280.  
  281.  include(FindPackageHandleStandardArgs)
  282. diff --git a/cmake/modules/FindHttpParser.cmake b/cmake/modules/FindHttpParser.cmake
  283. index edd14bb1..06bec283 100644
  284. --- a/cmake/modules/FindHttpParser.cmake
  285. +++ b/cmake/modules/FindHttpParser.cmake
  286. @@ -43,6 +43,8 @@ find_library(
  287.      HINTS
  288.      ${HTTP_PARSER_ROOT}/lib
  289.      ${HTTP_PARSER_ROOT}/bin
  290. +    ${HTTP_PARSER_DIR}/lib
  291. +    ${HTTP_PARSER_DIR}/bin
  292.  )
  293.  
  294.  #Obtain library version
  295. diff --git a/cmake/modules/FindHunspell.cmake b/cmake/modules/FindHunspell.cmake
  296. index 6eea5622..9f88862d 100644
  297. --- a/cmake/modules/FindHunspell.cmake
  298. +++ b/cmake/modules/FindHunspell.cmake
  299. @@ -50,11 +50,12 @@ find_path(
  300.      HUNSPELL_INCLUDE_DIR ${LIBINCS}
  301.      HINTS
  302.      ${HUNSPELL_ROOT}/include
  303. +    ${HUNSPELL_DIR}/include
  304.      ${PC_HUNSPELL_INCLUDEDIR}
  305.      ${PC_HUNSPELL_INCLUDE_DIRS}
  306.      PATH_SUFFIXES
  307.      ""
  308. -    if ( NOT ${WIN32} )
  309. +    if ( NOT WIN32 )
  310.      hunspell
  311.      endif()
  312.  )
  313. @@ -75,6 +76,8 @@ find_library(
  314.      ${PC_HUNSPELL_LIBRARY_DIRS}
  315.      ${HUNSPELL_ROOT}/lib
  316.      ${HUNSPELL_ROOT}/bin
  317. +    ${HUNSPELL_DIR}/lib
  318. +    ${HUNSPELL_DIR}/bin
  319.  )
  320.  include(FindPackageHandleStandardArgs)
  321.  find_package_handle_standard_args(
  322. diff --git a/cmake/modules/FindMINIZIP.cmake b/cmake/modules/FindMINIZIP.cmake
  323. index 5e6f77fb..d84fc1dd 100644
  324. --- a/cmake/modules/FindMINIZIP.cmake
  325. +++ b/cmake/modules/FindMINIZIP.cmake
  326. @@ -51,7 +51,7 @@ find_path(
  327.      ${PC_MINIZIP_INCLUDE_DIRS}
  328.      PATH_SUFFIXES
  329.      ""
  330. -    if ( NOT ${WIN32} )
  331. +    if ( NOT WIN32 )
  332.      minizip
  333.      endif()
  334.  )
  335. @@ -64,6 +64,8 @@ find_library(
  336.      ${PC_MINIZIP_LIBRARY_DIRS}
  337.      ${MINIZIP_ROOT}/lib
  338.      ${MINIZIP_ROOT}/bin
  339. +    ${MINIZIP_DIR}/lib
  340. +    ${MINIZIP_DIR}/bin
  341.  )
  342.  include(FindPackageHandleStandardArgs)
  343.  find_package_handle_standard_args(
  344. diff --git a/cmake/modules/FindQca.cmake b/cmake/modules/FindQca.cmake
  345. index 8dcb760e..f2a5f03b 100644
  346. --- a/cmake/modules/FindQca.cmake
  347. +++ b/cmake/modules/FindQca.cmake
  348. @@ -54,8 +54,10 @@ find_library(
  349.      Qca_LIBRARY
  350.      NAMES qca-qt${QT_DEFAULT_MAJOR_VERSION}${D}
  351.      HINTS
  352. -    ${QCA_DIR}/lib
  353. -    ${QCA_DIR}/bin
  354. +    ${Qca_ROOT}/lib
  355. +    ${Qca_ROOT}/bin
  356. +    ${Qca_DIR}/lib
  357. +    ${Qca_DIR}/bin
  358.  )
  359.  
  360.  include(FindPackageHandleStandardArgs)
  361. diff --git a/cmake/modules/fix-codestyle.cmake b/cmake/modules/fix-codestyle.cmake
  362. index 8c0cae45..0e59456a 100644
  363. --- a/cmake/modules/fix-codestyle.cmake
  364. +++ b/cmake/modules/fix-codestyle.cmake
  365. @@ -16,8 +16,8 @@ if(CLF_BIN)
  366.          ../plugins/*.h
  367.      )
  368.      foreach(src_file ${SRC_LIST})
  369. -        #Exclude libpsi
  370. -        if("${src_file}" MATCHES ".*/libpsi/.*")
  371. +        #Exclude iris
  372. +        if("${src_file}" MATCHES ".*/iris/.*")
  373.              list(REMOVE_ITEM SRC_LIST ${src_file})
  374.          endif()
  375.          #Exclude plugins if no ENABLE_PLUGINS flag enabled
  376. diff --git a/cmake/modules/policyRules.cmake b/cmake/modules/policyRules.cmake
  377. index d0c39894..b5bcf879 100644
  378. --- a/cmake/modules/policyRules.cmake
  379. +++ b/cmake/modules/policyRules.cmake
  380. @@ -1,13 +1,15 @@
  381.  cmake_minimum_required( VERSION 3.10.0 )
  382.  #Set automoc and autouic policy
  383. -if(NOT POLICY_SET)
  384. -    if(POLICY CMP0071)
  385. -        cmake_policy(SET CMP0071 NEW)
  386. +if(POLICY CMP0071)
  387. +    cmake_policy(SET CMP0071 NEW)
  388. +    if(NOT POLICY_SET) #less messages
  389.          message(STATUS "CMP0071 policy set to NEW")
  390.      endif()
  391. -    if(POLICY CMP0074)
  392. -        cmake_policy(SET CMP0074 NEW)
  393. +endif()
  394. +if(POLICY CMP0074)
  395. +    cmake_policy(SET CMP0074 NEW)
  396. +    if(NOT POLICY_SET) #less messages
  397.          message(STATUS "CMP0074 policy set to NEW")
  398.      endif()
  399. -    set(POLICY_SET ON)
  400.  endif()
  401. +set(POLICY_SET ON)
  402. diff --git a/cmake/modules/win32-prepare-deps.cmake b/cmake/modules/win32-prepare-deps.cmake
  403. index 9623fada..a6e1595f 100644
  404. --- a/cmake/modules/win32-prepare-deps.cmake
  405. +++ b/cmake/modules/win32-prepare-deps.cmake
  406. @@ -49,15 +49,22 @@ if(WIN32)
  407.      message(STATUS "Qt${QT_DEFAULT_MAJOR_VERSION} directory found at ${QT_DIR}")
  408.      set(QT_PLUGINS_DIR ${QT_DIR}/plugins)
  409.      set(QT_TRANSLATIONS_DIR ${QT_DIR}/translations)
  410. +    #Output pathes
  411. +    set(QT_PLUGINS_OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins")
  412. +    set(QT_LIBS_OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  413. +    if(BUILD_PSIMEDIA)
  414. +        set(PSIMEDIA_LIBS_OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  415. +    endif()
  416. +    set(PSI_LIBS_OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  417.      set(PSIMEDIA_FOUND OFF)
  418.      #Set paths
  419.      list(APPEND PATHES
  420.          ${QT_BIN_DIR}
  421. -        ${QCA_DIR}bin
  422. -        ${QCA_DIR}/bin
  423. +        ${Qca_DIR}bin
  424. +        ${Qca_DIR}/bin
  425.          ${QT_PLUGINS_DIR}/crypto
  426. -        ${QCA_DIR}lib/qca-qt${QT_DEFAULT_MAJOR_VERSION}/crypto
  427. -        ${QCA_DIR}lib/Qca-qt${QT_DEFAULT_MAJOR_VERSION}/crypto
  428. +        ${Qca_DIR}lib/qca-qt${QT_DEFAULT_MAJOR_VERSION}/crypto
  429. +        ${Qca_DIR}lib/Qca-qt${QT_DEFAULT_MAJOR_VERSION}/crypto
  430.          )
  431.      if(USE_MXE)
  432.          list(APPEND PATHES
  433. @@ -100,7 +107,8 @@ if(WIN32)
  434.          else()
  435.              list(APPEND WDARGS --release)
  436.          endif()
  437. -        list(APPEND WDARGS --plugindir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins")
  438. +        list(APPEND WDARGS --libdir "${QT_LIBS_OUTPUT}")
  439. +        list(APPEND WDARGS --plugindir "${QT_PLUGINS_OUTPUT}")
  440.          add_custom_target(windeploy
  441.              COMMAND ${WINDEPLOYQTBIN}
  442.              ${WDARGS}
  443. @@ -133,7 +141,7 @@ if(WIN32)
  444.                      )
  445.              endforeach()
  446.          endforeach()
  447. -        find_psi_lib("${ICU_LIBS}" "${PATHES}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  448. +        find_psi_lib("${ICU_LIBS}" "${PATHES}" "${QT_LIBS_OUTPUT}/")
  449.          unset(ICU_LIBS)
  450.          # Qt5 / Qt6 libraries
  451.          set(QT_LIBAS
  452. @@ -166,42 +174,42 @@ if(WIN32)
  453.                  Qt5WinExtras${D}.dll
  454.              )
  455.          endif()
  456. -        find_psi_lib("${QT_LIBAS}" "${QT_BIN_DIR}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  457. +        find_psi_lib("${QT_LIBAS}" "${QT_BIN_DIR}" "${QT_LIBS_OUTPUT}/")
  458.          #
  459. -        find_psi_lib(qtaudio_windows${D}.dll "${QT_PLUGINS_DIR}/audio/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/audio/")
  460. +        find_psi_lib(qtaudio_windows${D}.dll "${QT_PLUGINS_DIR}/audio/" "${QT_PLUGINS_OUTPUT}/audio/")
  461.          set(PLATFORMS_PLUGS
  462.              qdirect2d${D}.dll
  463.              qminimal${D}.dll
  464.              qoffscreen${D}.dll
  465.              qwindows${D}.dll
  466.              )
  467. -        find_psi_lib("${PLATFORMS_PLUGS}" "${QT_PLUGINS_DIR}/platforms/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/platforms/")
  468. +        find_psi_lib("${PLATFORMS_PLUGS}" "${QT_PLUGINS_DIR}/platforms/" "${QT_PLUGINS_OUTPUT}/platforms/")
  469.          #
  470.          set(PLATFORMTHEMES_PLUGS
  471.              qxdgdesktopportal${D}.dll
  472.              )
  473. -        find_psi_lib("${PLATFORMTHEMES_PLUGS}" "${QT_PLUGINS_DIR}/platformthemes/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/platformthemes/")
  474. +        find_psi_lib("${PLATFORMTHEMES_PLUGS}" "${QT_PLUGINS_DIR}/platformthemes/" "${QT_PLUGINS_OUTPUT}/platformthemes/")
  475.          #
  476.          set(STYLES_PLUGS
  477.              qwindowsvistastyle${D}.dll
  478.              )
  479. -        find_psi_lib("${STYLES_PLUGS}" "${QT_PLUGINS_DIR}/styles/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/styles/")
  480. +        find_psi_lib("${STYLES_PLUGS}" "${QT_PLUGINS_DIR}/styles/" "${QT_PLUGINS_OUTPUT}/styles/")
  481.          #
  482.          set(BEARER_PLUGS
  483.              qgenericbearer${D}.dll
  484.              qnativewifibearer${D}.dll
  485.              )
  486. -        find_psi_lib("${BEARER_PLUGS}" "${QT_PLUGINS_DIR}/bearer/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/bearer/")
  487. +        find_psi_lib("${BEARER_PLUGS}" "${QT_PLUGINS_DIR}/bearer/" "${QT_PLUGINS_OUTPUT}/bearer/")
  488.          #
  489.          set(GENERIC_PLUGS
  490.              qtuiotouchplugin${D}.dll
  491.              )
  492. -        find_psi_lib("${GENERIC_PLUGS}" "${QT_PLUGINS_DIR}/generic/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/generic/")
  493. +        find_psi_lib("${GENERIC_PLUGS}" "${QT_PLUGINS_DIR}/generic/" "${QT_PLUGINS_OUTPUT}/generic/")
  494.          #
  495.          set(ICONENGINES_PLUGS
  496.              qsvgicon${D}.dll
  497.              )
  498. -        find_psi_lib("${ICONENGINES_PLUGS}" "${QT_PLUGINS_DIR}/iconengines/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/iconengines/")
  499. +        find_psi_lib("${ICONENGINES_PLUGS}" "${QT_PLUGINS_DIR}/iconengines/" "${QT_PLUGINS_OUTPUT}/iconengines/")
  500.          #
  501.          set(IMAGEFORMATS_PLUGS
  502.              qdds${D}.dll
  503. @@ -217,42 +225,42 @@ if(WIN32)
  504.              qwbmp${D}.dll
  505.              qwebp${D}.dll
  506.              )
  507. -        find_psi_lib("${IMAGEFORMATS_PLUGS}" "${QT_PLUGINS_DIR}/imageformats/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/imageformats/")
  508. +        find_psi_lib("${IMAGEFORMATS_PLUGS}" "${QT_PLUGINS_DIR}/imageformats/" "${QT_PLUGINS_OUTPUT}/imageformats/")
  509.          #
  510.          set(MEDIASERVICE_PLUGS
  511.              dsengine${D}.dll
  512.              qtmedia_audioengine${D}.dll
  513.              wmfengine${D}.dll
  514.              )
  515. -        find_psi_lib("${MEDIASERVICE_PLUGS}" "${QT_PLUGINS_DIR}/mediaservice/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/mediaservice/")
  516. +        find_psi_lib("${MEDIASERVICE_PLUGS}" "${QT_PLUGINS_DIR}/mediaservice/" "${QT_PLUGINS_OUTPUT}/mediaservice/")
  517.          #
  518.          set(MULTIMEDIA_PLUGS
  519.              ffmpegmediaplugin${D}.dll
  520.              windowsmediaplugin${D}.dll
  521.              )
  522. -        find_psi_lib("${MULTIMEDIA_PLUGS}" "${QT_PLUGINS_DIR}/multimedia/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/multimedia/")
  523. +        find_psi_lib("${MULTIMEDIA_PLUGS}" "${QT_PLUGINS_DIR}/multimedia/" "${QT_PLUGINS_OUTPUT}/multimedia/")
  524.          #
  525.          set(NETWORKINFORMATION_PLUGS
  526.              qnetworklistmanager${D}.dll
  527.              )
  528. -        find_psi_lib("${NETWORKINFORMATION_PLUGS}" "${QT_PLUGINS_DIR}/networkinformation/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/networkinformation/")
  529. +        find_psi_lib("${NETWORKINFORMATION_PLUGS}" "${QT_PLUGINS_DIR}/networkinformation/" "${QT_PLUGINS_OUTPUT}/networkinformation/")
  530.          #
  531.          set(POSITION_PLUGS
  532.              qtposition_nmea${D}.dll
  533.              qtposition_positionpoll${D}.dll
  534.              qtposition_winrt${D}.dll
  535.              )
  536. -        find_psi_lib("${POSITION_PLUGS}" "${QT_PLUGINS_DIR}/position/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/position/")
  537. +        find_psi_lib("${POSITION_PLUGS}" "${QT_PLUGINS_DIR}/position/" "${QT_PLUGINS_OUTPUT}/position/")
  538.          #
  539.          set(PLAYLISTFORMATS_PLUGS
  540.              qtmultimedia_m3u${D}.dll
  541.              )
  542. -        find_psi_lib("${PLAYLISTFORMATS_PLUGS}" "${QT_PLUGINS_DIR}/playlistformats/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/playlistformats/")
  543. +        find_psi_lib("${PLAYLISTFORMATS_PLUGS}" "${QT_PLUGINS_DIR}/playlistformats/" "${QT_PLUGINS_OUTPUT}/playlistformats/")
  544.          #
  545.          set(PRINTSUPPORT_PLUGS
  546.              windowsprintersupport${D}.dll
  547.              )
  548. -        find_psi_lib("${PRINTSUPPORT_PLUGS}" "${QT_PLUGINS_DIR}/printsupport/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/printsupport/")
  549. +        find_psi_lib("${PRINTSUPPORT_PLUGS}" "${QT_PLUGINS_DIR}/printsupport/" "${QT_PLUGINS_OUTPUT}/printsupport/")
  550.          #
  551.          set(SQLDRIVERS_PLUGS
  552.              qsqlite${D}.dll
  553. @@ -260,21 +268,21 @@ if(WIN32)
  554.              qsqlodbc${D}.dll
  555.              qsqlpsql${D}.dll
  556.              )
  557. -        find_psi_lib("${SQLDRIVERS_PLUGS}" "${QT_PLUGINS_DIR}/sqldrivers/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/sqldrivers/")
  558. +        find_psi_lib("${SQLDRIVERS_PLUGS}" "${QT_PLUGINS_DIR}/sqldrivers/" "${QT_PLUGINS_OUTPUT}/sqldrivers/")
  559.          #
  560.          set(TLS_PLUGS
  561.              qcertonlybackend${D}.dll
  562.              qopensslbackend${D}.dll
  563.              qschannelbackend${D}.dll
  564.              )
  565. -        find_psi_lib("${TLS_PLUGS}" "${QT_PLUGINS_DIR}/tls/" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/tls/")
  566. +        find_psi_lib("${TLS_PLUGS}" "${QT_PLUGINS_DIR}/tls/" "${QT_PLUGINS_OUTPUT}/tls/")
  567.          #
  568.          if(KEYCHAIN_LIBS)
  569.              set(KEYCHAIN_LIBS
  570.                  qt${QT_DEFAULT_MAJOR_VERSION}keychain${D}.dll
  571.                  libqt${QT_DEFAULT_MAJOR_VERSION}keychain${D}.dll
  572.                  )
  573. -            find_psi_lib("${KEYCHAIN_LIBS}" "${PATHES}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  574. +            find_psi_lib("${KEYCHAIN_LIBS}" "${PATHES}" "${QT_LIBS_OUTPUT}/")
  575.          endif()
  576.      endif()
  577.      # psimedia deps
  578. @@ -346,7 +354,7 @@ if(WIN32)
  579.                  )
  580.              set(PSIMEDIA_DEPS_DIR "${GST_SDK}/bin")
  581.              set(GSTREAMER_PLUGINS_DIR "${GST_SDK}/lib/gstreamer-1.0")
  582. -            set(GST_PLUGINS_OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gstreamer-1.0/")
  583. +            set(GST_PLUGINS_OUTPUT "${PSIMEDIA_LIBS_OUTPUT}/gstreamer-1.0/")
  584.          endif()
  585.          if(USE_MXE)
  586.              set(PSIMEDIA_DEPS
  587. @@ -404,9 +412,9 @@ if(WIN32)
  588.                  )
  589.              set(PSIMEDIA_DEPS_DIR "${CMAKE_PREFIX_PATH}/bin")
  590.              set(GSTREAMER_PLUGINS_DIR "${CMAKE_PREFIX_PATH}/bin/gstreamer-1.0")
  591. -            set(GST_PLUGINS_OUTPUT "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/gstreamer-1.0/")
  592. +            set(GST_PLUGINS_OUTPUT "${PSIMEDIA_LIBS_OUTPUT}/gstreamer-1.0/")
  593.          endif()
  594. -        find_psi_lib("${PSIMEDIA_DEPS}" "${PSIMEDIA_DEPS_DIR}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  595. +        find_psi_lib("${PSIMEDIA_DEPS}" "${PSIMEDIA_DEPS_DIR}" "${PSIMEDIA_LIBS_OUTPUT}/")
  596.          # streamer plugins
  597.          find_psi_lib("${GSTREAMER_PLUGINS}" "${GSTREAMER_PLUGINS_DIR}/" "${GST_PLUGINS_OUTPUT}")
  598.      endif()
  599. @@ -417,7 +425,7 @@ if(WIN32)
  600.              "hunspell-1.${hunsp_counter}-0.dll"
  601.              )
  602.      endforeach()
  603. -    find_psi_lib("${HUNSPELL_LIBS}" "${PATHES}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  604. +    find_psi_lib("${HUNSPELL_LIBS}" "${PATHES}" "${PSI_LIBS_OUTPUT}")
  605.      unset(HUNSPELL_LIBS)
  606.      # other libs and executables
  607.      set( LIBRARIES_LIST
  608. @@ -447,6 +455,7 @@ if(WIN32)
  609.          libxslt-1.dll
  610.          libzlib.dll
  611.          libzstd.dll
  612. +        legacy.dll
  613.          ssleay32.dll
  614.          zlib1.dll
  615.          )
  616. @@ -507,7 +516,7 @@ if(WIN32)
  617.              libqjdns.dll
  618.              )
  619.      endif()
  620. -    find_psi_lib("${LIBRARIES_LIST}" "${PATHES}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  621. +    find_psi_lib("${LIBRARIES_LIST}" "${PATHES}" "${PSI_LIBS_OUTPUT}/")
  622.      if(NOT BUNDLED_QCA)
  623.          set(QCA_LIB
  624.              libqca-qt${QT_DEFAULT_MAJOR_VERSION}${D}.dll
  625. @@ -526,15 +535,15 @@ if(WIN32)
  626.                  qca-ossl${D}.dll
  627.                  )
  628.          endif()
  629. -        find_psi_lib("${QCA_LIB}" "${PATHES}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  630. -        find_psi_lib("${QCA_PLUGINS}" "${PATHES}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qtplugins/crypto/")
  631. +        find_psi_lib("${QCA_LIB}" "${PATHES}" "${PSI_LIBS_OUTPUT}/")
  632. +        find_psi_lib("${QCA_PLUGINS}" "${PATHES}" "${QT_PLUGINS_OUTPUT}/crypto/")
  633.      endif()
  634.      if (NOT BUNDLED_USRSCTP)
  635.              set(USRSCTP_LIB libusrsctp${D}.dll)
  636.          if(MSVC)
  637.              set(USRSCTP_LIB usrsctp${D}.dll)
  638.          endif()
  639. -        find_psi_lib("${USRSCTP_LIB}" "${PATHES}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/")
  640. +        find_psi_lib("${USRSCTP_LIB}" "${PATHES}" "${PSI_LIBS_OUTPUT}/")
  641.      endif()
  642.      copy("${PROJECT_SOURCE_DIR}/win32/qt.conf" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" "${LIBS_TARGET}")
  643.  endif()
  644. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  645. index 7d613e4e..208ebf9e 100644
  646. --- a/src/CMakeLists.txt
  647. +++ b/src/CMakeLists.txt
  648. @@ -198,7 +198,7 @@ else()
  649.      set(MAIN_ICON "psiplus_icon.png")
  650.  endif()
  651.  
  652. -include(${PROJECT_SOURCE_DIR}/cmake/modules/get-version.cmake)
  653. +include(get-version)
  654.  
  655.  if(LINUX)
  656.      if(PSI_PLUS)
  657. @@ -224,30 +224,6 @@ endif()
  658.  set(CONFIG_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/config.h")
  659.  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CONFIG_OUTPUT_FILE} @ONLY)
  660.  
  661. -#Copy default iconsets to build directory and add jisp files to prepare-bin target
  662. -function(prepare_iconsets ACTION)
  663. -    file(GLOB_RECURSE all_iconsets "${PROJECT_SOURCE_DIR}/iconsets/*")
  664. -    message(STATUS "Processing iconsets for ${ACTION}")
  665. -    foreach(_ITEM ${all_iconsets})
  666. -        get_filename_component(FNAME ${_ITEM} NAME)
  667. -        file(RELATIVE_PATH FREL ${PROJECT_SOURCE_DIR} ${_ITEM})
  668. -        get_filename_component(FDIR ${FREL} DIRECTORY)
  669. -        if(NOT ${ACTION} STREQUAL "prepare-bin")
  670. -            if("${_ITEM}" MATCHES ".*/default/.*" AND (NOT "${_ITEM}" MATCHES ".*/system/default/icondef.xml"))
  671. -                configure_file(${_ITEM} "${CMAKE_CURRENT_BINARY_DIR}/${FDIR}/${FNAME}" COPYONLY)
  672. -            endif()
  673. -        else()
  674. -            if(NOT "${_ITEM}" MATCHES ".*/default/.*|.*README")
  675. -                copy(${_ITEM} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${FDIR}/${FNAME}" ${ACTION})
  676. -            endif()
  677. -        endif()
  678. -        unset(_ITEM)
  679. -        unset(FNAME)
  680. -        unset(FREL)
  681. -        unset(FDIR)
  682. -    endforeach()
  683. -endfunction()
  684. -
  685.  prepare_iconsets(prepare-src)
  686.  #Generate iconsets.qrc and icondef.xml
  687.  set(ICONDEFXML_OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/iconsets/system/default/icondef.xml")
  688. @@ -390,28 +366,6 @@ if(WIN32)
  689.          configure_file(${PROJECT_SOURCE_DIR}/win32/psi_win.rc.in ${CMAKE_CURRENT_BINARY_DIR}/psi_win.rc @ONLY)
  690.          #configure_file(${PROJECT_SOURCE_DIR}/win32/psi.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/psi.manifest @ONLY)
  691.          # win resource compilation
  692. -        function(compile_rc_file RC_FILE_NAME RC_OUTPUT_NAME)
  693. -            if(NOT MSVC)
  694. -                set(CMD_ARG
  695. -                    --include=${CMAKE_CURRENT_SOURCE_DIR}
  696. -                    --input=${RC_FILE_NAME}
  697. -                    --output=${RC_OUTPUT_NAME}
  698. -            )
  699. -            else()
  700. -                set(CMD_ARG
  701. -                    /fo
  702. -                    ${RC_OUTPUT_NAME}
  703. -                    ${RC_FILE_NAME}
  704. -                )
  705. -            endif()
  706. -            add_custom_command(OUTPUT ${RC_OUTPUT_NAME}
  707. -                COMMAND ${CMAKE_RC_COMPILER}
  708. -                ARGS ${CMD_ARG}
  709. -                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/win32
  710. -                VERBATIM
  711. -            )
  712. -        endfunction()
  713. -
  714.          set(DECS_RC_NAME ${CMAKE_CURRENT_BINARY_DIR}/psi_win.rc)
  715.          set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/psi_win.o)
  716.          compile_rc_file(${DECS_RC_NAME} ${RC_FILE})
  717.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement