toolchain.lua 41 KB

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