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. "FloatFast",
  168. }
  169. if _ACTION == "gmake" or _ACTION == "ninja" then
  170. if nil == _OPTIONS["gcc"] then
  171. print("GCC flavor must be specified!")
  172. os.exit(1)
  173. end
  174. if "android-arm" == _OPTIONS["gcc"] then
  175. if not os.getenv("ANDROID_NDK_ARM")
  176. or not os.getenv("ANDROID_NDK_CLANG")
  177. or not os.getenv("ANDROID_NDK_ROOT") then
  178. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.")
  179. end
  180. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  181. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  182. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  183. premake.gcc.llvm = true
  184. location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
  185. elseif "android-x86" == _OPTIONS["gcc"] then
  186. if not os.getenv("ANDROID_NDK_X86")
  187. or not os.getenv("ANDROID_NDK_CLANG")
  188. or not os.getenv("ANDROID_NDK_ROOT") then
  189. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_X86, and ANDROID_NDK_ROOT environment variables.")
  190. end
  191. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  192. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  193. premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
  194. premake.gcc.llvm = true
  195. location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
  196. elseif "asmjs" == _OPTIONS["gcc"] then
  197. if not os.getenv("EMSDK") then
  198. print("Set EMSDK environment variable.")
  199. end
  200. premake.gcc.cc = "\"$(EMSDK)/fastcomp/bin/emcc\""
  201. premake.gcc.cxx = "\"$(EMSDK)/fastcomp/bin/em++\""
  202. premake.gcc.ar = "\"$(EMSDK)/fastcomp/bin/emar\""
  203. premake.gcc.llvm = true
  204. location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
  205. elseif "freebsd" == _OPTIONS["gcc"] then
  206. location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
  207. elseif "ios-arm" == _OPTIONS["gcc"]
  208. or "ios-arm64" == _OPTIONS["gcc"] then
  209. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  210. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  211. premake.gcc.ar = "ar"
  212. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  213. elseif "ios-simulator" == _OPTIONS["gcc"] then
  214. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  215. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  216. premake.gcc.ar = "ar"
  217. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  218. elseif "ios-simulator64" == _OPTIONS["gcc"] then
  219. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  220. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  221. premake.gcc.ar = "ar"
  222. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator64"))
  223. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  224. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  225. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  226. premake.gcc.ar = "ar"
  227. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  228. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  229. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  230. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  231. premake.gcc.ar = "ar"
  232. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  233. elseif "linux-gcc" == _OPTIONS["gcc"] then
  234. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  235. elseif "linux-gcc-afl" == _OPTIONS["gcc"] then
  236. premake.gcc.cc = "afl-gcc"
  237. premake.gcc.cxx = "afl-g++"
  238. premake.gcc.ar = "ar"
  239. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  240. elseif "linux-gcc-6" == _OPTIONS["gcc"] then
  241. premake.gcc.cc = "gcc-6"
  242. premake.gcc.cxx = "g++-6"
  243. premake.gcc.ar = "ar"
  244. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  245. elseif "linux-clang" == _OPTIONS["gcc"] then
  246. premake.gcc.cc = "clang"
  247. premake.gcc.cxx = "clang++"
  248. premake.gcc.ar = "ar"
  249. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  250. elseif "linux-clang-afl" == _OPTIONS["gcc"] then
  251. premake.gcc.cc = "afl-clang"
  252. premake.gcc.cxx = "afl-clang++"
  253. premake.gcc.ar = "ar"
  254. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  255. elseif "linux-mips-gcc" == _OPTIONS["gcc"] then
  256. location (path.join(_buildDir, "projects", _ACTION .. "-linux-mips-gcc"))
  257. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  258. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  259. elseif "linux-steamlink" == _OPTIONS["gcc"] then
  260. if not os.getenv("MARVELL_SDK_PATH") then
  261. print("Set MARVELL_SDK_PATH environment variable.")
  262. end
  263. premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc"
  264. premake.gcc.cxx = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-g++"
  265. premake.gcc.ar = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-ar"
  266. location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink"))
  267. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  268. if not os.getenv("MINGW") then
  269. print("Set MINGW environment variable.")
  270. end
  271. local mingwToolchain = "x86_64-w64-mingw32"
  272. if compiler32bit then
  273. if os.is("linux") then
  274. mingwToolchain = "i686-w64-mingw32"
  275. else
  276. mingwToolchain = "mingw32"
  277. end
  278. end
  279. premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
  280. premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
  281. premake.gcc.ar = "$(MINGW)/bin/ar"
  282. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  283. elseif "mingw-clang" == _OPTIONS["gcc"] then
  284. premake.gcc.cc = "$(CLANG)/bin/clang"
  285. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  286. premake.gcc.ar = "$(MINGW)/bin/ar"
  287. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  288. -- premake.gcc.llvm = true
  289. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  290. elseif "netbsd" == _OPTIONS["gcc"] then
  291. location (path.join(_buildDir, "projects", _ACTION .. "-netbsd"))
  292. elseif "osx" == _OPTIONS["gcc"] then
  293. if os.is("linux") then
  294. if not os.getenv("OSXCROSS") then
  295. print("Set OSXCROSS environment variable.")
  296. end
  297. local osxToolchain = "x86_64-apple-darwin15-"
  298. premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
  299. premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
  300. premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
  301. end
  302. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  303. elseif "orbis" == _OPTIONS["gcc"] then
  304. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  305. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  306. end
  307. orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-"
  308. premake.gcc.cc = orbisToolchain .. "clang"
  309. premake.gcc.cxx = orbisToolchain .. "clang++"
  310. premake.gcc.ar = orbisToolchain .. "ar"
  311. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  312. elseif "rpi" == _OPTIONS["gcc"] then
  313. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  314. elseif "riscv" == _OPTIONS["gcc"] then
  315. premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc"
  316. premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++"
  317. premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar"
  318. location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
  319. end
  320. elseif _ACTION == "vs2012"
  321. or _ACTION == "vs2013"
  322. or _ACTION == "vs2015"
  323. or _ACTION == "vs2017"
  324. then
  325. local action = premake.action.current()
  326. action.vstudio.windowsTargetPlatformVersion = windowsPlatform
  327. action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
  328. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  329. if "vs2017-clang" == _OPTIONS["vs"] then
  330. premake.vstudio.toolset = "v141_clang_c2"
  331. elseif "vs2015-clang" == _OPTIONS["vs"] then
  332. premake.vstudio.toolset = "LLVM-vs2014"
  333. else
  334. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  335. end
  336. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  337. elseif "winstore100" == _OPTIONS["vs"] then
  338. premake.vstudio.toolset = "v141"
  339. premake.vstudio.storeapp = "10.0"
  340. platforms { "ARM" }
  341. location (path.join(_buildDir, "projects", _ACTION .. "-winstore100"))
  342. elseif "durango" == _OPTIONS["vs"] then
  343. if not os.getenv("DurangoXDK") then
  344. print("DurangoXDK not found.")
  345. end
  346. premake.vstudio.toolset = "v140"
  347. premake.vstudio.storeapp = "durango"
  348. platforms { "Durango" }
  349. location (path.join(_buildDir, "projects", _ACTION .. "-durango"))
  350. elseif "orbis" == _OPTIONS["vs"] then
  351. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  352. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  353. end
  354. platforms { "Orbis" }
  355. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  356. elseif ("vs2012-xp") == _OPTIONS["vs"] then
  357. premake.vstudio.toolset = ("v110_xp")
  358. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  359. elseif "vs2013-xp" == _OPTIONS["vs"] then
  360. premake.vstudio.toolset = ("v120_xp")
  361. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  362. elseif "vs2015-xp" == _OPTIONS["vs"] then
  363. premake.vstudio.toolset = ("v140_xp")
  364. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  365. elseif "vs2015-xp" == _OPTIONS["vs"] then
  366. premake.vstudio.toolset = ("v141_xp")
  367. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  368. end
  369. elseif _ACTION == "xcode4"
  370. or _ACTION == "xcode8"
  371. or _ACTION == "xcode9" then
  372. local action = premake.action.current()
  373. local str_or = function(str, def)
  374. return #str > 0 and str or def
  375. end
  376. if "osx" == _OPTIONS["xcode"] then
  377. action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "10.11")
  378. premake.xcode.toolset = "macosx"
  379. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  380. elseif "ios" == _OPTIONS["xcode"] then
  381. action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "8.0")
  382. premake.xcode.toolset = "iphoneos"
  383. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  384. elseif "tvos" == _OPTIONS["xcode"] then
  385. action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0")
  386. premake.xcode.toolset = "appletvos"
  387. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  388. end
  389. end
  390. if not _OPTIONS["with-dynamic-runtime"] then
  391. flags { "StaticRuntime" }
  392. end
  393. if _OPTIONS["with-avx"] then
  394. flags { "EnableAVX" }
  395. end
  396. if _OPTIONS["with-crtnone"] then
  397. crtNone()
  398. end
  399. flags {
  400. "NoPCH",
  401. "NativeWChar",
  402. "NoRTTI",
  403. "NoExceptions",
  404. "NoEditAndContinue",
  405. "NoFramePointer",
  406. "Symbols",
  407. }
  408. defines {
  409. "__STDC_LIMIT_MACROS",
  410. "__STDC_FORMAT_MACROS",
  411. "__STDC_CONSTANT_MACROS",
  412. }
  413. configuration { "Debug" }
  414. targetsuffix "Debug"
  415. defines {
  416. "_DEBUG",
  417. }
  418. configuration { "Release" }
  419. flags {
  420. "NoBufferSecurityCheck",
  421. "OptimizeSpeed",
  422. }
  423. defines {
  424. "NDEBUG",
  425. }
  426. targetsuffix "Release"
  427. configuration { "qbs" }
  428. flags {
  429. "ExtraWarnings",
  430. }
  431. configuration { "vs*", "x32" }
  432. flags {
  433. "EnableSSE2",
  434. }
  435. configuration { "vs*", "not orbis", "not NX32", "not NX64" }
  436. includedirs { path.join(bxDir, "include/compat/msvc") }
  437. defines {
  438. "WIN32",
  439. "_WIN32",
  440. "_HAS_EXCEPTIONS=0",
  441. "_HAS_ITERATOR_DEBUGGING=0",
  442. "_ITERATOR_DEBUG_LEVEL=0",
  443. "_SCL_SECURE=0",
  444. "_SECURE_SCL=0",
  445. "_SCL_SECURE_NO_WARNINGS",
  446. "_CRT_SECURE_NO_WARNINGS",
  447. "_CRT_SECURE_NO_DEPRECATE",
  448. }
  449. buildoptions {
  450. "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union
  451. "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier
  452. "/Ob2", -- The Inline Function Expansion
  453. }
  454. linkoptions {
  455. "/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
  456. }
  457. configuration { "vs2008" }
  458. includedirs { path.join(bxDir, "include/compat/msvc/pre1600") }
  459. configuration { "x32", "vs*" }
  460. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  461. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  462. libdirs {
  463. path.join(_libDir, "lib/win32_" .. _ACTION),
  464. }
  465. configuration { "x64", "vs*" }
  466. defines { "_WIN64" }
  467. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  468. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  469. libdirs {
  470. path.join(_libDir, "lib/win64_" .. _ACTION),
  471. }
  472. configuration { "x32", "vs2017" }
  473. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  474. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  475. libdirs {
  476. path.join(_libDir, "lib/win32_" .. _ACTION),
  477. }
  478. configuration { "x64", "vs2017" }
  479. defines { "_WIN64" }
  480. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  481. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  482. libdirs {
  483. path.join(_libDir, "lib/win64_" .. _ACTION),
  484. }
  485. configuration { "ARM", "vs*" }
  486. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  487. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  488. configuration { "vs*-clang" }
  489. buildoptions {
  490. "-Qunused-arguments",
  491. }
  492. configuration { "x32", "vs*-clang" }
  493. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  494. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  495. configuration { "x64", "vs*-clang" }
  496. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  497. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  498. configuration { "winstore*" }
  499. removeflags {
  500. "StaticRuntime",
  501. "NoBufferSecurityCheck",
  502. }
  503. buildoptions {
  504. "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
  505. }
  506. linkoptions {
  507. "/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
  508. }
  509. configuration { "*-gcc* or osx" }
  510. buildoptions {
  511. "-Wshadow",
  512. }
  513. configuration { "mingw-*" }
  514. defines { "WIN32" }
  515. includedirs { path.join(bxDir, "include/compat/mingw") }
  516. defines {
  517. "MINGW_HAS_SECURE_API=1",
  518. }
  519. buildoptions {
  520. "-Wunused-value",
  521. "-fdata-sections",
  522. "-ffunction-sections",
  523. "-msse2",
  524. "-Wunused-value",
  525. "-Wundef",
  526. }
  527. linkoptions {
  528. "-Wl,--gc-sections",
  529. "-static",
  530. "-static-libgcc",
  531. "-static-libstdc++",
  532. }
  533. configuration { "x32", "mingw-gcc" }
  534. targetdir (path.join(_buildDir, "win32_mingw-gcc/bin"))
  535. objdir (path.join(_buildDir, "win32_mingw-gcc/obj"))
  536. libdirs {
  537. path.join(_libDir, "lib/win32_mingw-gcc"),
  538. }
  539. buildoptions {
  540. "-m32",
  541. "-mstackrealign",
  542. }
  543. configuration { "x64", "mingw-gcc" }
  544. targetdir (path.join(_buildDir, "win64_mingw-gcc/bin"))
  545. objdir (path.join(_buildDir, "win64_mingw-gcc/obj"))
  546. libdirs {
  547. path.join(_libDir, "lib/win64_mingw-gcc"),
  548. }
  549. buildoptions { "-m64" }
  550. configuration { "mingw-clang" }
  551. buildoptions {
  552. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++",
  553. "-isystem $(MINGW)/lib/gcc/x86_64-w64-mingw32/4.8.1/include/c++/x86_64-w64-mingw32",
  554. "-isystem $(MINGW)/x86_64-w64-mingw32/include",
  555. }
  556. linkoptions {
  557. "-Qunused-arguments",
  558. "-Wno-error=unused-command-line-argument-hard-error-in-future",
  559. }
  560. configuration { "x32", "mingw-clang" }
  561. targetdir (path.join(_buildDir, "win32_mingw-clang/bin"))
  562. objdir (path.join(_buildDir, "win32_mingw-clang/obj"))
  563. libdirs {
  564. path.join(_libDir, "lib/win32_mingw-clang"),
  565. }
  566. buildoptions { "-m32" }
  567. configuration { "x64", "mingw-clang" }
  568. targetdir (path.join(_buildDir, "win64_mingw-clang/bin"))
  569. objdir (path.join(_buildDir, "win64_mingw-clang/obj"))
  570. libdirs {
  571. path.join(_libDir, "lib/win64_mingw-clang"),
  572. }
  573. buildoptions { "-m64" }
  574. configuration { "linux-clang" }
  575. configuration { "linux-gcc-6" }
  576. buildoptions {
  577. -- "-fno-omit-frame-pointer",
  578. -- "-fsanitize=address",
  579. -- "-fsanitize=undefined",
  580. -- "-fsanitize=float-divide-by-zero",
  581. -- "-fsanitize=float-cast-overflow",
  582. }
  583. links {
  584. -- "asan",
  585. -- "ubsan",
  586. }
  587. configuration { "linux-gcc" }
  588. buildoptions {
  589. "-mfpmath=sse",
  590. }
  591. configuration { "linux-gcc* or linux-clang*" }
  592. buildoptions {
  593. "-msse2",
  594. -- "-Wdouble-promotion",
  595. -- "-Wduplicated-branches",
  596. -- "-Wduplicated-cond",
  597. -- "-Wjump-misses-init",
  598. "-Wshadow",
  599. -- "-Wnull-dereference",
  600. "-Wunused-value",
  601. "-Wundef",
  602. -- "-Wuseless-cast",
  603. }
  604. links {
  605. "rt",
  606. "dl",
  607. }
  608. linkoptions {
  609. "-Wl,--gc-sections",
  610. "-Wl,--as-needed",
  611. }
  612. configuration { "linux-gcc*" }
  613. buildoptions {
  614. "-Wlogical-op",
  615. }
  616. configuration { "linux-gcc*", "x32" }
  617. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  618. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  619. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  620. buildoptions {
  621. "-m32",
  622. }
  623. configuration { "linux-gcc*", "x64" }
  624. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  625. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  626. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  627. buildoptions {
  628. "-m64",
  629. }
  630. configuration { "linux-clang*", "x32" }
  631. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  632. objdir (path.join(_buildDir, "linux32_clang/obj"))
  633. libdirs { path.join(_libDir, "lib/linux32_clang") }
  634. buildoptions {
  635. "-m32",
  636. }
  637. configuration { "linux-clang*", "x64" }
  638. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  639. objdir (path.join(_buildDir, "linux64_clang/obj"))
  640. libdirs { path.join(_libDir, "lib/linux64_clang") }
  641. buildoptions {
  642. "-m64",
  643. }
  644. configuration { "linux-mips-gcc" }
  645. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  646. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  647. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  648. buildoptions {
  649. "-Wunused-value",
  650. "-Wundef",
  651. }
  652. links {
  653. "rt",
  654. "dl",
  655. }
  656. linkoptions {
  657. "-Wl,--gc-sections",
  658. }
  659. configuration { "linux-arm-gcc" }
  660. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  661. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  662. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  663. buildoptions {
  664. "-Wunused-value",
  665. "-Wundef",
  666. }
  667. links {
  668. "rt",
  669. "dl",
  670. }
  671. linkoptions {
  672. "-Wl,--gc-sections",
  673. }
  674. configuration { "android-*" }
  675. targetprefix ("lib")
  676. flags {
  677. "NoImportLib",
  678. }
  679. includedirs {
  680. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  681. "${ANDROID_NDK_ROOT}/sysroot/usr/include",
  682. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  683. }
  684. linkoptions {
  685. "-nostdlib",
  686. }
  687. links {
  688. "c",
  689. "dl",
  690. "m",
  691. "android",
  692. "log",
  693. "c++_shared",
  694. "gcc",
  695. }
  696. buildoptions {
  697. "-fPIC",
  698. "-no-canonical-prefixes",
  699. "-Wa,--noexecstack",
  700. "-fstack-protector-strong",
  701. "-ffunction-sections",
  702. "-Wunused-value",
  703. "-Wundef",
  704. }
  705. linkoptions {
  706. "-no-canonical-prefixes",
  707. "-Wl,--no-undefined",
  708. "-Wl,-z,noexecstack",
  709. "-Wl,-z,relro",
  710. "-Wl,-z,now",
  711. }
  712. configuration { "linux-steamlink" }
  713. targetdir (path.join(_buildDir, "steamlink/bin"))
  714. objdir (path.join(_buildDir, "steamlink/obj"))
  715. libdirs { path.join(_libDir, "lib/steamlink") }
  716. includedirs { path.join(bxDir, "include/compat/linux") }
  717. defines {
  718. "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
  719. }
  720. buildoptions {
  721. "-Wfatal-errors",
  722. "-Wunused-value",
  723. "-Wundef",
  724. "-pthread",
  725. "-marm",
  726. "-mfloat-abi=hard",
  727. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  728. }
  729. linkoptions {
  730. "-static-libgcc",
  731. "-static-libstdc++",
  732. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  733. }
  734. configuration { "android-arm" }
  735. targetdir (path.join(_buildDir, "android-arm/bin"))
  736. objdir (path.join(_buildDir, "android-arm/obj"))
  737. libdirs {
  738. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
  739. }
  740. includedirs {
  741. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi",
  742. }
  743. buildoptions {
  744. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  745. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  746. "-target armv7-none-linux-androideabi",
  747. "-mthumb",
  748. "-march=armv7-a",
  749. "-mfloat-abi=softfp",
  750. "-mfpu=neon",
  751. "-Wunused-value",
  752. "-Wundef",
  753. }
  754. linkoptions {
  755. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  756. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  757. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  758. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  759. "-target armv7-none-linux-androideabi",
  760. "-march=armv7-a",
  761. "-Wl,--fix-cortex-a8",
  762. }
  763. configuration { "android-x86" }
  764. targetdir (path.join(_buildDir, "android-x86/bin"))
  765. objdir (path.join(_buildDir, "android-x86/obj"))
  766. libdirs {
  767. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
  768. }
  769. includedirs {
  770. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android",
  771. }
  772. buildoptions {
  773. "-gcc-toolchain $(ANDROID_NDK_X86)",
  774. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  775. "-target i686-none-linux-android",
  776. "-march=i686",
  777. "-mtune=atom",
  778. "-mstackrealign",
  779. "-msse3",
  780. "-mfpmath=sse",
  781. "-Wunused-value",
  782. "-Wundef",
  783. }
  784. linkoptions {
  785. "-gcc-toolchain $(ANDROID_NDK_X86)",
  786. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  787. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  788. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  789. "-target i686-none-linux-android",
  790. }
  791. configuration { "asmjs" }
  792. targetdir (path.join(_buildDir, "asmjs/bin"))
  793. objdir (path.join(_buildDir, "asmjs/obj"))
  794. libdirs { path.join(_libDir, "lib/asmjs") }
  795. buildoptions {
  796. "-isystem \"$(EMSDK)/fastcomp/emscripten\"",
  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) \"$(EMSDK)/fastcomp/bin/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