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)
#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")
#define symbols for debug build
if (CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DDEBUG)
if (NOT WIN32)
add_definitions(-DSTACKTRACE)
endif ()
endif ()
################################################################################
# Libraries
################################################################################
find_package(OpenGL)
include(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
PKG_SEARCH_MODULE(SDL2MIXER REQUIRED SDL2_mixer)
include_directories(
${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/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
${SDL2_INCLUDE_DIRS}
${SDL2_mixer_INCLUDE_DIRS}
)
......@@ -45,6 +21,7 @@ FILE(GLOB_RECURSE clion_all_headers
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/gli
)
add_subdirectory(lib/gli)
#glm library
......@@ -52,71 +29,139 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/lib/glm
)
add_definitions(-DGLM_SWIZZLE)
add_subdirectory(lib/glm)
#glew library
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif ()
include_directories(
${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/glewinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/glew/src/visualinfo.c
)
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
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/Detour/*.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(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
#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(DetourCrowd STATIC ${DetourCrowd_cpp})
FILE(GLOB_RECURSE DebugUtils
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/recastnavigation/DebugUtils/*.h
)
################################################################################
# Project settings
################################################################################
#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
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.c
${CMAKE_CURRENT_SOURCE_DIR}/lib/nanovg/src/*.h
#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
)
add_executable(Game ${clion_all_headers})
target_link_libraries(Game ${LINKED_LIBRARIES} glew_static)
glew_static
nanovg
DebugUtils
DetourCrowd
Detour
Recast
SDL2
SDL2main
SDL2_mixer
GL
c++
c++abi
)
#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 .)
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