toolchain.lua 20 KB

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