premake4.lua 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. --
  2. -- Copyright 2010-2011 Branimir Karadzic. All rights reserved.
  3. -- License: http://www.opensource.org/licenses/BSD-2-Clause
  4. --
  5. solution "bgfx"
  6. configurations {
  7. "Debug",
  8. "Release",
  9. }
  10. platforms {
  11. "x32",
  12. "x64",
  13. "Xbox360",
  14. }
  15. language "C++"
  16. newoption {
  17. trigger = "gcc",
  18. value = "GCC",
  19. description = "Choose GCC flavor",
  20. allowed = {
  21. { "mingw", "MinGW" },
  22. }
  23. }
  24. -- Avoid error when invoking premake4 --help.
  25. if (_ACTION == nil) then return end
  26. ROOT_DIR = (path.getabsolute("..") .. "/")
  27. BUILD_DIR = (ROOT_DIR .. ".build/")
  28. THIRD_PARTY_DIR = (ROOT_DIR .. "3rdparty/")
  29. local XEDK = os.getenv("XEDK")
  30. if not XEDK then XEDK = "<you must install XBOX SDK>" end
  31. location (BUILD_DIR .. "projects/" .. _ACTION)
  32. if _ACTION == "gmake" then
  33. if "linux" ~= os.get() and nil == _OPTIONS["gcc"] then
  34. print("GCC flavor must be specified!")
  35. os.exit(1)
  36. end
  37. if "mingw" == _OPTIONS["gcc"] then
  38. premake.gcc.cc = "$(MINGW)/bin/mingw32-gcc"
  39. premake.gcc.cxx = "$(MINGW)/bin/mingw32-g++"
  40. premake.gcc.ar = "$(MINGW)/bin/ar"
  41. end
  42. end
  43. flags {
  44. "StaticRuntime",
  45. "NoMinimalRebuild",
  46. "NoPCH",
  47. "NativeWChar",
  48. -- "ExtraWarnings",
  49. "NoRTTI",
  50. "NoExceptions",
  51. "Symbols",
  52. }
  53. includedirs {
  54. ROOT_DIR .. "../_bx/include",
  55. }
  56. configuration "Debug"
  57. defines {
  58. "BGFX_BUILD_DEBUG=1",
  59. }
  60. targetsuffix "Debug"
  61. configuration "Release"
  62. defines {
  63. "BGFX_BUILD_RELEASE=1",
  64. }
  65. targetsuffix "Release"
  66. configuration { "vs*" }
  67. defines {
  68. "_HAS_EXCEPTIONS=0",
  69. "_HAS_ITERATOR_DEBUGGING=0",
  70. "_SCL_SECURE=0",
  71. "_CRT_SECURE_NO_WARNINGS",
  72. "_CRT_SECURE_NO_DEPRECATE",
  73. "__STDC_LIMIT_MACROS",
  74. "__STDC_FORMAT_MACROS",
  75. "__STDC_CONSTANT_MACROS",
  76. }
  77. configuration { "x32", "vs*" }
  78. defines { "WIN32" }
  79. targetdir (BUILD_DIR .. "win32_" .. _ACTION .. "/bin")
  80. objdir (BUILD_DIR .. "win32_" .. _ACTION .. "/obj")
  81. includedirs { THIRD_PARTY_DIR .. "compiler/msvc" }
  82. configuration { "x64", "vs*" }
  83. defines { "WIN32" }
  84. targetdir (BUILD_DIR .. "win64_" .. _ACTION .. "/bin")
  85. objdir (BUILD_DIR .. "win64_" .. _ACTION .. "/obj")
  86. includedirs { THIRD_PARTY_DIR .. "compiler/msvc" }
  87. configuration { "x32", "mingw" }
  88. defines { "WIN32" }
  89. targetdir (BUILD_DIR .. "win32_mingw" .. "/bin")
  90. objdir (BUILD_DIR .. "win32_mingw" .. "/obj")
  91. includedirs { THIRD_PARTY_DIR .. "compiler/mingw" }
  92. configuration { "x64", "mingw" }
  93. defines { "WIN32" }
  94. targetdir (BUILD_DIR .. "win64_mingw" .. "/bin")
  95. objdir (BUILD_DIR .. "win64_mingw" .. "/obj")
  96. includedirs { THIRD_PARTY_DIR .. "compiler/mingw" }
  97. configuration { "x32", "linux" }
  98. targetdir (BUILD_DIR .. "linux32" .. "/bin")
  99. objdir (BUILD_DIR .. "linux32" .. "/obj")
  100. configuration { "x64", "linux" }
  101. targetdir (BUILD_DIR .. "linux64" .. "/bin")
  102. objdir (BUILD_DIR .. "linux64" .. "/obj")
  103. configuration { "Xbox360" }
  104. defines { "_XBOX", "NOMINMAX" }
  105. targetdir (BUILD_DIR .. "xbox360" .. "/bin")
  106. objdir (BUILD_DIR .. "xbox360" .. "/obj")
  107. includedirs { THIRD_PARTY_DIR .. "compiler/msvc" }
  108. configuration {} -- reset configuration
  109. project "bgfx"
  110. uuid "f4c51860-ebf4-11e0-9572-0800200c9a66"
  111. kind "StaticLib"
  112. includedirs {
  113. "../include",
  114. ROOT_DIR .. "../bx/include",
  115. THIRD_PARTY_DIR .. "glew-1.5.4/include",
  116. }
  117. files {
  118. "../include/**.h",
  119. "../src/**.cpp",
  120. "../src/**.h",
  121. }
  122. project "shaderc"
  123. uuid "f3cd2e90-52a4-11e1-b86c-0800200c9a66"
  124. kind "ConsoleApp"
  125. local GLSL_OPTIMIZER = (THIRD_PARTY_DIR .. "glsl-optimizer/")
  126. configuration { "vs*" }
  127. includedirs { GLSL_OPTIMIZER .. "src/glsl/msvc" }
  128. configuration {}
  129. includedirs {
  130. ROOT_DIR .. "../bx/include",
  131. THIRD_PARTY_DIR .. "fcpp",
  132. GLSL_OPTIMIZER .. "include",
  133. GLSL_OPTIMIZER .. "include/c99",
  134. GLSL_OPTIMIZER .. "src/mesa",
  135. GLSL_OPTIMIZER .. "src/mapi",
  136. GLSL_OPTIMIZER .. "src/glsl",
  137. }
  138. files {
  139. ROOT_DIR .. "tools/shaderc.cpp",
  140. THIRD_PARTY_DIR .. "fcpp/**.h",
  141. THIRD_PARTY_DIR .. "fcpp/cpp1.c",
  142. THIRD_PARTY_DIR .. "fcpp/cpp2.c",
  143. THIRD_PARTY_DIR .. "fcpp/cpp3.c",
  144. THIRD_PARTY_DIR .. "fcpp/cpp4.c",
  145. THIRD_PARTY_DIR .. "fcpp/cpp5.c",
  146. THIRD_PARTY_DIR .. "fcpp/cpp6.c",
  147. THIRD_PARTY_DIR .. "fcpp/cpp6.c",
  148. GLSL_OPTIMIZER .. "src/mesa/**.c",
  149. GLSL_OPTIMIZER .. "src/glsl/**.cpp",
  150. GLSL_OPTIMIZER .. "src/mesa/**.h",
  151. GLSL_OPTIMIZER .. "src/glsl/**.c",
  152. GLSL_OPTIMIZER .. "src/glsl/**.cpp",
  153. GLSL_OPTIMIZER .. "src/glsl/**.h",
  154. }
  155. excludes {
  156. GLSL_OPTIMIZER .. "src/glsl/glcpp/glcpp.c",
  157. GLSL_OPTIMIZER .. "src/glsl/glcpp/tests/**",
  158. GLSL_OPTIMIZER .. "src/glsl/main.cpp",
  159. GLSL_OPTIMIZER .. "src/glsl/builtin_stubs.cpp",
  160. }
  161. links {
  162. "d3dx9",
  163. }
  164. project "ddsdump"
  165. uuid "838801ee-7bc3-11e1-9f19-eae7d36e7d26"
  166. kind "ConsoleApp"
  167. includedirs {
  168. ROOT_DIR .. "../bx/include",
  169. ROOT_DIR .. "include",
  170. ROOT_DIR .. "src",
  171. }
  172. files {
  173. ROOT_DIR .. "src/dds.*",
  174. ROOT_DIR .. "tools/ddsdump.cpp",
  175. }
  176. links {
  177. "bgfx",
  178. }
  179. project "makedisttex"
  180. uuid "b0561b30-91bb-11e1-b06e-023ad46e7d26"
  181. kind "ConsoleApp"
  182. includedirs {
  183. ROOT_DIR .. "../bx/include",
  184. THIRD_PARTY_DIR .. "edtaa3",
  185. THIRD_PARTY_DIR .. "stb_image",
  186. }
  187. files {
  188. THIRD_PARTY_DIR .. "edtaa3/**",
  189. ROOT_DIR .. "tools/makedisttex.cpp",
  190. }
  191. project "helloworld"
  192. uuid "ff2c8450-ebf4-11e0-9572-0800200c9a66"
  193. kind "ConsoleApp"
  194. includedirs {
  195. ROOT_DIR .. "include",
  196. }
  197. files {
  198. ROOT_DIR .. "examples/helloworld/**",
  199. }
  200. links {
  201. "bgfx",
  202. }