toolchain.lua 42 KB

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