toolchain.lua 40 KB

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