Commit 250e8fbd authored by Thomas Eppers's avatar Thomas Eppers
Browse files

merged

parents 145a917b 13b551f8
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 2.8)
project(gdw_ss15_cpp) 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") # Libraries
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 WIN32)
add_definitions(-DSTACKTRACE)
endif ()
endif ()
find_package(OpenGL) find_package(OpenGL)
include(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer)
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/Include ${SDL2_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/Include ${SDL2_mixer_INCLUDE_DIRS}
${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/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
) )
...@@ -45,6 +21,7 @@ FILE(GLOB_RECURSE clion_all_headers ...@@ -45,6 +21,7 @@ FILE(GLOB_RECURSE clion_all_headers
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/gli ${CMAKE_CURRENT_SOURCE_DIR}/lib/gli
) )
add_subdirectory(lib/gli)
#glm library #glm library
...@@ -52,71 +29,139 @@ include_directories( ...@@ -52,71 +29,139 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/glm ${CMAKE_CURRENT_SOURCE_DIR}/lib/glm
) )
add_definitions(-DGLM_SWIZZLE) add_definitions(-DGLM_SWIZZLE)
add_subdirectory(lib/glm)
#glew library #glew library
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif ()
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/include ${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/include
) )
set(GLEW_SRC set(glew_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/src/glew.c ${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/glewinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/src/visualinfo.c ${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/src/visualinfo.c
) )
add_definitions(-DGLEW_STATIC) add_definitions(-DGLEW_STATIC)
add_library(glew_static ${GLEW_SRC}) add_library(glew_static ${glew_SRC})
FILE(GLOB_RECURSE Recast_cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Recast/*.h
)
add_library(Recast STATIC ${Recast_cpp}) #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})
FILE(GLOB_RECURSE Detour_cpp set(debugutils_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/Source/DebugDraw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/*.h ${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(Detour STATIC ${Detour_cpp})
FILE(GLOB_RECURSE DetourCrowd_cpp #nanovg library
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/*.cpp include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src)
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DetourCrowd/*.h set(nanovg_SRC
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/nanovg.c
) )
add_library(nanovg ${nanovg_SRC})
add_library(DetourCrowd STATIC ${DetourCrowd_cpp})
FILE(GLOB_RECURSE DebugUtils ################################################################################
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/*.cpp # Project settings
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/*.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")
add_library(DebugUtils STATIC ${DebugUtils}) #define symbols for debug build
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
if (NOT MSVC)
add_definitions(-DSTACKTRACE)
endif ()
endif ()
FILE(GLOB_RECURSE nanovg_src #include directory of project
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.cpp include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.c ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.h
) )
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 set(LINKED_LIBRARIES
nanovg glew_static
DebugUtils nanovg
DetourCrowd DebugUtils
Detour DetourCrowd
Recast Detour
SDL2 Recast
SDL2main SDL2
SDL2_mixer SDL2main
GL SDL2_mixer
c++ GL
c++abi c++
) c++abi
)
add_executable(Game ${clion_all_headers})
target_link_libraries(Game ${LINKED_LIBRARIES} glew_static) #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 .) file(COPY assets DESTINATION .)
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