Added CMake files for Linux compilation and removed Makefiles build. CMake build should also work on Windows and MacOS for those who wish to use it.

This commit is contained in:
Cameron hart 2011-04-20 10:55:10 +00:00
parent 4ca8b91653
commit 3cee73cb8c
17 changed files with 232 additions and 186 deletions

27
CMakeLists.txt Normal file
View File

@ -0,0 +1,27 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RecastNavigation)
#SET(RECAST_VERSION r129)
IF(NOT CMAKE_BUILD_TYPE)
# SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF(NOT CMAKE_BUILD_TYPE)
IF(MSVC)
OPTION(USE_MSVC_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON)
IF(USE_MSVC_FAST_FLOATINGPOINT)
ADD_DEFINITIONS(/fp:fast)
ENDIF(USE_MSVC_FAST_FLOATINGPOINT)
ENDIF(MSVC)
IF(WIN32)
ADD_DEFINITIONS(/D _CRT_SECURE_NO_WARNINGS)
ENDIF(WIN32)
ADD_SUBDIRECTORY(DebugUtils)
ADD_SUBDIRECTORY(Detour)
ADD_SUBDIRECTORY(DetourCrowd)
ADD_SUBDIRECTORY(DetourTileCache)
ADD_SUBDIRECTORY(Recast)
ADD_SUBDIRECTORY(RecastDemo)

23
DebugUtils/CMakeLists.txt Normal file
View File

@ -0,0 +1,23 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(debugutils_SRCS
Source/DebugDraw.cpp
Source/DetourDebugDraw.cpp
Source/RecastDebugDraw.cpp
Source/RecastDump.cpp
)
SET(debugutils_HDRS
Include/DebugDraw.h
Include/DetourDebugDraw.h
Include/RecastDebugDraw.h
Include/RecastDump.h
)
INCLUDE_DIRECTORIES(Include
../Detour/Include
../DetourTileCache/Include
../Recast/Include
)
ADD_LIBRARY(DebugUtils ${debugutils_SRCS} ${debugutils_HDRS})

24
Detour/CMakeLists.txt Normal file
View File

@ -0,0 +1,24 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(detour_SRCS
Source/DetourAlloc.cpp
Source/DetourCommon.cpp
Source/DetourNavMesh.cpp
Source/DetourNavMeshBuilder.cpp
Source/DetourNavMeshQuery.cpp
Source/DetourNode.cpp
)
SET(detour_HDRS
Include/DetourAlloc.h
Include/DetourAssert.h
Include/DetourCommon.h
Include/DetourNavMesh.h
Include/DetourNavMeshBuilder.h
Include/DetourNavMeshQuery.h
Include/DetourNode.h
)
INCLUDE_DIRECTORIES(Include)
ADD_LIBRARY(Detour ${detour_SRCS} ${detour_HDRS})

View File

@ -0,0 +1,27 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(detourcrowd_SRCS
Source/DetourPathCorridor.cpp
Source/DetourLocalBoundary.cpp
Source/DetourObstacleAvoidance.cpp
Source/DetourPathQueue.cpp
Source/DetourCrowd.cpp
Source/DetourProximityGrid.cpp
)
SET(detourcrowd_HDRS
Include/DetourPathCorridor.h
Include/DetourCrowd.h
Include/DetourObstacleAvoidance.h
Include/DetourLocalBoundary.h
Include/DetourProximityGrid.h
Include/DetourPathQueue.h
)
INCLUDE_DIRECTORIES(Include
../Detour/Include
../DetourTileCache
../Recast/Include
)
ADD_LIBRARY(DetourCrowd ${detourcrowd_SRCS} ${detourcrowd_HDRS})

View File

@ -0,0 +1,18 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(detourtilecache_SRCS
Source/DetourTileCache.cpp
Source/DetourTileCacheBuilder.cpp
)
SET(detourtilecache_HDRS
Include/DetourTileCache.h
Include/DetourTileCacheBuilder.h
)
INCLUDE_DIRECTORIES(Include
../Detour/Include
../Recast/Include
)
ADD_LIBRARY(DetourTileCache ${detourtilecache_SRCS} ${detourtilecache_HDRS})

View File

@ -1,6 +1,6 @@
#include "DetourTileCache.h"
#include "DetourTileCacheBuilder.h"
#include "DetourNavmeshBuilder.h"
#include "DetourNavMeshBuilder.h"
#include "DetourNavMesh.h"
#include "DetourCommon.h"
#include "DetourAlloc.h"

View File

