CMakeLists.txt 2.7 KB

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