toolchain.lua 40 KB

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