crown.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. --
  2. -- Copyright (c) 2012-2026 Daniele Bartolini et al.
  3. -- SPDX-License-Identifier: MIT
  4. --
  5. function crown_project(_name, _kind, _defines)
  6. project ("crown" .. _name)
  7. kind (_kind)
  8. includedirs {
  9. CROWN_DIR .. "src",
  10. CROWN_DIR .. "3rdparty/bgfx/include",
  11. CROWN_DIR .. "3rdparty/bgfx/src",
  12. CROWN_DIR .. "3rdparty/bimg/include",
  13. CROWN_DIR .. "3rdparty/bx/include",
  14. CROWN_DIR .. "3rdparty/stb",
  15. CROWN_DIR .. "3rdparty/bullet3/src",
  16. CROWN_DIR .. "3rdparty/openal/include",
  17. CROWN_DIR .. "3rdparty/ufbx",
  18. CROWN_DIR .. "3rdparty/lz4/lib",
  19. }
  20. defines {
  21. _defines,
  22. }
  23. links {
  24. "bgfx",
  25. "bimg",
  26. "bx",
  27. "bullet",
  28. }
  29. if not _OPTIONS["no-lua"] then
  30. if not _OPTIONS["no-luajit"] then
  31. includedirs {
  32. CROWN_DIR .. "3rdparty/luajit/src",
  33. }
  34. configuration { "not vs*" }
  35. links {
  36. "luajit"
  37. }
  38. configuration { "vs*" }
  39. links {
  40. "lua51"
  41. }
  42. configuration {}
  43. else
  44. includedirs {
  45. CROWN_DIR .. "3rdparty/lua/src",
  46. }
  47. links { "lua" }
  48. defines {
  49. "CROWN_USE_LUAJIT=0",
  50. }
  51. end
  52. end
  53. configuration { "debug" }
  54. defines {
  55. "BX_CONFIG_DEBUG=1",
  56. }
  57. configuration { "debug or development" }
  58. defines {
  59. "CROWN_DEBUG=1"
  60. }
  61. configuration { "development" }
  62. defines {
  63. "CROWN_DEVELOPMENT=1"
  64. }
  65. configuration { "release or development" }
  66. defines {
  67. "BX_CONFIG_DEBUG=0",
  68. }
  69. configuration { "android*" }
  70. kind "ConsoleApp"
  71. targetextension ".so"
  72. linkoptions {
  73. "-shared"
  74. }
  75. links {
  76. "EGL",
  77. "GLESv2",
  78. "OpenSLES",
  79. "openal",
  80. }
  81. includedirs {
  82. CROWN_DIR .. "3rdparty/android",
  83. }
  84. configuration { "linux-*" }
  85. links {
  86. "pthread",
  87. "openal",
  88. }
  89. includedirs {
  90. CROWN_DIR .. "3rdparty/wayland/include",
  91. }
  92. configuration { "wasm" }
  93. kind "ConsoleApp"
  94. targetextension ".js"
  95. linkoptions {
  96. "-pthread", -- https://emscripten.org/docs/porting/pthreads.html#compiling-with-pthreads-enabled
  97. "-lopenal",
  98. "-s ABORTING_MALLOC=0",
  99. "-s PTHREAD_POOL_SIZE=8",
  100. "-s EXIT_RUNTIME=1",
  101. "-s FORCE_FILESYSTEM", -- https://github.com/emscripten-core/emscripten/blob/f5a1faa6c8d84fd5365a178013ce982d9168f6df/tools/file_packager.py#L17
  102. "-s MAX_WEBGL_VERSION=2",
  103. "-s TOTAL_MEMORY=256MB",
  104. "-s STACK_SIZE=256KB",
  105. "-s GL_ENABLE_GET_PROC_ADDRESS",
  106. -- "-s SAFE_HEAP=1",
  107. }
  108. configuration { "vs* or mingw*" }
  109. links {
  110. "openal",
  111. "dbghelp",
  112. "psapi",
  113. "ws2_32",
  114. "ole32",
  115. "gdi32",
  116. }
  117. configuration {}
  118. files {
  119. CROWN_DIR .. "src/**.h",
  120. CROWN_DIR .. "src/**.cpp",
  121. CROWN_DIR .. "3rdparty/ufbx/ufbx.c",
  122. CROWN_DIR .. "3rdparty/lz4/lib/*.c",
  123. }
  124. strip()
  125. configuration {} -- reset configuration
  126. end