toolchain.lua 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. --
  2. -- Copyright 2010-2015 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
  4. --
  5. local bxDir = path.getabsolute("..")
  6. local naclToolchain = ""
  7. function toolchain(_buildDir, _libDir)
  8. newoption {
  9. trigger = "gcc",
  10. value = "GCC",
  11. description = "Choose GCC flavor",
  12. allowed = {
  13. { "android-arm", "Android - ARM" },
  14. { "android-mips", "Android - MIPS" },
  15. { "android-x86", "Android - x86" },
  16. { "asmjs", "Emscripten/asm.js" },
  17. { "freebsd", "FreeBSD" },
  18. { "linux-gcc", "Linux (GCC compiler)" },
  19. { "linux-gcc-5", "Linux (GCC-5 compiler)" },
  20. { "linux-clang", "Linux (Clang compiler)" },
  21. { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" },
  22. { "linux-arm-gcc", "Linux (ARM, GCC compiler)" },
  23. { "ios-arm", "iOS - ARM" },
  24. { "ios-simulator", "iOS - Simulator" },
  25. { "tvos-arm64", "tvOS - ARM64" },
  26. { "tvos-simulator", "tvOS - Simulator" },
  27. { "mingw-gcc", "MinGW" },
  28. { "mingw-clang", "MinGW (clang compiler)" },
  29. { "nacl", "Native Client" },
  30. { "nacl-arm", "Native Client - ARM" },
  31. { "osx", "OSX" },
  32. { "pnacl", "Native Client - PNaCl" },
  33. { "ps4", "PS4" },
  34. { "qnx-arm", "QNX/Blackberry - ARM" },
  35. { "rpi", "RaspberryPi" },
  36. },
  37. }
  38. newoption {
  39. trigger = "vs",
  40. value = "toolset",
  41. description = "Choose VS toolset",
  42. allowed = {
  43. { "vs2012-clang", "Clang 3.6" },
  44. { "vs2013-clang", "Clang 3.6" },
  45. { "vs2012-xp", "Visual Studio 2012 targeting XP" },
  46. { "vs2013-xp", "Visual Studio 2013 targeting XP" },
  47. { "vs2015-xp", "Visual Studio 2015 targeting XP" },
  48. { "winphone8", "Windows Phone 8.0" },
  49. { "winphone81", "Windows Phone 8.1" },
  50. { "winstore81", "Windows Store 8.1" },
  51. { "winstore82", "Universal Windows App" },
  52. },
  53. }
  54. newoption {
  55. trigger = "xcode",
  56. value = "xcode_target",
  57. description = "Choose XCode target",
  58. allowed = {
  59. { "osx", "OSX" },
  60. { "ios", "iOS" },
  61. { "tvos", "tvOS" },
  62. }
  63. }
  64. newoption {
  65. trigger = "with-android",
  66. value = "#",
  67. description = "Set Android platform version (default: android-14).",
  68. }
  69. newoption {
  70. trigger = "with-ios",
  71. value = "#",
  72. description = "Set iOS target version (default: 8.0).",
  73. }
  74. newoption {
  75. trigger = "with-tvos",
  76. value = "#",
  77. description = "Set tvOS target version (default: 9.0).",
  78. }
  79. -- Avoid error when invoking genie --help.
  80. if (_ACTION == nil) then return false end
  81. location (path.join(_buildDir, "projects", _ACTION))
  82. if _ACTION == "clean" then
  83. os.rmdir(BUILD_DIR)
  84. end
  85. local androidPlatform = "android-14"
  86. if _OPTIONS["with-android"] then
  87. androidPlatform = "android-" .. _OPTIONS["with-android"]
  88. end
  89. local iosPlatform = ""
  90. if _OPTIONS["with-ios"] then
  91. iosPlatform = _OPTIONS["with-ios"]
  92. end
  93. local tvosPlatform = ""
  94. if _OPTIONS["with-tvos"] then
  95. tvosPlatform = _OPTIONS["with-tvos"]
  96. end
  97. if _ACTION == "gmake" then
  98. if nil == _OPTIONS["gcc"] then
  99. print("GCC flavor must be specified!")
  100. os.exit(1)
  101. end
  102. flags {
  103. "ExtraWarnings",
  104. }
  105. if "android-arm" == _OPTIONS["gcc"] then
  106. if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_ROOT") then
  107. print("Set ANDROID_NDK_ARM and ANDROID_NDK_ROOT envrionment variables.")
  108. end
  109. premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
  110. premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
  111. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  112. location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
  113. elseif "android-mips" == _OPTIONS["gcc"] then
  114. if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then
  115. print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
  116. end
  117. premake.gcc.cc = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc"
  118. premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
  119. premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
  120. location (path.join(_buildDir, "projects", _ACTION .. "-android-mips"))
  121. elseif "android-x86" == _OPTIONS["gcc"] then
  122. if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then
  123. print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
  124. end
  125. premake.gcc.cc = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc"
  126. premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
  127. premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
  128. location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
  129. elseif "asmjs" == _OPTIONS["gcc"] then
  130. if not os.getenv("EMSCRIPTEN") then
  131. print("Set EMSCRIPTEN enviroment variables.")
  132. end
  133. premake.gcc.cc = "$(EMSCRIPTEN)/emcc"
  134. premake.gcc.cxx = "$(EMSCRIPTEN)/em++"
  135. premake.gcc.ar = "$(EMSCRIPTEN)/emar"
  136. premake.gcc.llvm = true
  137. location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
  138. elseif "freebsd" == _OPTIONS["gcc"] then
  139. location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
  140. elseif "ios-arm" == _OPTIONS["gcc"] then
  141. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  142. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  143. premake.gcc.ar = "ar"
  144. location (path.join(_buildDir, "projects", _ACTION .. "-ios-arm"))
  145. elseif "ios-simulator" == _OPTIONS["gcc"] then
  146. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  147. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  148. premake.gcc.ar = "ar"
  149. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  150. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  151. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  152. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  153. premake.gcc.ar = "ar"
  154. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  155. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  156. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  157. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  158. premake.gcc.ar = "ar"
  159. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  160. elseif "linux-gcc" == _OPTIONS["gcc"] then
  161. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  162. elseif "linux-gcc-5" == _OPTIONS["gcc"] then
  163. premake.gcc.cc = "gcc-5"
  164. premake.gcc.cxx = "g++-5"
  165. premake.gcc.ar = "ar"
  166. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  167. elseif "linux-clang" == _OPTIONS["gcc"] then
  168. premake.gcc.cc = "clang"
  169. premake.gcc.cxx = "clang++"
  170. premake.gcc.ar = "ar"
  171. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  172. elseif "linux-mips-gcc" == _OPTIONS["gcc"] then
  173. location (path.join(_buildDir, "projects", _ACTION .. "-linux-mips-gcc"))
  174. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  175. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  176. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  177. premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
  178. premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
  179. premake.gcc.ar = "$(MINGW)/bin/ar"
  180. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  181. elseif "mingw-clang" == _OPTIONS["gcc"] then
  182. premake.gcc.cc = "$(CLANG)/bin/clang"
  183. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  184. premake.gcc.ar = "$(MINGW)/bin/ar"
  185. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  186. -- premake.gcc.llvm = true
  187. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  188. elseif "nacl" == _OPTIONS["gcc"] then
  189. if not os.getenv("NACL_SDK_ROOT") then
  190. print("Set NACL_SDK_ROOT enviroment variables.")
  191. end
  192. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-"
  193. if os.is("macosx") then
  194. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_newlib/bin/x86_64-nacl-"
  195. elseif os.is("linux") then
  196. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/x86_64-nacl-"
  197. end
  198. premake.gcc.cc = naclToolchain .. "gcc"
  199. premake.gcc.cxx = naclToolchain .. "g++"
  200. premake.gcc.ar = naclToolchain .. "ar"
  201. location (path.join(_buildDir, "projects", _ACTION .. "-nacl"))
  202. elseif "nacl-arm" == _OPTIONS["gcc"] then
  203. if not os.getenv("NACL_SDK_ROOT") then
  204. print("Set NACL_SDK_ROOT enviroment variables.")
  205. end
  206. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-"
  207. if os.is("macosx") then
  208. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_newlib/bin/arm-nacl-"
  209. elseif os.is("linux") then
  210. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_newlib/bin/arm-nacl-"
  211. end
  212. premake.gcc.cc = naclToolchain .. "gcc"
  213. premake.gcc.cxx = naclToolchain .. "g++"
  214. premake.gcc.ar = naclToolchain .. "ar"
  215. location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm"))
  216. elseif "osx" == _OPTIONS["gcc"] then
  217. if os.is("linux") then
  218. local osxToolchain = "x86_64-apple-darwin13-"
  219. premake.gcc.cc = osxToolchain .. "clang"
  220. premake.gcc.cxx = osxToolchain .. "clang++"
  221. premake.gcc.ar = osxToolchain .. "ar"
  222. end
  223. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  224. elseif "pnacl" == _OPTIONS["gcc"] then
  225. if not os.getenv("NACL_SDK_ROOT") then
  226. print("Set NACL_SDK_ROOT enviroment variables.")
  227. end
  228. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-"
  229. if os.is("macosx") then
  230. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_pnacl/bin/pnacl-"
  231. elseif os.is("linux") then
  232. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-"
  233. end
  234. premake.gcc.cc = naclToolchain .. "clang"
  235. premake.gcc.cxx = naclToolchain .. "clang++"
  236. premake.gcc.ar = naclToolchain .. "ar"
  237. location (path.join(_buildDir, "projects", _ACTION .. "-pnacl"))
  238. elseif "ps4" == _OPTIONS["gcc"] then
  239. if not os.getenv("PS4_SDK_ROOT") then
  240. print("Set PS4_SDK_ROOT enviroment variables.")
  241. end
  242. ps4Toolchain = "$(PS4_SDK_ROOT)/host_tools/bin/orbis-"
  243. premake.gcc.cc = ps4Toolchain .. "clang"
  244. premake.gcc.cxx = ps4Toolchain .. "clang++"
  245. premake.gcc.ar = ps4Toolchain .. "ar"
  246. location (path.join(_buildDir, "projects", _ACTION .. "-ps4"))
  247. elseif "qnx-arm" == _OPTIONS["gcc"] then
  248. if not os.getenv("QNX_HOST") then
  249. print("Set QNX_HOST enviroment variables.")
  250. end
  251. premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc"
  252. premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
  253. premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
  254. location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm"))
  255. elseif "rpi" == _OPTIONS["gcc"] then
  256. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  257. end
  258. elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then
  259. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  260. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  261. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  262. elseif "winphone8" == _OPTIONS["vs"] then
  263. premake.vstudio.toolset = "v110_wp80"
  264. location (path.join(_buildDir, "projects", _ACTION .. "-winphone8"))
  265. elseif "winphone81" == _OPTIONS["vs"] then
  266. premake.vstudio.toolset = "v120_wp81"
  267. premake.vstudio.storeapp = "8.1"
  268. platforms { "ARM" }
  269. location (path.join(_buildDir, "projects", _ACTION .. "-winphone81"))
  270. elseif "winstore81" == _OPTIONS["vs"] then
  271. premake.vstudio.toolset = "v120"
  272. premake.vstudio.storeapp = "8.1"
  273. platforms { "ARM" }
  274. location (path.join(_buildDir, "projects", _ACTION .. "-winstore81"))
  275. elseif "winstore82" == _OPTIONS["vs"] then
  276. premake.vstudio.toolset = "v140"
  277. premake.vstudio.storeapp = "8.2"
  278. platforms { "ARM" }
  279. location (path.join(_buildDir, "projects", _ACTION .. "-winstore82"))
  280. elseif ("vs2012-xp") == _OPTIONS["vs"] then
  281. premake.vstudio.toolset = ("v110_xp")
  282. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  283. elseif ("vs2013-xp") == _OPTIONS["vs"] then
  284. premake.vstudio.toolset = ("v120_xp")
  285. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  286. elseif ("vs2015-xp") == _OPTIONS["vs"] then
  287. premake.vstudio.toolset = ("v140_xp")
  288. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  289. end
  290. elseif _ACTION == "xcode4" then
  291. if "osx" == _OPTIONS["xcode"] then
  292. premake.xcode.toolset = "macosx"
  293. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  294. elseif "ios" == _OPTIONS["xcode"] then
  295. premake.xcode.toolset = "iphoneos"
  296. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  297. elseif "tvos" == _OPTIONS["xcode"] then
  298. premake.xcode.toolset = "appletvos"
  299. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  300. end
  301. end
  302. flags {
  303. "StaticRuntime",
  304. "NoPCH",
  305. "NativeWChar",
  306. "NoRTTI",
  307. "NoExceptions",
  308. "NoEditAndContinue",
  309. "Symbols",
  310. }
  311. defines {
  312. "__STDC_LIMIT_MACROS",
  313. "__STDC_FORMAT_MACROS",
  314. "__STDC_CONSTANT_MACROS",
  315. }
  316. configuration { "Debug" }
  317. targetsuffix "Debug"
  318. configuration { "Release" }
  319. flags {
  320. "OptimizeSpeed",
  321. }
  322. targetsuffix "Release"
  323. configuration { "vs*", "x32" }
  324. flags {
  325. "EnableSSE2",
  326. }
  327. configuration { "vs*" }
  328. includedirs { path.join(bxDir, "include/compat/msvc") }
  329. defines {
  330. "WIN32",
  331. "_WIN32",
  332. "_HAS_EXCEPTIONS=0",
  333. "_HAS_ITERATOR_DEBUGGING=0",
  334. "_SCL_SECURE=0",
  335. "_SECURE_SCL=0",
  336. "_SCL_SECURE_NO_WARNINGS",
  337. "_CRT_SECURE_NO_WARNINGS",
  338. "_CRT_SECURE_NO_DEPRECATE",
  339. }
  340. buildoptions {
  341. "/Oy-", -- Suppresses creation of frame pointers on the call stack.
  342. "/Ob2", -- The Inline Function Expansion
  343. }
  344. linkoptions {
  345. "/ignore:4221", -- LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
  346. }
  347. configuration { "vs2008" }
  348. includedirs { path.join(bxDir, "include/compat/msvc/pre1600") }
  349. configuration { "x32", "vs*" }
  350. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  351. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  352. libdirs {
  353. path.join(_libDir, "lib/win32_" .. _ACTION),
  354. }
  355. configuration { "x64", "vs*" }
  356. defines { "_WIN64" }
  357. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  358. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  359. libdirs {
  360. path.join(_libDir, "lib/win64_" .. _ACTION),
  361. }
  362. configuration { "ARM", "vs*" }
  363. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  364. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  365. configuration { "vs*-clang" }
  366. buildoptions {
  367. "-Qunused-arguments",
  368. }
  369. configuration { "x32", "vs*-clang" }
  370. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  371. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  372. configuration { "x64", "vs*-clang" }
  373. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  374. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  375. configuration { "winphone8* or winstore8*" }
  376. removeflags {
  377. "StaticRuntime",
  378. "NoExceptions",
  379. }
  380. configuration { "*-gcc* or osx" }
  381. buildoptions {
  382. "-Wshadow",
  383. }
  384. configuration { "mingw-*" }
  385. defines { "WIN32" }
  386. includedirs { path.join(bxDir, "include/compat/mingw") }
  387. buildoptions {
  388. "-Wunused-value",
  389. "-fdata-sections",
  390. "-ffunction-sections",
  391. "-msse2",
  392. "-Wunused-value",
  393. "-Wundef",
  394. }
  395. buildoptions_cpp {
  396. "-std=c++0x",
  397. }
  398. linkoptions {
  399. "-Wl,--gc-sections",
  400. "-static",
  401. "-static-libgcc",
  402. "-static-libstdc++",
  403. }
  404. configuration { "x32", "mingw-gcc" }
  405. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  406. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  407. libdirs {
  408. path.join(_libDir, "lib/win32_mingw-gcc"),
  409. }
  410. buildoptions { "-m32" }
  411. configuration { "x64", "mingw-gcc" }
  412. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  413. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  414. libdirs {
  415. path.join(_libDir, "lib/win64_mingw-gcc"),
  416. }
  417. buildoptions { "-m64" }
  418. configuration { "mingw-clang" }
  419. buildoptions {
  420. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  421. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  422. "-isystem$(MINGW)/x86_64-w64-mingw32/include",
  423. }
  424. linkoptions {
  425. "-Qunused-arguments",
  426. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  427. }
  428. configuration { "x32", "mingw-clang" }
  429. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  430. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  431. libdirs {
  432. path.join(_libDir, "lib/win32_mingw-clang"),
  433. }
  434. buildoptions { "-m32" }
  435. configuration { "x64", "mingw-clang" }
  436. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  437. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  438. libdirs {
  439. path.join(_libDir, "lib/win64_mingw-clang"),
  440. }
  441. buildoptions { "-m64" }
  442. configuration { "linux-clang" }
  443. configuration { "linux-gcc-5" }
  444. buildoptions {
  445. -- "-fno-omit-frame-pointer",
  446. -- "-fsanitize=address",
  447. -- "-fsanitize=undefined",
  448. -- "-fsanitize=float-divide-by-zero",
  449. -- "-fsanitize=float-cast-overflow",
  450. }
  451. links {
  452. -- "asan",
  453. -- "ubsan",
  454. }
  455. configuration { "linux-gcc" }
  456. buildoptions {
  457. "-mfpmath=sse",
  458. }
  459. configuration { "linux-gcc or linux-clang" }
  460. buildoptions {
  461. "-msse2",
  462. "-Wunused-value",
  463. "-Wundef",
  464. }
  465. buildoptions_cpp {
  466. "-std=c++0x",
  467. }
  468. links {
  469. "rt",
  470. "dl",
  471. }
  472. linkoptions {
  473. "-Wl,--gc-sections",
  474. }
  475. configuration { "linux-gcc*", "x32" }
  476. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  477. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  478. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  479. buildoptions {
  480. "-m32",
  481. }
  482. configuration { "linux-gcc*", "x64" }
  483. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  484. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  485. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  486. buildoptions {
  487. "-m64",
  488. }
  489. configuration { "linux-clang", "x32" }
  490. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  491. objdir (path.join(_buildDir, "linux32_clang/obj"))
  492. libdirs { path.join(_libDir, "lib/linux32_clang") }
  493. buildoptions {
  494. "-m32",
  495. }
  496. configuration { "linux-clang", "x64" }
  497. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  498. objdir (path.join(_buildDir, "linux64_clang/obj"))
  499. libdirs { path.join(_libDir, "lib/linux64_clang") }
  500. buildoptions {
  501. "-m64",
  502. }
  503. configuration { "linux-mips-gcc" }
  504. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  505. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  506. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  507. buildoptions {
  508. "-Wunused-value",
  509. "-Wundef",
  510. }
  511. buildoptions_cpp {
  512. "-std=c++0x",
  513. }
  514. links {
  515. "rt",
  516. "dl",
  517. }
  518. linkoptions {
  519. "-Wl,--gc-sections",
  520. }
  521. configuration { "linux-arm-gcc" }
  522. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  523. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  524. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  525. buildoptions {
  526. "-Wunused-value",
  527. "-Wundef",
  528. }
  529. buildoptions_cpp {
  530. "-std=c++0x",
  531. }
  532. links {
  533. "rt",
  534. "dl",
  535. }
  536. linkoptions {
  537. "-Wl,--gc-sections",
  538. }
  539. configuration { "android-*" }
  540. flags {
  541. "NoImportLib",
  542. }
  543. includedirs {
  544. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/include",
  545. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  546. }
  547. linkoptions {
  548. "-nostdlib",
  549. "-static-libgcc",
  550. }
  551. links {
  552. "c",
  553. "dl",
  554. "m",
  555. "android",
  556. "log",
  557. "gnustl_static",
  558. "gcc",
  559. }
  560. buildoptions {
  561. "-fPIC",
  562. "-no-canonical-prefixes",
  563. "-Wa,--noexecstack",
  564. "-fstack-protector",
  565. "-ffunction-sections",
  566. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  567. "-Wunused-value",
  568. "-Wundef",
  569. }
  570. buildoptions_cpp {
  571. "-std=c++0x",
  572. }
  573. linkoptions {
  574. "-no-canonical-prefixes",
  575. "-Wl,--no-undefined",
  576. "-Wl,-z,noexecstack",
  577. "-Wl,-z,relro",
  578. "-Wl,-z,now",
  579. }
  580. configuration { "android-arm" }
  581. targetdir (path.join(_buildDir, "android-arm/bin"))
  582. objdir (path.join(_buildDir, "android-arm/obj"))
  583. libdirs {
  584. path.join(_libDir, "lib/android-arm"),
  585. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
  586. }
  587. includedirs {
  588. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
  589. }
  590. buildoptions {
  591. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  592. "-mthumb",
  593. "-march=armv7-a",
  594. "-mfloat-abi=softfp",
  595. "-mfpu=neon",
  596. "-Wunused-value",
  597. "-Wundef",
  598. }
  599. linkoptions {
  600. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  601. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  602. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  603. "-march=armv7-a",
  604. "-Wl,--fix-cortex-a8",
  605. }
  606. configuration { "android-mips" }
  607. targetdir (path.join(_buildDir, "android-mips/bin"))
  608. objdir (path.join(_buildDir, "android-mips/obj"))
  609. libdirs {
  610. path.join(_libDir, "lib/android-mips"),
  611. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips",
  612. }
  613. includedirs {
  614. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include",
  615. }
  616. buildoptions {
  617. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  618. "-Wunused-value",
  619. "-Wundef",
  620. }
  621. linkoptions {
  622. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  623. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"),
  624. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"),
  625. }
  626. configuration { "android-x86" }
  627. targetdir (path.join(_buildDir, "android-x86/bin"))
  628. objdir (path.join(_buildDir, "android-x86/obj"))
  629. libdirs {
  630. path.join(_libDir, "lib/android-x86"),
  631. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86",
  632. }
  633. includedirs {
  634. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include",
  635. }
  636. buildoptions {
  637. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  638. "-march=i686",
  639. "-mtune=atom",
  640. "-mstackrealign",
  641. "-msse3",
  642. "-mfpmath=sse",
  643. "-Wunused-value",
  644. "-Wundef",
  645. }
  646. linkoptions {
  647. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  648. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  649. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "/arch-x86/usr/lib/crtend_so.o"),
  650. }
  651. configuration { "asmjs" }
  652. targetdir (path.join(_buildDir, "asmjs/bin"))
  653. objdir (path.join(_buildDir, "asmjs/obj"))
  654. libdirs { path.join(_libDir, "lib/asmjs") }
  655. buildoptions {
  656. "-isystem$(EMSCRIPTEN)/system/include",
  657. "-isystem$(EMSCRIPTEN)/system/include/libc",
  658. "-Wunused-value",
  659. "-Wundef",
  660. }
  661. configuration { "freebsd" }
  662. targetdir (path.join(_buildDir, "freebsd/bin"))
  663. objdir (path.join(_buildDir, "freebsd/obj"))
  664. libdirs { path.join(_libDir, "lib/freebsd") }
  665. includedirs {
  666. path.join(bxDir, "include/compat/freebsd"),
  667. }
  668. configuration { "nacl or nacl-arm or pnacl" }
  669. buildoptions {
  670. "-U__STRICT_ANSI__", -- strcasecmp, setenv, unsetenv,...
  671. "-fno-stack-protector",
  672. "-fdiagnostics-show-option",
  673. "-fdata-sections",
  674. "-ffunction-sections",
  675. "-Wunused-value",
  676. "-Wundef",
  677. }
  678. buildoptions_cpp {
  679. "-std=c++0x",
  680. }
  681. includedirs {
  682. "$(NACL_SDK_ROOT)/include",
  683. path.join(bxDir, "include/compat/nacl"),
  684. }
  685. configuration { "nacl" }
  686. buildoptions {
  687. "-pthread",
  688. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  689. "-msse2",
  690. }
  691. linkoptions {
  692. "-Wl,--gc-sections",
  693. }
  694. configuration { "x32", "nacl" }
  695. targetdir (path.join(_buildDir, "nacl-x86/bin"))
  696. objdir (path.join(_buildDir, "nacl-x86/obj"))
  697. libdirs { path.join(_libDir, "lib/nacl-x86") }
  698. linkoptions { "-melf32_nacl" }
  699. configuration { "x32", "nacl", "Debug" }
  700. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
  701. configuration { "x32", "nacl", "Release" }
  702. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
  703. configuration { "x64", "nacl" }
  704. targetdir (path.join(_buildDir, "nacl-x64/bin"))
  705. objdir (path.join(_buildDir, "nacl-x64/obj"))
  706. libdirs { path.join(_libDir, "lib/nacl-x64") }
  707. linkoptions { "-melf64_nacl" }
  708. configuration { "x64", "nacl", "Debug" }
  709. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
  710. configuration { "x64", "nacl", "Release" }
  711. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
  712. configuration { "nacl-arm" }
  713. buildoptions {
  714. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  715. }
  716. targetdir (path.join(_buildDir, "nacl-arm/bin"))
  717. objdir (path.join(_buildDir, "nacl-arm/obj"))
  718. libdirs { path.join(_libDir, "lib/nacl-arm") }
  719. configuration { "nacl-arm", "Debug" }
  720. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
  721. configuration { "nacl-arm", "Release" }
  722. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
  723. configuration { "pnacl" }
  724. targetdir (path.join(_buildDir, "pnacl/bin"))
  725. objdir (path.join(_buildDir, "pnacl/obj"))
  726. libdirs { path.join(_libDir, "lib/pnacl") }
  727. configuration { "pnacl", "Debug" }
  728. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  729. configuration { "pnacl", "Release" }
  730. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  731. configuration { "Xbox360" }
  732. targetdir (path.join(_buildDir, "xbox360/bin"))
  733. objdir (path.join(_buildDir, "xbox360/obj"))
  734. includedirs { path.join(bxDir, "include/compat/msvc") }
  735. libdirs { path.join(_libDir, "lib/xbox360") }
  736. defines {
  737. "NOMINMAX",
  738. "_XBOX",
  739. }
  740. configuration { "osx", "x32" }
  741. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  742. objdir (path.join(_buildDir, "osx32_clang/obj"))
  743. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  744. buildoptions {
  745. "-m32",
  746. }
  747. configuration { "osx", "x64" }
  748. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  749. objdir (path.join(_buildDir, "osx64_clang/obj"))
  750. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  751. buildoptions {
  752. "-m64",
  753. }
  754. configuration { "osx", "Universal" }
  755. targetdir (path.join(_buildDir, "osx_universal/bin"))
  756. objdir (path.join(_buildDir, "osx_universal/bin"))
  757. configuration { "osx" }
  758. buildoptions {
  759. "-Wfatal-errors",
  760. "-msse2",
  761. "-Wunused-value",
  762. "-Wundef",
  763. }
  764. includedirs { path.join(bxDir, "include/compat/osx") }
  765. configuration { "ios*" }
  766. linkoptions {
  767. "-lc++",
  768. }
  769. buildoptions {
  770. "-Wfatal-errors",
  771. "-Wunused-value",
  772. "-Wundef",
  773. }
  774. includedirs { path.join(bxDir, "include/compat/ios") }
  775. configuration { "xcode4", "ios*" }
  776. targetdir (path.join(_buildDir, "ios-arm/bin"))
  777. objdir (path.join(_buildDir, "ios-arm/obj"))
  778. configuration { "ios-arm" }
  779. targetdir (path.join(_buildDir, "ios-arm/bin"))
  780. objdir (path.join(_buildDir, "ios-arm/obj"))
  781. libdirs { path.join(_libDir, "lib/ios-arm") }
  782. linkoptions {
  783. "-miphoneos-version-min=7.0",
  784. "-arch armv7",
  785. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  786. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  787. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  788. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  789. }
  790. buildoptions {
  791. "-miphoneos-version-min=7.0",
  792. "-arch armv7",
  793. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  794. }
  795. configuration { "ios-simulator" }
  796. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  797. objdir (path.join(_buildDir, "ios-simulator/obj"))
  798. libdirs { path.join(_libDir, "lib/ios-simulator") }
  799. linkoptions {
  800. "-mios-simulator-version-min=7.0",
  801. "-arch i386",
  802. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  803. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  804. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  805. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  806. }
  807. buildoptions {
  808. "-mios-simulator-version-min=7.0",
  809. "-arch i386",
  810. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  811. }
  812. configuration { "tvos*" }
  813. linkoptions {
  814. "-lc++",
  815. }
  816. buildoptions {
  817. "-Wfatal-errors",
  818. "-Wunused-value",
  819. "-Wundef",
  820. }
  821. includedirs { path.join(bxDir, "include/compat/ios") }
  822. configuration { "xcode4", "tvos*" }
  823. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  824. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  825. configuration { "tvos-arm64" }
  826. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  827. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  828. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  829. linkoptions {
  830. "-mtvos-version-min=9.0",
  831. "-arch arm64",
  832. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  833. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  834. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  835. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  836. }
  837. buildoptions {
  838. "-mtvos-version-min=9.0",
  839. "-arch arm64",
  840. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  841. }
  842. configuration { "tvos-simulator" }
  843. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  844. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  845. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  846. linkoptions {
  847. "-mtvos-simulator-version-min=9.0",
  848. "-arch i386",
  849. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  850. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  851. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  852. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  853. }
  854. buildoptions {
  855. "-mtvos-simulator-version-min=9.0",
  856. "-arch i386",
  857. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  858. }
  859. configuration { "ps4" }
  860. targetdir (path.join(_buildDir, "ps4/bin"))
  861. objdir (path.join(_buildDir, "ps4/obj"))
  862. libdirs { path.join(_libDir, "lib/ps4") }
  863. includedirs {
  864. path.join(bxDir, "include/compat/freebsd"),
  865. "$(PS4_SDK_ROOT)/target/include",
  866. "$(PS4_SDK_ROOT)/target/include_common",
  867. }
  868. buildoptions {
  869. }
  870. buildoptions_cpp {
  871. "-std=c++0x",
  872. }
  873. linkoptions {
  874. }
  875. configuration { "qnx-arm" }
  876. targetdir (path.join(_buildDir, "qnx-arm/bin"))
  877. objdir (path.join(_buildDir, "qnx-arm/obj"))
  878. libdirs { path.join(_libDir, "lib/qnx-arm") }
  879. -- includedirs { path.join(bxDir, "include/compat/qnx") }
  880. buildoptions {
  881. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  882. "-Wunused-value",
  883. "-Wundef",
  884. }
  885. buildoptions_cpp {
  886. "-std=c++0x",
  887. }
  888. configuration { "rpi" }
  889. targetdir (path.join(_buildDir, "rpi/bin"))
  890. objdir (path.join(_buildDir, "rpi/obj"))
  891. libdirs {
  892. path.join(_libDir, "lib/rpi"),
  893. "/opt/vc/lib",
  894. }
  895. defines {
  896. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  897. "__STDC_VERSION__=199901L",
  898. }
  899. buildoptions {
  900. "-Wunused-value",
  901. "-Wundef",
  902. }
  903. buildoptions_cpp {
  904. "-std=c++0x",
  905. }
  906. includedirs {
  907. "/opt/vc/include",
  908. "/opt/vc/include/interface/vcos/pthreads",
  909. "/opt/vc/include/interface/vmcs_host/linux",
  910. }
  911. links {
  912. "rt",
  913. }
  914. linkoptions {
  915. "-Wl,--gc-sections",
  916. }
  917. configuration {} -- reset configuration
  918. return true
  919. end
  920. function strip()
  921. configuration { "android-arm", "Release" }
  922. postbuildcommands {
  923. "$(SILENT) echo Stripping symbols.",
  924. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  925. }
  926. configuration { "android-mips", "Release" }
  927. postbuildcommands {
  928. "$(SILENT) echo Stripping symbols.",
  929. "$(SILENT) $(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  930. }
  931. configuration { "android-x86", "Release" }
  932. postbuildcommands {
  933. "$(SILENT) echo Stripping symbols.",
  934. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  935. }
  936. configuration { "linux-* or rpi", "Release" }
  937. postbuildcommands {
  938. "$(SILENT) echo Stripping symbols.",
  939. "$(SILENT) strip -s \"$(TARGET)\""
  940. }
  941. configuration { "mingw*", "Release" }
  942. postbuildcommands {
  943. "$(SILENT) echo Stripping symbols.",
  944. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  945. }
  946. configuration { "pnacl" }
  947. postbuildcommands {
  948. "$(SILENT) echo Running pnacl-finalize.",
  949. "$(SILENT) " .. naclToolchain .. "finalize \"$(TARGET)\""
  950. }
  951. configuration { "*nacl*", "Release" }
  952. postbuildcommands {
  953. "$(SILENT) echo Stripping symbols.",
  954. "$(SILENT) " .. naclToolchain .. "strip -s \"$(TARGET)\""
  955. }
  956. configuration { "asmjs" }
  957. postbuildcommands {
  958. "$(SILENT) echo Running asmjs finalize.",
  959. "$(SILENT) $(EMSCRIPTEN)/emcc -O2 "
  960. -- .. "-s EMTERPRETIFY=1 "
  961. -- .. "-s EMTERPRETIFY_ASYNC=1 "
  962. .. "-s TOTAL_MEMORY=268435456 "
  963. -- .. "-s ALLOW_MEMORY_GROWTH=1 "
  964. .. "--memory-init-file 1 "
  965. .. "\"$(TARGET)\" -o \"$(TARGET)\".html "
  966. -- .. "--preload-file ../../../examples/runtime@/"
  967. }
  968. configuration {} -- reset configuration
  969. end