toolchain.lua 42 KB

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