toolchain.lua 21 KB

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