toolchain.lua 43 KB

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