toolchain.lua 19 KB

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