crown.lua 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. flags {
  119. "Symbols"
  120. }
  121. defines {
  122. "_DEBUG",
  123. "CROWN_DEBUG=1"
  124. }
  125. configuration { "release" }
  126. defines {
  127. "NDEBUG"
  128. }
  129. configuration { "android*" }
  130. kind "ConsoleApp"
  131. targetextension ".so"
  132. linkoptions {
  133. "-shared"
  134. }
  135. links {
  136. "EGL",
  137. "GLESv2",
  138. "OpenSLES",
  139. }
  140. configuration { "linux-*" }
  141. links {
  142. "X11",
  143. "Xrandr",
  144. "pthread",
  145. "dl",
  146. "GL",
  147. }
  148. configuration { "vs*" }
  149. links {
  150. "OpenGL32",
  151. "dbghelp",
  152. "xinput",
  153. }
  154. if _OPTIONS["with-physx"] then
  155. local function includedirs_physx(prefix)
  156. includedirs {
  157. prefix .. "Include",
  158. prefix .. "Include/common",
  159. prefix .. "Include/characterkinematic",
  160. prefix .. "Include/cloth",
  161. prefix .. "Include/common",
  162. prefix .. "Include/cooking",
  163. prefix .. "Include/extensions",
  164. prefix .. "Include/foundation",
  165. prefix .. "Include/geometry",
  166. prefix .. "Include/particles",
  167. prefix .. "Include/physxprofilesdk",
  168. prefix .. "Include/physxvisualdebuggersdk",
  169. prefix .. "Include/pvd",
  170. prefix .. "Include/pxtask",
  171. prefix .. "Include/vehicle",
  172. }
  173. end
  174. local function links_physx(config, os, platform)
  175. if os == "linux" then
  176. buildoptions {
  177. "-Wno-unknown-pragmas",
  178. "-Wno-unused-local-typedefs",
  179. }
  180. linkoptions {
  181. "-Wl,--start-group $(addprefix -l," ..
  182. " PhysX3" .. config .. "_" .. platform ..
  183. " PhysX3Common" .. config .. "_" .. platform ..
  184. " PhysX3Cooking" .. config .. "_" .. platform ..
  185. " PhysX3CharacterKinematic" .. config .. "_" .. platform ..
  186. " PhysX3Extensions" .. config ..
  187. ") -Wl,--end-group"
  188. }
  189. end
  190. if os == "android" then
  191. linkoptions {
  192. "-Wl,--start-group $(addprefix -l," ..
  193. " LowLevelCloth" .. config ..
  194. " PhysX3 " .. config ..
  195. " PhysX3Common" .. config ..
  196. " PxTask" .. config ..
  197. " LowLevel" .. config ..
  198. " PhysX3CharacterKinematic" .. config ..
  199. " PhysX3Cooking" .. config ..
  200. " PhysX3Extensions" .. config ..
  201. " PhysX3Vehicle" .. config ..
  202. " PhysXProfileSDK" .. config ..
  203. " PhysXVisualDebuggerSDK" .. config ..
  204. " PvdRuntime" .. config ..
  205. " SceneQuery" .. config ..
  206. " SimulationController" .. config ..
  207. ") -Wl,--end-group"
  208. }
  209. end
  210. if os == "windows" then
  211. links {
  212. "PhysX3" .. config .. "_" .. platform,
  213. "PhysX3Common" .. config .. "_" .. platform,
  214. "PhysX3Cooking" .. config .. "_" .. platform,
  215. "PhysX3CharacterKinematic" .. config .. "_" .. platform,
  216. "PhysX3Extensions",
  217. }
  218. end
  219. end
  220. configuration { "android*" }
  221. includedirs_physx("$(PHYSX_SDK_ANDROID)/")
  222. configuration { "linux*" }
  223. includedirs_physx("$(PHYSX_SDK_LINUX)/")
  224. configuration { "vs*" }
  225. includedirs_physx("$(PHYSX_SDK_WINDOWS)/")
  226. configuration { "android-arm" }
  227. libdirs {
  228. "$(PHYSX_SDK_ANDROID)/Lib/android9_neon",
  229. }
  230. configuration { "x32", "linux-*" }
  231. libdirs {
  232. "$(PHYSX_SDK_LINUX)/Lib/linux32",
  233. "$(PHYSX_SDK_LINUX)/Bin/linux32",
  234. }
  235. configuration { "x64", "linux-*" }
  236. libdirs {
  237. "$(PHYSX_SDK_LINUX)/Lib/linux64",
  238. "$(PHYSX_SDK_LINUX)/Bin/linux64",
  239. }
  240. configuration { "x32", "vs*" }
  241. libdirs {
  242. "$(PHYSX_SDK_WINDOWS)/Lib/win32",
  243. }
  244. configuration { "x64", "vs*" }
  245. libdirs {
  246. "$(PHYSX_SDK_WINDOWS)/Lib/win64",
  247. }
  248. configuration { "x32", "debug", "linux-*" }
  249. links_physx("DEBUG", "linux", "x86")
  250. configuration { "x64", "debug", "linux-*" }
  251. links_physx("DEBUG", "linux", "x64")
  252. configuration { "x32", "development", "linux-*" }
  253. links_physx("CHECKED", "linux", "x86")
  254. configuration { "x64", "development", "linux-*" }
  255. links_physx("CHECKED", "linux", "x64")
  256. configuration { "x32", "release", "linux-*" }
  257. links_physx("", "linux", "x86")
  258. configuration { "x64", "release", "linux-*" }
  259. links_physx("", "linux", "x64")
  260. configuration { "debug", "android-arm" }
  261. links_physx("DEBUG", "android", "")
  262. configuration { "development", "android-arm" }
  263. links_physx("CHECKED", "android", "")
  264. configuration { "release", "android-arm" }
  265. links_physx("", "android", "")
  266. configuration { "debug", "x32", "vs*"}
  267. links_physx("DEBUG", "windows", "x86")
  268. configuration { "debug", "x64", "vs*" }
  269. links_physx("DEBUG", "windows", "x64")
  270. configuration { "development", "x32", "vs*" }
  271. links_physx("CHECKED", "windows", "x86")
  272. configuration { "development", "x64", "vs*" }
  273. links_physx("CHECKED", "windows", "x64")
  274. configuration { "release", "x32", "vs*" }
  275. links_physx("", "windows", "x86")
  276. configuration { "release", "x64", "vs*" }
  277. links_physx("", "windows", "x64")
  278. end
  279. configuration {}
  280. files {
  281. CROWN_DIR .. "src/**.h",
  282. CROWN_DIR .. "src/**.cpp"
  283. }
  284. strip()
  285. configuration {} -- reset configuration
  286. end