CMakeLists.txt 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
  19. list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../../../hadoop-common-project/hadoop-common)
  20. include(HadoopCommon)
  21. find_package(OpenSSL REQUIRED)
  22. include_directories(
  23. main/native/utils/api
  24. main/native/pipes/api
  25. ${CMAKE_CURRENT_SOURCE_DIR}
  26. ${OPENSSL_INCLUDE_DIR}
  27. )
  28. # Example programs
  29. add_executable(wordcount-simple main/native/examples/impl/wordcount-simple.cc)
  30. target_link_libraries(wordcount-simple hadooppipes hadooputils)
  31. hadoop_output_directory(wordcount-simple examples)
  32. add_executable(wordcount-part main/native/examples/impl/wordcount-part.cc)
  33. target_link_libraries(wordcount-part hadooppipes hadooputils)
  34. hadoop_output_directory(wordcount-part examples)
  35. add_executable(wordcount-nopipe main/native/examples/impl/wordcount-nopipe.cc)
  36. target_link_libraries(wordcount-nopipe hadooppipes hadooputils)
  37. hadoop_output_directory(wordcount-nopipe examples)
  38. add_executable(pipes-sort main/native/examples/impl/sort.cc)
  39. target_link_libraries(pipes-sort hadooppipes hadooputils)
  40. hadoop_output_directory(pipes-sort examples)
  41. add_library(hadooputils STATIC
  42. main/native/utils/impl/StringUtils.cc
  43. main/native/utils/impl/SerialUtils.cc
  44. )
  45. add_library(hadooppipes STATIC
  46. main/native/pipes/impl/HadoopPipes.cc
  47. )
  48. include(CheckLibraryExists)
  49. check_library_exists(dl dlopen "" NEED_LINK_DL)
  50. if(NEED_LINK_DL)
  51. set(LIB_DL "dl")
  52. endif()
  53. if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
  54. exec_program("uname" ARGS "-r" OUTPUT_VARIABLE OS_VERSION)
  55. if(OS_VERSION VERSION_LESS "5.12")
  56. set(LIB_NET "socket" "nsl")
  57. endif()
  58. endif()
  59. target_link_libraries(hadooppipes
  60. ${OPENSSL_LIBRARIES}
  61. ${LIB_DL}
  62. ${LIB_NET}
  63. )