crown.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. "gcc",
  76. "EGL",
  77. "GLESv2",
  78. "OpenSLES",
  79. "openal",
  80. }
  81. configuration { "linux-*" }
  82. links {
  83. "pthread",
  84. "openal",
  85. }
  86. configuration { "wasm" }
  87. kind "ConsoleApp"
  88. targetextension ".js"
  89. linkoptions {
  90. "-pthread", -- https://emscripten.org/docs/porting/pthreads.html#compiling-with-pthreads-enabled
  91. "-lopenal",
  92. "-s ABORTING_MALLOC=0",
  93. "-s PTHREAD_POOL_SIZE=8",
  94. "-s EXIT_RUNTIME=1",
  95. "-s FORCE_FILESYSTEM", -- https://github.com/emscripten-core/emscripten/blob/f5a1faa6c8d84fd5365a178013ce982d9168f6df/tools/file_packager.py#L17
  96. "-s MAX_WEBGL_VERSION=2",
  97. "-s TOTAL_MEMORY=128MB",
  98. "-s GL_ENABLE_GET_PROC_ADDRESS",
  99. -- "-s SAFE_HEAP=1",
  100. }
  101. configuration { "vs* or mingw*" }
  102. links {
  103. "openal",
  104. "dbghelp",
  105. "psapi",
  106. "ws2_32",
  107. "ole32",
  108. "gdi32",
  109. }
  110. configuration {}
  111. files {
  112. CROWN_DIR .. "src/**.h",
  113. CROWN_DIR .. "src/**.cpp",
  114. CROWN_DIR .. "3rdparty/ufbx/ufbx.c"
  115. }
  116. strip()
  117. configuration {} -- reset configuration
  118. end