CMakeLists.txt 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
  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. # Component: exampleplugin
  17. #####################################################
  18. # Description:
  19. # ------------
  20. # Cmake Input File for exampleplugin
  21. #####################################################
  22. project(exampleplugin)
  23. if(EXAMPLEPLUGIN)
  24. #ADD_PLUGIN(...) executes HPCC/cmake_modules/FindEXAMPLE_PLUGIN_DEP.cmake to find any required DEPendencies such
  25. #as include files and libraries to link against. MAKE_EXAMPLEPLUGIN is set true if all the required dependencies
  26. #set in HPCC/cmake_modules/FindEXAMPLE_PLUGIN_DEP.cmake are met.
  27. #Both EXAMPLE_PLUGIN_DEP_INCLUDE_DIR and EXAMPLE_PLUGIN_DEP_LIBRARIES are also found and set in
  28. #HPCC/cmake_modules/FindEXAMPLE_PLUGIN_DEP.cmake.
  29. ADD_PLUGIN(exampleplugin PACKAGES EXAMPLE_PLUGIN_DEP MINVERSION 0.1.0)
  30. if(MAKE_EXAMPLEPLUGIN)
  31. set(
  32. SRCS
  33. #Add all sources to be compiled here.
  34. exampleplugin.hpp
  35. exampleplugin.cpp)
  36. include_directories(
  37. #Add any required HPCC include dirs here. EXAMPLE_PLUGIN_DEP_INCLUDE_DIR contains any and all external (non HPCC) paths.
  38. ./../../system/include
  39. ./../../rtl/eclrtl
  40. ./../../rtl/include
  41. ./../../common/deftype
  42. ./../../system/jlib
  43. ${EXAMPLE_PLUGIN_DEP_INCLUDE_DIR})
  44. add_definitions(-D_USRDLL -DECL_EXMAPLE_PLUGIN_EXPORTS)
  45. HPCC_ADD_LIBRARY(exampleplugin SHARED ${SRCS})
  46. if(${CMAKE_VERSION} VERSION_LESS "2.8.9")
  47. message(WARNING "Cannot set NO_SONAME. shlibdeps will give warnings when package is installed")
  48. elseif(NOT APPLE)
  49. set_target_properties(exampleplugin PROPERTIES NO_SONAME 1)
  50. endif()
  51. install(
  52. TARGETS exampleplugin
  53. DESTINATION plugins)
  54. target_link_libraries(
  55. exampleplugin
  56. #Add any required HPCC libraries to be linked against here. EXAMPLE_PLUGIN_DEP_LIBRARIES contains any and all external (non HPCC) libraries.
  57. eclrtl
  58. jlib
  59. ${EXAMPLE_PLUGIN_DEP_LIBRARIES})
  60. endif()
  61. endif()
  62. #Here the ECL plugin/service definitions contained with *.ecllib are set to be installed with the platform regardless
  63. #of whether the plugin itself was configured to be built. This is because the plugin libraries are dynamically linked
  64. #with the platform such that ECL queries can be compiled without the plugin needing to be installed locally, e.g. as
  65. #it the case for eclserver. Adequate tests must be conducted to ensure against undefined references. In addition,
  66. #this means that any changes to the plugin/service definitions must be correlated with the correct platform build
  67. #version when installing.
  68. if(PLATFORM)
  69. install(
  70. FILES ${CMAKE_CURRENT_SOURCE_DIR}/lib_exampleplugin.ecllib
  71. DESTINATION plugins
  72. COMPONENT Runtime)
  73. endif()