toolchain.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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. -- { "emscripten-experimental", "Emscripten" },
  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 "emscripten-experimental" == _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 = "$(EMSCRIPTEN)/emar"
  77. location (_buildDir .. "projects/" .. _ACTION .. "-emscripten")
  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. "m",
  321. "android",
  322. "log",
  323. "gnustl_static",
  324. "gcc",
  325. }
  326. buildoptions {
  327. "-std=c++0x",
  328. "-U__STRICT_ANSI__",
  329. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  330. }
  331. configuration { "android-arm" }
  332. targetdir (_buildDir .. "android-arm" .. "/bin")
  333. objdir (_buildDir .. "android-arm" .. "/obj")
  334. libdirs {
  335. _libDir .. "lib/android-arm",
  336. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a",
  337. }
  338. includedirs {
  339. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include",
  340. }
  341. linkoptions {
  342. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm",
  343. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtbegin_so.o",
  344. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-arm/usr/lib/crtend_so.o",
  345. "-march=armv7-a",
  346. "-Wl,--fix-cortex-a8",
  347. "-no-canonical-prefixes",
  348. "-Wl,--no-undefined",
  349. "-Wl,-z,noexecstack",
  350. "-Wl,-z,relro",
  351. "-Wl,-z,now",
  352. }
  353. buildoptions {
  354. "-fpic",
  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. configuration { "android-mips" }
  362. targetdir (_buildDir .. "android-mips" .. "/bin")
  363. objdir (_buildDir .. "android-mips" .. "/obj")
  364. libdirs {
  365. _libDir .. "lib/android-mips",
  366. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips",
  367. }
  368. includedirs {
  369. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include",
  370. }
  371. linkoptions {
  372. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  373. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtbegin_so.o",
  374. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips/usr/lib/crtend_so.o",
  375. }
  376. buildoptions {
  377. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-mips",
  378. }
  379. configuration { "android-x86" }
  380. targetdir (_buildDir .. "android-x86" .. "/bin")
  381. objdir (_buildDir .. "android-x86" .. "/obj")
  382. libdirs {
  383. _libDir .. "lib/android-x86",
  384. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86",
  385. }
  386. includedirs {
  387. "$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include",
  388. }
  389. linkoptions {
  390. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  391. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtbegin_so.o",
  392. "$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtend_so.o",
  393. }
  394. buildoptions {
  395. "--sysroot=$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86",
  396. }
  397. configuration { "emscripten-experimental" }
  398. targetdir (_buildDir .. "emscripten" .. "/bin")
  399. objdir (_buildDir .. "emscripten" .. "/obj")
  400. libdirs { _libDir .. "lib/emscripten" }
  401. includedirs { "$(EMSCRIPTEN)/system/include" }
  402. buildoptions {
  403. "-pthread",
  404. }
  405. configuration { "nacl or nacl-arm or pnacl" }
  406. includedirs {
  407. "$(NACL_SDK_ROOT)/include",
  408. bxDir .. "include/compat/nacl",
  409. }
  410. configuration { "nacl" }
  411. buildoptions {
  412. "-std=c++0x",
  413. "-U__STRICT_ANSI__",
  414. "-pthread",
  415. "-fno-stack-protector",
  416. "-fdiagnostics-show-option",
  417. "-Wunused-value",
  418. "-fdata-sections",
  419. "-ffunction-sections",
  420. "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic.
  421. "-msse2",
  422. }
  423. linkoptions {
  424. "-Wl,--gc-sections",
  425. }
  426. configuration { "x32", "nacl" }
  427. targetdir (_buildDir .. "nacl-x86" .. "/bin")
  428. objdir (_buildDir .. "nacl-x86" .. "/obj")
  429. libdirs { _libDir .. "lib/nacl-x86" }
  430. linkoptions { "-melf32_nacl" }
  431. configuration { "x32", "nacl", "Debug" }
  432. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Debug" }
  433. configuration { "x32", "nacl", "Release" }
  434. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_32/Release" }
  435. configuration { "x64", "nacl" }
  436. targetdir (_buildDir .. "nacl-x64" .. "/bin")
  437. objdir (_buildDir .. "nacl-x64" .. "/obj")
  438. libdirs { _libDir .. "lib/nacl-x64" }
  439. linkoptions { "-melf64_nacl" }
  440. configuration { "x64", "nacl", "Debug" }
  441. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Debug" }
  442. configuration { "x64", "nacl", "Release" }
  443. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_x86_64/Release" }
  444. configuration { "nacl-arm" }
  445. buildoptions {
  446. "-std=c++0x",
  447. "-U__STRICT_ANSI__",
  448. "-fno-stack-protector",
  449. "-fdiagnostics-show-option",
  450. "-Wunused-value",
  451. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  452. "-fdata-sections",
  453. "-ffunction-sections",
  454. }
  455. targetdir (_buildDir .. "nacl-arm" .. "/bin")
  456. objdir (_buildDir .. "nacl-arm" .. "/obj")
  457. libdirs { _libDir .. "lib/nacl-arm" }
  458. configuration { "nacl-arm", "Debug" }
  459. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Debug" }
  460. configuration { "nacl-arm", "Release" }
  461. libdirs { "$(NACL_SDK_ROOT)/lib/newlib_arm/Release" }
  462. configuration { "pnacl" }
  463. buildoptions {
  464. "-std=c++0x",
  465. "-U__STRICT_ANSI__",
  466. "-fno-stack-protector",
  467. "-fdiagnostics-show-option",
  468. "-Wunused-value",
  469. "-fdata-sections",
  470. "-ffunction-sections",
  471. }
  472. targetdir (_buildDir .. "pnacl" .. "/bin")
  473. objdir (_buildDir .. "pnacl" .. "/obj")
  474. libdirs { _libDir .. "lib/pnacl" }
  475. configuration { "pnacl", "Debug" }
  476. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" }
  477. configuration { "pnacl", "Release" }
  478. libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" }
  479. configuration { "Xbox360" }
  480. targetdir (_buildDir .. "xbox360" .. "/bin")
  481. objdir (_buildDir .. "xbox360" .. "/obj")
  482. includedirs { bxDir .. "include/compat/msvc" }
  483. libdirs { _libDir .. "lib/xbox360" }
  484. defines {
  485. "NOMINMAX",
  486. "_XBOX",
  487. }
  488. configuration { "osx", "x32" }
  489. targetdir (_buildDir .. "osx32_gcc" .. "/bin")
  490. objdir (_buildDir .. "osx32_gcc" .. "/obj")
  491. libdirs { _libDir .. "lib/osx32_gcc" }
  492. buildoptions {
  493. "-m32",
  494. }
  495. configuration { "osx", "x64" }
  496. targetdir (_buildDir .. "osx64_gcc" .. "/bin")
  497. objdir (_buildDir .. "osx64_gcc" .. "/obj")
  498. libdirs { _libDir .. "lib/osx64_gcc" }
  499. buildoptions {
  500. "-m64",
  501. }
  502. configuration { "osx" }
  503. buildoptions {
  504. "-U__STRICT_ANSI__",
  505. "-Wfatal-errors",
  506. "-Wunused-value",
  507. "-msse2",
  508. }
  509. includedirs { bxDir .. "include/compat/osx" }
  510. configuration { "ios-*" }
  511. linkoptions {
  512. "-lc++",
  513. }
  514. buildoptions {
  515. "-miphoneos-version-min=7.0",
  516. "-U__STRICT_ANSI__",
  517. "-Wfatal-errors",
  518. "-Wunused-value",
  519. }
  520. includedirs { bxDir .. "include/compat/ios" }
  521. configuration { "ios-arm" }
  522. targetdir (_buildDir .. "ios-arm" .. "/bin")
  523. objdir (_buildDir .. "ios-arm" .. "/obj")
  524. libdirs { _libDir .. "lib/ios-arm" }
  525. linkoptions {
  526. "-arch armv7",
  527. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk",
  528. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/system",
  529. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks",
  530. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/PrivateFrameworks",
  531. }
  532. buildoptions {
  533. "-arch armv7",
  534. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk",
  535. }
  536. configuration { "ios-simulator" }
  537. targetdir (_buildDir .. "ios-simulator" .. "/bin")
  538. objdir (_buildDir .. "ios-simulator" .. "/obj")
  539. libdirs { _libDir .. "lib/ios-simulator" }
  540. linkoptions {
  541. "-arch i386",
  542. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk",
  543. "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/usr/lib/system",
  544. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks",
  545. "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/PrivateFrameworks",
  546. }
  547. buildoptions {
  548. "-arch i386",
  549. "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk",
  550. }
  551. configuration { "qnx-arm" }
  552. targetdir (_buildDir .. "qnx-arm" .. "/bin")
  553. objdir (_buildDir .. "qnx-arm" .. "/obj")
  554. libdirs { _libDir .. "lib/qnx-arm" }
  555. -- includedirs { bxDir .. "include/compat/qnx" }
  556. buildoptions {
  557. "-std=c++0x",
  558. "-U__STRICT_ANSI__",
  559. "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
  560. }
  561. configuration {} -- reset configuration
  562. end
  563. function strip()
  564. configuration { "android-arm", "Release" }
  565. postbuildcommands {
  566. "@echo Stripping symbols.",
  567. "@$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
  568. }
  569. configuration { "android-mips", "Release" }
  570. postbuildcommands {
  571. "@echo Stripping symbols.",
  572. "@$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
  573. }
  574. configuration { "android-x86", "Release" }
  575. postbuildcommands {
  576. "@echo Stripping symbols.",
  577. "@$(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
  578. }
  579. configuration { "linux-*", "Release" }
  580. postbuildcommands {
  581. "@echo Stripping symbols.",
  582. "@strip -s \"$(TARGET)\""
  583. }
  584. configuration { "mingw", "Release" }
  585. postbuildcommands {
  586. "@echo Stripping symbols.",
  587. "@$(MINGW)/bin/strip -s \"$(TARGET)\""
  588. }
  589. configuration { "pnacl" }
  590. postbuildcommands {
  591. "@echo Running pnacl-finalize.",
  592. "@" .. naclToolchain .. "finalize \"$(TARGET)\""
  593. }
  594. configuration { "*nacl*", "Release" }
  595. postbuildcommands {
  596. "@echo Stripping symbols.",
  597. "@" .. naclToolchain .. "strip -s \"$(TARGET)\""
  598. }
  599. configuration {} -- reset configuration
  600. end