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 == "xcode4"
  378. or _ACTION == "xcode8"
  379. or _ACTION == "xcode9" then
  380. local action = premake.action.current()
  381. local str_or = function(str, def)
  382. return #str > 0 and str or def
  383. end
  384. if "osx" == _OPTIONS["xcode"] then
  385. action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "10.11")
  386. premake.xcode.toolset = "macosx"
  387. location (path.join(_buildDir, "projects", _ACTION .. "-osx"))
  388. elseif "ios" == _OPTIONS["xcode"] then
  389. action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "8.0")
  390. premake.xcode.toolset = "iphoneos"
  391. location (path.join(_buildDir, "projects", _ACTION .. "-ios"))
  392. elseif "tvos" == _OPTIONS["xcode"] then
  393. action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0")
  394. premake.xcode.toolset = "appletvos"
  395. location (path.join(_buildDir, "projects", _ACTION .. "-tvos"))
  396. end
  397. end
  398. if not _OPTIONS["with-dynamic-runtime"] then
  399. flags { "StaticRuntime" }
  400. end
  401. if _OPTIONS["with-avx"] then
  402. flags { "EnableAVX" }
  403. end
  404. if _OPTIONS["with-crtnone"] then
  405. crtNone()
  406. end
  407. flags {
  408. "NoPCH",
  409. "NativeWChar",
  410. "NoRTTI",
  411. "NoExceptions",
  412. "NoEditAndContinue",
  413. "NoFramePointer",
  414. "Symbols",
  415. }
  416. defines {
  417. "__STDC_LIMIT_MACROS",
  418. "__STDC_FORMAT_MACROS",
  419. "__STDC_CONSTANT_MACROS",
  420. }
  421. configuration { "Debug" }
  422. targetsuffix "Debug"
  423. defines {
  424. "_DEBUG",
  425. }
  426. configuration { "Release" }
  427. flags {
  428. "NoBufferSecurityCheck",
  429. "OptimizeSpeed",
  430. }
  431. defines {
  432. "NDEBUG",
  433. }
  434. targetsuffix "Release"
  435. configuration { "qbs" }
  436. flags {
  437. "ExtraWarnings",
  438. }
  439. configuration { "vs*", "x32" }
  440. flags {
  441. "EnableSSE2",
  442. }
  443. configuration { "vs*", "not orbis", "not NX32", "not NX64" }
  444. includedirs { path.join(bxDir, "include/compat/msvc") }
  445. defines {
  446. "WIN32",
  447. "_WIN32",
  448. "_HAS_EXCEPTIONS=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. "-Wshadow",
  605. -- "-Wnull-dereference",
  606. "-Wunused-value",
  607. "-Wundef",
  608. -- "-Wuseless-cast",
  609. }
  610. links {
  611. "rt",
  612. "dl",
  613. }
  614. linkoptions {
  615. "-Wl,--gc-sections",
  616. "-Wl,--as-needed",
  617. }
  618. configuration { "linux-gcc*" }
  619. buildoptions {
  620. "-Wlogical-op",
  621. }
  622. configuration { "linux-gcc*", "x32" }
  623. targetdir (path.join(_buildDir, "linux32_gcc/bin"))
  624. objdir (path.join(_buildDir, "linux32_gcc/obj"))
  625. libdirs { path.join(_libDir, "lib/linux32_gcc") }
  626. buildoptions {
  627. "-m32",
  628. }
  629. configuration { "linux-gcc*", "x64" }
  630. targetdir (path.join(_buildDir, "linux64_gcc/bin"))
  631. objdir (path.join(_buildDir, "linux64_gcc/obj"))
  632. libdirs { path.join(_libDir, "lib/linux64_gcc") }
  633. buildoptions {
  634. "-m64",
  635. }
  636. configuration { "linux-clang*", "x32" }
  637. targetdir (path.join(_buildDir, "linux32_clang/bin"))
  638. objdir (path.join(_buildDir, "linux32_clang/obj"))
  639. libdirs { path.join(_libDir, "lib/linux32_clang") }
  640. buildoptions {
  641. "-m32",
  642. }
  643. configuration { "linux-clang*", "x64" }
  644. targetdir (path.join(_buildDir, "linux64_clang/bin"))
  645. objdir (path.join(_buildDir, "linux64_clang/obj"))
  646. libdirs { path.join(_libDir, "lib/linux64_clang") }
  647. buildoptions {
  648. "-m64",
  649. }
  650. configuration { "linux-mips-gcc" }
  651. targetdir (path.join(_buildDir, "linux32_mips_gcc/bin"))
  652. objdir (path.join(_buildDir, "linux32_mips_gcc/obj"))
  653. libdirs { path.join(_libDir, "lib/linux32_mips_gcc") }
  654. buildoptions {
  655. "-Wunused-value",
  656. "-Wundef",
  657. }
  658. links {
  659. "rt",
  660. "dl",
  661. }
  662. linkoptions {
  663. "-Wl,--gc-sections",
  664. }
  665. configuration { "linux-arm-gcc" }
  666. targetdir (path.join(_buildDir, "linux32_arm_gcc/bin"))
  667. objdir (path.join(_buildDir, "linux32_arm_gcc/obj"))
  668. libdirs { path.join(_libDir, "lib/linux32_arm_gcc") }
  669. buildoptions {
  670. "-Wunused-value",
  671. "-Wundef",
  672. }
  673. links {
  674. "rt",
  675. "dl",
  676. }
  677. linkoptions {
  678. "-Wl,--gc-sections",
  679. }
  680. configuration { "android-*" }
  681. targetprefix ("lib")
  682. flags {
  683. "NoImportLib",
  684. }
  685. includedirs {
  686. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
  687. "${ANDROID_NDK_ROOT}/sysroot/usr/include",
  688. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  689. }
  690. linkoptions {
  691. "-nostdlib",
  692. }
  693. links {
  694. "c",
  695. "dl",
  696. "m",
  697. "android",
  698. "log",
  699. "c++_shared",
  700. "gcc",
  701. }
  702. buildoptions {
  703. "-fPIC",
  704. "-no-canonical-prefixes",
  705. "-Wa,--noexecstack",
  706. "-fstack-protector-strong",
  707. "-ffunction-sections",
  708. "-Wunused-value",
  709. "-Wundef",
  710. }
  711. linkoptions {
  712. "-no-canonical-prefixes",
  713. "-Wl,--no-undefined",
  714. "-Wl,-z,noexecstack",
  715. "-Wl,-z,relro",
  716. "-Wl,-z,now",
  717. }
  718. configuration { "android-arm" }
  719. targetdir (path.join(_buildDir, "android-arm/bin"))
  720. objdir (path.join(_buildDir, "android-arm/obj"))
  721. libdirs {
  722. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
  723. }
  724. includedirs {
  725. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi",
  726. }
  727. buildoptions {
  728. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  729. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  730. "-target armv7-none-linux-androideabi",
  731. "-mthumb",
  732. "-march=armv7-a",
  733. "-mfloat-abi=softfp",
  734. "-mfpu=neon",
  735. "-Wunused-value",
  736. "-Wundef",
  737. }
  738. linkoptions {
  739. "-gcc-toolchain $(ANDROID_NDK_ARM)",
  740. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
  741. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
  742. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
  743. "-target armv7-none-linux-androideabi",
  744. "-march=armv7-a",
  745. "-Wl,--fix-cortex-a8",
  746. }
  747. configuration { "android-arm64" }
  748. targetdir (path.join(_buildDir, "android-arm64/bin"))
  749. objdir (path.join(_buildDir, "android-arm64/obj"))
  750. libdirs {
  751. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/arm64-v8a",
  752. }
  753. includedirs {
  754. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/aarch64-linux-android",
  755. }
  756. buildoptions {
  757. "-gcc-toolchain $(ANDROID_NDK_ARM64)",
  758. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64"),
  759. "-target aarch64-none-linux-androideabi",
  760. "-march=armv8-a",
  761. "-Wunused-value",
  762. "-Wundef",
  763. }
  764. linkoptions {
  765. "-gcc-toolchain $(ANDROID_NDK_ARM64)",
  766. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64"),
  767. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64/usr/lib/crtbegin_so.o"),
  768. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64/usr/lib/crtend_so.o"),
  769. "-target aarch64-none-linux-androideabi",
  770. "-march=armv8-a",
  771. "-Wl,--fix-cortex-a8",
  772. }
  773. configuration { "android-x86" }
  774. targetdir (path.join(_buildDir, "android-x86/bin"))
  775. objdir (path.join(_buildDir, "android-x86/obj"))
  776. libdirs {
  777. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
  778. }
  779. includedirs {
  780. "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android",
  781. }
  782. buildoptions {
  783. "-gcc-toolchain $(ANDROID_NDK_X86)",
  784. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  785. "-target i686-none-linux-android",
  786. "-march=i686",
  787. "-mtune=atom",
  788. "-mstackrealign",
  789. "-msse3",
  790. "-mfpmath=sse",
  791. "-Wunused-value",
  792. "-Wundef",
  793. }
  794. linkoptions {
  795. "-gcc-toolchain $(ANDROID_NDK_X86)",
  796. "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
  797. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
  798. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
  799. "-target i686-none-linux-android",
  800. }
  801. configuration { "wasm*" }
  802. buildoptions {
  803. "-Wunused-value",
  804. "-Wundef",
  805. }
  806. linkoptions {
  807. "-s MAX_WEBGL_VERSION=2"
  808. }
  809. configuration { "wasm2js" }
  810. targetdir (path.join(_buildDir, "wasm2js/bin"))
  811. objdir (path.join(_buildDir, "wasm2js/obj"))
  812. libdirs { path.join(_libDir, "lib/wasm2js") }
  813. linkoptions {
  814. "-s WASM=0"
  815. }
  816. configuration { "wasm" }
  817. targetdir (path.join(_buildDir, "wasm/bin"))
  818. objdir (path.join(_buildDir, "wasm/obj"))
  819. libdirs { path.join(_libDir, "lib/wasm") }
  820. configuration { "freebsd" }
  821. targetdir (path.join(_buildDir, "freebsd/bin"))
  822. objdir (path.join(_buildDir, "freebsd/obj"))
  823. libdirs { path.join(_libDir, "lib/freebsd") }
  824. includedirs {
  825. path.join(bxDir, "include/compat/freebsd"),
  826. }
  827. configuration { "xbox360" }
  828. targetdir (path.join(_buildDir, "xbox360/bin"))
  829. objdir (path.join(_buildDir, "xbox360/obj"))
  830. includedirs { path.join(bxDir, "include/compat/msvc") }
  831. libdirs { path.join(_libDir, "lib/xbox360") }
  832. defines {
  833. "NOMINMAX",
  834. }
  835. configuration { "durango" }
  836. targetdir (path.join(_buildDir, "durango/bin"))
  837. objdir (path.join(_buildDir, "durango/obj"))
  838. includedirs { path.join(bxDir, "include/compat/msvc") }
  839. libdirs { path.join(_libDir, "lib/durango") }
  840. removeflags { "StaticRuntime" }
  841. defines {
  842. "NOMINMAX",
  843. }
  844. configuration { "netbsd" }
  845. targetdir (path.join(_buildDir, "netbsd/bin"))
  846. objdir (path.join(_buildDir, "netbsd/obj"))
  847. libdirs { path.join(_libDir, "lib/netbsd") }
  848. includedirs {
  849. path.join(bxDir, "include/compat/freebsd"),
  850. }
  851. configuration { "osx", "x32" }
  852. targetdir (path.join(_buildDir, "osx32_clang/bin"))
  853. objdir (path.join(_buildDir, "osx32_clang/obj"))
  854. --libdirs { path.join(_libDir, "lib/osx32_clang") }
  855. buildoptions {
  856. "-m32",
  857. }
  858. configuration { "osx", "x64" }
  859. targetdir (path.join(_buildDir, "osx64_clang/bin"))
  860. objdir (path.join(_buildDir, "osx64_clang/obj"))
  861. --libdirs { path.join(_libDir, "lib/osx64_clang") }
  862. buildoptions {
  863. "-m64",
  864. }
  865. configuration { "osx", "Universal" }
  866. targetdir (path.join(_buildDir, "osx_universal/bin"))
  867. objdir (path.join(_buildDir, "osx_universal/bin"))
  868. configuration { "osx" }
  869. buildoptions {
  870. "-Wfatal-errors",
  871. "-msse2",
  872. "-Wunused-value",
  873. "-Wundef",
  874. "-target x86_64-apple-macos" .. (#macosPlatform > 0 and macosPlatform or "10.11"),
  875. }
  876. includedirs { path.join(bxDir, "include/compat/osx") }
  877. configuration { "ios*" }
  878. linkoptions {
  879. "-lc++",
  880. }
  881. buildoptions {
  882. "-Wfatal-errors",
  883. "-Wunused-value",
  884. "-Wundef",
  885. }
  886. includedirs { path.join(bxDir, "include/compat/ios") }
  887. configuration { "xcode*", "ios*" }
  888. targetdir (path.join(_buildDir, "ios-arm/bin"))
  889. objdir (path.join(_buildDir, "ios-arm/obj"))
  890. configuration { "ios-arm" }
  891. targetdir (path.join(_buildDir, "ios-arm/bin"))
  892. objdir (path.join(_buildDir, "ios-arm/obj"))
  893. libdirs { path.join(_libDir, "lib/ios-arm") }
  894. linkoptions {
  895. "-arch armv7",
  896. }
  897. buildoptions {
  898. "-arch armv7",
  899. }
  900. configuration { "ios-arm64" }
  901. targetdir (path.join(_buildDir, "ios-arm64/bin"))
  902. objdir (path.join(_buildDir, "ios-arm64/obj"))
  903. libdirs { path.join(_libDir, "lib/ios-arm64") }
  904. linkoptions {
  905. "-arch arm64",
  906. }
  907. buildoptions {
  908. "-arch arm64",
  909. }
  910. configuration { "ios-arm*" }
  911. linkoptions {
  912. "-miphoneos-version-min=7.0",
  913. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  914. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/usr/lib/system",
  915. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  916. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  917. }
  918. buildoptions {
  919. "-miphoneos-version-min=7.0",
  920. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" ..iosPlatform .. ".sdk",
  921. "-fembed-bitcode",
  922. }
  923. configuration { "ios-simulator" }
  924. targetdir (path.join(_buildDir, "ios-simulator/bin"))
  925. objdir (path.join(_buildDir, "ios-simulator/obj"))
  926. libdirs { path.join(_libDir, "lib/ios-simulator") }
  927. linkoptions {
  928. "-mios-simulator-version-min=7.0",
  929. "-arch i386",
  930. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  931. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  932. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  933. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  934. }
  935. buildoptions {
  936. "-mios-simulator-version-min=7.0",
  937. "-arch i386",
  938. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  939. }
  940. configuration { "ios-simulator64" }
  941. targetdir (path.join(_buildDir, "ios-simulator64/bin"))
  942. objdir (path.join(_buildDir, "ios-simulator64/obj"))
  943. libdirs { path.join(_libDir, "lib/ios-simulator64") }
  944. linkoptions {
  945. "-mios-simulator-version-min=7.0",
  946. "-arch x86_64",
  947. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  948. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system",
  949. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks",
  950. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  951. }
  952. buildoptions {
  953. "-mios-simulator-version-min=7.0",
  954. "-arch x86_64",
  955. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk",
  956. }
  957. configuration { "tvos*" }
  958. linkoptions {
  959. "-lc++",
  960. }
  961. buildoptions {
  962. "-Wfatal-errors",
  963. "-Wunused-value",
  964. "-Wundef",
  965. }
  966. includedirs { path.join(bxDir, "include/compat/ios") }
  967. configuration { "xcode*", "tvos*" }
  968. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  969. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  970. configuration { "tvos-arm64" }
  971. targetdir (path.join(_buildDir, "tvos-arm64/bin"))
  972. objdir (path.join(_buildDir, "tvos-arm64/obj"))
  973. libdirs { path.join(_libDir, "lib/tvos-arm64") }
  974. linkoptions {
  975. "-mtvos-version-min=9.0",
  976. "-arch arm64",
  977. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  978. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/usr/lib/system",
  979. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  980. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  981. }
  982. buildoptions {
  983. "-mtvos-version-min=9.0",
  984. "-arch arm64",
  985. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS" ..tvosPlatform .. ".sdk",
  986. }
  987. configuration { "tvos-simulator" }
  988. targetdir (path.join(_buildDir, "tvos-simulator/bin"))
  989. objdir (path.join(_buildDir, "tvos-simulator/obj"))
  990. libdirs { path.join(_libDir, "lib/tvos-simulator") }
  991. linkoptions {
  992. "-mtvos-simulator-version-min=9.0",
  993. "-arch i386",
  994. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  995. "-L/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/usr/lib/system",
  996. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/Frameworks",
  997. "-F/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk/System/Library/PrivateFrameworks",
  998. }
  999. buildoptions {
  1000. "-mtvos-simulator-version-min=9.0",
  1001. "-arch i386",
  1002. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator" ..tvosPlatform .. ".sdk",
  1003. }
  1004. configuration { "orbis" }
  1005. targetdir (path.join(_buildDir, "orbis/bin"))
  1006. objdir (path.join(_buildDir, "orbis/obj"))
  1007. libdirs { path.join(_libDir, "lib/orbis") }
  1008. includedirs {
  1009. path.join(bxDir, "include/compat/freebsd"),
  1010. "$(SCE_ORBIS_SDK_DIR)/target/include",
  1011. "$(SCE_ORBIS_SDK_DIR)/target/include_common",
  1012. }
  1013. configuration { "rpi" }
  1014. targetdir (path.join(_buildDir, "rpi/bin"))
  1015. objdir (path.join(_buildDir, "rpi/obj"))
  1016. libdirs {
  1017. path.join(_libDir, "lib/rpi"),
  1018. "/opt/vc/lib",
  1019. }
  1020. defines {
  1021. "__VCCOREVER__=0x04000000", -- There is no special prefedined compiler symbol to detect RaspberryPi, faking it.
  1022. "__STDC_VERSION__=199901L",
  1023. }
  1024. buildoptions {
  1025. "-Wunused-value",
  1026. "-Wundef",
  1027. }
  1028. includedirs {
  1029. "/opt/vc/include",
  1030. "/opt/vc/include/interface/vcos/pthreads",
  1031. "/opt/vc/include/interface/vmcs_host/linux",
  1032. }
  1033. links {
  1034. "rt",
  1035. "dl",
  1036. }
  1037. linkoptions {
  1038. "-Wl,--gc-sections",
  1039. }
  1040. configuration { "riscv" }
  1041. targetdir (path.join(_buildDir, "riscv/bin"))
  1042. objdir (path.join(_buildDir, "riscv/obj"))
  1043. defines {
  1044. "__BSD_VISIBLE",
  1045. "__MISC_VISIBLE",
  1046. }
  1047. includedirs {
  1048. "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include",
  1049. path.join(bxDir, "include/compat/riscv"),
  1050. }
  1051. buildoptions {
  1052. "-Wunused-value",
  1053. "-Wundef",
  1054. "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf",
  1055. }
  1056. configuration {} -- reset configuration
  1057. return true
  1058. end
  1059. function strip()
  1060. configuration { "android-arm", "Release" }
  1061. postbuildcommands {
  1062. "$(SILENT) echo Stripping symbols.",
  1063. "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  1064. }
  1065. configuration { "android-arm64", "Release" }
  1066. postbuildcommands {
  1067. "$(SILENT) echo Stripping symbols.",
  1068. "$(SILENT) $(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-strip -s \"$(TARGET)\""
  1069. }
  1070. configuration { "android-x86", "Release" }
  1071. postbuildcommands {
  1072. "$(SILENT) echo Stripping symbols.",
  1073. "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  1074. }
  1075. configuration { "linux-* or rpi", "Release" }
  1076. postbuildcommands {
  1077. "$(SILENT) echo Stripping symbols.",
  1078. "$(SILENT) strip -s \"$(TARGET)\""
  1079. }
  1080. configuration { "mingw*", "Release" }
  1081. postbuildcommands {
  1082. "$(SILENT) echo Stripping symbols.",
  1083. "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\""
  1084. }
  1085. configuration { "riscv" }
  1086. postbuildcommands {
  1087. "$(SILENT) echo Stripping symbols.",
  1088. "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\""
  1089. }
  1090. configuration {} -- reset configuration
  1091. end