toolchain.lua 37 KB

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