toolchain.lua 41 KB

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