114 lines
4.2 KiB
CMake
114 lines
4.2 KiB
CMake
# ---------------------------------
|
|
# 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
|
|
# ---------------------------------
|
|
|
|
GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyOgre3D)
|
|
|
|
IF(OV_DISABLE_OGRE)
|
|
OV_PRINT(OV_PRINTED " SKIPPED Ogre3D/OIS, disabled, no 3D ...")
|
|
RETURN()
|
|
ENDIF(OV_DISABLE_OGRE)
|
|
|
|
IF(WIN32)
|
|
FIND_PATH(PATH_Ogre3D include/OGRE/Ogre.h PATHS ${LIST_DEPENDENCIES_PATH} $ENV{OGRE_HOME} PATH_SUFFIXES ogre .)
|
|
IF(PATH_Ogre3D)
|
|
SET(Ogre3D_FOUND TRUE)
|
|
SET(OIS_FOUND TRUE)
|
|
SET(Ogre3D_INCLUDE_DIRS ${PATH_Ogre3D}/include/OGRE ${PATH_Ogre3D}/include/OIS)
|
|
|
|
# Currently the different versions we package for different VS have a bit different libs...
|
|
STRING(REGEX MATCH "vc100.*" MSVC_VER100 ${MSVC_SERVICE_PACK})
|
|
STRING(REGEX MATCH "vc120.*" MSVC_VER120 ${MSVC_SERVICE_PACK})
|
|
IF(MSVC_VER100)
|
|
SET(Ogre3D_LIBRARIES_RELEASE OgreMain OIS)
|
|
SET(Ogre3D_LIBRARIES_DEBUG OgreMain_d OIS_d)
|
|
SET(Ogre3D_LIBRARY_DIRS_DEBUG ${PATH_Ogre3D}/lib/Debug)
|
|
ENDIF(MSVC_VER100)
|
|
IF(MSVC_VER120)
|
|
SET(Ogre3D_LIBRARIES_RELEASE OgreMain OgreOverlay OIS)
|
|
SET(Ogre3D_LIBRARIES_DEBUG OgreMain_d OgreOverlay_d OIS_d)
|
|
ENDIF(MSVC_VER120)
|
|
|
|
SET(Ogre3D_LIBRARY_DIRS_DEBUG ${PATH_Ogre3D}/lib/Debug)
|
|
SET(Ogre3D_LIBRARY_DIRS_RELEASE ${PATH_Ogre3D}/lib/Release)
|
|
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)
|
|
OV_PRINT(OV_PRINTED " 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})
|
|
# OV_PRINT(OV_PRINTED "A ${OIS_CFLAGS} ${Ogre3D_CFLAGS} B ${OIS_CFLAGS_OTHERS} ${Ogre3D_CFLAGS_OTHERS} C ${Ogre3D_LIBRARIES_RELEASE} D ${Ogre3D_LIBRARIES_DEBUG}")
|
|
|
|
IF(UNIX)
|
|
IF(Ogre3D_VERSION VERSION_EQUAL "1.9.0" OR Ogre3D_VERSION VERSION_GREATER "1.9.0")
|
|
SET(Ogre3D_LIBRARIES "${Ogre3_LIBRARIES};OgreOverlay")
|
|
ENDIF(Ogre3D_VERSION VERSION_EQUAL "1.9.0" OR Ogre3D_VERSION VERSION_GREATER "1.9.0")
|
|
|
|
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)
|
|
OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3D_LIB1}")
|
|
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Ogre3D_LIB1})
|
|
ELSE(Ogre3D_LIB1)
|
|
OV_PRINT(OV_PRINTED " [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)
|
|
OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3D_LIB1}")
|
|
TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${Ogre3D_LIB1})
|
|
ELSE(Ogre3D_LIB1)
|
|
OV_PRINT(OV_PRINTED " [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)
|
|
OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3D_LIB1}")
|
|
TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${Ogre3D_LIB1})
|
|
ELSE(Ogre3D_LIB1)
|
|
OV_PRINT(OV_PRINTED " [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)
|
|
OV_PRINT(OV_PRINTED " FAILED to find Ogre3D/OIS...")
|
|
ENDIF(Ogre3D_FOUND AND OIS_FOUND)
|
|
|
|
|
|
|
|
SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyOgre3D "Yes")
|
|
|