CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
  18. find_package(OpenSSL REQUIRED)
  19. set(CMAKE_BUILD_TYPE, Release)
  20. set(PIPES_FLAGS "-g -Wall -O2 -D_REENTRANT -D_GNU_SOURCE")
  21. set(PIPES_FLAGS "${PIPES_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64")
  22. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIPES_FLAGS}")
  23. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIPES_FLAGS}")
  24. include(../../../hadoop-common-project/hadoop-common/src/JNIFlags.cmake NO_POLICY_SCOPE)
  25. function(output_directory TGT DIR)
  26. SET_TARGET_PROPERTIES(${TGT} PROPERTIES
  27. RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
  28. SET_TARGET_PROPERTIES(${TGT} PROPERTIES
  29. ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
  30. SET_TARGET_PROPERTIES(${TGT} PROPERTIES
  31. LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${DIR}")
  32. endfunction(output_directory TGT DIR)
  33. include_directories(
  34. main/native/utils/api
  35. main/native/pipes/api
  36. ${CMAKE_CURRENT_SOURCE_DIR}
  37. ${OPENSSL_INCLUDE_DIR}
  38. )
  39. # Example programs
  40. add_executable(wordcount-simple main/native/examples/impl/wordcount-simple.cc)
  41. target_link_libraries(wordcount-simple hadooppipes hadooputils)
  42. output_directory(wordcount-simple examples)
  43. add_executable(wordcount-part main/native/examples/impl/wordcount-part.cc)
  44. target_link_libraries(wordcount-part hadooppipes hadooputils)
  45. output_directory(wordcount-part examples)
  46. add_executable(wordcount-nopipe main/native/examples/impl/wordcount-nopipe.cc)
  47. target_link_libraries(wordcount-nopipe hadooppipes hadooputils)
  48. output_directory(wordcount-nopipe examples)
  49. add_executable(pipes-sort main/native/examples/impl/sort.cc)
  50. target_link_libraries(pipes-sort hadooppipes hadooputils)
  51. output_directory(pipes-sort examples)
  52. add_library(hadooputils STATIC
  53. main/native/utils/impl/StringUtils.cc
  54. main/native/utils/impl/SerialUtils.cc
  55. )
  56. add_library(hadooppipes STATIC
  57. main/native/pipes/impl/HadoopPipes.cc
  58. )
  59. target_link_libraries(hadooppipes
  60. ${OPENSSL_LIBRARIES}
  61. pthread
  62. )