toolchain.lua 39 KB

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