CMakeLists.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ################################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 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: javaembed
  17. #####################################################
  18. # Description:
  19. # ------------
  20. # Cmake Input File for javaembed
  21. #####################################################
  22. project(javaembed)
  23. if(JAVAEMBED)
  24. ADD_PLUGIN(javaembed PACKAGES JNI)
  25. if(MAKE_JAVAEMBED)
  26. find_package(Java 1.8 COMPONENTS Development)
  27. set(
  28. SRCS
  29. javaembed.cpp)
  30. include_directories(
  31. ${JNI_INCLUDE_DIRS}
  32. ./../../system/include
  33. ./../../rtl/eclrtl
  34. ./../../rtl/include
  35. ./../../rtl/nbcd
  36. ./../../common/deftype
  37. ./../../system/jlib
  38. ./../../dali/base
  39. ./../../system/mp
  40. ./../../system/security/shared
  41. ./../../roxie/roxiemem
  42. ${HPCC_SOURCE_DIR}/esp/esdllib
  43. ${HPCC_SOURCE_DIR}/common/thorhelper
  44. ${CMAKE_BINARY_DIR}
  45. ${CMAKE_BINARY_DIR}/oss)
  46. set(java_sources HpccClassLoader.java
  47. HpccUtils.java
  48. ActivityContext.java)
  49. set(java_classes ${CMAKE_CURRENT_BINARY_DIR}/com/HPCCSystems/HpccClassLoader.class
  50. ${CMAKE_CURRENT_BINARY_DIR}/com/HPCCSystems/HpccUtils.class
  51. ${CMAKE_CURRENT_BINARY_DIR}/com/HPCCSystems/ActivityContext.class)
  52. add_custom_command ( OUTPUT ${java_classes}
  53. COMMAND ${Java_JAVAC_EXECUTABLE} ${java_sources} -d ${CMAKE_CURRENT_BINARY_DIR} -source 1.8 -target 1.8
  54. DEPENDS ${java_sources}
  55. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  56. )
  57. add_custom_target(build-java-classes ALL
  58. DEPENDS ${java_classes}
  59. )
  60. add_definitions(-D_USRDLL -DJAVAEMBED_EXPORTS)
  61. HPCC_ADD_LIBRARY(javaembed SHARED ${SRCS})
  62. add_dependencies(javaembed build-java-classes)
  63. if(${CMAKE_VERSION} VERSION_LESS "2.8.9")
  64. message(WARNING "Cannot set NO_SONAME. shlibdeps will give warnings when package is installed")
  65. elseif(NOT APPLE)
  66. set_target_properties(javaembed PROPERTIES NO_SONAME 1)
  67. endif()
  68. install(
  69. TARGETS javaembed
  70. DESTINATION plugins)
  71. install(
  72. FILES ${java_classes}
  73. DESTINATION classes/com/HPCCSystems
  74. COMPONENT Runtime)
  75. # We link against jsig so that signals are chained from the jvm
  76. get_filename_component(JAVA_LIBRARY_PATH ${JAVA_AWT_LIBRARY} PATH)
  77. if(APPLE)
  78. set(JSIG_LIBRARY ${JAVA_LIBRARY_PATH}/libjsig.dylib)
  79. elseif(WIN32)
  80. set(JSIG_LIBRARY ${JAVA_LIBRARY_PATH}/jsig.dll)
  81. else()
  82. set(JSIG_LIBRARY ${JAVA_LIBRARY_PATH}/libjsig.so)
  83. endif()
  84. target_link_libraries(
  85. javaembed
  86. #${JSIG_LIBRARY}
  87. ${JAVA_JVM_LIBRARY}
  88. eclrtl
  89. roxiemem
  90. jlib)
  91. endif()
  92. endif()
  93. if(PLATFORM OR CLIENTTOOLS_ONLY)
  94. install(
  95. FILES ${CMAKE_CURRENT_SOURCE_DIR}/java.ecllib
  96. DESTINATION plugins
  97. COMPONENT Runtime)
  98. endif()