@ -1,25 +0,0 @@
BIN = RecastDemo/Bin
BUILD = RecastDemo/Build/GNUMake
OBJ = $(BUILD)/Objects
# Add new targets here and add a corresponding
# .mk file to RecastDemo/Build/GNUMake
TARGETS = DebugUtils Detour Recast RecastDemo
# Dependencies
RecastDemo: $(OBJ) DebugUtils Detour Recast
$(OBJ):
mkdir -p $(OBJ)
all: $(TARGETS)
$(TARGETS):
make BIN=$(BIN) BUILD=$(BUILD) OBJ=$(OBJ) -f $(BUILD)/$(@).mk
CLEAN_TARGETS = $(foreach target,$(TARGETS),$(target)-clean)
clean: $(CLEAN_TARGETS)
rm -rf $(OBJ)
$(CLEAN_TARGETS): %-clean:
make BIN=$(BIN) BUILD=$(BUILD) OBJ=$(OBJ) -f $(BUILD)/$(*).mk clean
.PHONY: all clean $(TARGETS) $(CLEAN_TARGETS)

24
Recast/CMakeLists.txt Normal file
View File

@ -0,0 +1,24 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(recast_SRCS
Source/Recast.cpp
Source/RecastArea.cpp
Source/RecastAlloc.cpp
Source/RecastContour.cpp
Source/RecastFilter.cpp
Source/RecastLayers.cpp
Source/RecastMesh.cpp
Source/RecastMeshDetail.cpp
Source/RecastRasterization.cpp
Source/RecastRegion.cpp
)
SET(recast_HDRS
Include/Recast.h
Include/RecastAlloc.h
Include/RecastAssert.h
)
INCLUDE_DIRECTORIES(Include)
ADD_LIBRARY(Recast ${recast_SRCS} ${recast_HDRS})

View File

