CMakeLists.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #
  2. # Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
  17. set(mopen_public_header
  18. include/alibabacloud/mopen/MoPenClient.h
  19. include/alibabacloud/mopen/MoPenExport.h )
  20. set(mopen_public_header_model
  21. include/alibabacloud/mopen/model/MoPenAddGroupMemberRequest.h
  22. include/alibabacloud/mopen/model/MoPenAddGroupMemberResult.h
  23. include/alibabacloud/mopen/model/MoPenBindIsvRequest.h
  24. include/alibabacloud/mopen/model/MoPenBindIsvResult.h
  25. include/alibabacloud/mopen/model/MoPenCreateDeviceRequest.h
  26. include/alibabacloud/mopen/model/MoPenCreateDeviceResult.h
  27. include/alibabacloud/mopen/model/MoPenDeleteGroupRequest.h
  28. include/alibabacloud/mopen/model/MoPenDeleteGroupResult.h
  29. include/alibabacloud/mopen/model/MoPenDeleteGroupMemberRequest.h
  30. include/alibabacloud/mopen/model/MoPenDeleteGroupMemberResult.h
  31. include/alibabacloud/mopen/model/MoPenDoRecognizeRequest.h
  32. include/alibabacloud/mopen/model/MoPenDoRecognizeResult.h
  33. include/alibabacloud/mopen/model/MoPenFindGroupRequest.h
  34. include/alibabacloud/mopen/model/MoPenFindGroupResult.h
  35. include/alibabacloud/mopen/model/MoPenQueryCanvasRequest.h
  36. include/alibabacloud/mopen/model/MoPenQueryCanvasResult.h
  37. include/alibabacloud/mopen/model/MoPenSendMqttMessageRequest.h
  38. include/alibabacloud/mopen/model/MoPenSendMqttMessageResult.h
  39. include/alibabacloud/mopen/model/MopenCreateGroupRequest.h
  40. include/alibabacloud/mopen/model/MopenCreateGroupResult.h )
  41. set(mopen_src
  42. src/MoPenClient.cc
  43. src/model/MoPenAddGroupMemberRequest.cc
  44. src/model/MoPenAddGroupMemberResult.cc
  45. src/model/MoPenBindIsvRequest.cc
  46. src/model/MoPenBindIsvResult.cc
  47. src/model/MoPenCreateDeviceRequest.cc
  48. src/model/MoPenCreateDeviceResult.cc
  49. src/model/MoPenDeleteGroupRequest.cc
  50. src/model/MoPenDeleteGroupResult.cc
  51. src/model/MoPenDeleteGroupMemberRequest.cc
  52. src/model/MoPenDeleteGroupMemberResult.cc
  53. src/model/MoPenDoRecognizeRequest.cc
  54. src/model/MoPenDoRecognizeResult.cc
  55. src/model/MoPenFindGroupRequest.cc
  56. src/model/MoPenFindGroupResult.cc
  57. src/model/MoPenQueryCanvasRequest.cc
  58. src/model/MoPenQueryCanvasResult.cc
  59. src/model/MoPenSendMqttMessageRequest.cc
  60. src/model/MoPenSendMqttMessageResult.cc
  61. src/model/MopenCreateGroupRequest.cc
  62. src/model/MopenCreateGroupResult.cc )
  63. add_library(mopen ${LIB_TYPE}
  64. ${mopen_public_header}
  65. ${mopen_public_header_model}
  66. ${mopen_src})
  67. set_target_properties(mopen
  68. PROPERTIES
  69. LINKER_LANGUAGE CXX
  70. ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  71. LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  72. RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  73. OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}mopen
  74. )
  75. if(${LIB_TYPE} STREQUAL "SHARED")
  76. set_target_properties(mopen
  77. PROPERTIES
  78. DEFINE_SYMBOL ALIBABACLOUD_MOPEN_LIBRARY)
  79. endif()
  80. target_include_directories(mopen
  81. PRIVATE include
  82. ${CMAKE_SOURCE_DIR}/core/include
  83. )
  84. target_link_libraries(mopen
  85. core)
  86. if(CMAKE_HOST_WIN32)
  87. ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
  88. set(jsoncpp_install_dir ${INSTALL_DIR})
  89. add_dependencies(mopen
  90. jsoncpp)
  91. target_include_directories(mopen
  92. PRIVATE ${jsoncpp_install_dir}/include)
  93. target_link_libraries(mopen
  94. ${jsoncpp_install_dir}/lib/jsoncpp.lib)
  95. set_target_properties(mopen
  96. PROPERTIES
  97. COMPILE_OPTIONS "/bigobj")
  98. else()
  99. target_include_directories(mopen
  100. PRIVATE /usr/include/jsoncpp)
  101. target_link_libraries(mopen
  102. jsoncpp)
  103. endif()
  104. install(FILES ${mopen_public_header}
  105. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/mopen)
  106. install(FILES ${mopen_public_header_model}
  107. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/mopen/model)
  108. install(TARGETS mopen
  109. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  110. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  111. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  112. )