Commit 8458efb3 authored by Jozef Legeny's avatar Jozef Legeny

core/cmake-modules:

+ added necessary find scripts for the kernel



git-svn-id: svn://scm.gforge.inria.fr/svn/openvibe@3606 c330d7e9-fc0c-0410-a5b3-fd85c6f5aa8f
parent 19fa2ddd
# ---------------------------------
# Finds OpenViBE
# Adds library to target
# Adds include path
# ---------------------------------
OPTION(DYNAMIC_LINK_OPENVIBE "Dynamically link OpenViBE" ON)
IF(DYNAMIC_LINK_OPENVIBE)
ADD_DEFINITIONS(-DOV_Shared)
ENDIF(DYNAMIC_LINK_OPENVIBE)
IF(DYNAMIC_LINK_OPENVIBE)
SET(OPENVIBE_LINKING "")
ELSE(DYNAMIC_LINK_OPENVIBE)
SET(OPENVIBE_LINKING "-static")
ENDIF(DYNAMIC_LINK_OPENVIBE)
IF(OV_BRANCH_OPENVIBE)
set(SRC_DIR ${OV_BASE_DIR}/openvibe/${OV_BRANCH_OPENVIBE})
ELSE(OV_BRANCH_OPENVIBE)
set(SRC_DIR ${OV_BASE_DIR}/openvibe/${OV_TRUNK})
ENDIF(OV_BRANCH_OPENVIBE)
FIND_PATH(PATH_OPENVIBE src/openvibe/ov_all.h PATHS ${SRC_DIR})
IF(PATH_OPENVIBE)
MESSAGE(STATUS " Found OpenViBE...")
INCLUDE_DIRECTORIES(${PATH_OPENVIBE}/src/)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} openvibe${OPENVIBE_LINKING})
ADD_DEFINITIONS(-DTARGET_HAS_OpenViBE)
ELSE(PATH_OPENVIBE)
MESSAGE(STATUS " FAILED to find OpenViBE...")
ENDIF(PATH_OPENVIBE)
# ---------------------------------
# Finds module FS
# Adds library to target
# Adds include path
# ---------------------------------
OPTION(DYNAMIC_LINK_OPENVIBE_MODULE_FS "Dynamically link OpenViBE module FS" ON)
IF(DYNAMIC_LINK_OPENVIBE_MODULE_FS)
SET(OPENVIBE_MODULE_FS_LINKING "")
ELSE(DYNAMIC_LINK_OPENVIBE_MODULE_FS)
SET(OPENVIBE_MODULE_FS_LINKING "-static")
ENDIF(DYNAMIC_LINK_OPENVIBE_MODULE_FS)
IF(OV_BRANCH_MODULES_FS)
set(SRC_DIR ${OV_BASE_DIR}/openvibe-modules/fs/${OV_BRANCH_MODULES_FS})
ELSE(OV_BRANCH_MODULES_FS)
set(SRC_DIR ${OV_BASE_DIR}/openvibe-modules/fs/${OV_TRUNK})
ENDIF(OV_BRANCH_MODULES_FS)
FIND_PATH(PATH_OPENVIBE_MODULES_FS src/fs/defines.h PATHS ${SRC_DIR})
IF(PATH_OPENVIBE_MODULES_FS)
MESSAGE(STATUS " Found OpenViBE module FS...")
INCLUDE_DIRECTORIES(${PATH_OPENVIBE_MODULES_FS}/src/)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} openvibe-module-fs${OPENVIBE_MODULE_FS_LINKING})
ADD_DEFINITIONS(-DTARGET_HAS_FS)
ELSE(PATH_OPENVIBE_MODULES_FS)
MESSAGE(STATUS " FAILED to find OpenViBE module FS...")
ENDIF(PATH_OPENVIBE_MODULES_FS)
# ---------------------------------
# Finds module System
# Adds library to target
# Adds include path
# ---------------------------------
OPTION(DYNAMIC_LINK_OPENVIBE_MODULE_SYSTEM "Dynamically link OpenViBE module System" ON)
IF(DYNAMIC_LINK_OPENVIBE_MODULE_SYSTEM)
SET(OPENVIBE_MODULE_SYSTEM_LINKING "")
ELSE(DYNAMIC_LINK_OPENVIBE_MODULE_SYSTEM)
SET(OPENVIBE_MODULE_SYSTEM_LINKING "-static")
ENDIF(DYNAMIC_LINK_OPENVIBE_MODULE_SYSTEM)
IF(OV_BRANCH_MODULES_SYSTEM)
set(SRC_DIR ${OV_BASE_DIR}/openvibe-modules/system/${OV_BRANCH_MODULES_SYSTEM})
ELSE(OV_BRANCH_MODULES_SYSTEM)
set(SRC_DIR ${OV_BASE_DIR}/openvibe-modules/system/${OV_TRUNK})
ENDIF(OV_BRANCH_MODULES_SYSTEM)
FIND_PATH(PATH_OPENVIBE_MODULES_SYSTEM src/system/defines.h PATHS ${SRC_DIR})
IF(PATH_OPENVIBE_MODULES_SYSTEM)
MESSAGE(STATUS " Found OpenViBE module System...")
INCLUDE_DIRECTORIES(${PATH_OPENVIBE_MODULES_SYSTEM}/src/)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} openvibe-module-system${OPENVIBE_MODULE_SYSTEM_LINKING})
ADD_DEFINITIONS(-DTARGET_HAS_System)
ELSE(PATH_OPENVIBE_MODULES_SYSTEM)
MESSAGE(STATUS " FAILED to find OpenViBE module System...")
ENDIF(PATH_OPENVIBE_MODULES_SYSTEM)
# ---------------------------------
# Finds module XML
# Adds library to target
# Adds include path
# ---------------------------------
OPTION(DYNAMIC_LINK_OPENVIBE_MODULE_XML "Dynamically link OpenViBE module XML" ON)
IF(DYNAMIC_LINK_OPENVIBE_MODULE_XML)
SET(OPENVIBE_MODULE_XML_LINKING "")
ELSE(DYNAMIC_LINK_OPENVIBE_MODULE_XML)
SET(OPENVIBE_MODULE_XML_LINKING "-static")
ENDIF(DYNAMIC_LINK_OPENVIBE_MODULE_XML)
IF(OV_BRANCH_MODULES_XML)
set(SRC_DIR ${OV_BASE_DIR}/openvibe-modules/xml/${OV_BRANCH_MODULES_XML})
ELSE(OV_BRANCH_MODULES_XML)
set(SRC_DIR ${OV_BASE_DIR}/openvibe-modules/xml/${OV_TRUNK})
ENDIF(OV_BRANCH_MODULES_XML)
FIND_PATH(PATH_OPENVIBE_MODULES_XML src/xml/defines.h PATHS ${SRC_DIR})
IF(PATH_OPENVIBE_MODULES_XML)
MESSAGE(STATUS " Found OpenViBE module XML...")
INCLUDE_DIRECTORIES(${PATH_OPENVIBE_MODULES_XML}/src/)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} openvibe-module-xml${OPENVIBE_MODULE_XML_LINKING})
ADD_DEFINITIONS(-DTARGET_HAS_XML)
ELSE(PATH_OPENVIBE_MODULES_XML)
MESSAGE(STATUS " FAILED to find OpenViBE module XML...")
ENDIF(PATH_OPENVIBE_MODULES_XML)
# ---------------------------------
# Finds third party boost
# Adds library to target
# Adds include path
# ---------------------------------
IF(UNIX)
FIND_LIBRARY(LIB_Boost_Thread NAMES "boost_thread-mt" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib NO_DEFAULT_PATH)
FIND_LIBRARY(LIB_Boost_Thread NAMES "boost_thread-mt" PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/lib)
IF(LIB_Boost_Thread)
MESSAGE(STATUS " [ OK ] lib ${LIB_Boost_Thread}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_Boost_Thread} )
ELSE(LIB_Boost_Thread)
MESSAGE(STATUS " [FAILED] lib boost_thread-mt")
ENDIF(LIB_Boost_Thread)
# For Fedora
FIND_LIBRARY(LIB_STANDARD_MODULE_PTHREAD pthread)
IF(LIB_STANDARD_MODULE_PTHREAD)
MESSAGE(STATUS " Found pthread...")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_STANDARD_MODULE_PTHREAD})
ELSE(LIB_STANDARD_MODULE_PTHREAD)
MESSAGE(STATUS " FAILED to find pthread...")
ENDIF(LIB_STANDARD_MODULE_PTHREAD)
ENDIF(UNIX)
IF(WIN32)
OV_LINK_BOOST_LIB("thread" ${OV_WIN32_BOOST_VERSION})
ENDIF(WIN32)
# ---------------------------------
# Finds GTK toolkit
#
# Sets GTK_FOUND
# Sets GTK_LIBRARIES
# Sets GTK_LIBRARY_DIRS
# Sets GTK_LDFLAGS
# Sets GTK_LDFLAGS_OTHERS
# Sets GTK_INCLUDE_DIRS
# Sets GTK_CFLAGS
# Sets GTK_CFLAGS_OTHERS
# ---------------------------------
INCLUDE("FindThirdPartyPkgConfig")
IF(WIN32)
pkg_check_modules(GTK gtk+-win32-2.0 gthread-2.0)
ELSE(WIN32)
pkg_check_modules(GTK "gtk+-2.0" "gthread-2.0")
ENDIF(WIN32)
IF(GTK_FOUND)
MESSAGE(STATUS " Found GTK+...")
INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS} ${GTHREAD_INCLUDE_DIRS})
#shouldn't add GTK_CFLAGS, this results in AdditionalIncludeDirectories becoming broken in visual studio
#ADD_DEFINITIONS(${GTK_CFLAGS} ${GTK_CFLAGS_OTHERS} ${GTHREAD_CFLAGS}${GTHREAD_CFLAGS_OTHERS})
#LINK_DIRECTORIES(${GTK_LIBRARY_DIRS} ${GTHREAD_LIBRARY_DIRS})
IF(WIN32)
SET( GTK_LIB_LIST ${GTK_LIBRARIES} ${GTHREAD_LIBRARIES} zdll)
ELSE(WIN32)
SET( GTK_LIB_LIST ${GTK_LIBRARIES} ${GTHREAD_LIBRARIES} z)
ENDIF(WIN32)
IF(WIN32)
# gdi32.lib could be under the MS Windows SDK
INCLUDE("OvSetWindowsSDKPath")
ENDIF(WIN32)
FOREACH(GTK_LIB ${GTK_LIB_LIST})
SET(GTK_LIB1 "GTK_LIB1-NOTFOUND")
FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${GTK_LIBRARY_DIRS} ${GTK_LIBDIR} NO_DEFAULT_PATH)
FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${GTK_LIBRARY_DIRS} ${GTK_LIBDIR})
IF(WIN32)
FIND_LIBRARY(GTK_LIB1 NAMES ${GTK_LIB} PATHS ${OV_MS_SDK_PATH}/lib)
ENDIF(WIN32)
IF(GTK_LIB1)
MESSAGE(STATUS " [ OK ] Third party lib ${GTK_LIB1}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${GTK_LIB1})
ELSE(GTK_LIB1)
MESSAGE(STATUS " [FAILED] Third party lib ${GTK_LIB}")
ENDIF(GTK_LIB1)
ENDFOREACH(GTK_LIB)
ELSE(GTK_FOUND)
MESSAGE(STATUS " FAILED to find GTK+...")
IF(NOT PKG_CONFIG_FOUND)
MESSAGE(STATUS " Did not even find pkg-config exe")
ENDIF(NOT PKG_CONFIG_FOUND)
ENDIF(GTK_FOUND)
# ---------------------------------
# Finds Ogre3D toolkit
#
# Sets Ogre3D_FOUND
# Sets Ogre3D_LIBRARIES
# Sets Ogre3D_LIBRARY_DIRS
# Sets Ogre3D_LDFLAGS
# Sets Ogre3D_LDFLAGS_OTHERS
# Sets Ogre3D_INCLUDE_DIRS
# Sets Ogre3D_CFLAGS
# Sets Ogre3D_CFLAGS_OTHERS
#
# Adds library to target
# Adds include path
# ---------------------------------
IF(WIN32)
FIND_PATH(PATH_Ogre3D include/OGRE/Ogre.h PATHS ${OV_CUSTOM_DEPENDENCIES_PATH}/ogre $ENV{OGRE_HOME})
IF(PATH_Ogre3D)
SET(Ogre3D_FOUND TRUE)
SET(OIS_FOUND TRUE)
SET(Ogre3D_INCLUDE_DIRS ${PATH_Ogre3D}/include/OGRE ${PATH_Ogre3D}/include/OIS)
SET(Ogre3D_LIBRARIES_RELEASE OgreMain OIS)
SET(Ogre3D_LIBRARY_DIRS_RELEASE ${PATH_Ogre3D}/lib/Release)
SET(Ogre3D_LIBRARIES_DEBUG OgreMain_d OIS_d)
SET(Ogre3D_LIBRARY_DIRS_DEBUG ${PATH_Ogre3D}/lib/Debug)
ENDIF(PATH_Ogre3D)
ENDIF(WIN32)
IF(UNIX)
INCLUDE("FindThirdPartyPkgConfig")
pkg_check_modules(Ogre3D OGRE)
pkg_check_modules(OIS OIS)
ENDIF(UNIX)
IF(Ogre3D_FOUND AND OIS_FOUND)
MESSAGE(STATUS " Found Ogre3D/OIS...")
INCLUDE_DIRECTORIES(${OIS_INCLUDE_DIRS} ${Ogre3D_INCLUDE_DIRS})
ADD_DEFINITIONS(${OIS_CFLAGS} ${Ogre3D_CFLAGS})
ADD_DEFINITIONS(${OIS_CFLAGS_OTHERS} ${Ogre3D_CFLAGS_OTHERS})
# MESSAGE(STATUS "A ${OIS_CFLAGS} ${Ogre3D_CFLAGS} B ${OIS_CFLAGS_OTHERS} ${Ogre3D_CFLAGS_OTHERS} C ${Ogre3D_LIBRARIES_RELEASE} D ${Ogre3D_LIBRARIES_DEBUG}")
IF(UNIX)
FOREACH(Ogre3D_LIB ${Ogre3D_LIBRARIES} ${OIS_LIBRARIES})
SET(Ogre3D_LIB1 "Ogre3D_LIB1-NOTFOUND")
FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB} PATHS ${Ogre3D_LIBRARY_DIRS} ${Ogre3D_LIBDIR} NO_DEFAULT_PATH)
FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB})
IF(Ogre3D_LIB1)
MESSAGE(STATUS " [ OK ] Third party lib ${Ogre3D_LIB1}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Ogre3D_LIB1})
ELSE(Ogre3D_LIB1)
MESSAGE(STATUS " [FAILED] Third party lib ${Ogre3D_LIB}")
ENDIF(Ogre3D_LIB1)
ENDFOREACH(Ogre3D_LIB)
ENDIF(UNIX)
IF(WIN32)
FOREACH(Ogre3D_LIB ${Ogre3D_LIBRARIES_RELEASE})
SET(Ogre3D_LIB1 "Ogre3D_LIB1-NOTFOUND")
FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB} PATHS ${Ogre3D_LIBRARY_DIRS_RELEASE} ${Ogre3D_LIBDIR} NO_DEFAULT_PATH)
FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB})
IF(Ogre3D_LIB1)
MESSAGE(STATUS " [ OK ] Third party lib ${Ogre3D_LIB1}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${Ogre3D_LIB1})
ELSE(Ogre3D_LIB1)
MESSAGE(STATUS " [FAILED] Third party lib ${Ogre3D_LIB}")
ENDIF(Ogre3D_LIB1)
ENDFOREACH(Ogre3D_LIB)
FOREACH(Ogre3D_LIB ${Ogre3D_LIBRARIES_DEBUG})
SET(Ogre3D_LIB1 "Ogre3D_LIB1-NOTFOUND")
FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB} PATHS ${Ogre3D_LIBRARY_DIRS_DEBUG} ${Ogre3D_LIBDIR} NO_DEFAULT_PATH)
FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB})
IF(Ogre3D_LIB1)
MESSAGE(STATUS " [ OK ] Third party lib ${Ogre3D_LIB1}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${Ogre3D_LIB1})
ELSE(Ogre3D_LIB1)
MESSAGE(STATUS " [FAILED] Third party lib ${Ogre3D_LIB}")
ENDIF(Ogre3D_LIB1)
ENDFOREACH(Ogre3D_LIB)
ENDIF(WIN32)
ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyOgre3D)
ELSE(Ogre3D_FOUND AND OIS_FOUND)
MESSAGE(STATUS " FAILED to find Ogre3D/OIS...")
ENDIF(Ogre3D_FOUND AND OIS_FOUND)
# ---------------------------------
# Finds X11 toolkit
#
# Sets X11_FOUND
# Sets X11_LIBRARIES
# Sets X11_LIBRARY_DIRS
# Sets X11_LDFLAGS
# Sets X11_LDFLAGS_OTHERS
# Sets X11_INCLUDE_DIRS
# Sets X11_CFLAGS
# Sets X11_CFLAGS_OTHERS
# ---------------------------------
IF(UNIX)
INCLUDE("FindThirdPartyPkgConfig")
pkg_check_modules(X11 x11)
IF(X11_FOUND)
MESSAGE(STATUS " Found X11...")
INCLUDE_DIRECTORIES(${X11_INCLUDE_DIRS})
ADD_DEFINITIONS(${X11_CFLAGS})
ADD_DEFINITIONS(${X11_CFLAGS_OTHERS})
# LINK_DIRECTORIES(${X11_LIBRARY_DIRS})
FOREACH(X11_LIB ${X11_LIBRARIES})
SET(X11_LIB1 "X11_LIB1-NOTFOUND")
FIND_LIBRARY(X11_LIB1 NAMES ${X11_LIB} PATHS ${X11_LIBRARY_DIRS} ${X11_LIBDIR} NO_DEFAULT_PATH)
FIND_LIBRARY(X11_LIB1 NAMES ${X11_LIB})
IF(X11_LIB1)
MESSAGE(STATUS " [ OK ] Third party lib ${X11_LIB1}")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${X11_LIB1})
ELSE(X11_LIB1)
MESSAGE(STATUS " [FAILED] Third party lib ${X11_LIB}")
ENDIF(X11_LIB1)
ENDFOREACH(X11_LIB)
ELSE(X11_FOUND)
MESSAGE(STATUS " FAILED to find X11...")
ENDIF(X11_FOUND)
ENDIF(UNIX)
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