Advertisement
KukuRuzo

plugin bundled

Apr 30th, 2024
1,319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 3.77 KB | None | 0 0
  1. diff --git a/generic/omemoplugin/cmake/omemo_c.cmake b/generic/omemoplugin/cmake/omemo_c.cmake
  2. index 19654d1..0aa9f32 100644
  3. --- a/generic/omemoplugin/cmake/omemo_c.cmake
  4. +++ b/generic/omemoplugin/cmake/omemo_c.cmake
  5. @@ -1,13 +1,18 @@
  6.  cmake_minimum_required(VERSION 3.10.0)
  7.  
  8.  set(OmemoCGitRepo "https://github.com/psi-im/libomemo-c.git")
  9. +set(ProtobufCGitRepo "https://github.com/protobuf-c/protobuf-c.git")
  10.  
  11.  message(STATUS "OMEMO_C: using bundled")
  12.  set(OMEMO_C_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/omemo-c)
  13. +set(PROTOBUF_C_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/protobuf-c)
  14.  set(OMEMO_C_BUILD_DIR ${OMEMO_C_PREFIX}/build)
  15. +set(Protobuf_C_BUILD_DIR ${PROTOBUF_C_PREFIX}/build)
  16.  set(OMEMO_C_INCLUDE_DIR ${OMEMO_C_PREFIX}/src/OmemoCProject/src)
  17. -set(OMEMO_C_LIBRARY ${OMEMO_C_BUILD_DIR}/src/${CMAKE_STATIC_LIBRARY_PREFIX}omemo-c${D}${CMAKE_STATIC_LIBRARY_SUFFIX})
  18. -set(Protobuf_C_LIBRARY ${OMEMO_C_BUILD_DIR}/src/protobuf-c/build/${CMAKE_STATIC_LIBRARY_PREFIX}protobuf-c${CMAKE_STATIC_LIBRARY_SUFFIX})
  19. +set(OMEMO_C_LIBRARY ${OMEMO_C_BUILD_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}omemo-c${D}${CMAKE_STATIC_LIBRARY_SUFFIX})
  20. +set(Protobuf_C_LIBRARY ${Protobuf_C_BUILD_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}protobuf-c${CMAKE_STATIC_LIBRARY_SUFFIX})
  21. +set(Protobuf_C_INCLUDE_DIR ${PROTOBUF_C_PREFIX}/src/ProtobufCProject)
  22. +set(PROTOBUF_C_SOURCE_DIR ${PROTOBUF_C_PREFIX}/src/ProtobufCProject/build-cmake)
  23.  if(APPLE)
  24.      set(COREFOUNDATION_LIBRARY "-framework CoreFoundation")
  25.      set(COREFOUNDATION_LIBRARY_SECURITY "-framework Security")
  26. @@ -17,7 +22,38 @@ endif()
  27.  include(FindGit)
  28.  find_package(Git REQUIRED)
  29.  
  30. +if(WIN32)
  31. +    set(HIDE_FLAGS
  32. +        -DCMAKE_IGNORE_PATH="/usr/include/protobuf-c"
  33. +        -DCMAKE_SYSTEM_IGNORE_PATH="/usr/include/protobuf-c"
  34. +    )
  35. +endif()
  36. +
  37. +set(PROTOBUF_C_BUILD_OPTIONS
  38. +    ${HIDE_FLAGS}
  39. +    -DBUILD_SHARED_LIBS=OFF
  40. +    -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  41. +    -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  42. +    -DCMAKE_INSTALL_PREFIX=${OMEMO_C_BUILD_DIR}
  43. +    -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
  44. +    -DBUILD_PROTOC=OFF
  45. +    -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
  46. +    -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
  47. +    -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
  48. +    -DOSX_FRAMEWORK=OFF
  49. +)
  50.  include(ExternalProject)
  51. +ExternalProject_Add(ProtobufCProject
  52. +    PREFIX ${PROTOBUF_C_PREFIX}
  53. +    BINARY_DIR ${Protobuf_C_BUILD_DIR}
  54. +    GIT_REPOSITORY "${ProtobufCGitRepo}"
  55. +    CONFIGURE_COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${PROTOBUF_C_BUILD_OPTIONS} ${PROTOBUF_C_SOURCE_DIR}
  56. +    #CMAKE_ARGS ${PROTOBUF_C_BUILD_OPTIONS}
  57. +    BUILD_BYPRODUCTS ${Protobuf_C_LIBRARY}
  58. +    INSTALL_COMMAND ""
  59. +    UPDATE_COMMAND ""
  60. +)
  61. +
  62.  #set CMake options and transfer the environment to an external project
  63.  set(OMEMO_C_BUILD_OPTIONS
  64.      -DBUILD_SHARED_LIBS=OFF
  65. @@ -25,8 +61,11 @@ set(OMEMO_C_BUILD_OPTIONS
  66.      -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  67.      -DCMAKE_INSTALL_PREFIX=${OMEMO_C_PREFIX}/build
  68.      -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
  69. -    -DBUNDLED_PROTOBUF_C=ON
  70. -    -DGIT_EXEXUTABLE=${GIT_EXECUTABLE}
  71. +    -DBUILD_WITH_PROTOBUF=static
  72. +    -DProtobuf_C_LIBRARY:CACHE=${Protobuf_C_LIBRARY}
  73. +    -DProtobuf_C_INCLUDE_DIR:CACHE=${Protobuf_C_INCLUDE_DIR}
  74. +    -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${OMEMO_C_BUILD_DIR}
  75. +    -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
  76.      -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
  77.      -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
  78.      -DOSX_FRAMEWORK=OFF
  79. @@ -38,8 +77,8 @@ ExternalProject_Add(OmemoCProject
  80.      GIT_REPOSITORY "${OmemoCGitRepo}"
  81.      GIT_TAG omemo
  82.      CMAKE_ARGS ${OMEMO_C_BUILD_OPTIONS}
  83. -    BUILD_BYPRODUCTS ${OMEMO_C_LIBRARY} ${Protobuf_C_LIBRARY}
  84. +    BUILD_BYPRODUCTS ${OMEMO_C_LIBRARY}
  85.      INSTALL_COMMAND ""
  86.      UPDATE_COMMAND ""
  87. -    DEPENDS ${DEPENDS}
  88. +    DEPENDS ProtobufCProject
  89.  )
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement