toolchain.lua 40 KB

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