Commit 1346e075 authored by Dieter Devlaminck's avatar Dieter Devlaminck

added cmake modules for boost math and for external stimulator, added also...

added cmake modules for boost math and for external stimulator, added also GNUInstallDirs.cmake to solve issue on Fedora14
parent 0ca01448
# ---------------------------------
# Finds third party boost
# Adds library to target
# Adds include path
# ---------------------------------
INCLUDE("FindThirdPartyBoost")
IF(UNIX)
FIND_LIBRARY(LIB_Boost_Math NAMES "boost_math_c99" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib NO_DEFAULT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
MESSAGE(STATUS " looking in ${OV_CUSTOM_DEPENDENCIES_PATH}")
IF(LIB_Boost_Math)
MESSAGE(STATUS " [ OK ] lib ${LIB_Boost_Math}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_Boost_Math} )
ELSE(LIB_Boost_Math)
MESSAGE(STATUS " [FAILED] lib libboost_math_c99")
ENDIF(LIB_Boost_Math)
ENDIF(UNIX)
IF(WIN32)
IF(PATH_BOOST)
LINK_DIRECTORIES("math" ${OV_WIN32_BOOST_VERSION})
ENDIF(PATH_BOOST)
ENDIF(WIN32)
# ---------------------------------
# Finds OpenGL
# Adds library to target
# Adds include path
# ---------------------------------
SET(foundIncludeDir 1)
#GL is natively installed on our Linux pc's and comes with the installation of visual studio. In that case however, one has to make sure the SDK is in the INCLUDE environment variable
IF(WIN32)
FIND_PATH(PATH_GL GL\\gl.h)
ELSE(WIN32)
FIND_PATH(PATH_GL GL/gl.h)
ENDIF(WIN32)
IF(PATH_GL)
MESSAGE(STATUS " Found OpenGL in ${PATH_GL}" )
INCLUDE_DIRECTORIES(${PATH_GL})
ELSE(PATH_GL)
SET(foundIncludeDir 0)
ENDIF(PATH_GL)
FIND_PATH(PATH_FreeType include/ft2build.h PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/FreeType ${OV_CUSTOM_DEPENDENCIES_PATH}/include/FreeType/ NO_DEFAULT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
IF(PATH_FreeType)
MESSAGE(STATUS " Found FreeType in ${PATH_FreeType}" )
IF(WIN32)
INCLUDE_DIRECTORIES(${PATH_FreeType}/include)
ELSE(WIN32)
INCLUDE_DIRECTORIES(${PATH_FreeType}/include/freetype2)
ENDIF(WIN32)
ELSE(PATH_FreeType)
SET(foundIncludeDir 0)
ENDIF(PATH_FreeType)
#needs to be installed on both platforms (headers not present on our Linux box), headers should be installed in $ENV{OV_DEP_ExternalStimulator}/FTGL/include
FIND_PATH(PATH_FTGL include/FTGL/ftgl.h PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/FTGL ${OV_CUSTOM_DEPENDENCIES_PATH}/include/FTGL)
IF(PATH_FTGL)
MESSAGE(STATUS " Found FTGL in ${PATH_FTGL}" )
INCLUDE_DIRECTORIES(${PATH_FTGL}/include)
ELSE(PATH_FTGL)
SET(foundIncludeDir 0)
ENDIF(PATH_FTGL)
#natively installed on our Linux pc's, but should be installed on our Windows pc separately. Headers should be in $ENV{OV_DEP_ExternalStimulator}/SDL/include
IF(WIN32)
FIND_PATH(PATH_SDL include/SDL.h PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/SDL ${OV_CUSTOM_DEPENDENCIES_PATH}/include/SDL)
IF(PATH_SDL)
MESSAGE(STATUS " Found SDL in ${PATH_SDL}" )
INCLUDE_DIRECTORIES(${PATH_SDL}/include)
ELSE(PATH_SDL)
SET(foundIncludeDir 0)
ENDIF(PATH_SDL)
ELSE(WIN32)
FIND_PATH(PATH_SDL SDL/SDL.h)
IF(PATH_SDL)
MESSAGE(STATUS " Found SDL in ${PATH_SDL}" )
INCLUDE_DIRECTORIES(${PATH_SDL}/SDL)
ELSE(PATH_SDL)
SET(foundIncludeDir 0)
ENDIF(PATH_SDL)
ENDIF(WIN32)
#include windows library inpout32 for writing to parallel port
IF(WIN32)
FIND_PATH(INPOUT32 include/inpout32.h ${OV_CUSTOM_DEPENDENCIES_PATH}/inpout32/)
IF(INPOUT32)
MESSAGE(STATUS " Found inpout32 in ${INPOUT32}")
INCLUDE_DIRECTORIES(${INPOUT32}/include)
ELSE(INPOUT32)
SET(foundIncludeDir 0)
ENDIF(INPOUT32)
ENDIF(WIN32)
FIND_PATH(PATH_PRESAGE presage.h PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/include/presage/ ${OV_CUSTOM_DEPENDENCIES_PATH}/presage/include)
IF(PATH_PRESAGE)
MESSAGE(STATUS " Found Presage in ${PATH_PRESAGE}")
INCLUDE_DIRECTORIES(${PATH_PRESAGE})
SET(name_libpresage presage)
ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyPresage)
ELSE(PATH_PRESAGE)
MESSAGE(STATUS " FAILED to find Presage")
ENDIF(PATH_PRESAGE)
IF(foundIncludeDir)
IF(WIN32)
FIND_LIBRARY(LIB_GL OpenGL32)
#FIND_LIBRARY(LIB_glut glut32)
FIND_LIBRARY(LIB_SDL SDL PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/SDL/lib)
FIND_LIBRARY(LIB_SDLmain SDLmain PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/SDL/lib )
FIND_LIBRARY(LIB_FTGL ftgl PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/FTGL/lib)
FIND_LIBRARY(LIB_SDL_image SDL_image PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/SDL/lib)
FIND_LIBRARY(LIB_presage libpresage-1 PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/presage/lib)
IF(LIB_GL AND LIB_FTGL AND LIB_SDL AND LIB_SDLmain AND LIB_SDL_image)
MESSAGE(STATUS " [ OK ] lib ${LIB_GL}, ${LIB_FTGL}, ${LIB_SDL}, ${LIB_SDLmain}, ${LIB_SDL_image}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME}-dynamic ${LIB_GL} ${LIB_FTGL} ${LIB_SDL} ${LIB_SDLmain} ${LIB_SDL_image})
ELSE(LIB_GL AND LIB_FTGL AND LIB_SDL AND LIB_SDLmain AND LIB_SDL_image)
MESSAGE(STATUS " [FAILED] lib GL FTGL SDL")
ENDIF(LIB_GL AND LIB_FTGL AND LIB_SDL AND LIB_SDLmain AND LIB_SDL_image)
IF(LIB_presage)
MESSAGE(STATUS " [ OK ] lib ${LIB_presage}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME}-dynamic ${LIB_presage})
ELSE( LIB_presage)
MESSAGE(STATUS " [FAILED] lib presage")
ENDIF(LIB_presage)
#inpout32.lib
FIND_LIBRARY(LIB_INPOUT32 NAMES "inpout32.lib" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/inpout32/lib/)
IF(LIB_INPOUT32)
MESSAGE(STATUS " [ OK ] lib ${LIB_INPOUT32}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_INPOUT32} )
ELSE(LIB_INPOUT32)
MESSAGE(STATUS " [FAILED] lib inpout32")
ENDIF(LIB_INPOUT32)
ELSE(WIN32)
FIND_LIBRARY(LIB_GL GL)
FIND_LIBRARY(LIB_GLU GLU)
#FIND_LIBRARY(LIB_glut glut)
FIND_LIBRARY(LIB_SDL_image SDL_image)
FIND_LIBRARY(LIB_SDL SDL)
FIND_LIBRARY(LIB_FTGL NAMES ftgl PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib/)
FIND_LIBRARY(LIB_PRESAGE ${name_libpresage} PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib/)
IF(LIB_GL AND LIB_GLU AND LIB_FTGL AND LIB_SDL AND LIB_PRESAGE)
MESSAGE(STATUS " [ OK ] lib ${LIB_GL}, ${LIB_GLU}, ${LIB_FTGL}, ${LIB_SDL} and ${LIB_PRESAGE}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_GL} ${LIB_GLU} ${LIB_FTGL} ${LIB_SDL} ${LIB_SDL_image} ${LIB_PRESAGE})
ELSE(LIB_GL AND LIB_GLU AND LIB_FTGL AND LIB_SDL AND LIB_PRESAGE)
MESSAGE(STATUS " [FAILED] lib GL GLU FTGL SDL presage")
ENDIF(LIB_GL AND LIB_GLU AND LIB_FTGL AND LIB_SDL AND LIB_PRESAGE)
#pthread and rt seemed to be necessary on linux when using boost interprocess communication
TARGET_LINK_LIBRARIES(${PROJECT_NAME} pthread rt)
ENDIF(WIN32)
ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyModulesForExternalStimulator -D_GNU_SOURCE=1 -D_REENTRANT)
ENDIF(foundIncludeDir)
# - Define GNU standard installation directories
# Provides install directory variables as defined for GNU software:
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
# Inclusion of this module defines the following variables:
# CMAKE_INSTALL_<dir> - destination for files of a given type
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
# where <dir> is one of:
# BINDIR - user executables (bin)
# SBINDIR - system admin executables (sbin)
# LIBEXECDIR - program executables (libexec)
# SYSCONFDIR - read-only single-machine data (etc)
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
# LOCALSTATEDIR - modifiable single-machine data (var)
# LIBDIR - object code libraries (lib or lib64)
# INCLUDEDIR - C header files (include)
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
# DATAROOTDIR - read-only architecture-independent data root (share)
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
# INFODIR - info documentation (DATAROOTDIR/info)
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
# MANDIR - man documentation (DATAROOTDIR/man)
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
# install() commands for the corresponding file type. If the includer does
# not define a value the above-shown default will be used and the value will
# appear in the cache for editing by the user.
# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
# from the corresponding destination by prepending (if necessary) the value
# of CMAKE_INSTALL_PREFIX.
#=============================================================================
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
# Copyright 2011 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Installation directories
#
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
endif()
if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
endif()
if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
endif()
if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
endif()
if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(_LIBDIR_DEFAULT "lib")
# Override this default 'lib' with 'lib64' iff:
# - we are on Linux system but NOT cross-compiling
# - we are NOT on debian
# - we are on a 64 bits system
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
# Note that the future of multi-arch handling may be even
# more complicated than that: http://wiki.debian.org/Multiarch
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
AND NOT CMAKE_CROSSCOMPILING
AND NOT EXISTS "/etc/debian_version")
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
message(AUTHOR_WARNING
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
"Please enable at least one language before including GNUInstallDirs.")
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(_LIBDIR_DEFAULT "lib64")
endif()
endif()
endif()
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
endif()
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
endif()
if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
endif()
if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
endif()
#-----------------------------------------------------------------------------
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
# the cache and store the defaults in local variables if the cache values are
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
if(NOT CMAKE_INSTALL_DATADIR)
set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
endif()
if(NOT CMAKE_INSTALL_INFODIR)
set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
endif()
if(NOT CMAKE_INSTALL_LOCALEDIR)
set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
endif()
if(NOT CMAKE_INSTALL_MANDIR)
set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
endif()
if(NOT CMAKE_INSTALL_DOCDIR)
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
endif()
#-----------------------------------------------------------------------------
mark_as_advanced(
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_SBINDIR
CMAKE_INSTALL_LIBEXECDIR
CMAKE_INSTALL_SYSCONFDIR
CMAKE_INSTALL_SHAREDSTATEDIR
CMAKE_INSTALL_LOCALSTATEDIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_INCLUDEDIR
CMAKE_INSTALL_OLDINCLUDEDIR
CMAKE_INSTALL_DATAROOTDIR
CMAKE_INSTALL_DATADIR
CMAKE_INSTALL_INFODIR
CMAKE_INSTALL_LOCALEDIR
CMAKE_INSTALL_MANDIR
CMAKE_INSTALL_DOCDIR
)
# Result directories
#
foreach(dir
BINDIR
SBINDIR
LIBEXECDIR
SYSCONFDIR
SHAREDSTATEDIR
LOCALSTATEDIR
LIBDIR
INCLUDEDIR
OLDINCLUDEDIR
DATAROOTDIR
DATADIR
INFODIR
LOCALEDIR
MANDIR
DOCDIR
)
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
else()
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
endif()
endforeach()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment