Build.cmake 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. function(build_boxing_module build_static_flag build_shared_flag module_name module_name_core source_files)
  2. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  3. if (${build_static_flag})
  4. add_library("${${module_name}}" STATIC ${${source_files}})
  5. enable_strict_warnings(module_name)
  6. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  7. endif ()
  8. if (${build_shared_flag})
  9. add_library("${${module_name}}" SHARED ${${source_files}})
  10. enable_strict_warnings(module_name)
  11. target_link_libraries("${${module_name}}" ${${module_name_core}})
  12. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  13. endif ()
  14. endfunction()
  15. function(build_core_module build_static_flag build_shared_flag build_jni_flag module_name source_files jni_source_files)
  16. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  17. if (${build_static_flag})
  18. add_library("${${module_name}}" STATIC ${${source_files}})
  19. enable_strict_warnings(module_name)
  20. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  21. endif ()
  22. if (${build_shared_flag})
  23. if (${build_jni_flag})
  24. message("${${module_name}}: building with JNI...")
  25. add_library("${${module_name}}" SHARED ${${source_files}} ${${jni_source_files}})
  26. enable_strict_warnings(module_name)
  27. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  28. else ()
  29. add_library("${${module_name}}" SHARED ${${source_files}})
  30. enable_strict_warnings(module_name)
  31. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  32. endif ()
  33. endif ()
  34. endfunction()
  35. function(build_encoding_module build_static_flag build_shared_flag module_name module_name_core source_files)
  36. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  37. if (${build_static_flag})
  38. add_library("${${module_name}}" STATIC ${${source_files}})
  39. enable_strict_warnings(module_name)
  40. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  41. endif ()
  42. if (${build_shared_flag})
  43. add_library("${${module_name}}" SHARED ${${source_files}})
  44. enable_strict_warnings(module_name)
  45. target_link_libraries("${${module_name}}" ${${module_name_core}})
  46. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  47. endif ()
  48. endfunction()
  49. function(build_event_module build_static_flag build_shared_flag module_name module_name_core source_files)
  50. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  51. if (${build_static_flag})
  52. add_library("${${module_name}}" STATIC ${${source_files}})
  53. enable_strict_warnings(module_name)
  54. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  55. endif ()
  56. if (${build_shared_flag})
  57. add_library("${${module_name}}" SHARED ${${source_files}})
  58. enable_strict_warnings(module_name)
  59. target_link_libraries("${${module_name}}" ${${module_name_core}})
  60. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  61. endif ()
  62. endfunction()
  63. function(build_io_module build_static_flag build_shared_flag module_name module_name_core source_files)
  64. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  65. if (${build_static_flag})
  66. add_library("${${module_name}}" STATIC ${${source_files}})
  67. enable_strict_warnings(module_name)
  68. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  69. endif ()
  70. if (${build_shared_flag})
  71. add_library("${${module_name}}" SHARED ${${source_files}})
  72. enable_strict_warnings(module_name)
  73. target_link_libraries("${${module_name}}" ${${module_name_core}})
  74. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  75. endif ()
  76. endfunction()
  77. function(build_time_module build_static_flag build_shared_flag build_jni_flag module_name module_name_core source_files source_files_linux source_files_windows source_files_jni)
  78. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  79. if (${build_static_flag})
  80. add_library("${${module_name}}" STATIC ${${source_files}} ${${source_files_linux}} ${${source_files_windows}})
  81. enable_strict_warnings(module_name)
  82. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  83. endif ()
  84. if (${build_shared_flag})
  85. if (${build_jni_flag})
  86. message("${${module_name}}: building with JNI...")
  87. add_library("${${module_name}}" SHARED ${${source_files}} ${${source_files_linux}} ${${source_files_windows}} ${${source_files_jni}})
  88. enable_strict_warnings(module_name)
  89. target_link_libraries("${${module_name}}" ${${module_name_core}})
  90. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  91. else ()
  92. add_library("${${module_name}}" SHARED ${${source_files}} ${${source_files_linux}} ${${source_files_windows}})
  93. enable_strict_warnings(module_name)
  94. target_link_libraries("${${module_name}}" ${${module_name_core}})
  95. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  96. endif ()
  97. endif ()
  98. endfunction()