Build.cmake 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  8. target_sources("${${module_name}}" PUBLIC FILE_SET boxing_modules TYPE CXX_MODULES FILES
  9. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Boolean.cppm)
  10. endif ()
  11. if (${build_shared_flag})
  12. add_library("${${module_name}}" SHARED ${${source_files}})
  13. enable_strict_warnings(module_name)
  14. target_link_libraries("${${module_name}}" ${${module_name_core}})
  15. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  16. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  17. target_sources("${${module_name}}" PUBLIC FILE_SET boxing_modules TYPE CXX_MODULES FILES
  18. ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/boxing/Boolean.cppm)
  19. endif ()
  20. endfunction()
  21. function(build_core_module build_static_flag build_shared_flag build_jni_flag module_name source_files jni_source_files)
  22. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  23. if (${build_static_flag})
  24. add_library("${${module_name}}" STATIC ${${source_files}})
  25. enable_strict_warnings(module_name)
  26. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  27. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  28. endif ()
  29. if (${build_shared_flag})
  30. if (${build_jni_flag})
  31. message("${${module_name}}: building with JNI...")
  32. add_library("${${module_name}}" SHARED ${${source_files}} ${${jni_source_files}})
  33. enable_strict_warnings(module_name)
  34. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  35. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  36. else ()
  37. add_library("${${module_name}}" SHARED ${${source_files}})
  38. enable_strict_warnings(module_name)
  39. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  40. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  41. endif ()
  42. endif ()
  43. endfunction()
  44. function(build_encoding_module build_static_flag build_shared_flag module_name module_name_core source_files)
  45. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  46. if (${build_static_flag})
  47. add_library("${${module_name}}" STATIC ${${source_files}})
  48. enable_strict_warnings(module_name)
  49. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  50. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  51. endif ()
  52. if (${build_shared_flag})
  53. add_library("${${module_name}}" SHARED ${${source_files}})
  54. enable_strict_warnings(module_name)
  55. target_link_libraries("${${module_name}}" ${${module_name_core}})
  56. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  57. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  58. endif ()
  59. endfunction()
  60. function(build_event_module build_static_flag build_shared_flag module_name module_name_core source_files)
  61. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  62. if (${build_static_flag})
  63. add_library("${${module_name}}" STATIC ${${source_files}})
  64. enable_strict_warnings(module_name)
  65. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  66. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  67. endif ()
  68. if (${build_shared_flag})
  69. add_library("${${module_name}}" SHARED ${${source_files}})
  70. enable_strict_warnings(module_name)
  71. target_link_libraries("${${module_name}}" ${${module_name_core}})
  72. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  73. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  74. endif ()
  75. endfunction()
  76. function(build_io_module build_static_flag build_shared_flag module_name module_name_core source_files)
  77. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  78. if (${build_static_flag})
  79. add_library("${${module_name}}" STATIC ${${source_files}})
  80. enable_strict_warnings(module_name)
  81. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  82. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  83. endif ()
  84. if (${build_shared_flag})
  85. add_library("${${module_name}}" SHARED ${${source_files}})
  86. enable_strict_warnings(module_name)
  87. target_link_libraries("${${module_name}}" ${${module_name_core}})
  88. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  89. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  90. endif ()
  91. endfunction()
  92. 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)
  93. include(${CMAKE_CURRENT_LIST_DIR}/cmake/Security.cmake)
  94. if (${build_static_flag})
  95. add_library("${${module_name}}" STATIC ${${source_files}} ${${source_files_linux}} ${${source_files_windows}})
  96. enable_strict_warnings(module_name)
  97. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  98. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  99. endif ()
  100. if (${build_shared_flag})
  101. if (${build_jni_flag})
  102. message("${${module_name}}: building with JNI...")
  103. add_library("${${module_name}}" SHARED ${${source_files}} ${${source_files_linux}} ${${source_files_windows}} ${${source_files_jni}})
  104. enable_strict_warnings(module_name)
  105. target_link_libraries("${${module_name}}" ${${module_name_core}})
  106. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  107. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  108. else ()
  109. add_library("${${module_name}}" SHARED ${${source_files}} ${${source_files_linux}} ${${source_files_windows}})
  110. enable_strict_warnings(module_name)
  111. target_link_libraries("${${module_name}}" ${${module_name_core}})
  112. set_target_properties("${${module_name}}" PROPERTIES DEBUG_POSTFIX "-d")
  113. target_compile_features("${${module_name}}" PUBLIC cxx_std_20)
  114. endif ()
  115. endif ()
  116. endfunction()