Build.cmake 7.0 KB

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