toolchain.lua 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292
  1. --
  2. -- Copyright 2010-2018 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. "ExtraWarnings",
  166. }
  167. if _ACTION == "gmake" or _ACTION == "ninja" then
  168. if nil == _OPTIONS["gcc"] then
  169. print("GCC flavor must be specified!")
  170. os.exit(1)
  171. end
  172. if "android-arm" == _OPTIONS["gcc"] then
  173. if not os.getenv("ANDROID_NDK_ARM")
  174. or not os.getenv("ANDROID_NDK_CLANG")
  175. or not os.getenv("ANDROID_NDK_ROOT") then
  176. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.")
  177. end
  178. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  179. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  180. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  181. premake.gcc.llvm = true
  182. location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
  183. elseif "android-x86" == _OPTIONS["gcc"] then
  184. if not os.getenv("ANDROID_NDK_X86")
  185. or not os.getenv("ANDROID_NDK_CLANG")
  186. or not os.getenv("ANDROID_NDK_ROOT") then
  187. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_X86, and ANDROID_NDK_ROOT environment variables.")
  188. end
  189. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  190. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  191. premake.gcc.llvm = true
  192. location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
  193. elseif "asmjs" == _OPTIONS["gcc"] then
  194. if not os.getenv("EMSCRIPTEN") then
  195. print("Set EMSCRIPTEN environment variable.")
  196. end
  197. premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\""
  198. premake.gcc.cxx = "\"$(EMSCRIPTEN)/em++\""
  199. premake.gcc.ar = "\"$(EMSCRIPTEN)/emar\""
  200. premake.gcc.llvm = true
  201. location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
  202. elseif "freebsd" == _OPTIONS["gcc"] then
  203. location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
  204. elseif "ios-arm" == _OPTIONS["gcc"]
  205. or "ios-arm64" == _OPTIONS["gcc"] then
  206. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  207. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  208. premake.gcc.ar = "ar"
  209. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  210. elseif "ios-simulator" == _OPTIONS["gcc"] then
  211. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  212. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  213. premake.gcc.ar = "ar"
  214. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  215. elseif "ios-simulator64" == _OPTIONS["gcc"] then
  216. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  217. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  218. premake.gcc.ar = "ar"
  219. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator64"))
  220. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  221. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  222. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  223. premake.gcc.ar = "ar"
  224. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  225. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  226. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  227. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  228. premake.gcc.ar = "ar"
  229. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  230. elseif "linux-gcc" == _OPTIONS["gcc"] then
  231. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  232. elseif "linux-gcc-afl" == _OPTIONS["gcc"] then
  233. premake.gcc.cc = "afl-gcc"
  234. premake.gcc.cxx = "afl-g++"
  235. premake.gcc.ar = "ar"
  236. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  237. elseif "linux-gcc-6" == _OPTIONS["gcc"] then
  238. premake.gcc.cc = "gcc-6"
  239. premake.gcc.cxx = "g++-6"
  240. premake.gcc.ar = "ar"
  241. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  242. elseif "linux-clang" == _OPTIONS["gcc"] then
  243. premake.gcc.cc = "clang"
  244. premake.gcc.cxx = "clang++"
  245. premake.gcc.ar = "ar"
  246. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  247. elseif "linux-clang-afl" == _OPTIONS["gcc"] then
  248. premake.gcc.cc = "afl-clang"
  249. premake.gcc.cxx = "afl-clang++"
  250. premake.gcc.ar = "ar"
  251. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  252. elseif "linux-mips-gcc" == _OPTIONS["gcc"] then
  253. location (path.join(_buildDir, "projects", _ACTION .. "-linux-mips-gcc"))
  254. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  255. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  256. elseif "linux-steamlink" == _OPTIONS["gcc"] then
  257. if not os.getenv("MARVELL_SDK_PATH") then
  258. print("Set MARVELL_SDK_PATH environment variable.")
  259. end
  260. premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc"
  261. premake.gcc.cxx = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-g++"
  262. premake.gcc.ar = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-ar"
  263. location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink"))
  264. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  265. if not os.getenv("MINGW") then
  266. print("Set MINGW environment variable.")
  267. end
  268. local mingwToolchain = "x86_64-w64-mingw32"
  269. if compiler32bit then
  270. if os.is("linux") then
  271. mingwToolchain = "i686-w64-mingw32"
  272. else
  273. mingwToolchain = "mingw32"
  274. end
  275. end
  276. premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
  277. premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
  278. premake.gcc.ar = "$(MINGW)/bin/ar"
  279. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  280. elseif "mingw-clang" == _OPTIONS["gcc"] then
  281. premake.gcc.cc = "$(CLANG)/bin/clang"
  282. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  283. premake.gcc.ar = "$(MINGW)/bin/ar"
  284. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  285. -- premake.gcc.llvm = true
  286. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  287. elseif "netbsd" == _OPTIONS["gcc"] then
  288. location (path.join(_buildDir, "projects", _ACTION .. "-netbsd"))
  289. elseif "osx" == _OPTIONS["gcc"] then
  290. if os.is("linux") then
  291. if not os.getenv("OSXCROSS") then
  292. print("Set OSXCROSS environment variable.")
  293. end
  294. local osxToolchain = "x86_64-apple-darwin15-"
  295. premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
  296. premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
  297. premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
  298. end
  299. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  300. elseif "orbis" == _OPTIONS["gcc"] then
  301. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  302. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  303. end
  304. orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-"
  305. premake.gcc.cc = orbisToolchain .. "clang"
  306. premake.gcc.cxx = orbisToolchain .. "clang++"
  307. premake.gcc.ar = orbisToolchain .. "ar"
  308. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  309. elseif "rpi" == _OPTIONS["gcc"] then
  310. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  311. elseif "riscv" == _OPTIONS["gcc"] then
  312. premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc"
  313. premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++"
  314. premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar"
  315. location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
  316. end
  317. elseif _ACTION == "vs2012"
  318. or _ACTION == "vs2013"
  319. or _ACTION == "vs2015"
  320. or _ACTION == "vs2017"
  321. then
  322. local action = premake.action.current()
  323. action.vstudio.windowsTargetPlatformVersion = windowsPlatform
  324. action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
  325. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  326. if "vs2017-clang" == _OPTIONS["vs"] then
  327. premake.vstudio.toolset = "v141_clang_c2"
  328. elseif "vs2015-clang" == _OPTIONS["vs"] then
  329. premake.vstudio.toolset = "LLVM-vs2014"
  330. else
  331. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  332. end
  333. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  334. elseif "winstore100" == _OPTIONS["vs"] then
  335. premake.vstudio.toolset = "v141"
  336. premake.vstudio.storeapp = "10.0"
  337. platforms { "ARM" }
  338. location (path.join(_buildDir, "projects", _ACTION .. "-winstore100"))
  339. elseif "durango" == _OPTIONS["vs"] then
  340. if not os.getenv("DurangoXDK") then
  341. print("DurangoXDK not found.")
  342. end
  343. premake.vstudio.toolset = "v140"
  344. premake.vstudio.storeapp = "durango"
  345. platforms { "Durango" }
  346. location (path.join(_buildDir, "projects", _ACTION .. "-durango"))
  347. elseif "orbis" == _OPTIONS["vs"] then
  348. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  349. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  350. end
  351. platforms { "Orbis" }
  352. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  353. elseif ("vs2012-xp") == _OPTIONS["vs"] then
  354. premake.vstudio.toolset = ("v110_xp")
  355. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  356. elseif "vs2013-xp" == _OPTIONS["vs"] then
  357. premake.vstudio.toolset = ("v120_xp")
  358. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  359. elseif "vs2015-xp" == _OPTIONS["vs"] then
  360. premake.vstudio.toolset = ("v140_xp")
  361. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  362. elseif "vs2015-xp" == _OPTIONS["vs"] then
  363. premake.vstudio.toolset = ("v141_xp")
  364. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  365. end
  366. elseif _ACTION == "xcode4"
  367. or _ACTION == "xcode8"
  368. or _ACTION == "xcode9" then
  369. local action = premake.action.current()
  370. local str_or = function(str, def)
  371. return #str > 0 and str or def
  372. end
  373. if "osx" == _OPTIONS["xcode"] then
  374. action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "10.11")
  375. premake.xcode.toolset = "macosx"
  376. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  377. elseif "ios" == _OPTIONS["xcode"] then
  378. action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "8.0")
  379. premake.xcode.toolset = "iphoneos"
  380. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  381. elseif "tvos" == _OPTIONS["xcode"] then
  382. action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0")
  383. premake.xcode.toolset = "appletvos"
  384. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  385. end
  386. end
  387. if not _OPTIONS["with-dynamic-runtime"] then
  388. flags { "StaticRuntime" }
  389. end
  390. if _OPTIONS["with-avx"] then
  391. flags { "EnableAVX" }
  392. end
  393. if _OPTIONS["with-crtnone"] then
  394. crtNone()
  395. end
  396. flags {
  397. "NoPCH",
  398. "NativeWChar",
  399. "NoRTTI",
  400. "NoExceptions",
  401. "NoEditAndContinue",
  402. "NoFramePointer",
  403. "Symbols",
  404. }
  405. defines {
  406. "__STDC_LIMIT_MACROS",
  407. "__STDC_FORMAT_MACROS",
  408. "__STDC_CONSTANT_MACROS",
  409. }
  410. configuration { "Debug" }
  411. targetsuffix "Debug"
  412. defines {
  413. "_DEBUG",
  414. }
  415. configuration { "Release" }
  416. flags {
  417. "NoBufferSecurityCheck",
  418. "OptimizeSpeed",
  419. }
  420. defines {
  421. "NDEBUG",
  422. }
  423. targetsuffix "Release"
  424. configuration { "qbs" }
  425. flags {
  426. "ExtraWarnings",
  427. }
  428. configuration { "vs*", "x32" }
  429. flags {
  430. "EnableSSE2",
  431. }
  432. configuration { "vs*", "not orbis", "not NX32", "not NX64" }
  433. includedirs { path.join(bxDir, "include/compat/msvc") }
  434. defines {
  435. "WIN32",
  436. "_WIN32",
  437. "_HAS_EXCEPTIONS=0",
  438. "_HAS_ITERATOR_DEBUGGING=0",
  439. "_ITERATOR_DEBUG_LEVEL=0",
  440. "_SCL_SECURE=0",
  441. "_SECURE_SCL=0",
  442. "_SCL_SECURE_NO_WARNINGS",
  443. "_CRT_SECURE_NO_WARNINGS",
  444. "_CRT_SECURE_NO_DEPRECATE",
  445. }
  446. buildoptions {
  447. "/wd4201", -- warning C4201: nonstandard extension used: nameless struct/union
  448. "/wd4324", -- warning C4324: '': structure was padded due to alignment specifier
  449. "/Ob2", -- The Inline Function Expansion
  450. }
  451. linkoptions {
  452. "/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
  453. }
  454. configuration { "vs2008" }
  455. includedirs { path.join(bxDir, "include/compat/msvc/pre1600") }
  456. configuration { "x32", "vs*" }
  457. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  458. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  459. libdirs {
  460. path.join(_libDir, "lib/win32_" .. _ACTION),
  461. }
  462. configuration { "x64", "vs*" }
  463. defines { "_WIN64" }
  464. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  465. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  466. libdirs {
  467. path.join(_libDir, "lib/win64_" .. _ACTION),
  468. }
  469. configuration { "x32", "vs2017" }
  470. targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
  471. objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
  472. libdirs {
  473. path.join(_libDir, "lib/win32_" .. _ACTION),
  474. }
  475. configuration { "x64", "vs2017" }
  476. defines { "_WIN64" }
  477. targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
  478. objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
  479. libdirs {
  480. path.join(_libDir, "lib/win64_" .. _ACTION),
  481. }
  482. configuration { "ARM", "vs*" }
  483. targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
  484. objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
  485. configuration { "vs*-clang" }
  486. buildoptions {
  487. "-Qunused-arguments",
  488. }
  489. configuration { "x32", "vs*-clang" }
  490. targetdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/bin"))
  491. objdir (path.join(_buildDir, "win32_" .. _ACTION .. "-clang/obj"))
  492. configuration { "x64", "vs*-clang" }
  493. targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin"))
  494. objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj"))
  495. configuration { "winstore*" }
  496. removeflags {
  497. "StaticRuntime",
  498. "NoBufferSecurityCheck",
  499. }
  500. buildoptions {
  501. "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
  502. }
  503. linkoptions {
  504. "/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
  505. }
  506. configuration { "*-gcc* or osx" }
  507. buildoptions {
  508. "-Wshadow",
  509. }
  510. configuration { "mingw-*" }
  511. defines { "WIN32" }
  512. includedirs { path.join(bxDir, "include/compat/mingw") }
  513. defines {
  514. "MINGW_HAS_SECURE_API=1",
  515. }
  516. buildoptions {
  517. "-Wunused-value",
  518. "-fdata-sections",
  519. "-ffunction-sections",
  520. "-msse2",
  521. "-Wunused-value",
  522. "-Wundef",
  523. }
  524. buildoptions_cpp {
  525. "-std=c++14",
  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. buildoptions_cpp {
  605. "-std=c++14",
  606. }
  607. links {
  608. "rt",
  609. "dl",
  610. }
  611. linkoptions {
  612. "-Wl,--gc-sections",
  613. "-Wl,--as-needed",
  614. }
  615. configuration { "linux-gcc*" }
  616. buildoptions {
  617. "-Wlogical-op",
  618. }
  619. configuration { "linux-gcc*", "x32" }
  620. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  621. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  622. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  623. buildoptions {
  624. "-m32",
  625. }
  626. configuration { "linux-gcc*", "x64" }
  627. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  628. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  629. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  630. buildoptions {
  631. "-m64",
  632. }
  633. configuration { "linux-clang*", "x32" }
  634. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  635. objdir (path.join(_buildDir, "linux32_clang/obj"))
  636. libdirs { path.join(_libDir, "lib/linux32_clang") }
  637. buildoptions {
  638. "-m32",
  639. }
  640. configuration { "linux-clang*", "x64" }
  641. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  642. objdir (path.join(_buildDir, "linux64_clang/obj"))
  643. libdirs { path.join(_libDir, "lib/linux64_clang") }
  644. buildoptions {
  645. "-m64",
  646. }
  647. configuration { "linux-mips-gcc" }
  648. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  649. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  650. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  651. buildoptions {
  652. "-Wunused-value",
  653. "-Wundef",
  654. }
  655. buildoptions_cpp {
  656. "-std=c++14",
  657. }
  658. links {
  659. "rt",
  660. "dl",
  661. }
  662. linkoptions {
  663. "-Wl,--gc-sections",
  664. }
  665. configuration { "linux-arm-gcc" }
  666. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  667. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  668. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  669. buildoptions {
  670. "-Wunused-value",
  671. "-Wundef",
  672. }
  673. buildoptions_cpp {
  674. "-std=c++14",
  675. }
  676. links {
  677. "rt",
  678. "dl",
  679. }
  680. linkoptions {
  681. "-Wl,--gc-sections",
  682. }
  683. configuration { "android-*" }
  684. targetprefix ("lib")
  685. flags {
  686. "NoImportLib",
  687. }
  688. includedirs {
  689. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  690. "${ANDROID_NDK_ROOT}/sysroot/usr/include",
  691. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  692. }
  693. linkoptions {
  694. "-nostdlib",
  695. }
  696. links {
  697. "c",
  698. "dl",
  699. "m",
  700. "android",
  701. "log",
  702. "c++_shared",
  703. "gcc",
  704. }
  705. buildoptions {
  706. "-fPIC",
  707. "-no-canonical-prefixes",
  708. "-Wa,--noexecstack",
  709. "-fstack-protector-strong",
  710. "-ffunction-sections",
  711. "-Wunused-value",
  712. "-Wundef",
  713. }
  714. buildoptions_cpp {
  715. "-std=c++14",
  716. }
  717. linkoptions {
  718. "-no-canonical-prefixes",
  719. "-Wl,--no-undefined",
  720. "-Wl,-z,noexecstack",
  721. "-Wl,-z,relro",
  722. "-Wl,-z,now",
  723. }
  724. configuration { "linux-steamlink" }
  725. targetdir (path.join(_buildDir, "steamlink/bin"))
  726. objdir (path.join(_buildDir, "steamlink/obj"))
  727. libdirs { path.join(_libDir, "lib/steamlink") }
  728. includedirs { path.join(bxDir, "include/compat/linux") }
  729. defines {
  730. "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
  731. }
  732. buildoptions {
  733. "-std=c++14",
  734. "-Wfatal-errors",
  735. "-Wunused-value",
  736. "-Wundef",
  737. "-pthread",
  738. "-marm",
  739. "-mfloat-abi=hard",
  740. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  741. }
  742. linkoptions {
  743. "-static-libgcc",
  744. "-static-libstdc++",
  745. "--sysroot=$(MARVELL_SDK_PATH)/rootfs",
  746. }
  747. configuration { "android-arm" }
  748. targetdir (path.join(_buildDir, "android-arm/bin"))
  749. objdir (path.join(_buildDir, "android-arm/obj"))
  750. libdirs {
  751. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
  752. }
  753. includedirs {
  754. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi",
  755. }
  756. buildoptions {
  757. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  758. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  759. "-target armv7-none-linux-androideabi",
  760. "-mthumb",
  761. "-march=armv7-a",
  762. "-mfloat-abi=softfp",
  763. "-mfpu=neon",
  764. "-Wunused-value",
  765. "-Wundef",
  766. }
  767. linkoptions {
  768. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  769. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  770. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  771. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  772. "-target armv7-none-linux-androideabi",
  773. "-march=armv7-a",
  774. "-Wl,--fix-cortex-a8",
  775. }
  776. configuration { "android-x86" }
  777. targetdir (path.join(_buildDir, "android-x86/bin"))
  778. objdir (path.join(_buildDir, "android-x86/obj"))
  779. libdirs {
  780. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
  781. }
  782. includedirs {
  783. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android",
  784. }
  785. buildoptions {
  786. "-gcc-toolchain $(ANDROID_NDK_X86)",
  787. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  788. "-target i686-none-linux-android",
  789. "-march=i686",
  790. "-mtune=atom",
  791. "-mstackrealign",
  792. "-msse3",
  793. "-mfpmath=sse",
  794. "-Wunused-value",
  795. "-Wundef",
  796. }
  797. linkoptions {
  798. "-gcc-toolchain $(ANDROID_NDK_X86)",
  799. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  800. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  801. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  802. "-target i686-none-linux-android",
  803. }
  804. configuration { "asmjs" }
  805. targetdir (path.join(_buildDir, "asmjs/bin"))
  806. objdir (path.join(_buildDir, "asmjs/obj"))
  807. libdirs { path.join(_libDir, "lib/asmjs") }
  808. buildoptions {
  809. "-i\"system$(EMSCRIPTEN)/system/include\"",
  810. "-i\"system$(EMSCRIPTEN)/system/include/libcxx\"",
  811. "-i\"system$(EMSCRIPTEN)/system/include/libc\"",
  812. "-Wunused-value",
  813. "-Wundef",
  814. }
  815. buildoptions_cpp {
  816. "-std=c++14",
  817. }
  818. configuration { "freebsd" }
  819. targetdir (path.join(_buildDir, "freebsd/bin"))
  820. objdir (path.join(_buildDir, "freebsd/obj"))
  821. libdirs { path.join(_libDir, "lib/freebsd") }
  822. includedirs {
  823. path.join(bxDir, "include/compat/freebsd"),
  824. }
  825. configuration { "xbox360" }
  826. targetdir (path.join(_buildDir, "xbox360/bin"))
  827. objdir (path.join(_buildDir, "xbox360/obj"))
  828. includedirs { path.join(bxDir, "include/compat/msvc") }
  829. libdirs { path.join(_libDir, "lib/xbox360") }
  830. defines {
  831. "NOMINMAX",
  832. }
  833. configuration { "durango" }
  834. targetdir (path.join(_buildDir, "durango/bin"))
  835. objdir (path.join(_buildDir, "durango/obj"))
  836. includedirs { path.join(bxDir, "include/compat/msvc") }
  837. libdirs { path.join(_libDir, "lib/durango") }
  838. removeflags { "StaticRuntime" }
  839. defines {
  840. "NOMINMAX",
  841. }
  842. configuration { "netbsd" }
  843. targetdir (path.join(_buildDir, "netbsd/bin"))
  844. objdir (path.join(_buildDir, "netbsd/obj"))
  845. libdirs { path.join(_libDir, "lib/netbsd") }
  846. includedirs {
  847. path.join(bxDir, "include/compat/freebsd"),
  848. }
  849. configuration { "osx", "x32" }
  850. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  851. objdir (path.join(_buildDir, "osx32_clang/obj"))
  852. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  853. buildoptions {
  854. "-m32",
  855. }
  856. configuration { "osx", "x64" }
  857. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  858. objdir (path.join(_buildDir, "osx64_clang/obj"))
  859. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  860. buildoptions {
  861. "-m64",
  862. }
  863. configuration { "osx", "Universal" }
  864. targetdir (path.join(_buildDir, "osx_universal/bin"))
  865. objdir (path.join(_buildDir, "osx_universal/bin"))
  866. configuration { "osx" }
  867. buildoptions_cpp {
  868. "-std=c++14",
  869. }
  870. buildoptions_objcpp {
  871. "-std=c++14",
  872. }
  873. buildoptions {
  874. "-Wfatal-errors",
  875. "-msse2",
  876. "-Wunused-value",
  877. "-Wundef",
  878. }
  879. includedirs { path.join(bxDir, "include/compat/osx") }
  880. configuration { "ios*" }
  881. linkoptions {
  882. "-lc++",
  883. }
  884. buildoptions_cpp {
  885. "-std=c++14",
  886. }
  887. buildoptions_objcpp {
  888. "-std=c++14",
  889. }
  890. buildoptions {
  891. "-Wfatal-errors",
  892. "-Wunused-value",
  893. "-Wundef",
  894. }
  895. includedirs { path.join(bxDir, "include/compat/ios") }
  896. configuration { "xcode*", "ios*" }
  897. targetdir (path.join(_buildDir, "ios-arm/bin"))
  898. objdir (path.join(_buildDir, "ios-arm/obj"))
  899. configuration { "ios-arm" }
  900. targetdir (path.join(_buildDir, "ios-arm/bin"))
  901. objdir (path.join(_buildDir, "ios-arm/obj"))
  902. libdirs { path.join(_libDir, "lib/ios-arm") }
  903. linkoptions {
  904. "-arch armv7",
  905. }
  906. buildoptions {
  907. "-arch armv7",
  908. }
  909. configuration { "ios-arm64" }
  910. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  911. objdir (path.join(_buildDir, "ios-arm64/obj"))
  912. libdirs { path.join(_libDir, "lib/ios-arm64") }
  913. linkoptions {
  914. "-arch arm64",
  915. }
  916. buildoptions {
  917. "-arch arm64",
  918. }
  919. configuration { "ios-arm*" }
  920. linkoptions {
  921. "-miphoneos-version-min=7.0",
  922. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  923. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  924. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  925. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  926. }
  927. buildoptions {
  928. "-miphoneos-version-min=7.0",
  929. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  930. "-fembed-bitcode",
  931. }
  932. configuration { "ios-simulator" }
  933. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  934. objdir (path.join(_buildDir, "ios-simulator/obj"))
  935. libdirs { path.join(_libDir, "lib/ios-simulator") }
  936. linkoptions {
  937. "-mios-simulator-version-min=7.0",
  938. "-arch i386",
  939. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  940. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  941. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  942. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  943. }
  944. buildoptions {
  945. "-mios-simulator-version-min=7.0",
  946. "-arch i386",
  947. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  948. }
  949. configuration { "ios-simulator64" }
  950. targetdir (path.join(_buildDir, "ios-simulator64/bin"))
  951. objdir (path.join(_buildDir, "ios-simulator64/obj"))
  952. libdirs { path.join(_libDir, "lib/ios-simulator64") }
  953. linkoptions {
  954. "-mios-simulator-version-min=7.0",
  955. "-arch x86_64",
  956. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  957. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  958. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  959. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  960. }
  961. buildoptions {
  962. "-mios-simulator-version-min=7.0",
  963. "-arch x86_64",
  964. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  965. }
  966. configuration { "tvos*" }
  967. linkoptions {
  968. "-lc++",
  969. }
  970. buildoptions {
  971. "-Wfatal-errors",
  972. "-Wunused-value",
  973. "-Wundef",
  974. }
  975. includedirs { path.join(bxDir, "include/compat/ios") }
  976. configuration { "xcode*", "tvos*" }
  977. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  978. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  979. configuration { "tvos-arm64" }
  980. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  981. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  982. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  983. linkoptions {
  984. "-mtvos-version-min=9.0",
  985. "-arch arm64",
  986. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  987. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  988. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  989. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  990. }
  991. buildoptions {
  992. "-mtvos-version-min=9.0",
  993. "-arch arm64",
  994. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  995. }
  996. configuration { "tvos-simulator" }
  997. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  998. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  999. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  1000. linkoptions {
  1001. "-mtvos-simulator-version-min=9.0",
  1002. "-arch i386",
  1003. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1004. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  1005. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  1006. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  1007. }
  1008. buildoptions {
  1009. "-mtvos-simulator-version-min=9.0",
  1010. "-arch i386",
  1011. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1012. }
  1013. configuration { "orbis" }
  1014. targetdir (path.join(_buildDir, "orbis/bin"))
  1015. objdir (path.join(_buildDir, "orbis/obj"))
  1016. libdirs { path.join(_libDir, "lib/orbis") }
  1017. includedirs {
  1018. path.join(bxDir, "include/compat/freebsd"),
  1019. "$(SCE_ORBIS_SDK_DIR)/target/include",
  1020. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  1021. }
  1022. buildoptions_cpp {
  1023. "-std=c++14",
  1024. }
  1025. configuration { "rpi" }
  1026. targetdir (path.join(_buildDir, "rpi/bin"))
  1027. objdir (path.join(_buildDir, "rpi/obj"))
  1028. libdirs {
  1029. path.join(_libDir, "lib/rpi"),
  1030. "/opt/vc/lib",
  1031. }
  1032. defines {
  1033. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  1034. "__STDC_VERSION__=199901L",
  1035. }
  1036. buildoptions {
  1037. "-Wunused-value",
  1038. "-Wundef",
  1039. }
  1040. buildoptions_cpp {
  1041. "-std=c++14",
  1042. }
  1043. includedirs {
  1044. "/opt/vc/include",
  1045. "/opt/vc/include/interface/vcos/pthreads",
  1046. "/opt/vc/include/interface/vmcs_host/linux",
  1047. }
  1048. links {
  1049. "rt",
  1050. "dl",
  1051. }
  1052. linkoptions {
  1053. "-Wl,--gc-sections",
  1054. }
  1055. configuration { "riscv" }
  1056. targetdir (path.join(_buildDir, "riscv/bin"))
  1057. objdir (path.join(_buildDir, "riscv/obj"))
  1058. defines {
  1059. "__BSD_VISIBLE",
  1060. "__MISC_VISIBLE",
  1061. }
  1062. includedirs {
  1063. "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include",
  1064. path.join(bxDir, "include/compat/riscv"),
  1065. }
  1066. buildoptions {
  1067. "-Wunused-value",
  1068. "-Wundef",
  1069. "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf",
  1070. }
  1071. buildoptions_cpp {
  1072. "-std=c++14",
  1073. }
  1074. configuration {} -- reset configuration
  1075. return true
  1076. end
  1077. function strip()
  1078. configuration { "android-arm", "Release" }
  1079. postbuildcommands {
  1080. "$(SILENT) echo Stripping symbols.",
  1081. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  1082. }
  1083. configuration { "android-x86", "Release" }
  1084. postbuildcommands {
  1085. "$(SILENT) echo Stripping symbols.",
  1086. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  1087. }
  1088. configuration { "linux-steamlink", "Release" }
  1089. postbuildcommands {
  1090. "$(SILENT) echo Stripping symbols.",
  1091. "$(SILENT) $(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-strip -s \"$(TARGET)\""
  1092. }
  1093. configuration { "linux-* or rpi", "not linux-steamlink", "Release" }
  1094. postbuildcommands {
  1095. "$(SILENT) echo Stripping symbols.",
  1096. "$(SILENT) strip -s \"$(TARGET)\""
  1097. }
  1098. configuration { "mingw*", "Release" }
  1099. postbuildcommands {
  1100. "$(SILENT) echo Stripping symbols.",
  1101. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1102. }
  1103. configuration { "asmjs" }
  1104. postbuildcommands {
  1105. "$(SILENT) echo Running asmjs finalize.",
  1106. "$(SILENT) \"$(EMSCRIPTEN)/emcc\" -O2 "
  1107. -- .. "-s ALLOW_MEMORY_GROWTH=1 "
  1108. -- .. "-s ASSERTIONS=2 "
  1109. -- .. "-s EMTERPRETIFY=1 "
  1110. -- .. "-s EMTERPRETIFY_ASYNC=1 "
  1111. .. "-s PRECISE_F32=1 "
  1112. .. "-s TOTAL_MEMORY=268435456 "
  1113. -- .. "-s USE_WEBGL2=1 "
  1114. .. "--memory-init-file 1 "
  1115. .. "\"$(TARGET)\" -o \"$(TARGET)\".html "
  1116. -- .. "--preload-file ../../../examples/runtime@/ "
  1117. }
  1118. configuration { "riscv" }
  1119. postbuildcommands {
  1120. "$(SILENT) echo Stripping symbols.",
  1121. "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\""
  1122. }
  1123. configuration {} -- reset configuration
  1124. end