toolchain.lua 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. --
  2. -- Copyright 2010-2013 Branimir Karadzic. All rights reserved.
  3. -- License: http://www.opensource.org/licenses/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-clang", "Linux (Clang compiler)" },
  20. { "mingw", "MinGW" },
  21. { "nacl", "Native Client" },
  22. { "nacl-arm", "Native Client - ARM" },
  23. { "pnacl", "Native Client - PNaCl" },
  24. { "osx", "OSX" },
  25. { "ios-arm", "iOS - ARM" },
  26. { "ios-simulator", "iOS - Simulator" },
  27. { "qnx-arm", "QNX/Blackberry - ARM" },
  28. }
  29. }
  30. -- Avoid error when invoking premake4 --help.
  31. if (_ACTION == nil) then return end
  32. location (_buildDir .. "projects/" .. _ACTION)
  33. if _ACTION == "clean" then
  34. os.rmdir(BUILD_DIR)
  35. end
  36. if _ACTION == "gmake" then
  37. if nil == _OPTIONS["gcc"] then
  38. print("GCC flavor must be specified!")
  39. os.exit(1)
  40. end
  41. flags {
  42. "ExtraWarnings",
  43. }
  44. if "android-arm" == _OPTIONS["gcc"] then
  45. if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_ROOT") then
  46. print("Set ANDROID_NDK_ARM and ANDROID_NDK_ROOT envrionment variables.")
  47. end
  48. premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
  49. premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
  50. premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
  51. location (_buildDir .. "projects/" .. _ACTION .. "-android-arm")
  52. end
  53. if "android-mips" == _OPTIONS["gcc"] then
  54. if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then
  55. print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
  56. end
  57. premake.gcc.cc = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc"
  58. premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
  59. premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
  60. location (_buildDir .. "projects/" .. _ACTION .. "-android-mips")
  61. end
  62. if "android-x86" == _OPTIONS["gcc"] then
  63. if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then
  64. print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
  65. end
  66. premake.gcc.cc = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc"
  67. premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
  68. premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
  69. location (_buildDir .. "projects/" .. _ACTION .. "-android-x86")
  70. end
  71. if "asmjs" == _OPTIONS["gcc"] then
  72. if not os.getenv("EMSCRIPTEN") then
  73. print("Set EMSCRIPTEN enviroment variables.")
  74. end
  75. premake.gcc.cc = "$(EMSCRIPTEN)/emcc"
  76. premake.gcc.cxx = "$(EMSCRIPTEN)/em++"
  77. premake.gcc.ar = "ar"
  78. location (_buildDir .. "projects/" .. _ACTION .. "-asmjs")
  79. end
  80. if "freebsd" == _OPTIONS["gcc"] then
  81. location (_buildDir .. "projects/" .. _ACTION .. "-freebsd")
  82. end
  83. if "linux-gcc" == _OPTIONS["gcc"] then
  84. location (_buildDir .. "projects/" .. _ACTION .. "-linux")
  85. end
  86. if "linux-clang" == _OPTIONS["gcc"] then
  87. premake.gcc.cc = "clang"
  88. premake.gcc.cxx = "clang++"
  89. premake.gcc.ar = "ar"
  90. location (_buildDir .. "projects/" .. _ACTION .. "-linux-clang")
  91. end
  92. if "mingw" == _OPTIONS["gcc"] then
  93. premake.gcc.cc = "$(MINGW)/bin/x86_64-w64-mingw32-gcc"
  94. premake.gcc.cxx = "$(MINGW)/bin/x86_64-w64-mingw32-g++"
  95. premake.gcc.ar = "$(MINGW)/bin/ar"
  96. location (_buildDir .. "projects/" .. _ACTION .. "-mingw")
  97. end
  98. if "nacl" == _OPTIONS["gcc"] then
  99. if not os.getenv("NACL_SDK_ROOT") then
  100. print("Set NACL_SDK_ROOT enviroment variables.")
  101. end
  102. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/x86_64-nacl-"
  103. if os.is("macosx") then
  104. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_newlib/bin/x86_64-nacl-"
  105. elseif os.is("linux") then
  106. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/x86_64-nacl-"
  107. end
  108. premake.gcc.cc = naclToolchain .. "gcc"
  109. premake.gcc.cxx = naclToolchain .. "g++"
  110. premake.gcc.ar = naclToolchain .. "ar"
  111. location (_buildDir .. "projects/" .. _ACTION .. "-nacl")
  112. end
  113. if "nacl-arm" == _OPTIONS["gcc"] then
  114. if not os.getenv("NACL_SDK_ROOT") then
  115. print("Set NACL_SDK_ROOT enviroment variables.")
  116. end
  117. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_newlib/bin/arm-nacl-"
  118. if os.is("macosx") then
  119. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_newlib/bin/arm-nacl-"
  120. elseif os.is("linux") then
  121. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_newlib/bin/arm-nacl-"
  122. end
  123. premake.gcc.cc = naclToolchain .. "gcc"
  124. premake.gcc.cxx = naclToolchain .. "g++"
  125. premake.gcc.ar = naclToolchain .. "ar"
  126. location (_buildDir .. "projects/" .. _ACTION .. "-nacl-arm")
  127. end
  128. if "pnacl" == _OPTIONS["gcc"] then
  129. if not os.getenv("NACL_SDK_ROOT") then
  130. print("Set NACL_SDK_ROOT enviroment variables.")
  131. end
  132. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-"
  133. if os.is("macosx") then
  134. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_pnacl/bin/pnacl-"
  135. elseif os.is("linux") then
  136. naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-"
  137. end
  138. premake.gcc.cc = naclToolchain .. "clang"
  139. premake.gcc.cxx = naclToolchain .. "clang++"
  140. premake.gcc.ar = naclToolchain .. "ar"
  141. location (_buildDir .. "projects/" .. _ACTION .. "-pnacl")
  142. end
  143. if "osx" == _OPTIONS["gcc"] then
  144. location (_buildDir .. "projects/" .. _ACTION .. "-osx")
  145. end
  146. if "ios-arm" == _OPTIONS["gcc"] then
  147. premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  148. premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"
  149. premake.gcc.ar = "ar"
  150. location (_buildDir .. "projects/" .. _ACTION .. "-ios-arm")
  151. end
  152. if "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 (_buildDir .. "projects/" .. _ACTION .. "-ios-simulator")
  157. end
  158. if "qnx-arm" == _OPTIONS["gcc"] then
  159. if not os.getenv("QNX_HOST") then
  160. print("Set QNX_HOST enviroment variables.")
  161. end
  162. premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc"
  163. premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++"
  164. premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar"
  165. location (_buildDir .. "projects/" .. _ACTION .. "-qnx-arm")
  166. end
  167. end
  168. flags {
  169. "StaticRuntime",
  170. "NoMinimalRebuild",
  171. "NoPCH",
  172. "NativeWChar",
  173. "NoRTTI",
  174. "NoExceptions",
  175. "NoEditAndContinue",
  176. "Symbols",
  177. }
  178. defines {
  179. "__STDC_LIMIT_MACROS",
  180. "__STDC_FORMAT_MACROS",
  181. "__STDC_CONSTANT_MACROS",
  182. }
  183. configuration { "Debug" }
  184. targetsuffix "Debug"
  185. configuration { "Release" }
  186. flags {
  187. "OptimizeSpeed",
  188. }
  189. targetsuffix "Release"
  190. configuration { "vs*" }
  191. flags {
  192. "EnableSSE2",
  193. }
  194. includedirs { bxDir .. "include/compat/msvc" }
  195. defines {
  196. "WIN32",
  197. "_WIN32",
  198. "_HAS_EXCEPTIONS=0",
  199. "_HAS_ITERATOR_DEBUGGING=0",
  200. "_SCL_SECURE=0",
  201. "_SECURE_SCL=0",
  202. "_SCL_SECURE_NO_WARNINGS",
  203. "_CRT_SECURE_NO_WARNINGS",
  204. "_CRT_SECURE_NO_DEPRECATE",
  205. }
  206. buildoptions {
  207. "/Oy-", -- Suppresses creation of frame pointers on the call stack.
  208. "/Ob2", -- The Inline Function Expansion
  209. }
  210. linkoptions {
  211. "/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
  212. }
  213. configuration { "vs2008" }
  214. includedirs { bxDir .. "include/compat/msvc/pre1600" }
  215. configuration { "x32", "vs*" }
  216. targetdir (_buildDir .. "win32_" .. _ACTION .. "/bin")
  217. objdir (_buildDir .. "win32_" .. _ACTION .. "/obj")
  218. libdirs {
  219. _libDir .. "lib/win32_" .. _ACTION,
  220. "$(DXSDK_DIR)/lib/x86",
  221. }
  222. configuration { "x64", "vs*" }
  223. defines { "_WIN64" }
  224. targetdir (_buildDir .. "win64_" .. _ACTION .. "/bin")
  225. objdir (_buildDir .. "win64_" .. _ACTION .. "/obj")
  226. libdirs {
  227. _libDir .. "lib/win64_" .. _ACTION,
  228. "$(DXSDK_DIR)/lib/x64",
  229. }
  230. configuration { "mingw" }
  231. defines { "WIN32" }
  232. includedirs { bxDir .. "include/compat/mingw" }
  233. buildoptions {
  234. "-std=c++11",
  235. "-U__STRICT_ANSI__",
  236. "-Wunused-value",
  237. "-fdata-sections",
  238. "-ffunction-sections",
  239. "-msse2",
  240. }
  241. linkoptions {
  242. "-Wl,--gc-sections",
  243. }
  244. configuration { "x32", "mingw" }
  245. targetdir (_buildDir .. "win32_mingw" .. "/bin")
  246. objdir (_buildDir .. "win32_mingw" .. "/obj")
  247. libdirs {
  248. _libDir .. "lib/win32_mingw",
  249. "$(DXSDK_DIR)/lib/x86",
  250. }
  251. buildoptions { "-m32" }
  252. configuration { "x64", "mingw" }
  253. targetdir (_buildDir .. "win64_mingw" .. "/bin")
  254. objdir (_buildDir .. "win64_mingw" .. "/obj")
  255. libdirs {
  256. _libDir .. "lib/win64_mingw",
  257. "$(DXSDK_DIR)/lib/x64",
  258. "$(GLES_X64_DIR)",
  259. }
  260. buildoptions { "-m64" }
  261. configuration { "linux-gcc and not linux-clang" }
  262. buildoptions {
  263. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  264. }
  265. configuration { "linux-clang" }
  266. buildoptions {
  267. "--analyze",
  268. }
  269. configuration { "linux-*" }
  270. buildoptions {
  271. "-std=c++0x",
  272. "-U__STRICT_ANSI__",
  273. "-Wunused-value",
  274. "-msse2",
  275. }
  276. links {
  277. "rt",
  278. }
  279. linkoptions {
  280. "-Wl,--gc-sections",
  281. }
  282. configuration { "linux-gcc", "x32" }
  283. targetdir (_buildDir .. "linux32_gcc" .. "/bin")
  284. objdir (_buildDir .. "linux32_gcc" .. "/obj")
  285. libdirs { _libDir .. "lib/linux32_gcc" }
  286. buildoptions {
  287. "-m32",
  288. }
  289. configuration { "linux-gcc", "x64" }
  290. targetdir (_buildDir .. "linux64_gcc" .. "/bin")
  291. objdir (_buildDir .. "linux64_gcc" .. "/obj")
  292. libdirs { _libDir .. "lib/linux64_gcc" }
  293. buildoptions {
  294. "-m64",
  295. }
  296. configuration { "linux-clang", "x32" }
  297. targetdir (_buildDir .. "linux32_clang" .. "/bin")
  298. objdir (_buildDir .. "linux32_clang" .. "/obj")
  299. libdirs { _libDir .. "lib/linux32_clang" }
  300. buildoptions {
  301. "-m32",
  302. }
  303. configuration { "linux-clang", "x64" }
  304. targetdir (_buildDir .. "linux64_clang" .. "/bin")
  305. objdir (_buildDir .. "linux64_clang" .. "/obj")
  306. libdirs { _libDir .. "lib/linux64_clang" }
  307. buildoptions {
  308. "-m64",
  309. }
  310. configuration { "android-*" }
  311. flags {
  312. "NoImportLib",
  313. }
  314. includedirs {
  315. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/include",
  316. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  317. }
  318. linkoptions {
  319. "-nostdlib",
  320. "-static-libgcc",
  321. }
  322. links {
  323. "c",
  324. "dl",
  325. "m",
  326. "android",
  327. "log",
  328. "gnustl_static",
  329. "gcc",
  330. }
  331. buildoptions {
  332. "-fPIC",
  333. "-std=c++0x",
  334. "-U__STRICT_ANSI__",
  335. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  336. "-no-canonical-prefixes",
  337. "-Wa,--noexecstack",
  338. "-fstack-protector",
  339. "-ffunction-sections",
  340. }
  341. linkoptions {
  342. "-no-canonical-prefixes",
  343. "-Wl,--no-undefined",
  344. "-Wl,-z,noexecstack",
  345. "-Wl,-z,relro",
  346. "-Wl,-z,now",
  347. }
  348. configuration { "android-arm" }
  349. targetdir (_buildDir .. "android-arm" .. "/bin")
  350. objdir (_buildDir .. "android-arm" .. "/obj")
  351. libdirs {
  352. _libDir .. "lib/android-arm",
  353. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
  354. }
  355. includedirs {
  356. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
  357. }
  358. buildoptions {
  359. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm",
  360. "-mthumb",
  361. "-march=armv7-a",
  362. "-mfloat-abi=softfp",
  363. "-mfpu=neon",
  364. }
  365. linkoptions {
  366. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm",
  367. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtbegin_so.o",
  368. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtend_so.o",
  369. "-march=armv7-a",
  370. "-Wl,--fix-cortex-a8",
  371. }
  372. configuration { "android-mips" }
  373. targetdir (_buildDir .. "android-mips" .. "/bin")
  374. objdir (_buildDir .. "android-mips" .. "/obj")
  375. libdirs {
  376. _libDir .. "lib/android-mips",
  377. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips",
  378. }
  379. includedirs {
  380. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include",
  381. }
  382. buildoptions {
  383. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  384. }
  385. linkoptions {
  386. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  387. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtbegin_so.o",
  388. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtend_so.o",
  389. }
  390. configuration { "android-x86" }
  391. targetdir (_buildDir .. "android-x86" .. "/bin")
  392. objdir (_buildDir .. "android-x86" .. "/obj")
  393. libdirs {
  394. _libDir .. "lib/android-x86",
  395. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86",
  396. }
  397. includedirs {
  398. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include",
  399. }
  400. buildoptions {
  401. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  402. "-march=i686",
  403. "-mtune=atom",
  404. "-mstackrealign",
  405. "-msse3",
  406. "-mfpmath=sse",
  407. }
  408. linkoptions {
  409. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  410. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtbegin_so.o",
  411. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtend_so.o",
  412. }
  413. configuration { "asmjs" }
  414. targetdir (_buildDir .. "asmjs" .. "/bin")
  415. objdir (_buildDir .. "asmjs" .. "/obj")
  416. libdirs { _libDir .. "lib/asmjs" }
  417. includedirs {
  418. "$(EMSCRIPTEN)/system/include",
  419. "$(EMSCRIPTEN)/system/include/libc",
  420. }
  421. buildoptions {
  422. "-Wno-unknown-warning-option", -- Linux Emscripten doesn't know about no-warn-absolute-paths...
  423. "-Wno-warn-absolute-paths",
  424. }
  425. configuration { "freebsd" }
  426. targetdir (_buildDir .. "freebsd" .. "/bin")
  427. objdir (_buildDir .. "freebsd" .. "/obj")
  428. libdirs { _libDir .. "lib/freebsd" }
  429. includedirs {
  430. bxDir .. "include/compat/freebsd",
  431. }
  432. configuration { "nacl or nacl-arm or pnacl" }
  433. includedirs {
  434. "$(NACL_SDK_ROOT)/include",
  435. bxDir .. "include/compat/nacl",
  436. }
  437. configuration { "nacl" }
  438. buildoptions {
  439. "-std=c++0x",
  440. "-U__STRICT_ANSI__",
  441. "-pthread",
  442. "-fno-stack-protector",
  443. "-fdiagnostics-show-option",
  444. "-Wunused-value",
  445. "-fdata-sections",
  446. "-ffunction-sections",
  447. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  448. "-msse2",
  449. }
  450. linkoptions {
  451. "-Wl,--gc-sections",
  452. }
  453. configuration { "x32", "nacl" }
  454. targetdir (_buildDir .. "nacl-x86" .. "/bin")
  455. objdir (_buildDir .. "nacl-x86" .. "/obj")
  456. libdirs { _libDir .. "lib/nacl-x86" }
  457. linkoptions { "-melf32_nacl" }
  458. configuration { "x32", "nacl", "Debug" }
  459. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
  460. configuration { "x32", "nacl", "Release" }
  461. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
  462. configuration { "x64", "nacl" }
  463. targetdir (_buildDir .. "nacl-x64" .. "/bin")
  464. objdir (_buildDir .. "nacl-x64" .. "/obj")
  465. libdirs { _libDir .. "lib/nacl-x64" }
  466. linkoptions { "-melf64_nacl" }
  467. configuration { "x64", "nacl", "Debug" }
  468. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
  469. configuration { "x64", "nacl", "Release" }
  470. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
  471. configuration { "nacl-arm" }
  472. buildoptions {
  473. "-std=c++0x",
  474. "-U__STRICT_ANSI__",
  475. "-fno-stack-protector",
  476. "-fdiagnostics-show-option",
  477. "-Wunused-value",
  478. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  479. "-fdata-sections",
  480. "-ffunction-sections",
  481. }
  482. targetdir (_buildDir .. "nacl-arm" .. "/bin")
  483. objdir (_buildDir .. "nacl-arm" .. "/obj")
  484. libdirs { _libDir .. "lib/nacl-arm" }
  485. configuration { "nacl-arm", "Debug" }
  486. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
  487. configuration { "nacl-arm", "Release" }
  488. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
  489. configuration { "pnacl" }
  490. buildoptions {
  491. "-std=c++0x",
  492. "-U__STRICT_ANSI__",
  493. "-fno-stack-protector",
  494. "-fdiagnostics-show-option",
  495. "-Wunused-value",
  496. "-fdata-sections",
  497. "-ffunction-sections",
  498. }
  499. targetdir (_buildDir .. "pnacl" .. "/bin")
  500. objdir (_buildDir .. "pnacl" .. "/obj")
  501. libdirs { _libDir .. "lib/pnacl" }
  502. configuration { "pnacl", "Debug" }
  503. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  504. configuration { "pnacl", "Release" }
  505. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  506. configuration { "Xbox360" }
  507. targetdir (_buildDir .. "xbox360" .. "/bin")
  508. objdir (_buildDir .. "xbox360" .. "/obj")
  509. includedirs { bxDir .. "include/compat/msvc" }
  510. libdirs { _libDir .. "lib/xbox360" }
  511. defines {
  512. "NOMINMAX",
  513. "_XBOX",
  514. }
  515. configuration { "osx", "x32" }
  516. targetdir (_buildDir .. "osx32_gcc" .. "/bin")
  517. objdir (_buildDir .. "osx32_gcc" .. "/obj")
  518. libdirs { _libDir .. "lib/osx32_gcc" }
  519. buildoptions {
  520. "-m32",
  521. }
  522. configuration { "osx", "x64" }
  523. targetdir (_buildDir .. "osx64_gcc" .. "/bin")
  524. objdir (_buildDir .. "osx64_gcc" .. "/obj")
  525. libdirs { _libDir .. "lib/osx64_gcc" }
  526. buildoptions {
  527. "-m64",
  528. }
  529. configuration { "osx" }
  530. buildoptions {
  531. "-U__STRICT_ANSI__",
  532. "-Wfatal-errors",
  533. "-Wunused-value",
  534. "-msse2",
  535. }
  536. includedirs { bxDir .. "include/compat/osx" }
  537. configuration { "ios-*" }
  538. linkoptions {
  539. "-lc++",
  540. }
  541. buildoptions {
  542. "-miphoneos-version-min=7.0",
  543. "-U__STRICT_ANSI__",
  544. "-Wfatal-errors",
  545. "-Wunused-value",
  546. }
  547. includedirs { bxDir .. "include/compat/ios" }
  548. configuration { "ios-arm" }
  549. targetdir (_buildDir .. "ios-arm" .. "/bin")
  550. objdir (_buildDir .. "ios-arm" .. "/obj")
  551. libdirs { _libDir .. "lib/ios-arm" }
  552. linkoptions {
  553. "-arch armv7",
  554. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk",
  555. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/lib/system",
  556. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks",
  557. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/PrivateFrameworks",
  558. }
  559. buildoptions {
  560. "-arch armv7",
  561. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk",
  562. }
  563. configuration { "ios-simulator" }
  564. targetdir (_buildDir .. "ios-simulator" .. "/bin")
  565. objdir (_buildDir .. "ios-simulator" .. "/obj")
  566. libdirs { _libDir .. "lib/ios-simulator" }
  567. linkoptions {
  568. "-arch i386",
  569. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk",
  570. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/lib/system",
  571. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks",
  572. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/PrivateFrameworks",
  573. }
  574. buildoptions {
  575. "-arch i386",
  576. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk",
  577. }
  578. configuration { "qnx-arm" }
  579. targetdir (_buildDir .. "qnx-arm" .. "/bin")
  580. objdir (_buildDir .. "qnx-arm" .. "/obj")
  581. libdirs { _libDir .. "lib/qnx-arm" }
  582. -- includedirs { bxDir .. "include/compat/qnx" }
  583. buildoptions {
  584. "-std=c++0x",
  585. "-U__STRICT_ANSI__",
  586. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  587. }
  588. configuration {} -- reset configuration
  589. end
  590. function strip()
  591. configuration { "android-arm", "Release" }
  592. postbuildcommands {
  593. "@echo Stripping symbols.",
  594. "@$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  595. }
  596. configuration { "android-mips", "Release" }
  597. postbuildcommands {
  598. "@echo Stripping symbols.",
  599. "@$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  600. }
  601. configuration { "android-x86", "Release" }
  602. postbuildcommands {
  603. "@echo Stripping symbols.",
  604. "@$(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  605. }
  606. configuration { "linux-*", "Release" }
  607. postbuildcommands {
  608. "@echo Stripping symbols.",
  609. "@strip -s \"$(TARGET)\""
  610. }
  611. configuration { "mingw", "Release" }
  612. postbuildcommands {
  613. "@echo Stripping symbols.",
  614. "@$(MINGW)/bin/strip -s \"$(TARGET)\""
  615. }
  616. configuration { "pnacl" }
  617. postbuildcommands {
  618. "@echo Running pnacl-finalize.",
  619. "@" .. naclToolchain .. "finalize \"$(TARGET)\""
  620. }
  621. configuration { "*nacl*", "Release" }
  622. postbuildcommands {
  623. "@echo Stripping symbols.",
  624. "@" .. naclToolchain .. "strip -s \"$(TARGET)\""
  625. }
  626. configuration { "asmjs" }
  627. postbuildcommands {
  628. "@echo Running asmjs finalize.",
  629. "@$(EMSCRIPTEN)/emcc -O2 -s TOTAL_MEMORY=268435456 \"$(TARGET)\" -o \"$(TARGET)\".html"
  630. -- ALLOW_MEMORY_GROWTH
  631. }
  632. configuration {} -- reset configuration
  633. end