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