CMakeLists.txt 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 3.1 FATAL_ERROR)
  19. add_definitions(-DLIBHDFS_DLL_EXPORT)
  20. include_directories(
  21. include
  22. ${GENERATED_JAVAH}
  23. ${CMAKE_CURRENT_SOURCE_DIR}
  24. ${CMAKE_BINARY_DIR}
  25. ${JNI_INCLUDE_DIRS}
  26. main/native
  27. main/native/libhdfs
  28. ${OS_DIR}
  29. )
  30. hadoop_add_dual_library(hdfs
  31. exception.c
  32. jni_helper.c
  33. hdfs.c
  34. common/htable.c
  35. ${OS_DIR}/mutexes.c
  36. ${OS_DIR}/thread_local_storage.c
  37. )
  38. if(NEED_LINK_DL)
  39. set(LIB_DL dl)
  40. endif()
  41. hadoop_target_link_dual_libraries(hdfs
  42. ${JAVA_JVM_LIBRARY}
  43. ${LIB_DL}
  44. ${OS_LINK_LIBRARIES}
  45. )
  46. hadoop_dual_output_directory(hdfs ${OUT_DIR})
  47. set(LIBHDFS_VERSION "0.0.0")
  48. set_target_properties(hdfs PROPERTIES
  49. SOVERSION ${LIBHDFS_VERSION})
  50. build_libhdfs_test(test_libhdfs_ops hdfs_static test_libhdfs_ops.c)
  51. link_libhdfs_test(test_libhdfs_ops hdfs_static ${JAVA_JVM_LIBRARY})
  52. build_libhdfs_test(test_libhdfs_reads hdfs_static test_libhdfs_read.c)
  53. link_libhdfs_test(test_libhdfs_reads hdfs_static ${JAVA_JVM_LIBRARY})
  54. build_libhdfs_test(test_libhdfs_write hdfs_static test_libhdfs_write.c)
  55. link_libhdfs_test(test_libhdfs_write hdfs_static ${JAVA_JVM_LIBRARY})
  56. build_libhdfs_test(test_libhdfs_threaded hdfs_static expect.c test_libhdfs_threaded.c ${OS_DIR}/thread.c)
  57. link_libhdfs_test(test_libhdfs_threaded hdfs_static native_mini_dfs)
  58. add_libhdfs_test(test_libhdfs_threaded hdfs_static)
  59. if (NOT WIN32)
  60. build_libhdfs_test(test_libhdfs_zerocopy hdfs_static expect.c test_libhdfs_zerocopy.c)
  61. link_libhdfs_test(test_libhdfs_zerocopy hdfs_static native_mini_dfs ${OS_LINK_LIBRARIES})
  62. add_libhdfs_test(test_libhdfs_zerocopy hdfs_static)
  63. endif()
  64. # Skip vecsum on Windows. This could be made to work in the future by
  65. # introducing an abstraction layer over the sys/mman.h functions.
  66. if(NOT WIN32)
  67. build_libhdfs_test(test_libhdfs_vecsum hdfs vecsum.c)
  68. if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
  69. link_libhdfs_test(test_libhdfs_vecsum hdfs pthread)
  70. else()
  71. link_libhdfs_test(test_libhdfs_vecsum hdfs pthread rt)
  72. endif()
  73. endif()