toolchain.lua 34 KB

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