toolchain.lua 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370
  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. buildoptions {
  516. "-Wunused-value",
  517. "-fdata-sections",
  518. "-ffunction-sections",
  519. "-msse2",
  520. "-Wunused-value",
  521. "-Wundef",
  522. }
  523. buildoptions_cpp {
  524. "-std=c++11",
  525. }
  526. linkoptions {
  527. "-Wl,--gc-sections",
  528. "-static",
  529. "-static-libgcc",
  530. "-static-libstdc++",
  531. }
  532. configuration { "x32", "mingw-gcc" }
  533. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  534. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  535. libdirs {
  536. path.join(_libDir, "lib/win32_mingw-gcc"),
  537. }
  538. buildoptions {
  539. "-m32",
  540. "-mstackrealign",
  541. }
  542. configuration { "x64", "mingw-gcc" }
  543. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  544. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  545. libdirs {
  546. path.join(_libDir, "lib/win64_mingw-gcc"),
  547. }
  548. buildoptions { "-m64" }
  549. configuration { "mingw-clang" }
  550. buildoptions {
  551. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  552. "-isystem$(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  553. "-isystem$(MINGW)/x86_64-w64-mingw32/include",
  554. }
  555. linkoptions {
  556. "-Qunused-arguments",
  557. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  558. }
  559. configuration { "x32", "mingw-clang" }
  560. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  561. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  562. libdirs {
  563. path.join(_libDir, "lib/win32_mingw-clang"),
  564. }
  565. buildoptions { "-m32" }
  566. configuration { "x64", "mingw-clang" }
  567. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  568. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  569. libdirs {
  570. path.join(_libDir, "lib/win64_mingw-clang"),
  571. }
  572. buildoptions { "-m64" }
  573. configuration { "linux-clang" }
  574. configuration { "linux-gcc-6" }
  575. buildoptions {
  576. -- "-fno-omit-frame-pointer",
  577. -- "-fsanitize=address",
  578. -- "-fsanitize=undefined",
  579. -- "-fsanitize=float-divide-by-zero",
  580. -- "-fsanitize=float-cast-overflow",
  581. }
  582. links {
  583. -- "asan",
  584. -- "ubsan",
  585. }
  586. configuration { "linux-gcc" }
  587. buildoptions {
  588. "-mfpmath=sse",
  589. }
  590. configuration { "linux-gcc* or linux-clang*" }
  591. buildoptions {
  592. "-msse2",
  593. "-Wunused-value",
  594. "-Wundef",
  595. }
  596. buildoptions_cpp {
  597. "-std=c++11",
  598. }
  599. links {
  600. "rt",
  601. "dl",
  602. }
  603. linkoptions {
  604. "-Wl,--gc-sections",
  605. }
  606. configuration { "linux-gcc*", "x32" }
  607. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  608. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  609. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  610. buildoptions {
  611. "-m32",
  612. }
  613. configuration { "linux-gcc*", "x64" }
  614. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  615. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  616. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  617. buildoptions {
  618. "-m64",
  619. }
  620. configuration { "linux-clang*", "x32" }
  621. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  622. objdir (path.join(_buildDir, "linux32_clang/obj"))
  623. libdirs { path.join(_libDir, "lib/linux32_clang") }
  624. buildoptions {
  625. "-m32",
  626. }
  627. configuration { "linux-clang*", "x64" }
  628. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  629. objdir (path.join(_buildDir, "linux64_clang/obj"))
  630. libdirs { path.join(_libDir, "lib/linux64_clang") }
  631. buildoptions {
  632. "-m64",
  633. }
  634. configuration { "linux-mips-gcc" }
  635. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  636. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  637. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  638. buildoptions {
  639. "-Wunused-value",
  640. "-Wundef",
  641. }
  642. buildoptions_cpp {
  643. "-std=c++11",
  644. }
  645. links {
  646. "rt",
  647. "dl",
  648. }
  649. linkoptions {
  650. "-Wl,--gc-sections",
  651. }
  652. configuration { "linux-arm-gcc" }
  653. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  654. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  655. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  656. buildoptions {
  657. "-Wunused-value",
  658. "-Wundef",
  659. }
  660. buildoptions_cpp {
  661. "-std=c++11",
  662. }
  663. links {
  664. "rt",
  665. "dl",
  666. }
  667. linkoptions {
  668. "-Wl,--gc-sections",
  669. }
  670. configuration { "android-*" }
  671. targetprefix ("lib")
  672. flags {
  673. "NoImportLib",
  674. }
  675. includedirs {
  676. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include",
  677. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  678. }
  679. linkoptions {
  680. "-nostdlib",
  681. "-static-libgcc",
  682. }
  683. links {
  684. "c",
  685. "dl",
  686. "m",
  687. "android",
  688. "log",
  689. "gnustl_static",
  690. "gcc",
  691. }
  692. buildoptions {
  693. "-fPIC",
  694. "-no-canonical-prefixes",
  695. "-Wa,--noexecstack",
  696. "-fstack-protector",
  697. "-ffunction-sections",
  698. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  699. "-Wunused-value",
  700. "-Wundef",
  701. }
  702. buildoptions_cpp {
  703. "-std=c++11",
  704. }
  705. linkoptions {
  706. "-no-canonical-prefixes",
  707. "-Wl,--no-undefined",
  708. "-Wl,-z,noexecstack",
  709. "-Wl,-z,relro",
  710. "-Wl,-z,now",
  711. }
  712. configuration { "linux-steamlink" }
  713. targetdir (path.join(_buildDir, "steamlink/bin"))
  714. objdir (path.join(_buildDir, "steamlink/obj"))
  715. libdirs { path.join(_libDir, "lib/steamlink") }
  716. includedirs { path.join(bxDir, "include/compat/linux") }
  717. defines {
  718. "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
  719. }
  720. buildoptions {
  721. "-std=c++11",
  722. "-Wfatal-errors",
  723. "-Wunused-value",
  724. "-Wundef",
  725. "-pthread",
  726. "-marm",
  727. "-mfloat-abi=hard",
  728. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  729. }
  730. linkoptions {
  731. "-static-libgcc",
  732. "-static-libstdc++",
  733. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  734. }
  735. configuration { "android-arm" }
  736. targetdir (path.join(_buildDir, "android-arm/bin"))
  737. objdir (path.join(_buildDir, "android-arm/obj"))
  738. libdirs {
  739. path.join(_libDir, "lib/android-arm"),
  740. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a",
  741. }
  742. includedirs {
  743. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include",
  744. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include",
  745. }
  746. buildoptions {
  747. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  748. "-mthumb",
  749. "-march=armv7-a",
  750. "-mfloat-abi=softfp",
  751. "-mfpu=neon",
  752. "-Wunused-value",
  753. "-Wundef",
  754. }
  755. linkoptions {
  756. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  757. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  758. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  759. "-march=armv7-a",
  760. "-Wl,--fix-cortex-a8",
  761. }
  762. configuration { "android-mips" }
  763. targetdir (path.join(_buildDir, "android-mips/bin"))
  764. objdir (path.join(_buildDir, "android-mips/obj"))
  765. libdirs {
  766. path.join(_libDir, "lib/android-mips"),
  767. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips",
  768. }
  769. includedirs {
  770. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips/include",
  771. }
  772. buildoptions {
  773. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  774. "-Wunused-value",
  775. "-Wundef",
  776. }
  777. linkoptions {
  778. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
  779. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"),
  780. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"),
  781. }
  782. configuration { "android-x86" }
  783. targetdir (path.join(_buildDir, "android-x86/bin"))
  784. objdir (path.join(_buildDir, "android-x86/obj"))
  785. libdirs {
  786. path.join(_libDir, "lib/android-x86"),
  787. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86",
  788. }
  789. includedirs {
  790. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include",
  791. }
  792. buildoptions {
  793. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  794. "-march=i686",
  795. "-mtune=atom",
  796. "-mstackrealign",
  797. "-msse3",
  798. "-mfpmath=sse",
  799. "-Wunused-value",
  800. "-Wundef",
  801. }
  802. linkoptions {
  803. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  804. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  805. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  806. }
  807. configuration { "asmjs" }
  808. targetdir (path.join(_buildDir, "asmjs/bin"))
  809. objdir (path.join(_buildDir, "asmjs/obj"))
  810. libdirs { path.join(_libDir, "lib/asmjs") }
  811. buildoptions {
  812. "-i\"system$(EMSCRIPTEN)/system/include\"",
  813. "-i\"system$(EMSCRIPTEN)/system/include/libc\"",
  814. "-Wunused-value",
  815. "-Wundef",
  816. }
  817. configuration { "freebsd" }
  818. targetdir (path.join(_buildDir, "freebsd/bin"))
  819. objdir (path.join(_buildDir, "freebsd/obj"))
  820. libdirs { path.join(_libDir, "lib/freebsd") }
  821. includedirs {
  822. path.join(bxDir, "include/compat/freebsd"),
  823. }
  824. configuration { "nacl or nacl-arm or pnacl" }
  825. buildoptions {
  826. "-U__STRICT_ANSI__", -- strcasecmp, setenv, unsetenv,...
  827. "-fno-stack-protector",
  828. "-fdiagnostics-show-option",
  829. "-fdata-sections",
  830. "-ffunction-sections",
  831. "-Wunused-value",
  832. "-Wundef",
  833. }
  834. buildoptions_cpp {
  835. "-std=c++11",
  836. }
  837. includedirs {
  838. "$(NACL_SDK_ROOT)/include",
  839. path.join(bxDir, "include/compat/nacl"),
  840. }
  841. configuration { "nacl" }
  842. buildoptions {
  843. "-pthread",
  844. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  845. "-msse2",
  846. }
  847. linkoptions {
  848. "-Wl,--gc-sections",
  849. }
  850. configuration { "x32", "nacl" }
  851. targetdir (path.join(_buildDir, "nacl-x86/bin"))
  852. objdir (path.join(_buildDir, "nacl-x86/obj"))
  853. libdirs { path.join(_libDir, "lib/nacl-x86") }
  854. linkoptions { "-melf32_nacl" }
  855. configuration { "x32", "nacl", "Debug" }
  856. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Debug" }
  857. configuration { "x32", "nacl", "Release" }
  858. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Release" }
  859. configuration { "x64", "nacl" }
  860. targetdir (path.join(_buildDir, "nacl-x64/bin"))
  861. objdir (path.join(_buildDir, "nacl-x64/obj"))
  862. libdirs { path.join(_libDir, "lib/nacl-x64") }
  863. linkoptions { "-melf64_nacl" }
  864. configuration { "x64", "nacl", "Debug" }
  865. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Debug" }
  866. configuration { "x64", "nacl", "Release" }
  867. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Release" }
  868. configuration { "nacl-arm" }
  869. buildoptions {
  870. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  871. }
  872. targetdir (path.join(_buildDir, "nacl-arm/bin"))
  873. objdir (path.join(_buildDir, "nacl-arm/obj"))
  874. libdirs { path.join(_libDir, "lib/nacl-arm") }
  875. configuration { "nacl-arm", "Debug" }
  876. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Debug" }
  877. configuration { "nacl-arm", "Release" }
  878. libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Release" }
  879. configuration { "pnacl" }
  880. targetdir (path.join(_buildDir, "pnacl/bin"))
  881. objdir (path.join(_buildDir, "pnacl/obj"))
  882. libdirs { path.join(_libDir, "lib/pnacl") }
  883. configuration { "pnacl", "Debug" }
  884. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  885. configuration { "pnacl", "Release" }
  886. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  887. configuration { "xbox360" }
  888. targetdir (path.join(_buildDir, "xbox360/bin"))
  889. objdir (path.join(_buildDir, "xbox360/obj"))
  890. includedirs { path.join(bxDir, "include/compat/msvc") }
  891. libdirs { path.join(_libDir, "lib/xbox360") }
  892. defines {
  893. "NOMINMAX",
  894. }
  895. configuration { "durango" }
  896. targetdir (path.join(_buildDir, "durango/bin"))
  897. objdir (path.join(_buildDir, "durango/obj"))
  898. includedirs { path.join(bxDir, "include/compat/msvc") }
  899. libdirs { path.join(_libDir, "lib/durango") }
  900. removeflags { "StaticRuntime" }
  901. defines {
  902. "NOMINMAX",
  903. }
  904. configuration { "netbsd" }
  905. targetdir (path.join(_buildDir, "netbsd/bin"))
  906. objdir (path.join(_buildDir, "netbsd/obj"))
  907. libdirs { path.join(_libDir, "lib/netbsd") }
  908. includedirs {
  909. path.join(bxDir, "include/compat/freebsd"),
  910. }
  911. configuration { "osx", "x32" }
  912. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  913. objdir (path.join(_buildDir, "osx32_clang/obj"))
  914. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  915. buildoptions {
  916. "-m32",
  917. }
  918. configuration { "osx", "x64" }
  919. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  920. objdir (path.join(_buildDir, "osx64_clang/obj"))
  921. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  922. buildoptions {
  923. "-m64",
  924. }
  925. configuration { "osx", "Universal" }
  926. targetdir (path.join(_buildDir, "osx_universal/bin"))
  927. objdir (path.join(_buildDir, "osx_universal/bin"))
  928. configuration { "osx" }
  929. buildoptions_cpp {
  930. "-std=c++11",
  931. }
  932. buildoptions {
  933. "-Wfatal-errors",
  934. "-msse2",
  935. "-Wunused-value",
  936. "-Wundef",
  937. }
  938. includedirs { path.join(bxDir, "include/compat/osx") }
  939. configuration { "ios*" }
  940. linkoptions {
  941. "-lc++",
  942. }
  943. buildoptions_cpp {
  944. "-std=c++11",
  945. }
  946. buildoptions {
  947. "-Wfatal-errors",
  948. "-Wunused-value",
  949. "-Wundef",
  950. }
  951. includedirs { path.join(bxDir, "include/compat/ios") }
  952. configuration { "xcode4", "ios*" }
  953. targetdir (path.join(_buildDir, "ios-arm/bin"))
  954. objdir (path.join(_buildDir, "ios-arm/obj"))
  955. configuration { "ios-arm" }
  956. targetdir (path.join(_buildDir, "ios-arm/bin"))
  957. objdir (path.join(_buildDir, "ios-arm/obj"))
  958. libdirs { path.join(_libDir, "lib/ios-arm") }
  959. linkoptions {
  960. "-arch armv7",
  961. }
  962. buildoptions {
  963. "-arch armv7",
  964. }
  965. configuration { "ios-arm64" }
  966. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  967. objdir (path.join(_buildDir, "ios-arm64/obj"))
  968. libdirs { path.join(_libDir, "lib/ios-arm64") }
  969. linkoptions {
  970. "-arch arm64",
  971. }
  972. buildoptions {
  973. "-arch arm64",
  974. }
  975. configuration { "ios-arm*" }
  976. linkoptions {
  977. "-miphoneos-version-min=7.0",
  978. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  979. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  980. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  981. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  982. }
  983. buildoptions {
  984. "-miphoneos-version-min=7.0",
  985. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  986. }
  987. configuration { "ios-simulator" }
  988. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  989. objdir (path.join(_buildDir, "ios-simulator/obj"))
  990. libdirs { path.join(_libDir, "lib/ios-simulator") }
  991. linkoptions {
  992. "-mios-simulator-version-min=7.0",
  993. "-arch i386",
  994. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  995. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  996. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  997. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  998. }
  999. buildoptions {
  1000. "-mios-simulator-version-min=7.0",
  1001. "-arch i386",
  1002. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  1003. }
  1004. configuration { "tvos*" }
  1005. linkoptions {
  1006. "-lc++",
  1007. }
  1008. buildoptions {
  1009. "-Wfatal-errors",
  1010. "-Wunused-value",
  1011. "-Wundef",
  1012. }
  1013. includedirs { path.join(bxDir, "include/compat/ios") }
  1014. configuration { "xcode4", "tvos*" }
  1015. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  1016. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  1017. configuration { "tvos-arm64" }
  1018. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  1019. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  1020. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  1021. linkoptions {
  1022. "-mtvos-version-min=9.0",
  1023. "-arch arm64",
  1024. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  1025. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  1026. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  1027. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1028. }
  1029. buildoptions {
  1030. "-mtvos-version-min=9.0",
  1031. "-arch arm64",
  1032. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  1033. }
  1034. configuration { "tvos-simulator" }
  1035. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  1036. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  1037. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  1038. linkoptions {
  1039. "-mtvos-simulator-version-min=9.0",
  1040. "-arch i386",
  1041. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1042. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  1043. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  1044. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1045. }
  1046. buildoptions {
  1047. "-mtvos-simulator-version-min=9.0",
  1048. "-arch i386",
  1049. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1050. }
  1051. configuration { "orbis" }
  1052. targetdir (path.join(_buildDir, "orbis/bin"))
  1053. objdir (path.join(_buildDir, "orbis/obj"))
  1054. libdirs { path.join(_libDir, "lib/orbis") }
  1055. includedirs {
  1056. path.join(bxDir, "include/compat/freebsd"),
  1057. "$(SCE_ORBIS_SDK_DIR)/target/include",
  1058. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  1059. }
  1060. buildoptions {
  1061. }
  1062. buildoptions_cpp {
  1063. "-std=c++11",
  1064. }
  1065. linkoptions {
  1066. }
  1067. configuration { "qnx-arm" }
  1068. targetdir (path.join(_buildDir, "qnx-arm/bin"))
  1069. objdir (path.join(_buildDir, "qnx-arm/obj"))
  1070. libdirs { path.join(_libDir, "lib/qnx-arm") }
  1071. -- includedirs { path.join(bxDir, "include/compat/qnx") }
  1072. buildoptions {
  1073. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  1074. "-Wunused-value",
  1075. "-Wundef",
  1076. }
  1077. buildoptions_cpp {
  1078. "-std=c++11",
  1079. }
  1080. configuration { "rpi" }
  1081. targetdir (path.join(_buildDir, "rpi/bin"))
  1082. objdir (path.join(_buildDir, "rpi/obj"))
  1083. libdirs {
  1084. path.join(_libDir, "lib/rpi"),
  1085. "/opt/vc/lib",
  1086. }
  1087. defines {
  1088. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  1089. "__STDC_VERSION__=199901L",
  1090. }
  1091. buildoptions {
  1092. "-Wunused-value",
  1093. "-Wundef",
  1094. }
  1095. buildoptions_cpp {
  1096. "-std=c++11",
  1097. }
  1098. includedirs {
  1099. "/opt/vc/include",
  1100. "/opt/vc/include/interface/vcos/pthreads",
  1101. "/opt/vc/include/interface/vmcs_host/linux",
  1102. }
  1103. links {
  1104. "rt",
  1105. }
  1106. linkoptions {
  1107. "-Wl,--gc-sections",
  1108. }
  1109. configuration { "riscv" }
  1110. targetdir (path.join(_buildDir, "riscv/bin"))
  1111. objdir (path.join(_buildDir, "riscv/obj"))
  1112. includedirs {
  1113. "$(RISCV_DIR)/sysroot/usr/include",
  1114. }
  1115. buildoptions {
  1116. "-Wunused-value",
  1117. "-Wundef",
  1118. "--sysroot=$(RISCV_DIR)/sysroot",
  1119. }
  1120. buildoptions_cpp {
  1121. "-std=c++11",
  1122. }
  1123. configuration {} -- reset configuration
  1124. return true
  1125. end
  1126. function strip()
  1127. configuration { "android-arm", "Release" }
  1128. postbuildcommands {
  1129. "$(SILENT) echo Stripping symbols.",
  1130. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  1131. }
  1132. configuration { "android-mips", "Release" }
  1133. postbuildcommands {
  1134. "$(SILENT) echo Stripping symbols.",
  1135. "$(SILENT) $(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  1136. }
  1137. configuration { "android-x86", "Release" }
  1138. postbuildcommands {
  1139. "$(SILENT) echo Stripping symbols.",
  1140. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  1141. }
  1142. configuration { "linux-steamlink", "Release" }
  1143. postbuildcommands {
  1144. "$(SILENT) echo Stripping symbols.",
  1145. "$(SILENT) $(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-strip -s \"$(TARGET)\""
  1146. }
  1147. configuration { "linux-* or rpi", "not linux-steamlink", "Release" }
  1148. postbuildcommands {
  1149. "$(SILENT) echo Stripping symbols.",
  1150. "$(SILENT) strip -s \"$(TARGET)\""
  1151. }
  1152. configuration { "mingw*", "Release" }
  1153. postbuildcommands {
  1154. "$(SILENT) echo Stripping symbols.",
  1155. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1156. }
  1157. configuration { "pnacl" }
  1158. postbuildcommands {
  1159. "$(SILENT) echo Running pnacl-finalize.",
  1160. "$(SILENT) " .. naclToolchain .. "finalize \"$(TARGET)\""
  1161. }
  1162. configuration { "*nacl*", "Release" }
  1163. postbuildcommands {
  1164. "$(SILENT) echo Stripping symbols.",
  1165. "$(SILENT) " .. naclToolchain .. "strip -s \"$(TARGET)\""
  1166. }
  1167. configuration { "asmjs" }
  1168. postbuildcommands {
  1169. "$(SILENT) echo Running asmjs finalize.",
  1170. "$(SILENT) \"$(EMSCRIPTEN)/emcc\" -O2 "
  1171. -- .. "-s EMTERPRETIFY=1 "
  1172. -- .. "-s EMTERPRETIFY_ASYNC=1 "
  1173. .. "-s TOTAL_MEMORY=268435456 "
  1174. -- .. "-s ALLOW_MEMORY_GROWTH=1 "
  1175. -- .. "-s USE_WEBGL2=1 "
  1176. .. "--memory-init-file 1 "
  1177. .. "\"$(TARGET)\" -o \"$(TARGET)\".html "
  1178. -- .. "--preload-file ../../../examples/runtime@/"
  1179. }
  1180. configuration {} -- reset configuration
  1181. end