@ -1,7 +0,0 @@
OBJECTS = $(patsubst $(NAME)/Source/%.cpp,$(OBJ)/%.o,$(wildcard $(NAME)/Source/*.cpp))
CPPFLAGS += -I$(NAME)/Include
$(OBJ)/%.o: $(NAME)/Source/%.cpp
c++ $(CPPFLAGS) -c -o $@ $<
.PHONY: clean

View File

@ -1,19 +0,0 @@
NAME = DebugUtils
SOURCES = \
DebugDraw.cpp \
DetourDebugDraw.cpp \
RecastDebugDraw.cpp \
RecastDump.cpp
HEADERS = \
DebugDraw.h \
DetourDebugDraw.h \
RecastDebugDraw.h \
RecastDump.h
CPPFLAGS = \
-I Detour/Include \
-I Recast/Include
include $(BUILD)/HelperLibrary.mk

View File

@ -1,22 +0,0 @@
NAME = Detour
SOURCES = \
DetourAlloc.cpp \
DetourCommon.cpp \
DetourNavMesh.cpp \
DetourNavMeshBuilder.cpp \
DetourNavMeshQuery.cpp \
DetourNode.cpp \
DetourObstacleAvoidance.cpp
HEADERS = \
DetourAlloc.h \
DetourAssert.h \
DetourCommon.h \
DetourNavMesh.h \
DetourNavMeshBuilder.h \
DetourNavMeshQuery.h \
DetourNode.h \
DetourObstacleAvoidance.h
include $(BUILD)/Library.mk

View File

@ -1,7 +0,0 @@
include $(BUILD)/Common.mk
$(BIN)/$(NAME).a: $(OBJECTS)
ar -q $@ $(OBJECTS)
clean:
rm -f $(BIN)/$(NAME).a $(OBJECTS)

View File

@ -1,10 +0,0 @@
include $(BUILD)/Common.mk
CPPFLAGS += -fPIC
LDFLAGS += -shared
$(BIN)/lib$(NAME).so: $(OBJECTS)
c++ $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
clean:
rm -f $(BIN)/lib$(NAME).so $(OBJECTS)

View File

@ -1,7 +0,0 @@
include $(BUILD)/Common.mk
$(BIN)/$(NAME): $(OBJECTS)
c++ $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
clean:
rm -f $(BIN)/$(NAME).a $(OBJECTS)

View File

@ -1,18 +0,0 @@
NAME = Recast
OBJECTS = \
Recast.cpp \
RecastAlloc.cpp \
RecastArea.cpp \
RecastFilter.cpp \
RecastMesh.cpp \
RecastMeshDetail.cpp \
RecastRasterization.cpp \
RecastRegion.cpp
HEADERS = \
Recast.h \
RecastAlloc.h \
RecastAssert.h
include $(BUILD)/Library.mk

View File

@ -1,70 +0,0 @@
NAME = RecastDemo
SOURCES = \
ChunkyTriMesh.cpp \
ConvexVolumeTool.cpp \
CrowdManager.cpp \
CrowdTool.cpp \
Filelist.cpp \
foo \
imgui.cpp \
imguiRenderGL.cpp \
InputGeom.cpp \
main.cpp \
MeshLoaderObj.cpp \
NavMeshTesterTool.cpp \
OffMeshConnectionTool.cpp \
PerfTimer.cpp \
Sample.cpp \
Sample_Debug.cpp \
SampleInterfaces.cpp \
Sample_SoloMeshSimple.cpp \
Sample_SoloMeshTiled.cpp \
Sample_TileMesh.cpp \
SDLMain.m \
SlideShow.cpp \
TestCase.cpp \
ValueHistory.cpp
HEADERS = \
ChunkyTriMesh.h \
ConvexVolumeTool.h \
CrowdManager.h \
CrowdTool.h \
Filelist.h \
foo \
imgui.h \
imguiRenderGL.h \
InputGeom.h \
MeshLoaderObj.h \
NavMeshTesterTool.h \
OffMeshConnectionTool.h \
PerfTimer.h \
Sample_Debug.h \
Sample.h \
SampleInterfaces.h \
Sample_SoloMeshSimple.h \
Sample_SoloMeshTiled.h \
Sample_TileMesh.h \
SDLMain.h \
SlideShow.h \
TestCase.h \
ValueHistory.h
CPPFLAGS = \
-I $(NAME)/Contrib \
-I DebugUtils/Include \
-I Detour/Include \
-I Recast/Include \
`pkg-config --cflags sdl`
LDFLAGS = \
-L $(BIN) \
-lDetour \
-lRecast \
-lGL -lGLU \
`pkg-config --libs sdl`
LIBS = $(BIN)/DebugUtils.a
include $(BUILD)/Program.mk

88
RecastDemo/CMakeLists.txt Normal file
View File

@ -0,0 +1,88 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(recastdemo_SRCS
Source/ChunkyTriMesh.cpp
Source/ConvexVolumeTool.cpp
Source/CrowdTool.cpp
Source/Filelist.cpp
Source/imgui.cpp
Source/imguiRenderGL.cpp
Source/InputGeom.cpp
Source/main.cpp
Source/MeshLoaderObj.cpp
Source/NavMeshTesterTool.cpp
Source/OffMeshConnectionTool.cpp
Source/PerfTimer.cpp
Source/Sample.cpp
Source/Sample_Debug.cpp
Source/Sample_SoloMesh.cpp
Source/Sample_TileMesh.cpp
Source/Sample_TempObstacles.cpp
Source/SampleInterfaces.cpp
Source/SlideShow.cpp
Source/TestCase.cpp
Source/ValueHistory.cpp
Contrib/fastlz/fastlz.c
)
SET(recastdemo_HDRS
Include/ChunkyTriMesh.h
Include/ConvexVolumeTool.h
Include/CrowdTool.h
Include/Filelist.h
Include/imgui.h
Include/imguiRenderGL.h
Include/InputGeom.h
Include/MeshLoaderObj.h
Include/NavMeshTesterTool.h
Include/OffMeshConnectionTool.h
Include/PerfTimer.h
Include/Sample.h
Include/Sample_Debug.h
Include/Sample_SoloMesh.h
Include/Sample_TileMesh.h
Include/Sample_TempObstacles.h
Include/SampleInterfaces.h
Include/SDLMain.h
Include/SlideShow.h
Include/TestCase.h
Include/ValueHistory.h
)
FIND_PACKAGE(OpenGL REQUIRED)
IF(WIN32)
FIND_LIBRARY(SDL_LIBRARY NAME SDL PATHS Contrib/SDL/lib)
FIND_LIBRARY(SDLMAIN_LIBRARY NAME SDLmain PATHS Contrib/SDL/lib)
SET(SDL_INCLUDE_DIR Contrib/SDL/include)
ELSE(WIN32)
FIND_PACKAGE(SDL REQUIRED)
ENDIF(WIN32)
INCLUDE_DIRECTORIES(Include
Contrib
Contrib/fastlz
../DebugUtils/Include
../Detour/Include
../DetourCrowd/Include
../DetourTileCache/Include
../Recast/Include
${SDL_INCLUDE_DIR}
)
IF(XCODE)
ADD_EXECUTABLE(RecastDemo MACOSX_BUNDLE Source/SDLMain.m Include/SDLMain.h ${recastdemo_SRCS} ${recastdemo_HDRS})
ELSE(XCODE)
ADD_EXECUTABLE(RecastDemo WIN32 ${recastdemo_SRCS} ${recastdemo_HDRS})
ENDIF(XCODE)
TARGET_LINK_LIBRARIES(RecastDemo DebugUtils Detour DetourCrowd DetourTileCache Recast ${SDL_LIBRARY} ${SDLMAIN_LIBRARY} ${OPENGL_LIBRARIES})
IF(MSVC)
# Enable some linker optimisations
SET_TARGET_PROPERTIES(RecastDemo PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
SET_TARGET_PROPERTIES(RecastDemo PROPERTIES LINK_FLAGS_MINSIZEREL "/OPT:REF /OPT:ICF")
SET_TARGET_PROPERTIES(RecastDemo PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/OPT:REF /OPT:ICF")
ENDIF(MSVC)
SET(EXECUTABLE_OUTPUT_PATH ${RecastNavigation_SOURCE_DIR}/RecastDemo/Bin)