toolchain.lua 39 KB

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