Commits

Andrew Fenn committed 107d2b2 Draft

Refactored the cmake script to work on linux as well as take into account the changes made in Ogitor

  • Participants
  • Parent commits 2c7749d

Comments (0)

Files changed (1)

 	message(SEND_ERROR "The CMAKE script doesn't support Mac OS yet.")	
 endif(APPLE)
 
-if(UNIX)
-	message(SEND_ERROR "The CMAKE script doesn't support Unix yet.")	
-endif(UNIX)
-
 if(APPLE)
 	find_package(CG REQUIRED)
 endif(APPLE)
 	message(SEND_ERROR "You need Ogre 1.8 Byatis or later to build this.")	
 endif()
 
-if(UNIX)
-	get_filename_component(OGRE_PLUGIN_DIR_LINUX ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} PATH)
-	set (OGRE_PLUGIN_DIR_LINUX ${OGRE_PLUGIN_DIR_LINUX} CACHE STRING "Ogre plugin dir (release)")
-endif(UNIX)
+set(SRCS
+	./src/TerrainCutEditor.cpp
+	./include/TerrainCutEditor.h
+	#./src/TerrainCutOutline.cpp
+	#./include/TerrainCutOutline.h
+	)
 
-include_directories(${OGRE_INCLUDE_DIRS})
-#include_directories(${OGRE_Terrain_INCLUDE_DIR})
-#find_package(OIS REQUIRED)
+set(SRCS ${SRCS})
 
-#if(NOT OIS_FOUND)
-#	message(SEND_ERROR "Failed to find OIS.")
-#else(NOT OIS_FOUND)
+find_package(Ogitor REQUIRED)
+find_package(OFS REQUIRED)
 
-if(NOT OGRE_MEDIA_DIR)
-	message(SEND_ERROR "Failed to find OGRE Media Directory.")
-else(NOT OGRE_MEDIA_DIR)
+if(WIN32)
+	getenv_path(OGRE_BYATIS)
+	set(OGRE_SAMPLES_INCLUDEPATH
+		${ENV_OGRE_BYATIS}/Samples/include
+	)
+endif(WIN32)
 
-	set(SRCS
-		./src/TerrainCutEditor.cpp
-		./include/TerrainCutEditor.h
-		#./src/TerrainCutOutline.cpp
-		#./include/TerrainCutOutline.h
-		)
+include_directories(SYSTEM ${OIS_INCLUDE_DIRS})
+include_directories(SYSTEM ${OGRE_INCLUDE_DIRS})
+include_directories(SYSTEM ${OGRE_Terrain_INCLUDE_DIR})
+include_directories(SYSTEM ${OGRE_Paging_INCLUDE_DIR})
+include_directories(SYSTEM ${Boost_INCLUDE_DIR})
+include_directories(SYSTEM ${Ogitor_INCLUDE_DIRS})
+include_directories(SYSTEM ${OFS_INCLUDE_DIR})
 
-	set(SRCS ${SRCS})
-	
-	# Dependencies
-	set(OGITOR_SOURCE_DIR CACHE PATH "Path to Ogitor sources (for dependencies)" )
-	set(OGITOR_BUILD_DIR CACHE PATH "Path to Ogitor build (for dependencies)" )
-	set(OGITOR_MEDIA_DIR  "${OGITOR_BUILD_DIR}/RunPath/Media")
-	
-	# Dependencies
-	set(DEPENDENCIES_INCLUDES
-    		"${OGITOR_SOURCE_DIR}/Dependencies/OFS/include"
-    		"${OGITOR_SOURCE_DIR}/Ogitor/include"
-	)
-	set(OGITOR_RELEASE_LIBPATH "${OGITOR_BUILD_DIR}/lib/Release")
-	set(OGITOR_RELEASE_LIB "${OGITOR_RELEASE_LIBPATH}/Ogitor.lib")
-	
-	set(OGITOR_DEBUG_LIBPATH "${OGITOR_BUILD_DIR}/lib/Debug")
-	set(OGITOR_DEBUG_LIB "${OGITOR_DEBUG_LIBPATH}/Ogitor_d.lib")
-	
-	set(DEPENDENCIES_LIBPATH "${OGITOR_BUILD_DIR}/Dependencies/lib")
-	set(PAGED_GEOMETRY_DEBUG_LIB "${DEPENDENCIES_LIBPATH}/Debug/PagedGeometry_d.lib")
-	set(PAGED_GEOMETRY_RELEASE_LIB "${DEPENDENCIES_LIBPATH}/Release/PagedGeometry.lib")
-	set(OFS_DEBUG_LIB "${DEPENDENCIES_LIBPATH}/Debug/OFS_d.lib")
-	set(OFS_RELEASE_LIB "${DEPENDENCIES_LIBPATH}/Release/OFS.lib")
+include_directories(
+   ${CMAKE_CURRENT_SOURCE_DIR}/include
+)
 
