premake4.lua 11 KB

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