crown.lua 2.4 KB

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