crown.lua 2.6 KB

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