toolchain.lua 39 KB

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