toolchain.lua 38 KB

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