crown.lua 2.4 KB

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