premake5.lua 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. --
  2. -- premake5 file to build RecastDemo
  3. -- http://premake.github.io/
  4. --
  5. local action = _ACTION or ""
  6. local todir = "Build/" .. action
  7. solution "recastnavigation"
  8. configurations {
  9. "Debug",
  10. "Release"
  11. }
  12. location (todir)
  13. floatingpoint "Fast"
  14. symbols "On"
  15. exceptionhandling "Off"
  16. rtti "Off"
  17. flags { "FatalCompileWarnings" }
  18. -- debug configs
  19. configuration "Debug*"
  20. defines { "DEBUG" }
  21. targetdir ( todir .. "/lib/Debug" )
  22. -- release configs
  23. configuration "Release*"
  24. defines { "NDEBUG" }
  25. optimize "On"
  26. targetdir ( todir .. "/lib/Release" )
  27. configuration "not windows"
  28. warnings "Extra"
  29. -- windows specific
  30. configuration "windows"
  31. platforms { "Win32", "Win64" }
  32. defines { "WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS", "_HAS_EXCEPTIONS=0" }
  33. -- warnings "Extra" uses /W4 which is too aggressive for us, so use W3 instead.
  34. -- Disable:
  35. -- * C4351: new behavior for array initialization
  36. buildoptions { "/W3", "/wd4351" }
  37. filter "platforms:Win32"
  38. architecture "x32"
  39. filter "platforms:Win64"
  40. architecture "x64"
  41. project "DebugUtils"
  42. language "C++"
  43. kind "StaticLib"
  44. includedirs {
  45. "../DebugUtils/Include",
  46. "../Detour/Include",
  47. "../DetourTileCache/Include",
  48. "../Recast/Include"
  49. }
  50. files {
  51. "../DebugUtils/Include/*.h",
  52. "../DebugUtils/Source/*.cpp"
  53. }
  54. project "Detour"
  55. language "C++"
  56. kind "StaticLib"
  57. includedirs {
  58. "../Detour/Include"
  59. }
  60. files {
  61. "../Detour/Include/*.h",
  62. "../Detour/Source/*.cpp"
  63. }
  64. -- linux library cflags and libs
  65. configuration { "linux", "gmake" }
  66. buildoptions {
  67. "-Wno-error=class-memaccess"
  68. }
  69. project "DetourCrowd"
  70. language "C++"
  71. kind "StaticLib"
  72. includedirs {
  73. "../DetourCrowd/Include",
  74. "../Detour/Include",
  75. "../Recast/Include"
  76. }
  77. files {
  78. "../DetourCrowd/Include/*.h",
  79. "../DetourCrowd/Source/*.cpp"
  80. }
  81. project "DetourTileCache"
  82. language "C++"
  83. kind "StaticLib"
  84. includedirs {
  85. "../DetourTileCache/Include",
  86. "../Detour/Include",
  87. "../Recast/Include"
  88. }
  89. files {
  90. "../DetourTileCache/Include/*.h",
  91. "../DetourTileCache/Source/*.cpp"
  92. }
  93. project "Recast"
  94. language "C++"
  95. kind "StaticLib"
  96. includedirs {
  97. "../Recast/Include"
  98. }
  99. files {
  100. "../Recast/Include/*.h",
  101. "../Recast/Source/*.cpp"
  102. }
  103. project "RecastDemo"
  104. language "C++"
  105. kind "WindowedApp"
  106. includedirs {
  107. "../RecastDemo/Include",
  108. "../RecastDemo/Contrib",
  109. "../RecastDemo/Contrib/fastlz",
  110. "../DebugUtils/Include",
  111. "../Detour/Include",
  112. "../DetourCrowd/Include",
  113. "../DetourTileCache/Include",
  114. "../Recast/Include"
  115. }
  116. files {
  117. "../RecastDemo/Include/*.h",
  118. "../RecastDemo/Source/*.cpp",
  119. "../RecastDemo/Contrib/fastlz/*.h",
  120. "../RecastDemo/Contrib/fastlz/*.c"
  121. }
  122. -- project dependencies
  123. links {
  124. "DebugUtils",
  125. "Detour",
  126. "DetourCrowd",
  127. "DetourTileCache",
  128. "Recast"
  129. }
  130. -- distribute executable in RecastDemo/Bin directory
  131. targetdir "Bin"
  132. -- linux library cflags and libs
  133. configuration { "linux", "gmake" }
  134. buildoptions {
  135. "`pkg-config --cflags sdl2`",
  136. "`pkg-config --cflags gl`",
  137. "`pkg-config --cflags glu`",
  138. "-Wno-ignored-qualifiers",
  139. "-Wno-error=class-memaccess"
  140. }
  141. linkoptions {
  142. "`pkg-config --libs sdl2`",
  143. "`pkg-config --libs gl`",
  144. "`pkg-config --libs glu`"
  145. }
  146. -- windows library cflags and libs
  147. configuration { "windows" }
  148. includedirs { "../RecastDemo/Contrib/SDL/include" }
  149. libdirs { "../RecastDemo/Contrib/SDL/lib/%{cfg.architecture:gsub('x86_64', 'x64')}" }
  150. debugdir "../RecastDemo/Bin/"
  151. links {
  152. "glu32",
  153. "opengl32",
  154. "SDL2",
  155. "SDL2main",
  156. }
  157. postbuildcommands {
  158. -- Copy the SDL2 dll to the Bin folder.
  159. '{COPY} "%{path.getabsolute("Contrib/SDL/lib/" .. cfg.architecture:gsub("x86_64", "x64") .. "/SDL2.dll")}" "%{cfg.targetdir}"'
  160. }
  161. -- mac includes and libs
  162. configuration { "macosx" }
  163. kind "ConsoleApp" -- xcode4 failes to run the project if using WindowedApp
  164. includedirs { "/Library/Frameworks/SDL2.framework/Headers" }
  165. links {
  166. "OpenGL.framework",
  167. "SDL2.framework",
  168. "Cocoa.framework",
  169. }
  170. project "Tests"
  171. language "C++"
  172. kind "ConsoleApp"
  173. -- Catch requires RTTI and exceptions
  174. exceptionhandling "On"
  175. rtti "On"
  176. includedirs {
  177. "../DebugUtils/Include",
  178. "../Detour/Include",
  179. "../DetourCrowd/Include",
  180. "../DetourTileCache/Include",
  181. "../Recast/Include",
  182. "../Recast/Source",
  183. "../Tests/Recast",
  184. "../Tests",
  185. }
  186. files {
  187. "../Tests/*.h",
  188. "../Tests/*.hpp",
  189. "../Tests/*.cpp",
  190. "../Tests/Recast/*.h",
  191. "../Tests/Recast/*.cpp",
  192. "../Tests/Detour/*.h",
  193. "../Tests/Detour/*.cpp",
  194. }
  195. -- project dependencies
  196. links {
  197. "DebugUtils",
  198. "Detour",
  199. "DetourCrowd",
  200. "DetourTileCache",
  201. "Recast",
  202. }
  203. -- distribute executable in RecastDemo/Bin directory
  204. targetdir "Bin"
  205. -- linux library cflags and libs
  206. configuration { "linux", "gmake" }
  207. buildoptions {
  208. "`pkg-config --cflags sdl2`",
  209. "`pkg-config --cflags gl`",
  210. "`pkg-config --cflags glu`",
  211. "-Wno-parentheses" -- Disable parentheses warning for the Tests target, as Catch's macros generate this everywhere.
  212. }
  213. linkoptions {
  214. "`pkg-config --libs sdl2`",
  215. "`pkg-config --libs gl`",
  216. "`pkg-config --libs glu`"
  217. }
  218. -- windows library cflags and libs
  219. configuration { "windows" }
  220. includedirs { "../RecastDemo/Contrib/SDL/include" }
  221. libdirs { "../RecastDemo/Contrib/SDL/lib/%{cfg.architecture:gsub('x86_64', 'x64')}" }
  222. debugdir "../RecastDemo/Bin/"
  223. links {
  224. "glu32",
  225. "opengl32",
  226. "SDL2",
  227. "SDL2main",
  228. }
  229. -- mac includes and libs
  230. configuration { "macosx" }
  231. kind "ConsoleApp"
  232. includedirs { "/Library/Frameworks/SDL2.framework/Headers" }
  233. links {
  234. "OpenGL.framework",
  235. "SDL2.framework",
  236. "Cocoa.framework",
  237. }