toolchain.lua 40 KB

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