SHARE
TWEET

more work with plugs cmake

a guest Sep 6th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/cmake/modules/FindPsiPluginsApi.cmake b/cmake/modules/FindPsiPluginsApi.cmake
  2. index 74897750..506b6f7f 100644
  3. --- a/cmake/modules/FindPsiPluginsApi.cmake
  4. +++ b/cmake/modules/FindPsiPluginsApi.cmake
  5. @@ -32,30 +32,28 @@ if(PsiPluginsApi_INCLUDE_DIR)
  6.  endif()
  7.  
  8.  if(PLUGINS_ROOT_DIR)
  9. -    get_filename_component(
  10. -        ABS_PLUGINS_ROOT_DIR
  11. -        "${PLUGINS_ROOT_DIR}"
  12. -        ABSOLUTE
  13. -    )
  14. +    get_filename_component(ABS_PLUGINS_ROOT_DIR "${PLUGINS_ROOT_DIR}" ABSOLUTE)
  15. +endif()
  16. +get_filename_component(ABS_CURRENT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
  17. +get_filename_component(ABS_PARENT_DIR "${ABS_CURRENT_DIR}/.." ABSOLUTE)
  18. +
  19. +if(CMAKE_CROSSCOMPILING OR CMAKE_CROSS_COMPILING OR (EXISTS "${ABS_PLUGINS_ROOT_DIR}/include"))
  20. +    set(SEARCH_FLAG NO_CMAKE_FIND_ROOT_PATH)
  21.  endif()
  22. -get_filename_component(
  23. -    ABS_CURRENT_DIR
  24. -    "${CMAKE_CURRENT_LIST_DIR}/../.."
  25. -    ABSOLUTE
  26. -)
  27.  
  28.  find_path(
  29.      PsiPluginsApi_DIR
  30.      NAMES
  31.      "variables.cmake"
  32.      PATHS
  33. -    ${ABS_CURRENT_DIR}
  34.      ${ABS_PLUGINS_ROOT_DIR}/cmake/modules
  35. +    ${ABS_CURRENT_DIR}
  36. +    ${ABS_PARENT_DIR}/psi
  37.      PATH_SUFFIXES
  38.      src/plugins/cmake/modules
  39.      share/psi/plugins
  40.      share/psi-plus/plugins
  41. -    CMAKE_FIND_ROOT_PATH_BOTH
  42. +    ${SEARCH_FLAG}
  43.  )
  44.  
  45.  find_path(
  46. @@ -63,13 +61,14 @@ find_path(
  47.      NAMES
  48.      "applicationinfoaccessor.h"
  49.      PATHS
  50. -    ${ABS_CURRENT_DIR}
  51.      ${ABS_PLUGINS_ROOT_DIR}/include
  52. +    ${ABS_CURRENT_DIR}
  53. +    ${ABS_PARENT_DIR}/psi
  54.      PATH_SUFFIXES
  55.      src/plugins/include
  56. -    share/psi/plugins/include
  57. -    share/psi-plus/plugins/include
  58. -    CMAKE_FIND_ROOT_PATH_BOTH
  59. +    include/psi/plugins
  60. +    include/psi-plus/plugins
  61. +    ${SEARCH_FLAG}
  62.  )
  63.  
  64.  include(FindPackageHandleStandardArgs)
  65. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  66. index ccedc37a..9d758f7b 100644
  67. --- a/src/CMakeLists.txt
  68. +++ b/src/CMakeLists.txt
  69. @@ -447,15 +447,20 @@ if(LINUX)
  70.              install(FILES ${DOC_FILES} DESTINATION "${PROJECT_OUTPUT_DATA_DIR}")
  71.          endif()
  72.          if(INSTALL_PLUGINS_SDK)
  73. +            set(API_OUTPUT_DATA_DIR "${DATA_INSTALL_DIR}/${SHARE_SUFF}")
  74. +            set(API_INCLUDES_DIR "${CMAKE_INSTALL_PREFIX}/include/${SHARE_SUFF}/plugins")
  75.              set(plugins_dir "${PSI_LIBDIR}/plugins")
  76. -            set(data_dir ${PROJECT_OUTPUT_DATA_DIR})
  77. +            set(plugins_dir_sfx "lib${LIB_SUFFIX}/${SHARE_SUFF}/plugins")
  78. +            set(data_dir "${API_OUTPUT_DATA_DIR}")
  79. +            set(data_dir_sfx "share/${SHARE_SUFF}/plugins")
  80. +            set(plugins_includes_dir "${API_INCLUDES_DIR}")
  81.              configure_file(${PROJECT_SOURCE_DIR}/src/plugins/pluginsconf.pri.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/pluginsconf.pri @ONLY)
  82.              configure_file(${PROJECT_SOURCE_DIR}/src/plugins/variables.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/variables.cmake @ONLY)
  83. -            install(FILES ${PLUGINS_INCLUDES} DESTINATION ${PROJECT_OUTPUT_DATA_DIR}/plugins/include)
  84. -            install(FILES ${CMAKE_CURRENT_BINARY_DIR}/variables.cmake DESTINATION ${PROJECT_OUTPUT_DATA_DIR}/plugins)
  85. -            install(FILES ${PROJECT_SOURCE_DIR}/src/plugins/plugins.pri DESTINATION ${PROJECT_OUTPUT_DATA_DIR}/plugins)
  86. -            install(FILES ${PROJECT_SOURCE_DIR}/src/plugins/psiplugin.pri DESTINATION ${PROJECT_OUTPUT_DATA_DIR}/plugins)
  87. -            install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pluginsconf.pri DESTINATION ${PROJECT_OUTPUT_DATA_DIR}/plugins)
  88. +            install(FILES ${PLUGINS_INCLUDES} DESTINATION ${API_INCLUDES_DIR})
  89. +            install(FILES ${CMAKE_CURRENT_BINARY_DIR}/variables.cmake DESTINATION ${API_OUTPUT_DATA_DIR}/plugins)
  90. +            install(FILES ${PROJECT_SOURCE_DIR}/src/plugins/plugins.pri DESTINATION ${API_OUTPUT_DATA_DIR}/plugins)
  91. +            install(FILES ${PROJECT_SOURCE_DIR}/src/plugins/psiplugin.pri DESTINATION ${API_OUTPUT_DATA_DIR}/plugins)
  92. +            install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pluginsconf.pri DESTINATION ${API_OUTPUT_DATA_DIR}/plugins)
  93.              install(FILES ${PROJECT_SOURCE_DIR}/cmake/modules/FindPsiPluginsApi.cmake DESTINATION ${DATA_INSTALL_DIR}/cmake/Modules)
  94.          endif()
  95.      endif()
  96. diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
  97. index 9ccf6c57..8843ce0c 100644
  98. --- a/src/plugins/CMakeLists.txt
  99. +++ b/src/plugins/CMakeLists.txt
  100. @@ -17,6 +17,8 @@ set( CMAKE_MODULE_PATH
  101.  find_package(PsiPluginsApi QUIET)
  102.  if(PsiPluginsApi_DIR)
  103.      include(${PsiPluginsApi_DIR}/variables.cmake)
  104. +    message(STATUS "PsiPluginsApi_DIR: ${PsiPluginsApi_DIR}")
  105. +    message(STATUS "PsiPluginsApi_INCLUDE_DIR: ${PsiPluginsApi_INCLUDE_DIR}")
  106.  endif()
  107.  
  108.  if(PROJECT_NAME AND MAIN_PROGRAM_NAME)
  109. diff --git a/src/plugins/cmake/modules/FindPsiPluginsApi.cmake b/src/plugins/cmake/modules/FindPsiPluginsApi.cmake
  110. index d8e39b7a..506b6f7f 100644
  111. --- a/src/plugins/cmake/modules/FindPsiPluginsApi.cmake
  112. +++ b/src/plugins/cmake/modules/FindPsiPluginsApi.cmake
  113. @@ -37,19 +37,23 @@ endif()
  114.  get_filename_component(ABS_CURRENT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
  115.  get_filename_component(ABS_PARENT_DIR "${ABS_CURRENT_DIR}/.." ABSOLUTE)
  116.  
  117. +if(CMAKE_CROSSCOMPILING OR CMAKE_CROSS_COMPILING OR (EXISTS "${ABS_PLUGINS_ROOT_DIR}/include"))
  118. +    set(SEARCH_FLAG NO_CMAKE_FIND_ROOT_PATH)
  119. +endif()
  120. +
  121.  find_path(
  122.      PsiPluginsApi_DIR
  123.      NAMES
  124.      "variables.cmake"
  125.      PATHS
  126. +    ${ABS_PLUGINS_ROOT_DIR}/cmake/modules
  127.      ${ABS_CURRENT_DIR}
  128.      ${ABS_PARENT_DIR}/psi
  129. -    ${ABS_PLUGINS_ROOT_DIR}/cmake/modules
  130.      PATH_SUFFIXES
  131.      src/plugins/cmake/modules
  132.      share/psi/plugins
  133.      share/psi-plus/plugins
  134. -    CMAKE_FIND_ROOT_PATH_BOTH
  135. +    ${SEARCH_FLAG}
  136.  )
  137.  
  138.  find_path(
  139. @@ -57,14 +61,14 @@ find_path(
  140.      NAMES
  141.      "applicationinfoaccessor.h"
  142.      PATHS
  143. +    ${ABS_PLUGINS_ROOT_DIR}/include
  144.      ${ABS_CURRENT_DIR}
  145.      ${ABS_PARENT_DIR}/psi
  146. -    ${ABS_PLUGINS_ROOT_DIR}/include
  147.      PATH_SUFFIXES
  148.      src/plugins/include
  149. -    share/psi/plugins/include
  150. -    share/psi-plus/plugins/include
  151. -    CMAKE_FIND_ROOT_PATH_BOTH
  152. +    include/psi/plugins
  153. +    include/psi-plus/plugins
  154. +    ${SEARCH_FLAG}
  155.  )
  156.  
  157.  include(FindPackageHandleStandardArgs)
  158. diff --git a/src/plugins/variables.cmake.in b/src/plugins/variables.cmake.in
  159. index a368950f..1924598c 100644
  160. --- a/src/plugins/variables.cmake.in
  161. +++ b/src/plugins/variables.cmake.in
  162. @@ -1,7 +1,7 @@
  163.  set( LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
  164. -set( PLUGINS_INSTALL_PATH "@plugins_dir@" CACHE STRING "Install path for plugins" )
  165. -set( PLUGINS_DATA_PATH "@data_dir@/plugins" CACHE STRING "Path to plugins datadir" )
  166. +set( PLUGINS_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/@plugins_dir_sfx@" CACHE STRING "Install path for plugins" )
  167. +set( PLUGINS_DATA_PATH "${CMAKE_INSTALL_PREFIX}/@data_dir_sfx@" CACHE STRING "Path to plugins datadir" )
  168.  set( MAIN_PROGRAM_NAME "@SHARE_SUFF@" CACHE STRING "Name of main client" )
  169.  add_definitions( -DQT_PLUGIN )
  170. -include_directories("${PLUGINS_DATA_PATH}/include")
  171. +include_directories("@plugins_includes_dir@")
  172.  set(CMAKE_CXX_STANDARD 14)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top