toolchain.lua 38 KB

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