From c5bbbee9c1ffaa0c956335fd682f5bb88d8d72e4 Mon Sep 17 00:00:00 2001 From: k1ll Date: Thu, 15 Mar 2012 21:37:55 +0100 Subject: [PATCH] Added needed cmake files and added a comment to clarify the changes in FindOgre.cmake --- cmake/FindCg.cmake | 53 +++++++++++++++++++++++++++++++++++++++ cmake/FindFreeImage.cmake | 47 ++++++++++++++++++++++++++++++++++ cmake/FindOGRE.cmake | 1 + cmake/FindZZip.cmake | 48 +++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 cmake/FindCg.cmake create mode 100644 cmake/FindFreeImage.cmake create mode 100644 cmake/FindZZip.cmake diff --git a/cmake/FindCg.cmake b/cmake/FindCg.cmake new file mode 100644 index 000000000..4bd348c46 --- /dev/null +++ b/cmake/FindCg.cmake @@ -0,0 +1,53 @@ +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ +# +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- + +# - Try to find Cg +# Once done, this will define +# +# Cg_FOUND - system has Cg +# Cg_INCLUDE_DIRS - the Cg include directories +# Cg_LIBRARIES - link these to use Cg + +include(FindPkgMacros) +findpkg_begin(Cg) + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(Cg_HOME) +getenv_path(OGRE_SOURCE) +getenv_path(OGRE_HOME) + +# construct search paths +set(Cg_PREFIX_PATH ${Cg_HOME} ${ENV_Cg_HOME} + ${OGRE_SOURCE}/Dependencies + ${ENV_OGRE_SOURCE}/Dependencies + ${OGRE_HOME} ${ENV_OGRE_HOME} + /opt/nvidia-cg-toolkit) +create_search_paths(Cg) +# redo search if prefix path changed +clear_if_changed(Cg_PREFIX_PATH + Cg_LIBRARY_FWK + Cg_LIBRARY_REL + Cg_LIBRARY_DBG + Cg_INCLUDE_DIR +) + +set(Cg_LIBRARY_NAMES Cg) +get_debug_names(Cg_LIBRARY_NAMES) + +use_pkgconfig(Cg_PKGC Cg) + +findpkg_framework(Cg) + +find_path(Cg_INCLUDE_DIR NAMES cg.h HINTS ${Cg_FRAMEWORK_INCLUDES} ${Cg_INC_SEARCH_PATH} ${Cg_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Cg) +find_library(Cg_LIBRARY_REL NAMES ${Cg_LIBRARY_NAMES} HINTS ${Cg_LIB_SEARCH_PATH} ${Cg_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) +find_library(Cg_LIBRARY_DBG NAMES ${Cg_LIBRARY_NAMES_DBG} HINTS ${Cg_LIB_SEARCH_PATH} ${Cg_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) +make_library_set(Cg_LIBRARY) + +findpkg_finish(Cg) +add_parent_dir(Cg_INCLUDE_DIRS Cg_INCLUDE_DIR) diff --git a/cmake/FindFreeImage.cmake b/cmake/FindFreeImage.cmake new file mode 100644 index 000000000..3b21a17d6 --- /dev/null +++ b/cmake/FindFreeImage.cmake @@ -0,0 +1,47 @@ +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ +# +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- + +# - Try to find FreeImage +# Once done, this will define +# +# FreeImage_FOUND - system has FreeImage +# FreeImage_INCLUDE_DIRS - the FreeImage include directories +# FreeImage_LIBRARIES - link these to use FreeImage + +include(FindPkgMacros) +findpkg_begin(FreeImage) + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(FREEIMAGE_HOME) + +# construct search paths +set(FreeImage_PREFIX_PATH ${FREEIMAGE_HOME} ${ENV_FREEIMAGE_HOME}) +create_search_paths(FreeImage) +# redo search if prefix path changed +clear_if_changed(FreeImage_PREFIX_PATH + FreeImage_LIBRARY_FWK + FreeImage_LIBRARY_REL + FreeImage_LIBRARY_DBG + FreeImage_INCLUDE_DIR +) + +set(FreeImage_LIBRARY_NAMES freeimage) +get_debug_names(FreeImage_LIBRARY_NAMES) + +use_pkgconfig(FreeImage_PKGC freeimage) + +findpkg_framework(FreeImage) + +find_path(FreeImage_INCLUDE_DIR NAMES FreeImage.h HINTS ${FreeImage_INC_SEARCH_PATH} ${FreeImage_PKGC_INCLUDE_DIRS}) +find_library(FreeImage_LIBRARY_REL NAMES ${FreeImage_LIBRARY_NAMES} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) +find_library(FreeImage_LIBRARY_DBG NAMES ${FreeImage_LIBRARY_NAMES_DBG} HINTS ${FreeImage_LIB_SEARCH_PATH} ${FreeImage_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) +make_library_set(FreeImage_LIBRARY) + +findpkg_finish(FreeImage) + diff --git a/cmake/FindOGRE.cmake b/cmake/FindOGRE.cmake index fd292ddeb..2c07a4d55 100644 --- a/cmake/FindOGRE.cmake +++ b/cmake/FindOGRE.cmake @@ -258,6 +258,7 @@ if (OGRE_STATIC) endif () endif () + #Removed FWK because it normally is unnecessary and would break the build when not available #set(OGRE_LIBRARIES ${OGRE_LIBRARIES} ${OGRE_LIBRARY_FWK} ${ZZip_LIBRARIES} ${ZLIB_LIBRARIES} # ${FreeImage_LIBRARIES} ${FREETYPE_LIBRARIES} # ${X11_LIBRARIES} ${X11_Xt_LIBRARIES} ${XAW_LIBRARY} ${X11_Xrandr_LIB} diff --git a/cmake/FindZZip.cmake b/cmake/FindZZip.cmake new file mode 100644 index 000000000..68fe043f3 --- /dev/null +++ b/cmake/FindZZip.cmake @@ -0,0 +1,48 @@ +#------------------------------------------------------------------- +# This file is part of the CMake build system for OGRE +# (Object-oriented Graphics Rendering Engine) +# For the latest info, see http://www.ogre3d.org/ +# +# The contents of this file are placed in the public domain. Feel +# free to make use of it in any way you like. +#------------------------------------------------------------------- + +# - Try to find zziplib +# Once done, this will define +# +# ZZip_FOUND - system has ZZip +# ZZip_INCLUDE_DIRS - the ZZip include directories +# ZZip_LIBRARIES - link these to use ZZip + +include(FindPkgMacros) +findpkg_begin(ZZip) + +# Get path, convert backslashes as ${ENV_${var}} +getenv_path(ZZIP_HOME) + + +# construct search paths +set(ZZip_PREFIX_PATH ${ZZIP_HOME} ${ENV_ZZIP_HOME}) +create_search_paths(ZZip) +# redo search if prefix path changed +clear_if_changed(ZZip_PREFIX_PATH + ZZip_LIBRARY_FWK + ZZip_LIBRARY_REL + ZZip_LIBRARY_DBG + ZZip_INCLUDE_DIR +) + +set(ZZip_LIBRARY_NAMES zzip zziplib) +get_debug_names(ZZip_LIBRARY_NAMES) + +use_pkgconfig(ZZip_PKGC zziplib) + +findpkg_framework(ZZip) + +find_path(ZZip_INCLUDE_DIR NAMES zzip/zzip.h HINTS ${ZZip_INC_SEARCH_PATH} ${ZZip_PKGC_INCLUDE_DIRS}) +find_library(ZZip_LIBRARY_REL NAMES ${ZZip_LIBRARY_NAMES} HINTS ${ZZip_LIB_SEARCH_PATH} ${ZZip_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" release relwithdebinfo minsizerel) +find_library(ZZip_LIBRARY_DBG NAMES ${ZZip_LIBRARY_NAMES_DBG} HINTS ${ZZip_LIB_SEARCH_PATH} ${ZZip_PKGC_LIBRARY_DIRS} PATH_SUFFIXES "" debug) +make_library_set(ZZip_LIBRARY) + +findpkg_finish(ZZip) +