toolchain.lua 38 KB

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