From 3cee73cb8c08377b9153a841f597bc862b0ce889 Mon Sep 17 00:00:00 2001 From: Cameron hart Date: Wed, 20 Apr 2011 10:55:10 +0000 Subject: [PATCH] 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. --- CMakeLists.txt | 27 +++++++ DebugUtils/CMakeLists.txt | 23 ++++++ Detour/CMakeLists.txt | 24 ++++++ DetourCrowd/CMakeLists.txt | 27 +++++++ DetourTileCache/CMakeLists.txt | 18 +++++ DetourTileCache/Source/DetourTileCache.cpp | 2 +- Makefile | 25 ------ Recast/CMakeLists.txt | 24 ++++++ RecastDemo/Build/GNUMake/Common.mk | 7 -- RecastDemo/Build/GNUMake/DebugUtils.mk | 19 ----- RecastDemo/Build/GNUMake/Detour.mk | 22 ------ RecastDemo/Build/GNUMake/HelperLibrary.mk | 7 -- RecastDemo/Build/GNUMake/Library.mk | 10 --- RecastDemo/Build/GNUMake/Program.mk | 7 -- RecastDemo/Build/GNUMake/Recast.mk | 18 ----- RecastDemo/Build/GNUMake/RecastDemo.mk | 70 ----------------- RecastDemo/CMakeLists.txt | 88 ++++++++++++++++++++++ 17 files changed, 232 insertions(+), 186 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 DebugUtils/CMakeLists.txt create mode 100644 Detour/CMakeLists.txt create mode 100644 DetourCrowd/CMakeLists.txt create mode 100644 DetourTileCache/CMakeLists.txt delete mode 100644 Makefile create mode 100644 Recast/CMakeLists.txt delete mode 100644 RecastDemo/Build/GNUMake/Common.mk delete mode 100644 RecastDemo/Build/GNUMake/DebugUtils.mk delete mode 100644 RecastDemo/Build/GNUMake/Detour.mk delete mode 100644 RecastDemo/Build/GNUMake/HelperLibrary.mk delete mode 100644 RecastDemo/Build/GNUMake/Library.mk delete mode 100644 RecastDemo/Build/GNUMake/Program.mk delete mode 100644 RecastDemo/Build/GNUMake/Recast.mk delete mode 100644 RecastDemo/Build/GNUMake/RecastDemo.mk create mode 100644 RecastDemo/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8dd69f6 --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/DebugUtils/CMakeLists.txt b/DebugUtils/CMakeLists.txt new file mode 100644 index 0000000..e79364a --- /dev/null +++ b/DebugUtils/CMakeLists.txt @@ -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}) diff --git a/Detour/CMakeLists.txt b/Detour/CMakeLists.txt new file mode 100644 index 0000000..e05ed11 --- /dev/null +++ b/Detour/CMakeLists.txt @@ -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}) diff --git a/DetourCrowd/CMakeLists.txt b/DetourCrowd/CMakeLists.txt new file mode 100644 index 0000000..0c34e1b --- /dev/null +++ b/DetourCrowd/CMakeLists.txt @@ -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}) diff --git a/DetourTileCache/CMakeLists.txt b/DetourTileCache/CMakeLists.txt new file mode 100644 index 0000000..dd481a4 --- /dev/null +++ b/DetourTileCache/CMakeLists.txt @@ -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}) diff --git a/DetourTileCache/Source/DetourTileCache.cpp b/DetourTileCache/Source/DetourTileCache.cpp index 0f0ca74..2af3cfe 100644 --- a/DetourTileCache/Source/DetourTileCache.cpp +++ b/DetourTileCache/Source/DetourTileCache.cpp @@ -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" diff --git a/Makefile b/Makefile deleted file mode 100644 index 6f93a0d..0000000 --- a/Makefile +++ /dev/null @@ -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) \ No newline at end of file diff --git a/Recast/CMakeLists.txt b/Recast/CMakeLists.txt new file mode 100644 index 0000000..2023048 --- /dev/null +++ b/Recast/CMakeLists.txt @@ -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}) diff --git a/RecastDemo/Build/GNUMake/Common.mk b/RecastDemo/Build/GNUMake/Common.mk deleted file mode 100644 index 85f7772..0000000 --- a/RecastDemo/Build/GNUMake/Common.mk +++ /dev/null @@ -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 \ No newline at end of file diff --git a/RecastDemo/Build/GNUMake/DebugUtils.mk b/RecastDemo/Build/GNUMake/DebugUtils.mk deleted file mode 100644 index 0a5d660..0000000 --- a/RecastDemo/Build/GNUMake/DebugUtils.mk +++ /dev/null @@ -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 \ No newline at end of file diff --git a/RecastDemo/Build/GNUMake/Detour.mk b/RecastDemo/Build/GNUMake/Detour.mk deleted file mode 100644 index aefd3ce..0000000 --- a/RecastDemo/Build/GNUMake/Detour.mk +++ /dev/null @@ -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 \ No newline at end of file diff --git a/RecastDemo/Build/GNUMake/HelperLibrary.mk b/RecastDemo/Build/GNUMake/HelperLibrary.mk deleted file mode 100644 index 15042ce..0000000 --- a/RecastDemo/Build/GNUMake/HelperLibrary.mk +++ /dev/null @@ -1,7 +0,0 @@ -include $(BUILD)/Common.mk - -$(BIN)/$(NAME).a: $(OBJECTS) - ar -q $@ $(OBJECTS) - -clean: - rm -f $(BIN)/$(NAME).a $(OBJECTS) \ No newline at end of file diff --git a/RecastDemo/Build/GNUMake/Library.mk b/RecastDemo/Build/GNUMake/Library.mk deleted file mode 100644 index 10745fb..0000000 --- a/RecastDemo/Build/GNUMake/Library.mk +++ /dev/null @@ -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) \ No newline at end of file diff --git a/RecastDemo/Build/GNUMake/Program.mk b/RecastDemo/Build/GNUMake/Program.mk deleted file mode 100644 index 62f600d..0000000 --- a/RecastDemo/Build/GNUMake/Program.mk +++ /dev/null @@ -1,7 +0,0 @@ -include $(BUILD)/Common.mk - -$(BIN)/$(NAME): $(OBJECTS) - c++ $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) - -clean: - rm -f $(BIN)/$(NAME).a $(OBJECTS) \ No newline at end of file diff --git a/RecastDemo/Build/GNUMake/Recast.mk b/RecastDemo/Build/GNUMake/Recast.mk deleted file mode 100644 index c25ee34..0000000 --- a/RecastDemo/Build/GNUMake/Recast.mk +++ /dev/null @@ -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 \ No newline at end of file diff --git a/RecastDemo/Build/GNUMake/RecastDemo.mk b/RecastDemo/Build/GNUMake/RecastDemo.mk deleted file mode 100644 index 42f6b5e..0000000 --- a/RecastDemo/Build/GNUMake/RecastDemo.mk +++ /dev/null @@ -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 \ No newline at end of file diff --git a/RecastDemo/CMakeLists.txt b/RecastDemo/CMakeLists.txt new file mode 100644 index 0000000..415b27f --- /dev/null +++ b/RecastDemo/CMakeLists.txt @@ -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) +