crown.lua 9.0 KB

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