toolchain.lua 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  1. --
  2. -- Copyright 2010-2020 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. { "asmjs", "Emscripten/asm.js" },
  45. { "freebsd", "FreeBSD" },
  46. { "linux-gcc", "Linux (GCC compiler)" },
  47. { "linux-gcc-afl", "Linux (GCC + AFL fuzzer)" },
  48. { "linux-gcc-6", "Linux (GCC-6 compiler)" },
  49. { "linux-clang", "Linux (Clang compiler)" },
  50. { "linux-clang-afl", "Linux (Clang + AFL fuzzer)" },
  51. { "linux-mips-gcc", "Linux (MIPS, GCC compiler)" },
  52. { "linux-arm-gcc", "Linux (ARM, GCC compiler)" },
  53. { "ios-arm", "iOS - ARM" },
  54. { "ios-arm64", "iOS - ARM64" },
  55. { "ios-simulator", "iOS - Simulator" },
  56. { "ios-simulator64", "iOS - Simulator 64" },
  57. { "tvos-arm64", "tvOS - ARM64" },
  58. { "tvos-simulator", "tvOS - Simulator" },
  59. { "mingw-gcc", "MinGW" },
  60. { "mingw-clang", "MinGW (clang compiler)" },
  61. { "netbsd", "NetBSD" },
  62. { "osx", "OSX" },
  63. { "orbis", "Orbis" },
  64. { "riscv", "RISC-V" },
  65. { "rpi", "RaspberryPi" },
  66. { "haiku", "Haiku" },
  67. },
  68. }
  69. newoption {
  70. trigger = "vs",
  71. value = "toolset",
  72. description = "Choose VS toolset",
  73. allowed = {
  74. { "vs2012-clang", "Clang 3.6" },
  75. { "vs2013-clang", "Clang 3.6" },
  76. { "vs2015-clang", "Clang 3.9" },
  77. { "vs2017-clang", "Clang with MS CodeGen" },
  78. { "vs2012-xp", "Visual Studio 2012 targeting XP" },
  79. { "vs2013-xp", "Visual Studio 2013 targeting XP" },
  80. { "vs2015-xp", "Visual Studio 2015 targeting XP" },
  81. { "vs2017-xp", "Visual Studio 2017 targeting XP" },
  82. { "winstore100", "Universal Windows App 10.0" },
  83. { "durango", "Durango" },
  84. { "orbis", "Orbis" },
  85. },
  86. }
  87. newoption {
  88. trigger = "xcode",
  89. value = "xcode_target",
  90. description = "Choose XCode target",
  91. allowed = {
  92. { "osx", "OSX" },
  93. { "ios", "iOS" },
  94. { "tvos", "tvOS" },
  95. }
  96. }
  97. newoption {
  98. trigger = "with-android",
  99. value = "#",
  100. description = "Set Android platform version (default: android-14).",
  101. }
  102. newoption {
  103. trigger = "with-ios",
  104. value = "#",
  105. description = "Set iOS target version (default: 8.0).",
  106. }
  107. newoption {
  108. trigger = "with-macos",
  109. value = "#",
  110. description = "Set macOS target version (default 10.11).",
  111. }
  112. newoption {
  113. trigger = "with-tvos",
  114. value = "#",
  115. description = "Set tvOS target version (default: 9.0).",
  116. }
  117. newoption {
  118. trigger = "with-windows",
  119. value = "#",
  120. description = "Set the Windows target platform version (default: $WindowsSDKVersion or 8.1).",
  121. }
  122. newoption {
  123. trigger = "with-dynamic-runtime",
  124. description = "Dynamically link with the runtime rather than statically",
  125. }
  126. newoption {
  127. trigger = "with-32bit-compiler",
  128. description = "Use 32-bit compiler instead 64-bit.",
  129. }
  130. newoption {
  131. trigger = "with-avx",
  132. description = "Use AVX extension.",
  133. }
  134. -- Avoid error when invoking genie --help.
  135. if (_ACTION == nil) then return false end
  136. location (path.join(_buildDir, "projects", _ACTION))
  137. if _ACTION == "clean" then
  138. os.rmdir(_buildDir)
  139. os.mkdir(_buildDir)
  140. os.exit(1)
  141. end
  142. local androidPlatform = "android-24"
  143. if _OPTIONS["with-android"] then
  144. androidPlatform = "android-" .. _OPTIONS["with-android"]
  145. end
  146. local iosPlatform = ""
  147. if _OPTIONS["with-ios"] then
  148. iosPlatform = _OPTIONS["with-ios"]
  149. end
  150. local macosPlatform = ""
  151. if _OPTIONS["with-macos"] then
  152. macosPlatform = _OPTIONS["with-macos"]
  153. end
  154. local tvosPlatform = ""
  155. if _OPTIONS["with-tvos"] then
  156. tvosPlatform = _OPTIONS["with-tvos"]
  157. end
  158. local windowsPlatform = string.gsub(os.getenv("WindowsSDKVersion") or "8.1", "\\", "")
  159. if _OPTIONS["with-windows"] then
  160. windowsPlatform = _OPTIONS["with-windows"]
  161. end
  162. local compiler32bit = false
  163. if _OPTIONS["with-32bit-compiler"] then
  164. compiler32bit = true
  165. end
  166. flags {
  167. "Cpp14",
  168. "ExtraWarnings",
  169. "FloatFast",
  170. }
  171. if _ACTION == "gmake" or _ACTION == "ninja" then
  172. if nil == _OPTIONS["gcc"] then
  173. print("GCC flavor must be specified!")
  174. os.exit(1)
  175. end
  176. if "android-arm" == _OPTIONS["gcc"] then
  177. if not os.getenv("ANDROID_NDK_ARM")
  178. or not os.getenv("ANDROID_NDK_CLANG")
  179. or not os.getenv("ANDROID_NDK_ROOT") then
  180. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.")
  181. end
  182. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  183. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  184. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  185. premake.gcc.llvm = true
  186. location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
  187. elseif "android-arm64" == _OPTIONS["gcc"] then
  188. if not os.getenv("ANDROID_NDK_ARM64")
  189. or not os.getenv("ANDROID_NDK_CLANG")
  190. or not os.getenv("ANDROID_NDK_ROOT") then
  191. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM64, and ANDROID_NDK_ROOT environment variables.")
  192. end
  193. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  194. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  195. premake.gcc.ar = "$(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-ar"
  196. premake.gcc.llvm = true
  197. location (path.join(_buildDir, "projects", _ACTION .. "-android-arm64"))
  198. elseif "android-x86" == _OPTIONS["gcc"] then
  199. if not os.getenv("ANDROID_NDK_X86")
  200. or not os.getenv("ANDROID_NDK_CLANG")
  201. or not os.getenv("ANDROID_NDK_ROOT") then
  202. print("Set ANDROID_NDK_CLANG, ANDROID_NDK_X86, and ANDROID_NDK_ROOT environment variables.")
  203. end
  204. premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
  205. premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
  206. premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
  207. premake.gcc.llvm = true
  208. location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
  209. elseif "asmjs" == _OPTIONS["gcc"] then
  210. if not os.getenv("EMSCRIPTEN") then
  211. print("Set EMSCRIPTEN environment variable.")
  212. end
  213. premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\""
  214. premake.gcc.cxx = "\"$(EMSCRIPTEN)/em++\""
  215. premake.gcc.ar = "\"$(EMSCRIPTEN)/emar\""
  216. premake.gcc.llvm = true
  217. premake.gcc.namestyle = "Emscripten"
  218. location (path.join(_buildDir, "projects", _ACTION .. "-asmjs"))
  219. elseif "freebsd" == _OPTIONS["gcc"] then
  220. location (path.join(_buildDir, "projects", _ACTION .. "-freebsd"))
  221. elseif "ios-arm" == _OPTIONS["gcc"]
  222. or "ios-arm64" == _OPTIONS["gcc"] then
  223. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  224. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  225. premake.gcc.ar = "ar"
  226. location (path.join(_buildDir, "projects", _ACTION .. "-" .. _OPTIONS["gcc"]))
  227. elseif "ios-simulator" == _OPTIONS["gcc"] then
  228. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  229. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  230. premake.gcc.ar = "ar"
  231. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator"))
  232. elseif "ios-simulator64" == _OPTIONS["gcc"] then
  233. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  234. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  235. premake.gcc.ar = "ar"
  236. location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator64"))
  237. elseif "tvos-arm64" == _OPTIONS["gcc"] then
  238. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  239. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  240. premake.gcc.ar = "ar"
  241. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-arm64"))
  242. elseif "tvos-simulator" == _OPTIONS["gcc"] then
  243. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  244. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  245. premake.gcc.ar = "ar"
  246. location (path.join(_buildDir, "projects", _ACTION .. "-tvos-simulator"))
  247. elseif "linux-gcc" == _OPTIONS["gcc"] then
  248. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  249. elseif "linux-gcc-afl" == _OPTIONS["gcc"] then
  250. premake.gcc.cc = "afl-gcc"
  251. premake.gcc.cxx = "afl-g++"
  252. premake.gcc.ar = "ar"
  253. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  254. elseif "linux-gcc-6" == _OPTIONS["gcc"] then
  255. premake.gcc.cc = "gcc-6"
  256. premake.gcc.cxx = "g++-6"
  257. premake.gcc.ar = "ar"
  258. location (path.join(_buildDir, "projects", _ACTION .. "-linux"))
  259. elseif "linux-clang" == _OPTIONS["gcc"] then
  260. premake.gcc.cc = "clang"
  261. premake.gcc.cxx = "clang++"
  262. premake.gcc.ar = "ar"
  263. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  264. elseif "linux-clang-afl" == _OPTIONS["gcc"] then
  265. premake.gcc.cc = "afl-clang"
  266. premake.gcc.cxx = "afl-clang++"
  267. premake.gcc.ar = "ar"
  268. location (path.join(_buildDir, "projects", _ACTION .. "-linux-clang"))
  269. elseif "linux-mips-gcc" == _OPTIONS["gcc"] then
  270. location (path.join(_buildDir, "projects", _ACTION .. "-linux-mips-gcc"))
  271. elseif "linux-arm-gcc" == _OPTIONS["gcc"] then
  272. location (path.join(_buildDir, "projects", _ACTION .. "-linux-arm-gcc"))
  273. elseif "mingw-gcc" == _OPTIONS["gcc"] then
  274. if not os.getenv("MINGW") then
  275. print("Set MINGW environment variable.")
  276. end
  277. local mingwToolchain = "x86_64-w64-mingw32"
  278. if compiler32bit then
  279. if os.is("linux") then
  280. mingwToolchain = "i686-w64-mingw32"
  281. else
  282. mingwToolchain = "mingw32"
  283. end
  284. end
  285. premake.gcc.cc = "$(MINGW)/bin/" .. mingwToolchain .. "-gcc"
  286. premake.gcc.cxx = "$(MINGW)/bin/" .. mingwToolchain .. "-g++"
  287. premake.gcc.ar = "$(MINGW)/bin/ar"
  288. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-gcc"))
  289. elseif "mingw-clang" == _OPTIONS["gcc"] then
  290. premake.gcc.cc = "$(CLANG)/bin/clang"
  291. premake.gcc.cxx = "$(CLANG)/bin/clang++"
  292. premake.gcc.ar = "$(MINGW)/bin/ar"
  293. -- premake.gcc.ar = "$(CLANG)/bin/llvm-ar"
  294. -- premake.gcc.llvm = true
  295. location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang"))
  296. elseif "netbsd" == _OPTIONS["gcc"] then
  297. location (path.join(_buildDir, "projects", _ACTION .. "-netbsd"))
  298. elseif "osx" == _OPTIONS["gcc"] then
  299. if os.is("linux") then
  300. if not os.getenv("OSXCROSS") then
  301. print("Set OSXCROSS environment variable.")
  302. end
  303. local osxToolchain = "x86_64-apple-darwin15-"
  304. premake.gcc.cc = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang"
  305. premake.gcc.cxx = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "clang++"
  306. premake.gcc.ar = "$(OSXCROSS)/target/bin/" .. osxToolchain .. "ar"
  307. end
  308. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  309. elseif "orbis" == _OPTIONS["gcc"] then
  310. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  311. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  312. end
  313. orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-"
  314. premake.gcc.cc = orbisToolchain .. "clang"
  315. premake.gcc.cxx = orbisToolchain .. "clang++"
  316. premake.gcc.ar = orbisToolchain .. "ar"
  317. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  318. elseif "rpi" == _OPTIONS["gcc"] then
  319. location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
  320. elseif "riscv" == _OPTIONS["gcc"] then
  321. premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc"
  322. premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++"
  323. premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar"
  324. location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
  325. end
  326. elseif _ACTION == "vs2012"
  327. or _ACTION == "vs2013"
  328. or _ACTION == "vs2015"
  329. or _ACTION == "vs2017"
  330. or _ACTION == "vs2019"
  331. then
  332. local action = premake.action.current()
  333. action.vstudio.windowsTargetPlatformVersion = windowsPlatform
  334. action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
  335. if (_ACTION .. "-clang") == _OPTIONS["vs"] then
  336. if "vs2017-clang" == _OPTIONS["vs"] then
  337. premake.vstudio.toolset = "v141_clang_c2"
  338. elseif "vs2015-clang" == _OPTIONS["vs"] then
  339. premake.vstudio.toolset = "LLVM-vs2014"
  340. else
  341. premake.vstudio.toolset = ("LLVM-" .. _ACTION)
  342. end
  343. location (path.join(_buildDir, "projects", _ACTION .. "-clang"))
  344. elseif "winstore100" == _OPTIONS["vs"] then
  345. premake.vstudio.toolset = "v141"
  346. premake.vstudio.storeapp = "10.0"
  347. platforms { "ARM" }
  348. location (path.join(_buildDir, "projects", _ACTION .. "-winstore100"))
  349. elseif "durango" == _OPTIONS["vs"] then
  350. if not os.getenv("DurangoXDK") then
  351. print("DurangoXDK not found.")
  352. end
  353. premake.vstudio.toolset = "v140"
  354. premake.vstudio.storeapp = "durango"
  355. platforms { "Durango" }
  356. location (path.join(_buildDir, "projects", _ACTION .. "-durango"))
  357. elseif "orbis" == _OPTIONS["vs"] then
  358. if not os.getenv("SCE_ORBIS_SDK_DIR") then
  359. print("Set SCE_ORBIS_SDK_DIR environment variable.")
  360. end
  361. platforms { "Orbis" }
  362. location (path.join(_buildDir, "projects", _ACTION .. "-orbis"))
  363. elseif ("vs2012-xp") == _OPTIONS["vs"] then
  364. premake.vstudio.toolset = ("v110_xp")
  365. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  366. elseif "vs2013-xp" == _OPTIONS["vs"] then
  367. premake.vstudio.toolset = ("v120_xp")
  368. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  369. elseif "vs2015-xp" == _OPTIONS["vs"] then
  370. premake.vstudio.toolset = ("v140_xp")
  371. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  372. elseif "vs2015-xp" == _OPTIONS["vs"] then
  373. premake.vstudio.toolset = ("v141_xp")
  374. location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
  375. end
  376. elseif _ACTION == "xcode4"
  377. or _ACTION == "xcode8"
  378. or _ACTION == "xcode9" 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. "-Wl,--fix-cortex-a8",
  745. }
  746. configuration { "android-arm64" }
  747. targetdir (path.join(_buildDir, "android-arm64/bin"))
  748. objdir (path.join(_buildDir, "android-arm64/obj"))
  749. libdirs {
  750. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/arm64-v8a",
  751. }
  752. includedirs {
  753. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/aarch64-linux-android",
  754. }
  755. buildoptions {
  756. "-gcc-toolchain $(ANDROID_NDK_ARM64)",
  757. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64"),
  758. "-target aarch64-none-linux-androideabi",
  759. "-march=armv8-a",
  760. "-Wunused-value",
  761. "-Wundef",
  762. }
  763. linkoptions {
  764. "-gcc-toolchain $(ANDROID_NDK_ARM64)",
  765. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64"),
  766. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64/usr/lib/crtbegin_so.o"),
  767. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64/usr/lib/crtend_so.o"),
  768. "-target aarch64-none-linux-androideabi",
  769. "-march=armv8-a",
  770. "-Wl,--fix-cortex-a8",
  771. }
  772. configuration { "android-x86" }
  773. targetdir (path.join(_buildDir, "android-x86/bin"))
  774. objdir (path.join(_buildDir, "android-x86/obj"))
  775. libdirs {
  776. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
  777. }
  778. includedirs {
  779. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android",
  780. }
  781. buildoptions {
  782. "-gcc-toolchain $(ANDROID_NDK_X86)",
  783. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  784. "-target i686-none-linux-android",
  785. "-march=i686",
  786. "-mtune=atom",
  787. "-mstackrealign",
  788. "-msse3",
  789. "-mfpmath=sse",
  790. "-Wunused-value",
  791. "-Wundef",
  792. }
  793. linkoptions {
  794. "-gcc-toolchain $(ANDROID_NDK_X86)",
  795. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  796. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  797. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  798. "-target i686-none-linux-android",
  799. }
  800. configuration { "asmjs" }
  801. targetdir (path.join(_buildDir, "asmjs/bin"))
  802. objdir (path.join(_buildDir, "asmjs/obj"))
  803. libdirs { path.join(_libDir, "lib/asmjs") }
  804. buildoptions {
  805. "-Wunused-value",
  806. "-Wundef",
  807. }
  808. linkoptions {
  809. -- "-s ASSERTIONS=2",
  810. -- "-s EMTERPRETIFY=1",
  811. -- "-s EMTERPRETIFY_ASYNC=1",
  812. "-s PRECISE_F32=1",
  813. }
  814. configuration { "freebsd" }
  815. targetdir (path.join(_buildDir, "freebsd/bin"))
  816. objdir (path.join(_buildDir, "freebsd/obj"))
  817. libdirs { path.join(_libDir, "lib/freebsd") }
  818. includedirs {
  819. path.join(bxDir, "include/compat/freebsd"),
  820. }
  821. configuration { "xbox360" }
  822. targetdir (path.join(_buildDir, "xbox360/bin"))
  823. objdir (path.join(_buildDir, "xbox360/obj"))
  824. includedirs { path.join(bxDir, "include/compat/msvc") }
  825. libdirs { path.join(_libDir, "lib/xbox360") }
  826. defines {
  827. "NOMINMAX",
  828. }
  829. configuration { "durango" }
  830. targetdir (path.join(_buildDir, "durango/bin"))
  831. objdir (path.join(_buildDir, "durango/obj"))
  832. includedirs { path.join(bxDir, "include/compat/msvc") }
  833. libdirs { path.join(_libDir, "lib/durango") }
  834. removeflags { "StaticRuntime" }
  835. defines {
  836. "NOMINMAX",
  837. }
  838. configuration { "netbsd" }
  839. targetdir (path.join(_buildDir, "netbsd/bin"))
  840. objdir (path.join(_buildDir, "netbsd/obj"))
  841. libdirs { path.join(_libDir, "lib/netbsd") }
  842. includedirs {
  843. path.join(bxDir, "include/compat/freebsd"),
  844. }
  845. configuration { "osx", "x32" }
  846. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  847. objdir (path.join(_buildDir, "osx32_clang/obj"))
  848. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  849. buildoptions {
  850. "-m32",
  851. }
  852. configuration { "osx", "x64" }
  853. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  854. objdir (path.join(_buildDir, "osx64_clang/obj"))
  855. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  856. buildoptions {
  857. "-m64",
  858. }
  859. configuration { "osx", "Universal" }
  860. targetdir (path.join(_buildDir, "osx_universal/bin"))
  861. objdir (path.join(_buildDir, "osx_universal/bin"))
  862. configuration { "osx" }
  863. buildoptions {
  864. "-Wfatal-errors",
  865. "-msse2",
  866. "-Wunused-value",
  867. "-Wundef",
  868. "-target x86_64-apple-macos" .. (#macosPlatform > 0 and macosPlatform or "10.11"),
  869. }
  870. includedirs { path.join(bxDir, "include/compat/osx") }
  871. configuration { "ios*" }
  872. linkoptions {
  873. "-lc++",
  874. }
  875. buildoptions {
  876. "-Wfatal-errors",
  877. "-Wunused-value",
  878. "-Wundef",
  879. }
  880. includedirs { path.join(bxDir, "include/compat/ios") }
  881. configuration { "xcode*", "ios*" }
  882. targetdir (path.join(_buildDir, "ios-arm/bin"))
  883. objdir (path.join(_buildDir, "ios-arm/obj"))
  884. configuration { "ios-arm" }
  885. targetdir (path.join(_buildDir, "ios-arm/bin"))
  886. objdir (path.join(_buildDir, "ios-arm/obj"))
  887. libdirs { path.join(_libDir, "lib/ios-arm") }
  888. linkoptions {
  889. "-arch armv7",
  890. }
  891. buildoptions {
  892. "-arch armv7",
  893. }
  894. configuration { "ios-arm64" }
  895. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  896. objdir (path.join(_buildDir, "ios-arm64/obj"))
  897. libdirs { path.join(_libDir, "lib/ios-arm64") }
  898. linkoptions {
  899. "-arch arm64",
  900. }
  901. buildoptions {
  902. "-arch arm64",
  903. }
  904. configuration { "ios-arm*" }
  905. linkoptions {
  906. "-miphoneos-version-min=7.0",
  907. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  908. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  909. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  910. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  911. }
  912. buildoptions {
  913. "-miphoneos-version-min=7.0",
  914. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  915. "-fembed-bitcode",
  916. }
  917. configuration { "ios-simulator" }
  918. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  919. objdir (path.join(_buildDir, "ios-simulator/obj"))
  920. libdirs { path.join(_libDir, "lib/ios-simulator") }
  921. linkoptions {
  922. "-mios-simulator-version-min=7.0",
  923. "-arch i386",
  924. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  925. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  926. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  927. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  928. }
  929. buildoptions {
  930. "-mios-simulator-version-min=7.0",
  931. "-arch i386",
  932. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  933. }
  934. configuration { "ios-simulator64" }
  935. targetdir (path.join(_buildDir, "ios-simulator64/bin"))
  936. objdir (path.join(_buildDir, "ios-simulator64/obj"))
  937. libdirs { path.join(_libDir, "lib/ios-simulator64") }
  938. linkoptions {
  939. "-mios-simulator-version-min=7.0",
  940. "-arch x86_64",
  941. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  942. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  943. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  944. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  945. }
  946. buildoptions {
  947. "-mios-simulator-version-min=7.0",
  948. "-arch x86_64",
  949. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  950. }
  951. configuration { "tvos*" }
  952. linkoptions {
  953. "-lc++",
  954. }
  955. buildoptions {
  956. "-Wfatal-errors",
  957. "-Wunused-value",
  958. "-Wundef",
  959. }
  960. includedirs { path.join(bxDir, "include/compat/ios") }
  961. configuration { "xcode*", "tvos*" }
  962. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  963. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  964. configuration { "tvos-arm64" }
  965. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  966. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  967. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  968. linkoptions {
  969. "-mtvos-version-min=9.0",
  970. "-arch arm64",
  971. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  972. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  973. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  974. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  975. }
  976. buildoptions {
  977. "-mtvos-version-min=9.0",
  978. "-arch arm64",
  979. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  980. }
  981. configuration { "tvos-simulator" }
  982. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  983. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  984. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  985. linkoptions {
  986. "-mtvos-simulator-version-min=9.0",
  987. "-arch i386",
  988. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  989. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  990. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  991. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  992. }
  993. buildoptions {
  994. "-mtvos-simulator-version-min=9.0",
  995. "-arch i386",
  996. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  997. }
  998. configuration { "orbis" }
  999. targetdir (path.join(_buildDir, "orbis/bin"))
  1000. objdir (path.join(_buildDir, "orbis/obj"))
  1001. libdirs { path.join(_libDir, "lib/orbis") }
  1002. includedirs {
  1003. path.join(bxDir, "include/compat/freebsd"),
  1004. "$(SCE_ORBIS_SDK_DIR)/target/include",
  1005. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  1006. }
  1007. configuration { "rpi" }
  1008. targetdir (path.join(_buildDir, "rpi/bin"))
  1009. objdir (path.join(_buildDir, "rpi/obj"))
  1010. libdirs {
  1011. path.join(_libDir, "lib/rpi"),
  1012. "/opt/vc/lib",
  1013. }
  1014. defines {
  1015. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  1016. "__STDC_VERSION__=199901L",
  1017. }
  1018. buildoptions {
  1019. "-Wunused-value",
  1020. "-Wundef",
  1021. }
  1022. includedirs {
  1023. "/opt/vc/include",
  1024. "/opt/vc/include/interface/vcos/pthreads",
  1025. "/opt/vc/include/interface/vmcs_host/linux",
  1026. }
  1027. links {
  1028. "rt",
  1029. "dl",
  1030. }
  1031. linkoptions {
  1032. "-Wl,--gc-sections",
  1033. }
  1034. configuration { "riscv" }
  1035. targetdir (path.join(_buildDir, "riscv/bin"))
  1036. objdir (path.join(_buildDir, "riscv/obj"))
  1037. defines {
  1038. "__BSD_VISIBLE",
  1039. "__MISC_VISIBLE",
  1040. }
  1041. includedirs {
  1042. "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include",
  1043. path.join(bxDir, "include/compat/riscv"),
  1044. }
  1045. buildoptions {
  1046. "-Wunused-value",
  1047. "-Wundef",
  1048. "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf",
  1049. }
  1050. configuration {} -- reset configuration
  1051. return true
  1052. end
  1053. function strip()
  1054. configuration { "android-arm", "Release" }
  1055. postbuildcommands {
  1056. "$(SILENT) echo Stripping symbols.",
  1057. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  1058. }
  1059. configuration { "android-arm64", "Release" }
  1060. postbuildcommands {
  1061. "$(SILENT) echo Stripping symbols.",
  1062. "$(SILENT) $(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-strip -s \"$(TARGET)\""
  1063. }
  1064. configuration { "android-x86", "Release" }
  1065. postbuildcommands {
  1066. "$(SILENT) echo Stripping symbols.",
  1067. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  1068. }
  1069. configuration { "linux-* or rpi", "Release" }
  1070. postbuildcommands {
  1071. "$(SILENT) echo Stripping symbols.",
  1072. "$(SILENT) strip -s \"$(TARGET)\""
  1073. }
  1074. configuration { "mingw*", "Release" }
  1075. postbuildcommands {
  1076. "$(SILENT) echo Stripping symbols.",
  1077. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1078. }
  1079. configuration { "riscv" }
  1080. postbuildcommands {
  1081. "$(SILENT) echo Stripping symbols.",
  1082. "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\""
  1083. }
  1084. configuration {} -- reset configuration
  1085. end