toolchain.lua 40 KB

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