-	if(WIN32)
-		getenv_path(OGRE_BYATIS)
-		set(OGRE_SAMPLES_INCLUDEPATH
-			${ENV_OGRE_BYATIS}/Samples/include
-		)
-	endif(WIN32)
 
-	if(UNIX)
-		find_path(OGRE_SAMPLES_INCLUDEPATH SdkTrays.h
-			/usr/share/OGRE/Samples/Common/include/
-			/usr/local/share/OGRE/Samples/Common/include/
-		)
-	endif(UNIX)
+add_definitions(-DPLUGIN_EXPORT)
+add_library(TerrainCutter SHARED ${SRCS})
+set(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/lib")
 
-	include_directories(./include ${OIS_INCLUDE_DIRS}
-		${OGRE_INCLUDE_DIRS}
-		${OGRE_Terrain_INCLUDE_DIR}
-		${OGRE_Paging_INCLUDE_DIR}
-		${Boost_INCLUDE_DIR}
-		${OGRE_SAMPLES_INCLUDEPATH}
-        ${DEPENDENCIES_INCLUDES})
+set_target_properties(TerrainCutter  PROPERTIES DEBUG_POSTFIX _d)
 
-	add_definitions(-DPLUGIN_EXPORT)
-	add_library(TerrainCutter SHARED ${SRCS})
-	set(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/lib")
+if(APPLE)
+	find_package(IOKIT REQUIRED)
+	find_package(Carbon REQUIRED)
 
-	set_target_properties(TerrainCutter  PROPERTIES DEBUG_POSTFIX _d)
+    target_link_libraries(TerrainCutter
+        ${OGRE_LIBRARIES} ${OGRE_Terrain_LIBRARY} ${OGRE_Paging_LIBRARY}
+        ${Ogitor_LIBRARIES}
+        ${OFS_LIBRARIES}
+        ${OIS_LIBRARIES}
+        ${Boost_LIBRARIES}
 
-	if(APPLE)
-		find_package(IOKIT REQUIRED)
-		find_package(Carbon REQUIRED)
-        TARGET_LINK_LIBRARIES(TerrainCutter 
-			${OGRE_LIBRARIES} 
-			${OIS_LIBRARIES} 
-			${IOKit_LIBRARIES} 
-			${Carbon_LIBRARIES} 
-			${OGRE_Terrain_LIBRARY} 
-			debug ${OGITOR_DEBUG_LIB}
-			optimized ${OGITOR_RELEASE_LIB}
-			debug ${OFS_DEBUG_LIB}
-			optimized ${OFS_RELEASE_LIB}
-			debug ${PAGED_GEOMETRY_DEBUG_LIB}
-			optimized ${PAGED_GEOMETRY_RELEASE_LIB})
-    ELSE()
-        TARGET_LINK_LIBRARIES(TerrainCutter 
-			${OGRE_LIBRARIES} 
-			${OIS_LIBRARIES} 
-			${OGRE_Terrain_LIBRARY} 
-			${PAGED_GEOMETRY_LIB} 
-			${Boost_LIBRARIES}
-			debug ${OGITOR_DEBUG_LIB}
-			optimized ${OGITOR_RELEASE_LIB}
-			debug ${OFS_DEBUG_LIB}
-			optimized ${OFS_RELEASE_LIB}
-			debug ${PAGED_GEOMETRY_DEBUG_LIB}
-			optimized ${PAGED_GEOMETRY_RELEASE_LIB}
-			)
-	endif(APPLE)
+        ${Carbon_LIBRARIES}
+        ${IOKit_LIBRARIES}
+    )
+else()
+    target_link_libraries(TerrainCutter
+        ${OGRE_LIBRARIES} ${OGRE_Terrain_LIBRARY} ${OGRE_Paging_LIBRARY}
+        ${Ogitor_LIBRARIES}
+        ${OFS_LIBRARIES}
+        ${OIS_LIBRARIES}
+        ${Boost_LIBRARIES}
+    )
+endif(APPLE)
 
-	if(APPLE)
-		install(TARGETS TerrainCutter BUNDLE DESTINATION ${PREFIX}bin CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
-		install(TARGETS TerrainCutter BUNDLE DESTINATION ${PREFIX}Debug CONFIGURATIONS Debug)
-	endif()
+if(APPLE)
+	install(TARGETS TerrainCutter BUNDLE DESTINATION ${PREFIX}bin CONFIGURATIONS Release RelWithDebInfo MinSizeRel)
+	install(TARGETS TerrainCutter BUNDLE DESTINATION ${PREFIX}Debug CONFIGURATIONS Debug)
+endif()
 
-	if(WIN32)
-		file(TO_NATIVE_PATH "${OGITOR_BUILD_DIR}/RunPath/Plugins" OGITOR_RUNPATH_WIN)
-				
-		add_custom_command(TARGET TerrainCutter POST_BUILD 
-			COMMAND copy \"$(TargetPath)\" "${OGITOR_RUNPATH_WIN}")
-		add_custom_command(TARGET TerrainCutter POST_BUILD
-			COMMAND if exist 
-			"${OGITOR_RUNPATH_WIN}\\TerrainCutter_d.dll" 
-			move "${OGITOR_RUNPATH_WIN}\\TerrainCutter_d.dll" "${OGITOR_RUNPATH_WIN}\\Debug")
+if(WIN32)
+	file(TO_NATIVE_PATH "${OGITOR_BUILD_DIR}/RunPath/Plugins" OGITOR_RUNPATH_WIN)
+			
+	add_custom_command(TARGET TerrainCutter POST_BUILD 
+		COMMAND copy \"$(TargetPath)\" "${OGITOR_RUNPATH_WIN}")
+	add_custom_command(TARGET TerrainCutter POST_BUILD
+		COMMAND if exist 
+		"${OGITOR_RUNPATH_WIN}\\TerrainCutter_d.dll" 
+		move "${OGITOR_RUNPATH_WIN}\\TerrainCutter_d.dll" "${OGITOR_RUNPATH_WIN}\\Debug")
 
-		install(TARGETS TerrainCutter
-			RUNTIME DESTINATION "${OGITOR_BUILD_DIR}/RunPath/Plugins"
-			CONFIGURATIONS Release)
-		install(TARGETS TerrainCutter
-			RUNTIME DESTINATION "${OGITOR_BUILD_DIR}/RunPath/Plugins/Debug"
-			CONFIGURATIONS Debug)
-		install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/Icons/spade.svg" 
-				DESTINATION "${OGITOR_BUILD_DIR}/RunPath/Plugins/Icons")	
-	endif(WIN32)
-	
-
-
-endif(NOT OGRE_MEDIA_DIR)	
-#endif(NOT OIS_FOUND)
+	install(TARGETS TerrainCutter
+		RUNTIME DESTINATION "${OGITOR_BUILD_DIR}/RunPath/Plugins"
+		CONFIGURATIONS Release)
+	install(TARGETS TerrainCutter
+		RUNTIME DESTINATION "${OGITOR_BUILD_DIR}/RunPath/Plugins/Debug"
+		CONFIGURATIONS Debug)
+	install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/Icons/spade.svg" 
+			DESTINATION "${OGITOR_BUILD_DIR}/RunPath/Plugins/Icons")	
+endif(WIN32)
 
 # vim: set sw=2 ts=2 noet: