crown.lua 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. --
  2. -- Copyright (c) 2012-2016 Daniele Bartolini and individual contributors.
  3. -- License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. --
  5. function crown_project(_name, _kind, _defines)
  6. project ("crown" .. _name)
  7. kind (_kind)
  8. includedirs {
  9. CROWN_DIR .. "src",
  10. CROWN_DIR .. "src/core",
  11. CROWN_DIR .. "src/core/containers",
  12. CROWN_DIR .. "src/core/error",
  13. CROWN_DIR .. "src/core/filesystem",
  14. CROWN_DIR .. "src/core/json",
  15. CROWN_DIR .. "src/core/math",
  16. CROWN_DIR .. "src/core/memory",
  17. CROWN_DIR .. "src/core/network",
  18. CROWN_DIR .. "src/core/strings",
  19. CROWN_DIR .. "src/core/thread",
  20. CROWN_DIR .. "src/input",
  21. CROWN_DIR .. "src/lua",
  22. CROWN_DIR .. "src/main",
  23. CROWN_DIR .. "src/resource",
  24. CROWN_DIR .. "src/world",
  25. CROWN_DIR .. "third/bx/include",
  26. CROWN_DIR .. "third/bgfx/include",
  27. CROWN_DIR .. "third/bgfx/src",
  28. CROWN_DIR .. "third/stb_vorbis",
  29. }
  30. defines {
  31. _defines,
  32. }
  33. links {
  34. "bgfx",
  35. }
  36. if _OPTIONS["with-luajit"] then
  37. includedirs {
  38. CROWN_DIR .. "third/luajit/src",
  39. }
  40. configuration { "android-arm" }
  41. libdirs {
  42. CROWN_DIR .. "third/luajit/pre/android_arm"
  43. }
  44. configuration { "linux-* or android-arm" }
  45. links {
  46. "luajit"
  47. }
  48. configuration { "x32", "linux-*" }
  49. libdirs {
  50. CROWN_DIR .. "third/luajit/pre/linux_x86"
  51. }
  52. configuration { "x64", "linux-*" }
  53. libdirs {
  54. CROWN_DIR .. "third/luajit/pre/linux_x64"
  55. }
  56. configuration { "vs*"}
  57. links {
  58. "lua51"
  59. }
  60. configuration { "x32", "vs*" }
  61. libdirs {
  62. CROWN_DIR .. "third/luajit/pre/win_x86"
  63. }
  64. configuration { "x64", "vs*" }
  65. libdirs {
  66. CROWN_DIR .. "third/luajit/pre/win_x64"
  67. }
  68. configuration {}
  69. end
  70. if _OPTIONS["with-openal"] then
  71. includedirs {
  72. CROWN_DIR .. "third/openal/include"
  73. }
  74. links { "openal" }
  75. configuration {}
  76. end
  77. if _OPTIONS["with-bullet"] then
  78. includedirs {
  79. CROWN_DIR .. "third/bullet3/src",
  80. CROWN_DIR .. "third/bullet3/src/Bullet3Collision",
  81. CROWN_DIR .. "third/bullet3/src/Bullet3Collision/BroadPhaseCollision",
  82. CROWN_DIR .. "third/bullet3/src/Bullet3Collision/NarrowPhaseCollision",
  83. CROWN_DIR .. "third/bullet3/src/Bullet3Common",
  84. CROWN_DIR .. "third/bullet3/src/Bullet3Dynamics",
  85. CROWN_DIR .. "third/bullet3/src/Bullet3Dynamics/ConstraintSover",
  86. CROWN_DIR .. "third/bullet3/src/Bullet3Geometry",
  87. CROWN_DIR .. "third/bullet3/src/Bullet3OpenCL",
  88. CROWN_DIR .. "third/bullet3/src/Bullet3OpenCL/BroadphaseCollision",
  89. CROWN_DIR .. "third/bullet3/src/Bullet3OpenCL/initialize",
  90. CROWN_DIR .. "third/bullet3/src/Bullet3OpenCL/NarrowPhaseCollision",
  91. CROWN_DIR .. "third/bullet3/src/Bullet3OpenCL/ParallelPrimitives",
  92. CROWN_DIR .. "third/bullet3/src/Bullet3OpenCL/Raycast",
  93. CROWN_DIR .. "third/bullet3/src/Bullet3OpenCL/RigidBody",
  94. CROWN_DIR .. "third/bullet3/src/Bullet3Serialize",
  95. CROWN_DIR .. "third/bullet3/src/Bullet3Serialize/Bullet2FileLoader",
  96. CROWN_DIR .. "third/bullet3/src/BulletCollision",
  97. CROWN_DIR .. "third/bullet3/src/BulletCollision/BroadphaseCollision",
  98. CROWN_DIR .. "third/bullet3/src/BulletCollision/CollisionDispatch",
  99. CROWN_DIR .. "third/bullet3/src/BulletCollision/CollisionShapes",
  100. CROWN_DIR .. "third/bullet3/src/BulletCollision/Gimpact",
  101. CROWN_DIR .. "third/bullet3/src/BulletCollision/NarrowPhaseCollision",
  102. CROWN_DIR .. "third/bullet3/src/BulletDynamics",
  103. CROWN_DIR .. "third/bullet3/src/BulletDynamics/Character",
  104. CROWN_DIR .. "third/bullet3/src/BulletDynamics/ConstraintSolver",
  105. CROWN_DIR .. "third/bullet3/src/BulletDynamics/Dynamics",
  106. CROWN_DIR .. "third/bullet3/src/BulletDynamics/Featherstone",
  107. CROWN_DIR .. "third/bullet3/src/BulletDynamics/MLCPSolvers",
  108. CROWN_DIR .. "third/bullet3/src/BulletDynamics/Vehicle",
  109. CROWN_DIR .. "third/bullet3/src/BulletSoftBody",
  110. CROWN_DIR .. "third/bullet3/src/LinearMath",
  111. CROWN_DIR .. "third/bullet3/src/clew",
  112. }
  113. links {
  114. "bullet",
  115. }
  116. end
  117. configuration { "debug or development" }
  118. defines {
  119. "CROWN_DEBUG=1"
  120. }
  121. configuration { "android*" }
  122. kind "ConsoleApp"
  123. targetextension ".so"
  124. linkoptions {
  125. "-shared"
  126. }
  127. links {
  128. "EGL",
  129. "GLESv2",
  130. "OpenSLES",
  131. }
  132. configuration { "linux-*" }
  133. links {
  134. "X11",
  135. "Xrandr",
  136. "pthread",
  137. "dl",
  138. "GL",
  139. }
  140. configuration { "vs*" }
  141. links {
  142. "OpenGL32",
  143. "dbghelp",
  144. "xinput",
  145. "psapi",
  146. }
  147. if _OPTIONS["with-physx"] then
  148. local function includedirs_physx(prefix)
  149. includedirs {
  150. prefix .. "Include",
  151. prefix .. "Include/common",
  152. prefix .. "Include/characterkinematic",
  153. prefix .. "Include/cloth",
  154. prefix .. "Include/common",
  155. prefix .. "Include/cooking",
  156. prefix .. "Include/extensions",
  157. prefix .. "Include/foundation",
  158. prefix .. "Include/geometry",
  159. prefix .. "Include/particles",
  160. prefix .. "Include/physxprofilesdk",
  161. prefix .. "Include/physxvisualdebuggersdk",
  162. prefix .. "Include/pvd",
  163. prefix .. "Include/pxtask",
  164. prefix .. "Include/vehicle",
  165. }
  166. end
  167. local function links_physx(config, os, platform)
  168. if os == "linux" then
  169. buildoptions {
  170. "-Wno-unknown-pragmas",
  171. "-Wno-unused-local-typedefs",
  172. }
  173. linkoptions {
  174. "-Wl,--start-group $(addprefix -l," ..
  175. " PhysX3" .. config .. "_" .. platform ..
  176. " PhysX3Common" .. config .. "_" .. platform ..
  177. " PhysX3Cooking" .. config .. "_" .. platform ..
  178. " PhysX3CharacterKinematic" .. config .. "_" .. platform ..
  179. " PhysX3Extensions" .. config ..
  180. ") -Wl,--end-group"
  181. }
  182. end
  183. if os == "android" then
  184. linkoptions {
  185. "-Wl,--start-group $(addprefix -l," ..
  186. " LowLevelCloth" .. config ..
  187. " PhysX3 " .. config ..
  188. " PhysX3Common" .. config ..
  189. " PxTask" .. config ..
  190. " LowLevel" .. config ..
  191. " PhysX3CharacterKinematic" .. config ..
  192. " PhysX3Cooking" .. config ..
  193. " PhysX3Extensions" .. config ..
  194. " PhysX3Vehicle" .. config ..
  195. " PhysXProfileSDK" .. config ..
  196. " PhysXVisualDebuggerSDK" .. config ..
  197. " PvdRuntime" .. config ..
  198. " SceneQuery" .. config ..
  199. " SimulationController" .. config ..
  200. ") -Wl,--end-group"
  201. }
  202. end
  203. if os == "windows" then
  204. links {
  205. "PhysX3" .. config .. "_" .. platform,
  206. "PhysX3Common" .. config .. "_" .. platform,
  207. "PhysX3Cooking" .. config .. "_" .. platform,
  208. "PhysX3CharacterKinematic" .. config .. "_" .. platform,
  209. "PhysX3Extensions",
  210. }
  211. end
  212. end
  213. configuration { "android*" }
  214. includedirs_physx("$(PHYSX_SDK_ANDROID)/")
  215. configuration { "linux*" }
  216. includedirs_physx("$(PHYSX_SDK_LINUX)/")
  217. configuration { "vs*" }
  218. includedirs_physx("$(PHYSX_SDK_WINDOWS)/")
  219. configuration { "android-arm" }
  220. libdirs {
  221. "$(PHYSX_SDK_ANDROID)/Lib/android9_neon",
  222. }
  223. configuration { "x32", "linux-*" }
  224. libdirs {
  225. "$(PHYSX_SDK_LINUX)/Lib/linux32",
  226. "$(PHYSX_SDK_LINUX)/Bin/linux32",
  227. }
  228. configuration { "x64", "linux-*" }
  229. libdirs {
  230. "$(PHYSX_SDK_LINUX)/Lib/linux64",
  231. "$(PHYSX_SDK_LINUX)/Bin/linux64",
  232. }
  233. configuration { "x32", "vs*" }
  234. libdirs {
  235. "$(PHYSX_SDK_WINDOWS)/Lib/win32",
  236. }
  237. configuration { "x64", "vs*" }
  238. libdirs {
  239. "$(PHYSX_SDK_WINDOWS)/Lib/win64",
  240. }
  241. configuration { "x32", "debug", "linux-*" }
  242. links_physx("DEBUG", "linux", "x86")
  243. configuration { "x64", "debug", "linux-*" }
  244. links_physx("DEBUG", "linux", "x64")
  245. configuration { "x32", "development", "linux-*" }
  246. links_physx("CHECKED", "linux", "x86")
  247. configuration { "x64", "development", "linux-*" }
  248. links_physx("CHECKED", "linux", "x64")
  249. configuration { "x32", "release", "linux-*" }
  250. links_physx("", "linux", "x86")
  251. configuration { "x64", "release", "linux-*" }
  252. links_physx("", "linux", "x64")
  253. configuration { "debug", "android-arm" }
  254. links_physx("DEBUG", "android", "")
  255. configuration { "development", "android-arm" }
  256. links_physx("CHECKED", "android", "")
  257. configuration { "release", "android-arm" }
  258. links_physx("", "android", "")
  259. configuration { "debug", "x32", "vs*"}
  260. links_physx("DEBUG", "windows", "x86")
  261. configuration { "debug", "x64", "vs*" }
  262. links_physx("DEBUG", "windows", "x64")
  263. configuration { "development", "x32", "vs*" }
  264. links_physx("CHECKED", "windows", "x86")
  265. configuration { "development", "x64", "vs*" }
  266. links_physx("CHECKED", "windows", "x64")
  267. configuration { "release", "x32", "vs*" }
  268. links_physx("", "windows", "x86")
  269. configuration { "release", "x64", "vs*" }
  270. links_physx("", "windows", "x64")
  271. end
  272. configuration {}
  273. files {
  274. CROWN_DIR .. "src/**.h",
  275. CROWN_DIR .. "src/**.cpp"
  276. }
  277. strip()
  278. configuration {} -- reset configuration
  279. end