toolchain.lua 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  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. "-Wundef",
  241. }
  242. linkoptions {
  243. "-Wl,--gc-sections",
  244. }
  245. configuration { "x32", "mingw" }
  246. targetdir (_buildDir .. "win32_mingw" .. "/bin")
  247. objdir (_buildDir .. "win32_mingw" .. "/obj")
  248. libdirs {
  249. _libDir .. "lib/win32_mingw",
  250. "$(DXSDK_DIR)/lib/x86",
  251. }
  252. buildoptions { "-m32" }
  253. configuration { "x64", "mingw" }
  254. targetdir (_buildDir .. "win64_mingw" .. "/bin")
  255. objdir (_buildDir .. "win64_mingw" .. "/obj")
  256. libdirs {
  257. _libDir .. "lib/win64_mingw",
  258. "$(DXSDK_DIR)/lib/x64",
  259. "$(GLES_X64_DIR)",
  260. }
  261. buildoptions { "-m64" }
  262. configuration { "linux-gcc and not linux-clang" }
  263. buildoptions {
  264. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  265. }
  266. configuration { "linux-clang" }
  267. buildoptions {
  268. "--analyze",
  269. }
  270. configuration { "linux-*" }
  271. buildoptions {
  272. "-std=c++0x",
  273. "-U__STRICT_ANSI__",
  274. "-Wunused-value",
  275. "-msse2",
  276. }
  277. links {
  278. "rt",
  279. }
  280. linkoptions {
  281. "-Wl,--gc-sections",
  282. }
  283. configuration { "linux-gcc", "x32" }
  284. targetdir (_buildDir .. "linux32_gcc" .. "/bin")
  285. objdir (_buildDir .. "linux32_gcc" .. "/obj")
  286. libdirs { _libDir .. "lib/linux32_gcc" }
  287. buildoptions {
  288. "-m32",
  289. }
  290. configuration { "linux-gcc", "x64" }
  291. targetdir (_buildDir .. "linux64_gcc" .. "/bin")
  292. objdir (_buildDir .. "linux64_gcc" .. "/obj")
  293. libdirs { _libDir .. "lib/linux64_gcc" }
  294. buildoptions {
  295. "-m64",
  296. }
  297. configuration { "linux-clang", "x32" }
  298. targetdir (_buildDir .. "linux32_clang" .. "/bin")
  299. objdir (_buildDir .. "linux32_clang" .. "/obj")
  300. libdirs { _libDir .. "lib/linux32_clang" }
  301. buildoptions {
  302. "-m32",
  303. }
  304. configuration { "linux-clang", "x64" }
  305. targetdir (_buildDir .. "linux64_clang" .. "/bin")
  306. objdir (_buildDir .. "linux64_clang" .. "/obj")
  307. libdirs { _libDir .. "lib/linux64_clang" }
  308. buildoptions {
  309. "-m64",
  310. }
  311. configuration { "android-*" }
  312. flags {
  313. "NoImportLib",
  314. }
  315. includedirs {
  316. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/include",
  317. "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
  318. }
  319. linkoptions {
  320. "-nostdlib",
  321. "-static-libgcc",
  322. }
  323. links {
  324. "c",
  325. "dl",
  326. "m",
  327. "android",
  328. "log",
  329. "gnustl_static",
  330. "gcc",
  331. }
  332. buildoptions {
  333. "-fPIC",
  334. "-std=c++0x",
  335. "-U__STRICT_ANSI__",
  336. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  337. "-no-canonical-prefixes",
  338. "-Wa,--noexecstack",
  339. "-fstack-protector",
  340. "-ffunction-sections",
  341. }
  342. linkoptions {
  343. "-no-canonical-prefixes",
  344. "-Wl,--no-undefined",
  345. "-Wl,-z,noexecstack",
  346. "-Wl,-z,relro",
  347. "-Wl,-z,now",
  348. }
  349. configuration { "android-arm" }
  350. targetdir (_buildDir .. "android-arm" .. "/bin")
  351. objdir (_buildDir .. "android-arm" .. "/obj")
  352. libdirs {
  353. _libDir .. "lib/android-arm",
  354. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
  355. }
  356. includedirs {
  357. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
  358. }
  359. buildoptions {
  360. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm",
  361. "-mthumb",
  362. "-march=armv7-a",
  363. "-mfloat-abi=softfp",
  364. "-mfpu=neon",
  365. }
  366. linkoptions {
  367. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm",
  368. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtbegin_so.o",
  369. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtend_so.o",
  370. "-march=armv7-a",
  371. "-Wl,--fix-cortex-a8",
  372. }
  373. configuration { "android-mips" }
  374. targetdir (_buildDir .. "android-mips" .. "/bin")
  375. objdir (_buildDir .. "android-mips" .. "/obj")
  376. libdirs {
  377. _libDir .. "lib/android-mips",
  378. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips",
  379. }
  380. includedirs {
  381. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include",
  382. }
  383. buildoptions {
  384. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  385. }
  386. linkoptions {
  387. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  388. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtbegin_so.o",
  389. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtend_so.o",
  390. }
  391. configuration { "android-x86" }
  392. targetdir (_buildDir .. "android-x86" .. "/bin")
  393. objdir (_buildDir .. "android-x86" .. "/obj")
  394. libdirs {
  395. _libDir .. "lib/android-x86",
  396. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86",
  397. }
  398. includedirs {
  399. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include",
  400. }
  401. buildoptions {
  402. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  403. "-march=i686",
  404. "-mtune=atom",
  405. "-mstackrealign",
  406. "-msse3",
  407. "-mfpmath=sse",
  408. }
  409. linkoptions {
  410. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  411. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtbegin_so.o",
  412. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtend_so.o",
  413. }
  414. configuration { "asmjs" }
  415. targetdir (_buildDir .. "asmjs" .. "/bin")
  416. objdir (_buildDir .. "asmjs" .. "/obj")
  417. libdirs { _libDir .. "lib/asmjs" }
  418. includedirs {
  419. "$(EMSCRIPTEN)/system/include",
  420. "$(EMSCRIPTEN)/system/include/libc",
  421. }
  422. buildoptions {
  423. "-Wno-unknown-warning-option", -- Linux Emscripten doesn't know about no-warn-absolute-paths...
  424. "-Wno-warn-absolute-paths",
  425. }
  426. configuration { "freebsd" }
  427. targetdir (_buildDir .. "freebsd" .. "/bin")
  428. objdir (_buildDir .. "freebsd" .. "/obj")
  429. libdirs { _libDir .. "lib/freebsd" }
  430. includedirs {
  431. bxDir .. "include/compat/freebsd",
  432. }
  433. configuration { "nacl or nacl-arm or pnacl" }
  434. includedirs {
  435. "$(NACL_SDK_ROOT)/include",
  436. bxDir .. "include/compat/nacl",
  437. }
  438. configuration { "nacl" }
  439. buildoptions {
  440. "-std=c++0x",
  441. "-U__STRICT_ANSI__",
  442. "-pthread",
  443. "-fno-stack-protector",
  444. "-fdiagnostics-show-option",
  445. "-Wunused-value",
  446. "-fdata-sections",
  447. "-ffunction-sections",
  448. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  449. "-msse2",
  450. }
  451. linkoptions {
  452. "-Wl,--gc-sections",
  453. }
  454. configuration { "x32", "nacl" }
  455. targetdir (_buildDir .. "nacl-x86" .. "/bin")
  456. objdir (_buildDir .. "nacl-x86" .. "/obj")
  457. libdirs { _libDir .. "lib/nacl-x86" }
  458. linkoptions { "-melf32_nacl" }
  459. configuration { "x32", "nacl", "Debug" }
  460. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
  461. configuration { "x32", "nacl", "Release" }
  462. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
  463. configuration { "x64", "nacl" }
  464. targetdir (_buildDir .. "nacl-x64" .. "/bin")
  465. objdir (_buildDir .. "nacl-x64" .. "/obj")
  466. libdirs { _libDir .. "lib/nacl-x64" }
  467. linkoptions { "-melf64_nacl" }
  468. configuration { "x64", "nacl", "Debug" }
  469. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
  470. configuration { "x64", "nacl", "Release" }
  471. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
  472. configuration { "nacl-arm" }
  473. buildoptions {
  474. "-std=c++0x",
  475. "-U__STRICT_ANSI__",
  476. "-fno-stack-protector",
  477. "-fdiagnostics-show-option",
  478. "-Wunused-value",
  479. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  480. "-fdata-sections",
  481. "-ffunction-sections",
  482. }
  483. targetdir (_buildDir .. "nacl-arm" .. "/bin")
  484. objdir (_buildDir .. "nacl-arm" .. "/obj")
  485. libdirs { _libDir .. "lib/nacl-arm" }
  486. configuration { "nacl-arm", "Debug" }
  487. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
  488. configuration { "nacl-arm", "Release" }
  489. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
  490. configuration { "pnacl" }
  491. buildoptions {
  492. "-std=c++0x",
  493. "-U__STRICT_ANSI__",
  494. "-fno-stack-protector",
  495. "-fdiagnostics-show-option",
  496. "-Wunused-value",
  497. "-fdata-sections",
  498. "-ffunction-sections",
  499. }
  500. targetdir (_buildDir .. "pnacl" .. "/bin")
  501. objdir (_buildDir .. "pnacl" .. "/obj")
  502. libdirs { _libDir .. "lib/pnacl" }
  503. configuration { "pnacl", "Debug" }
  504. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  505. configuration { "pnacl", "Release" }
  506. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  507. configuration { "Xbox360" }
  508. targetdir (_buildDir .. "xbox360" .. "/bin")
  509. objdir (_buildDir .. "xbox360" .. "/obj")
  510. includedirs { bxDir .. "include/compat/msvc" }
  511. libdirs { _libDir .. "lib/xbox360" }
  512. defines {
  513. "NOMINMAX",
  514. "_XBOX",
  515. }
  516. configuration { "osx", "x32" }
  517. targetdir (_buildDir .. "osx32_gcc" .. "/bin")
  518. objdir (_buildDir .. "osx32_gcc" .. "/obj")
  519. libdirs { _libDir .. "lib/osx32_gcc" }
  520. buildoptions {
  521. "-m32",
  522. }
  523. configuration { "osx", "x64" }
  524. targetdir (_buildDir .. "osx64_gcc" .. "/bin")
  525. objdir (_buildDir .. "osx64_gcc" .. "/obj")
  526. libdirs { _libDir .. "lib/osx64_gcc" }
  527. buildoptions {
  528. "-m64",
  529. }
  530. configuration { "osx" }
  531. buildoptions {
  532. "-U__STRICT_ANSI__",
  533. "-Wfatal-errors",
  534. "-Wunused-value",
  535. "-msse2",
  536. }
  537. includedirs { bxDir .. "include/compat/osx" }
  538. configuration { "ios-*" }
  539. linkoptions {
  540. "-lc++",
  541. }
  542. buildoptions {
  543. "-miphoneos-version-min=7.0",
  544. "-U__STRICT_ANSI__",
  545. "-Wfatal-errors",
  546. "-Wunused-value",
  547. }
  548. includedirs { bxDir .. "include/compat/ios" }
  549. configuration { "ios-arm" }
  550. targetdir (_buildDir .. "ios-arm" .. "/bin")
  551. objdir (_buildDir .. "ios-arm" .. "/obj")
  552. libdirs { _libDir .. "lib/ios-arm" }
  553. linkoptions {
  554. "-arch armv7",
  555. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk",
  556. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/lib/system",
  557. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks",
  558. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/PrivateFrameworks",
  559. }
  560. buildoptions {
  561. "-arch armv7",
  562. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk",
  563. }
  564. configuration { "ios-simulator" }
  565. targetdir (_buildDir .. "ios-simulator" .. "/bin")
  566. objdir (_buildDir .. "ios-simulator" .. "/obj")
  567. libdirs { _libDir .. "lib/ios-simulator" }
  568. linkoptions {
  569. "-arch i386",
  570. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk",
  571. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/lib/system",
  572. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks",
  573. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/PrivateFrameworks",
  574. }
  575. buildoptions {
  576. "-arch i386",
  577. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk",
  578. }
  579. configuration { "qnx-arm" }
  580. targetdir (_buildDir .. "qnx-arm" .. "/bin")
  581. objdir (_buildDir .. "qnx-arm" .. "/obj")
  582. libdirs { _libDir .. "lib/qnx-arm" }
  583. -- includedirs { bxDir .. "include/compat/qnx" }
  584. buildoptions {
  585. "-std=c++0x",
  586. "-U__STRICT_ANSI__",
  587. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  588. }
  589. configuration {} -- reset configuration
  590. end
  591. function strip()
  592. configuration { "android-arm", "Release" }
  593. postbuildcommands {
  594. "@echo Stripping symbols.",
  595. "@$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  596. }
  597. configuration { "android-mips", "Release" }
  598. postbuildcommands {
  599. "@echo Stripping symbols.",
  600. "@$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  601. }
  602. configuration { "android-x86", "Release" }
  603. postbuildcommands {
  604. "@echo Stripping symbols.",
  605. "@$(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  606. }
  607. configuration { "linux-*", "Release" }
  608. postbuildcommands {
  609. "@echo Stripping symbols.",
  610. "@strip -s \"$(TARGET)\""
  611. }
  612. configuration { "mingw", "Release" }
  613. postbuildcommands {
  614. "@echo Stripping symbols.",
  615. "@$(MINGW)/bin/strip -s \"$(TARGET)\""
  616. }
  617. configuration { "pnacl" }
  618. postbuildcommands {
  619. "@echo Running pnacl-finalize.",
  620. "@" .. naclToolchain .. "finalize \"$(TARGET)\""
  621. }
  622. configuration { "*nacl*", "Release" }
  623. postbuildcommands {
  624. "@echo Stripping symbols.",
  625. "@" .. naclToolchain .. "strip -s \"$(TARGET)\""
  626. }
  627. configuration { "asmjs" }
  628. postbuildcommands {
  629. "@echo Running asmjs finalize.",
  630. "@$(EMSCRIPTEN)/emcc -O2 -s TOTAL_MEMORY=268435456 \"$(TARGET)\" -o \"$(TARGET)\".html"
  631. -- ALLOW_MEMORY_GROWTH
  632. }
  633. configuration {} -- reset configuration
  634. end