toolchain.lua 40 KB

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