premake4.lua 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. solution "0_Bullet3Solution"
  2. local osversion = os.getversion()
  3. print(string.format(" %d.%d.%d (%s)",
  4. osversion.majorversion, osversion.minorversion, osversion.revision,
  5. osversion.description))
  6. if _ACTION == "vs2010" or _ACTION=="vs2008" then
  7. buildoptions
  8. {
  9. -- Multithreaded compiling
  10. "/MP",
  11. -- Disable a few useless warnings
  12. "/wd4244",
  13. "/wd4267"
  14. }
  15. end
  16. act = ""
  17. if _ACTION then
  18. act = _ACTION
  19. end
  20. newoption {
  21. trigger = "ios",
  22. description = "Enable iOS target (requires xcode4)"
  23. }
  24. newoption
  25. {
  26. trigger = "enable_system_opengl",
  27. description = "Try to link and use the system OpenGL headers version instead of dynamically loading OpenGL (dlopen is default)"
  28. }
  29. newoption
  30. {
  31. trigger = "enable_openvr",
  32. description = "Enable experimental Virtual Reality examples, using OpenVR for HTC Vive and Oculus Rift"
  33. }
  34. newoption
  35. {
  36. trigger = "enable_system_x11",
  37. description = "Try to link and use system X11 headers instead of dynamically loading X11 (dlopen is default)"
  38. }
  39. newoption
  40. {
  41. trigger = "noopengl3",
  42. description = "Don't compile any OpenGL3+ code"
  43. }
  44. newoption
  45. {
  46. trigger = "midi",
  47. description = "Use Midi controller to control parameters"
  48. }
  49. -- _OPTIONS["midi"] = "1";
  50. newoption
  51. {
  52. trigger = "no-demos",
  53. description = "Don't build demos"
  54. }
  55. newoption
  56. {
  57. trigger = "no-extras",
  58. description = "Don't build Extras"
  59. }
  60. newoption
  61. {
  62. trigger = "standalone-examples",
  63. description = "Build standalone examples with reduced dependencies."
  64. }
  65. newoption
  66. {
  67. trigger = "no-clsocket",
  68. description = "Disable clsocket and clsocket tests (used for optional TCP networking in pybullet and shared memory C-API)"
  69. }
  70. newoption
  71. {
  72. trigger = "no-enet",
  73. description = "Disable enet and enet tests (used for optional UDP networking in pybullet and shared memory C-API)"
  74. }
  75. newoption
  76. {
  77. trigger = "lua",
  78. description = "Enable Lua scipting support in Example Browser"
  79. }
  80. newoption
  81. {
  82. trigger = "enable_pybullet",
  83. description = "Enable high-level Python scripting of Bullet with URDF/SDF import and synthetic camera."
  84. }
  85. if os.is("Linux") then
  86. default_python_include_dir = "/usr/include/python2.7"
  87. default_python_lib_dir = "/usr/local/lib/"
  88. end
  89. if os.is("Windows") then
  90. default_python_include_dir = "C:/Python-3.5.2/include"
  91. default_python_lib_dir = "C:/Python-3.5.2/libs"
  92. end
  93. newoption
  94. {
  95. trigger = "python_include_dir",
  96. value = default_python_include_dir,
  97. description = "Python (2.x or 3.x) include directory"
  98. }
  99. newoption
  100. {
  101. trigger = "python_lib_dir",
  102. value = default_python_lib_dir,
  103. description = "Python (2.x or 3.x) library directory "
  104. }
  105. newoption {
  106. trigger = "targetdir",
  107. value = "path such as ../bin",
  108. description = "Set the output location for the generated project files"
  109. }
  110. newoption
  111. {
  112. trigger = "no-test",
  113. description = "Disable all tests"
  114. }
  115. newoption
  116. {
  117. trigger = "no-gtest",
  118. description = "Disable unit tests using gtest"
  119. }
  120. newoption
  121. {
  122. trigger = "no-bullet3",
  123. description = "Do not build bullet3 libs"
  124. }
  125. newoption
  126. {
  127. trigger = "double",
  128. description = "Double precision version of Bullet"
  129. }
  130. newoption
  131. {
  132. trigger = "serial",
  133. description = "Enable serial, for testing the VR glove in C++"
  134. }
  135. newoption
  136. {
  137. trigger = "audio",
  138. description = "Enable audio"
  139. }
  140. if _OPTIONS["double"] then
  141. defines {"BT_USE_DOUBLE_PRECISION"}
  142. end
  143. configurations {"Release", "Debug"}
  144. configuration "Release"
  145. flags { "Optimize", "EnableSSE2","StaticRuntime", "NoMinimalRebuild", "FloatFast"}
  146. configuration "Debug"
  147. defines {"_DEBUG=1"}
  148. flags { "Symbols", "StaticRuntime" , "NoMinimalRebuild", "NoEditAndContinue" ,"FloatFast"}
  149. if os.is("Linux") or os.is("macosx") then
  150. if os.is64bit() then
  151. platforms {"x64"}
  152. else
  153. platforms {"x32"}
  154. end
  155. else
  156. platforms {"x32","x64"}
  157. end
  158. configuration {"x32"}
  159. targetsuffix ("_" .. act)
  160. configuration "x64"
  161. targetsuffix ("_" .. act .. "_64" )
  162. configuration {"x64", "debug"}
  163. targetsuffix ("_" .. act .. "_x64_debug")
  164. configuration {"x64", "release"}
  165. targetsuffix ("_" .. act .. "_x64_release" )
  166. configuration {"x32", "debug"}
  167. targetsuffix ("_" .. act .. "_debug" )
  168. configuration{}
  169. postfix=""
  170. if _ACTION == "xcode4" then
  171. if _OPTIONS["ios"] then
  172. _OPTIONS["no-bullet3"] = "1"
  173. _OPTIONS["no-gtest"] = "1"
  174. postfix = "ios";
  175. xcodebuildsettings
  176. {
  177. 'INFOPLIST_FILE = "../../test/Bullet2/Info.plist"',
  178. 'CODE_SIGN_IDENTITY = "iPhone Developer"',
  179. "SDKROOT = iphoneos",
  180. 'ARCHS = "armv7"',
  181. 'TARGETED_DEVICE_FAMILY = "1,2"',
  182. 'VALID_ARCHS = "armv7"',
  183. }
  184. else
  185. xcodebuildsettings
  186. {
  187. 'ARCHS = "$(ARCHS_STANDARD_32_BIT) $(ARCHS_STANDARD_64_BIT)"',
  188. 'VALID_ARCHS = "x86_64 i386"',
  189. -- 'SDKROOT = "macosx10.9"',
  190. }
  191. end
  192. end
  193. -- comment-out for now, URDF reader needs exceptions
  194. -- flags { "NoRTTI", "NoExceptions"}
  195. -- defines { "_HAS_EXCEPTIONS=0" }
  196. --printf ( _OPTIONS["targetdir"] )
  197. targetdir( _OPTIONS["targetdir"] or "../bin" )
  198. location("./" .. act .. postfix)
  199. projectRootDir = os.getcwd() .. "/../"
  200. print("Project root directory: " .. projectRootDir);
  201. if not _OPTIONS["python_include_dir"] then
  202. _OPTIONS["python_include_dir"] = default_python_include_dir
  203. end
  204. if not _OPTIONS["python_lib_dir"] then
  205. _OPTIONS["python_lib_dir"] = default_python_lib_dir
  206. end
  207. if os.is("Linux") then
  208. default_glfw_include_dir = "usr/local/include/GLFW"
  209. default_glfw_lib_dir = "/usr/local/lib/"
  210. default_glfw_lib_name = "glfw3"
  211. end
  212. if os.is("macosx") then
  213. default_glfw_include_dir = "/usr/local/Cellar/glfw/3.2.1/include"
  214. default_glfw_lib_dir = "/usr/local/Cellar/glfw/3.2.1/lib"
  215. default_glfw_lib_name = "glfw"
  216. end
  217. if os.is("Windows") then
  218. default_glfw_include_dir = "c:/glfw/include"
  219. default_glfw_lib_dir = "c:/glfw/lib"
  220. default_glfw_lib_name = "glfw3"
  221. end
  222. if not _OPTIONS["glfw_lib_dir"] then
  223. _OPTIONS["glfw_lib_dir"] = default_glfw_lib_dir
  224. end
  225. if not _OPTIONS["glfw_include_dir"] then
  226. _OPTIONS["glfw_include_dir"] = default_glfw_include_dir
  227. end
  228. if not _OPTIONS["glfw_lib_name"] then
  229. _OPTIONS["glfw_lib_name"] = default_glfw_lib_name
  230. end
  231. newoption
  232. {
  233. trigger = "glfw_include_dir",
  234. value = default_glfw_include_dir,
  235. description = "GLFW 3.x include directory"
  236. }
  237. newoption
  238. {
  239. trigger = "glfw_lib_name",
  240. value = default_glfw_lib_name,
  241. description = "GLFW 3.x library name (glfw, glfw3)"
  242. }
  243. newoption
  244. {
  245. trigger = "glfw_lib_dir",
  246. value = default_glfw_lib_dir,
  247. description = "(optional) GLFW 3.x library directory "
  248. }
  249. newoption
  250. {
  251. trigger = "enable_glfw",
  252. value = false,
  253. description = "(optional) use GLFW 3.x library"
  254. }
  255. if _OPTIONS["enable_glfw"] then
  256. defines {"B3_USE_GLFW"}
  257. function initOpenGL()
  258. includedirs {
  259. projectRootDir .. "examples/ThirdPartyLibs/glad"
  260. }
  261. includedirs {
  262. _OPTIONS["glfw_include_dir"],
  263. }
  264. libdirs {
  265. _OPTIONS["glfw_lib_dir"]
  266. }
  267. links { _OPTIONS["glfw_lib_name"]}
  268. files { projectRootDir .. "examples/ThirdPartyLibs/glad/glad.c" }
  269. end
  270. function findOpenGL3()
  271. return true
  272. end
  273. function initGlew()
  274. end
  275. else
  276. dofile ("findOpenGLGlewGlut.lua")
  277. if (not findOpenGL3()) then
  278. defines {"NO_OPENGL3"}
  279. end
  280. end
  281. dofile ("findOpenCL.lua")
  282. dofile ("findDirectX11.lua")
  283. language "C++"
  284. if _OPTIONS["audio"] then
  285. include "../examples/TinyAudio"
  286. end
  287. if _OPTIONS["serial"] then
  288. include "../examples/ThirdPartyLibs/serial"
  289. end
  290. if not _OPTIONS["no-demos"] then
  291. include "../examples/ExampleBrowser"
  292. include "../examples/RobotSimulator"
  293. include "../examples/OpenGLWindow"
  294. include "../examples/ThirdPartyLibs/Gwen"
  295. include "../examples/HelloWorld"
  296. include "../examples/SharedMemory"
  297. include "../examples/ThirdPartyLibs/BussIK"
  298. if _OPTIONS["lua"] then
  299. include "../examples/ThirdPartyLibs/lua-5.2.3"
  300. end
  301. if _OPTIONS["enable_pybullet"] then
  302. include "../examples/pybullet"
  303. end
  304. include "../examples/SimpleOpenGL3"
  305. if _OPTIONS["standalone-examples"] then
  306. include "../examples/TinyRenderer"
  307. include "../examples/BasicDemo"
  308. include "../examples/InverseDynamics"
  309. include "../examples/ExtendedTutorials"
  310. include "../examples/MultiThreading"
  311. end
  312. if not _OPTIONS["no-test"] then
  313. include "../test/SharedMemory"
  314. end
  315. end
  316. if _OPTIONS["midi"] then
  317. include "../examples/ThirdPartyLibs/midi"
  318. end
  319. if not _OPTIONS["no-clsocket"] then
  320. defines {"BT_ENABLE_CLSOCKET"}
  321. include "../examples/ThirdPartyLibs/clsocket"
  322. include "../test/clsocket"
  323. end
  324. if not _OPTIONS["no-enet"] then
  325. defines {"BT_ENABLE_ENET"}
  326. include "../examples/ThirdPartyLibs/enet"
  327. include "../test/enet/nat_punchthrough/client"
  328. include "../test/enet/nat_punchthrough/server"
  329. include "../test/enet/chat/client"
  330. include "../test/enet/chat/server"
  331. end
  332. if _OPTIONS["no-bullet3"] then
  333. print "--no-bullet3 implies --no-demos"
  334. _OPTIONS["no-demos"] = "1"
  335. else
  336. include "../src/Bullet3Common"
  337. include "../src/Bullet3Geometry"
  338. include "../src/Bullet3Collision"
  339. include "../src/Bullet3Dynamics"
  340. include "../src/Bullet3OpenCL"
  341. include "../src/Bullet3Serialize/Bullet2FileLoader"
  342. end
  343. if _OPTIONS["no-extras"] then
  344. print "--no-extras implies --no-demos"
  345. _OPTIONS["no-demos"] = "1"
  346. else
  347. include "../Extras"
  348. end
  349. if not _OPTIONS["no-test"] then
  350. include "../test/Bullet2"
  351. if not _OPTIONS["no-gtest"] then
  352. include "../test/gtest-1.7.0"
  353. -- include "../test/hello_gtest"
  354. include "../test/collision"
  355. include "../test/BulletDynamics/pendulum"
  356. if not _OPTIONS["no-bullet3"] then
  357. if not _OPTIONS["no-extras"] then
  358. include "../test/InverseDynamics"
  359. end
  360. include "../test/TestBullet3OpenCL"
  361. end
  362. if not _OPTIONS["no-demos"] then
  363. -- Gwen is only used for demos
  364. include "../test/GwenOpenGLTest"
  365. end
  366. end
  367. end
  368. include "../src/BulletInverseDynamics"
  369. include "../src/BulletSoftBody"
  370. include "../src/BulletDynamics"
  371. include "../src/BulletCollision"
  372. include "../src/LinearMath"