From 3eeae12c498d1a4dbe969462d2ba841f77ee3ccb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 2 Jan 2011 01:48:38 +0200 Subject: Initial commit. This code based on mana client http://www.gitorious.org/mana/mana and my private repository. --- CMake/Modules/FindENet.cmake | 52 +++++++++++++++++++++ CMake/Modules/FindGuichan.cmake | 100 ++++++++++++++++++++++++++++++++++++++++ CMake/Modules/FindLibIntl.cmake | 46 ++++++++++++++++++ CMake/Modules/FindSDL_gfx.cmake | 39 ++++++++++++++++ 4 files changed, 237 insertions(+) create mode 100644 CMake/Modules/FindENet.cmake create mode 100644 CMake/Modules/FindGuichan.cmake create mode 100644 CMake/Modules/FindLibIntl.cmake create mode 100644 CMake/Modules/FindSDL_gfx.cmake (limited to 'CMake') diff --git a/CMake/Modules/FindENet.cmake b/CMake/Modules/FindENet.cmake new file mode 100644 index 000000000..98da51a3d --- /dev/null +++ b/CMake/Modules/FindENet.cmake @@ -0,0 +1,52 @@ +# - Try to find enet +# Once done this will define +# +# ENET_FOUND - system has enet +# ENET_INCLUDE_DIR - the enet include directory +# ENET_LIBRARIES - the libraries needed to use enet +# ENET_DEFINITIONS - Compiler switches required for using enet + +IF (ENet_INCLUDE_DIR AND ENet_LIBRARY) + SET(ENet_FIND_QUIETLY TRUE) +ENDIF (ENet_INCLUDE_DIR AND ENet_LIBRARY) + +# for Windows we rely on the environement variables +# %INCLUDE% and %LIB%; FIND_LIBRARY checks %LIB% +# automatically on Windows +IF(WIN32) + FIND_PATH(ENet_INCLUDE_DIR enet/enet.h + $ENV{INCLUDE} + ) + FIND_LIBRARY(ENet_LIBRARY + NAMES enet + ) +ELSE() + FIND_PATH(ENet_INCLUDE_DIR enet/enet.h + /usr/include + /usr/local/include + ) + FIND_LIBRARY(ENet_LIBRARY + NAMES enet + PATHS /usr/lib /usr/local/lib + ) +ENDIF() + +IF (ENet_INCLUDE_DIR AND ENet_LIBRARY) + SET(ENET_FOUND TRUE) + SET(ENET_INCLUDE_DIR ${ENet_INCLUDE_DIR}) + SET(ENET_LIBRARIES ${ENet_LIBRARY}) +ELSE () + SET(ENET_FOUND FALSE) +ENDIF () + +IF (ENET_FOUND) + IF (NOT ENet_FIND_QUIETLY) + MESSAGE(STATUS "Found enet: ${ENet_LIBRARY}") + ENDIF (NOT ENet_FIND_QUIETLY) +ELSE (ENET_FOUND) + IF (ENet_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find enet") + ENDIF (ENet_FIND_REQUIRED) +ENDIF (ENET_FOUND) + +MARK_AS_ADVANCED(ENet_INCLUDE_DIR ENet_LIBRARY) diff --git a/CMake/Modules/FindGuichan.cmake b/CMake/Modules/FindGuichan.cmake new file mode 100644 index 000000000..dbc863e2f --- /dev/null +++ b/CMake/Modules/FindGuichan.cmake @@ -0,0 +1,100 @@ +# - Try to find Guichan +# Once done this will define +# +# GUICHAN_FOUND - system has Guichan +# GUICHAN_INCLUDE_DIR - the Guichan include directory +# GUICHAN_LIBRARIES - the libraries needed to use Guichan +# +# Supported components: SDL OpenGL +# +# TODO: Clean up the components stuff and try to add all known +# components when none are specified. May not bail out for not found +# components then, set some var instead... + +# Be quiet if Guichan was already found +# We need an extra variable to have the check per component + +IF (Guichan_INCLUDE_DIR AND Guichan_LIBRARY) + SET(Guichan_QUIET TRUE) +ENDIF () + +FIND_PATH(Guichan_INCLUDE_DIR + NAMES guichan.hpp + PATHS /usr/include /usr/local/include + ) + +FIND_LIBRARY(Guichan_LIBRARY + NAMES guichan + PATHS /usr/lib /usr/local/lib + ) + +MARK_AS_ADVANCED(Guichan_INCLUDE_DIR Guichan_LIBRARY) + +IF (Guichan_INCLUDE_DIR AND Guichan_LIBRARY) + SET(GUICHAN_FOUND TRUE) + SET(GUICHAN_INCLUDE_DIR ${Guichan_INCLUDE_DIR}) + SET(GUICHAN_LIBRARIES ${Guichan_LIBRARY}) + + IF (NOT Guichan_FIND_QUIETLY AND NOT Guichan_QUIET) + MESSAGE(STATUS "Found Guichan: ${Guichan_LIBRARY}") + ENDIF () +ENDIF () + +# Bail out if Guichan is not found but required +IF (NOT GUICHAN_FOUND AND Guichan_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find Guichan library ${GUICHAN_INCLUDE_DIR}") +ENDIF () + +# Check for guichan components +FOREACH (COMPONENT ${Guichan_FIND_COMPONENTS}) + SET(COMPONENT_FOUND FALSE) + + IF (COMPONENT STREQUAL "SDL") + SET(COMPONENT_FOUND TRUE) + SET(Guichan_HEADER "guichan/sdl.hpp") + SET(Guichan_LIBRARY "guichan_sdl") + ENDIF () + + IF (COMPONENT STREQUAL "OpenGL") + SET(COMPONENT_FOUND TRUE) + SET(Guichan_HEADER "guichan/opengl.hpp") + SET(Guichan_LIBRARY "guichan_opengl") + ENDIF () + + IF (NOT COMPONENT_FOUND) + MESSAGE(FATAL_ERROR "Invalid Guichan component: ${COMPONENT}") + ENDIF (NOT COMPONENT_FOUND) + + # Check if we already found this component + IF (Guichan_LIBRARY_${COMPONENT}) + SET(Guichan_QUIET TRUE) + ELSE () + SET(Guichan_QUIET FALSE) + ENDIF () + + FIND_LIBRARY(Guichan_LIBRARY_${COMPONENT} + NAMES ${Guichan_LIBRARY} + PATHS /usr/lib /usr/local/lib + ) + + MARK_AS_ADVANCED(Guichan_LIBRARY_${COMPONENT}) + + IF (NOT EXISTS ${Guichan_INCLUDE_DIR}/${Guichan_HEADER} OR + NOT Guichan_LIBRARY_${COMPONENT}) + SET(GUICHAN_FOUND FALSE) + MESSAGE(FATAL_ERROR "Could NOT find Guichan component ${COMPONENT}") + ENDIF () + + # Check guichan >= 0.8.0 by searching for the widgetlistener.hpp file. + SET(Guichan_HEADER "guichan/widgetlistener.hpp") + IF (NOT EXISTS ${Guichan_INCLUDE_DIR}/${Guichan_HEADER}) + SET(GUICHAN_FOUND FALSE) + MESSAGE(FATAL_ERROR "Guichan version is less than 0.8.0") + ENDIF() + + IF (NOT Guichan_FIND_QUIETLY AND NOT Guichan_QUIET) + MESSAGE(STATUS "Found Guichan ${COMPONENT}: ${Guichan_LIBRARY_${COMPONENT}}") + ENDIF () + + SET(GUICHAN_LIBRARIES ${GUICHAN_LIBRARIES} ${Guichan_LIBRARY_${COMPONENT}}) +ENDFOREACH() diff --git a/CMake/Modules/FindLibIntl.cmake b/CMake/Modules/FindLibIntl.cmake new file mode 100644 index 000000000..e75960525 --- /dev/null +++ b/CMake/Modules/FindLibIntl.cmake @@ -0,0 +1,46 @@ +# Try to find the libintl library. Explicit searching is currently +# only required for Win32, though it might be useful for some UNIX +# variants, too. Therefore code for searching common UNIX include +# directories is included, too. +# +# Once done this will define +# +# LIBINTL_FOUND - system has libintl +# LIBINTL_LIBRARIES - the library needed for linking + +IF (LibIntl_LIBRARY) + SET(LibIntl_FIND_QUIETLY TRUE) +ENDIF () + +# for Windows we rely on the environement variables +# %INCLUDE% and %LIB%; FIND_LIBRARY checks %LIB% +# automatically on Windows +IF(WIN32) + FIND_LIBRARY(LibIntl_LIBRARY + NAMES intl + ) +ELSE() + FIND_LIBRARY(LibIntl_LIBRARY + NAMES intl + PATHS /usr/lib /usr/local/lib + ) +ENDIF() + +IF (LibIntl_LIBRARY) + SET(LIBINTL_FOUND TRUE) + SET(LIBINTL_LIBRARIES ${LibIntl_LIBRARY}) +ELSE () + SET(LIBINTL_FOUND FALSE) +ENDIF () + +IF (LIBINTL_FOUND) + IF (NOT LibIntl_FIND_QUIETLY) + MESSAGE(STATUS "Found libintl: ${LibIntl_LIBRARY}") + ENDIF () +ELSE () + IF (LibIntl_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find libintl") + ENDIF () +ENDIF () + +MARK_AS_ADVANCED(LibIntl_LIBRARY) diff --git a/CMake/Modules/FindSDL_gfx.cmake b/CMake/Modules/FindSDL_gfx.cmake new file mode 100644 index 000000000..74c1c6c74 --- /dev/null +++ b/CMake/Modules/FindSDL_gfx.cmake @@ -0,0 +1,39 @@ +# - Try to find SDL_gfx +# Once done this will define +# +# SDLGFX_FOUND - system has SDL_gfx +# SDLGFX_INCLUDE_DIR - the SDL_gfx include directory + +# Be quiet if SDL_gfx was already found +IF (SDL_gfx_INCLUDE_DIR AND SDL_gfx_LIBRARY) + SET(SDL_gfx_QUIET TRUE) +ENDIF (SDL_gfx_INCLUDE_DIR AND SDL_gfx_LIBRARY) + + +FIND_PATH(SDL_gfx_INCLUDE_DIR + NAMES SDL_rotozoom.h + PATH_SUFFIXES SDL + ) + +FIND_LIBRARY(SDL_gfx_LIBRARY + NAMES SDL_gfx + PATHS /usr/lib /usr/local/lib + ) + +MARK_AS_ADVANCED(SDL_gfx_INCLUDE_DIR SDL_gfx_LIBRARY) + + +IF (SDL_gfx_INCLUDE_DIR AND SDL_gfx_LIBRARY) + SET(SDLGFX_FOUND TRUE) + SET(SDLGFX_INCLUDE_DIR ${SDL_gfx_INCLUDE_DIR}) + SET(SDLGFX_LIBRARIES ${SDL_gfx_LIBRARY}) + + IF (NOT SDL_gfx_FIND_QUIETLY AND NOT SDL_gfx_QUIET) + MESSAGE(STATUS "Found SDL_gfx: ${SDL_gfx_LIBRARY}") + ENDIF (NOT SDL_gfx_FIND_QUIETLY AND NOT SDL_gfx_QUIET) +ENDIF (SDL_gfx_INCLUDE_DIR AND SDL_gfx_LIBRARY) + +# Bail out if SDL_gfx is not found but required +IF (NOT SDLGFX_FOUND AND SDL_gfx_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could NOT find SDL_gfx library ${SDLGFX_INCLUDE_DIR}") +ENDIF (NOT SDLGFX_FOUND AND SDL_gfx_FIND_REQUIRED) -- cgit v1.2.3-60-g2f50