Commit 028325f0 authored by Jerry's avatar Jerry
Browse files

Merge branch 'develop' into local/demo

parents cbaed220 12789100
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 2.8)
project(gdw_ss15_cpp)
#use clang instead of g++
#set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
#set compiler options
if (${CMAKE_CXX_COMPILER} MATCHES "clang")
set(CMAKE_CXX_FLAGS "${CMAKE_FXX_FLAGS} -stdlib=libc++")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Wall -Wextra")
################################################################################
# Libraries
################################################################################
find_package(OpenGL)
#define symbols for debug build
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
if (NOT WIN32)
add_definitions(-DSTACKTRACE)
endif ()
endif ()
if(UNIX)
include(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer)
include_directories(
${SDL2_INCLUDE_DIRS}
${SDL2_mixer_INCLUDE_DIRS}
)
elseif(WIN32)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/include
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer/x86_64-w64-mingw32/include/SDL2
)
link_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/x86_64-w64-mingw32/lib
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer/x86_64-w64-mingw32/lib
)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/x86_64-w64-mingw32/bin/SDL2.dll DESTINATION .)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer/x86_64-w64-mingw32/bin/ DESTINATION . FILES_MATCHING PATTERN *.dll)
endif()
#gli library
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/gli
)
add_subdirectory(lib/gli)
#define symbols for project
add_definitions(-DGLM_SWIZZLE)
add_definitions(-DGLEW_STATIC)
find_package(OpenGL)
#glm library
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/include
${CMAKE_CURRENT_SOURCE_DIR}/lib/gli
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourTileCache/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/glm
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2/include
${CMAKE_CURRENT_SOURCE_DIR}/lib/sdl2_mixer/x86_64-w64-mingw32/include/SDL2
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src
)
FILE(GLOB_RECURSE clion_all_headers
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/*.inl
${CMAKE_CURRENT_SOURCE_DIR}/lib/glm
)
add_definitions(-DGLM_SWIZZLE)
add_subdirectory(lib/glm)
#glew library
add_library(glew_static STATIC IMPORTED)
set_target_properties(glew_static PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/build/libGLEW.a
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif ()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/include
)
FILE(GLOB_RECURSE Recast_cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/*.h
set(glew_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/src/glew.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/src/glewinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/src/visualinfo.c
)
add_definitions(-DGLEW_STATIC)
add_library(glew_static ${glew_SRC})
add_library(Recast STATIC ${Recast_cpp})
FILE(GLOB_RECURSE Detour_cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/*.h
#recastNavigation library
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourTileCache/Include
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/Include
)
set(recast_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/Recast.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastArea.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastAlloc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastContour.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastFilter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastLayers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastMesh.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastMeshDetail.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastRasterization.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Source/RecastRegion.cpp
)
add_library(Recast ${recast_SRC})
set(detour_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Source/DetourAlloc.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Source/DetourCommon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Source/DetourNavMesh.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Source/DetourNavMeshBuilder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/Source/DetourNode.cpp
)
add_library(Detour ${detour_SRC})
set(detourcrowd_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Source/DetourPathCorridor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Source/DetourLocalBoundary.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Source/DetourObstacleAvoidance.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Source/DetourPathQueue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Source/DetourCrowd.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Source/DetourProximityGrid.cpp
)
add_library(DetourCrowd ${detourcrowd_SRC})
add_library(Detour STATIC ${Detour_cpp})
FILE(GLOB_RECURSE DetourCrowd_cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/*.h
set(debugutils_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/Source/DebugDraw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/Source/DetourDebugDraw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/Source/RecastDebugDraw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/Source/RecastDump.cpp
)
add_library(DebugUtils ${debugutils_SRC})
add_library(DetourCrowd STATIC ${DetourCrowd_cpp})
FILE(GLOB_RECURSE DebugUtils
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/*.h
#nanovg library
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src)
set(nanovg_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/nanovg.c
)
add_library(nanovg ${nanovg_SRC})
add_library(DebugUtils STATIC ${DebugUtils})
################################################################################
# Project settings
################################################################################
FILE(GLOB_RECURSE nanovg_src
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.h
#set compiler options
if (${CMAKE_CXX_COMPILER} MATCHES "clang")
set(CMAKE_CXX_FLAGS "${CMAKE_FXX_FLAGS} -stdlib=libc++")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -Wall -Wextra")
#define symbols for debug build
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
if (NOT MSVC)
add_definitions(-DSTACKTRACE)
endif ()
endif ()
#include directory of project
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
)
add_library(nanovg STATIC ${nanovg_src})
#project files to compile
file(GLOB_RECURSE project_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
)
file(GLOB_RECURSE project_HDR
${CMAKE_CURRENT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp
)
file(GLOB_RECURSE project_INL
${CMAKE_CURRENT_SOURCE_DIR}/*.inl
)
#libraries to link
set(LINKED_LIBRARIES
nanovg
DebugUtils
DetourCrowd
Detour
Recast
SDL2
SDL2main
SDL2_mixer
GL
c++
c++abi
glew_static
nanovg
DebugUtils
DetourCrowd
Detour
Recast
SDL2main
SDL2
SDL2_mixer
)
add_executable(Game ${clion_all_headers})
target_link_libraries(Game ${LINKED_LIBRARIES} glew_static)
if(UNIX)
set( LINKED_LIBRARIES
${LINKED_LIBRARIES}
GL
c++
c++abi)
elseif(WIN32)
set( LINKED_LIBRARIES
imagehlp
mingw32
${LINKED_LIBRARIES}
opengl32
-static-libgcc
-static-libstdc++)
endif()
#build executable and then link to the libraries
add_executable(Game ${project_SRC} ${project_HDR} ${project_INL})
target_link_libraries(Game ${LINKED_LIBRARIES})
#copy assets to the executable destination
file(COPY assets DESTINATION .)
......@@ -573,7 +573,7 @@ namespace gdw {
}
void maploader::set_agent_pos(unsigned long long int entityID, const glm::vec3 &pos) {
auto found = std::find_if(entityAgent.begin(),entityAgent.end(),[&](const auto&a){return a.second == entityID;});
auto found = entityAgent.find(entityID);
if(found != entityAgent.end())
set_agent_pos(found->first, pos);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment