toolchain.lua 39 KB

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