toolchain.lua 39 KB

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