You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindThirdPartyOgre3D.cmake 4.2KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # ---------------------------------
  2. # Finds Ogre3D toolkit
  3. #
  4. # Sets Ogre3D_FOUND
  5. # Sets Ogre3D_LIBRARIES
  6. # Sets Ogre3D_LIBRARY_DIRS
  7. # Sets Ogre3D_LDFLAGS
  8. # Sets Ogre3D_LDFLAGS_OTHERS
  9. # Sets Ogre3D_INCLUDE_DIRS
  10. # Sets Ogre3D_CFLAGS
  11. # Sets Ogre3D_CFLAGS_OTHERS
  12. #
  13. # Adds library to target
  14. # Adds include path
  15. # ---------------------------------
  16. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyOgre3D)
  17. IF(OV_DISABLE_OGRE)
  18. OV_PRINT(OV_PRINTED " SKIPPED Ogre3D/OIS, disabled, no 3D ...")
  19. RETURN()
  20. ENDIF(OV_DISABLE_OGRE)
  21. IF(WIN32)
  22. FIND_PATH(PATH_Ogre3D include/OGRE/Ogre.h PATHS ${LIST_DEPENDENCIES_PATH} $ENV{OGRE_HOME} PATH_SUFFIXES ogre .)
  23. IF(PATH_Ogre3D)
  24. SET(Ogre3D_FOUND TRUE)
  25. SET(OIS_FOUND TRUE)
  26. SET(Ogre3D_INCLUDE_DIRS ${PATH_Ogre3D}/include/OGRE ${PATH_Ogre3D}/include/OIS)
  27. # Currently the different versions we package for different VS have a bit different libs...
  28. STRING(REGEX MATCH "vc100.*" MSVC_VER100 ${MSVC_SERVICE_PACK})
  29. STRING(REGEX MATCH "vc120.*" MSVC_VER120 ${MSVC_SERVICE_PACK})
  30. IF(MSVC_VER100)
  31. SET(Ogre3D_LIBRARIES_RELEASE OgreMain OIS)
  32. SET(Ogre3D_LIBRARIES_DEBUG OgreMain_d OIS_d)
  33. SET(Ogre3D_LIBRARY_DIRS_DEBUG ${PATH_Ogre3D}/lib/Debug)
  34. ENDIF(MSVC_VER100)
  35. IF(MSVC_VER120)
  36. SET(Ogre3D_LIBRARIES_RELEASE OgreMain OgreOverlay OIS)
  37. SET(Ogre3D_LIBRARIES_DEBUG OgreMain_d OgreOverlay_d OIS_d)
  38. ENDIF(MSVC_VER120)
  39. SET(Ogre3D_LIBRARY_DIRS_DEBUG ${PATH_Ogre3D}/lib/Debug)
  40. SET(Ogre3D_LIBRARY_DIRS_RELEASE ${PATH_Ogre3D}/lib/Release)
  41. ENDIF(PATH_Ogre3D)
  42. ENDIF(WIN32)
  43. IF(UNIX)
  44. INCLUDE("FindThirdPartyPkgConfig")
  45. pkg_check_modules(Ogre3D OGRE)
  46. pkg_check_modules(OIS OIS)
  47. ENDIF(UNIX)
  48. IF(Ogre3D_FOUND AND OIS_FOUND)
  49. OV_PRINT(OV_PRINTED " Found Ogre3D/OIS...")
  50. INCLUDE_DIRECTORIES(${OIS_INCLUDE_DIRS} ${Ogre3D_INCLUDE_DIRS})
  51. ADD_DEFINITIONS(${OIS_CFLAGS} ${Ogre3D_CFLAGS})
  52. ADD_DEFINITIONS(${OIS_CFLAGS_OTHERS} ${Ogre3D_CFLAGS_OTHERS})
  53. # OV_PRINT(OV_PRINTED "A ${OIS_CFLAGS} ${Ogre3D_CFLAGS} B ${OIS_CFLAGS_OTHERS} ${Ogre3D_CFLAGS_OTHERS} C ${Ogre3D_LIBRARIES_RELEASE} D ${Ogre3D_LIBRARIES_DEBUG}")
  54. IF(UNIX)
  55. IF(Ogre3D_VERSION VERSION_EQUAL "1.9.0" OR Ogre3D_VERSION VERSION_GREATER "1.9.0")
  56. SET(Ogre3D_LIBRARIES "${Ogre3_LIBRARIES};OgreOverlay")
  57. ENDIF(Ogre3D_VERSION VERSION_EQUAL "1.9.0" OR Ogre3D_VERSION VERSION_GREATER "1.9.0")
  58. FOREACH(Ogre3D_LIB ${Ogre3D_LIBRARIES} ${OIS_LIBRARIES})
  59. SET(Ogre3D_LIB1 "Ogre3D_LIB1-NOTFOUND")
  60. FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB} PATHS ${Ogre3D_LIBRARY_DIRS} ${Ogre3D_LIBDIR} NO_DEFAULT_PATH)
  61. FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB})
  62. IF(Ogre3D_LIB1)
  63. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3D_LIB1}")
  64. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Ogre3D_LIB1})
  65. ELSE(Ogre3D_LIB1)
  66. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${Ogre3D_LIB}")
  67. ENDIF(Ogre3D_LIB1)
  68. ENDFOREACH(Ogre3D_LIB)
  69. ENDIF(UNIX)
  70. IF(WIN32)
  71. FOREACH(Ogre3D_LIB ${Ogre3D_LIBRARIES_RELEASE})
  72. SET(Ogre3D_LIB1 "Ogre3D_LIB1-NOTFOUND")
  73. FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB} PATHS ${Ogre3D_LIBRARY_DIRS_RELEASE} ${Ogre3D_LIBDIR} NO_DEFAULT_PATH)
  74. FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB})
  75. IF(Ogre3D_LIB1)
  76. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3D_LIB1}")
  77. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${Ogre3D_LIB1})
  78. ELSE(Ogre3D_LIB1)
  79. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${Ogre3D_LIB}")
  80. ENDIF(Ogre3D_LIB1)
  81. ENDFOREACH(Ogre3D_LIB)
  82. FOREACH(Ogre3D_LIB ${Ogre3D_LIBRARIES_DEBUG})
  83. SET(Ogre3D_LIB1 "Ogre3D_LIB1-NOTFOUND")
  84. FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB} PATHS ${Ogre3D_LIBRARY_DIRS_DEBUG} ${Ogre3D_LIBDIR} NO_DEFAULT_PATH)
  85. FIND_LIBRARY(Ogre3D_LIB1 NAMES ${Ogre3D_LIB})
  86. IF(Ogre3D_LIB1)
  87. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${Ogre3D_LIB1}")
  88. TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${Ogre3D_LIB1})
  89. ELSE(Ogre3D_LIB1)
  90. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${Ogre3D_LIB}")
  91. ENDIF(Ogre3D_LIB1)
  92. ENDFOREACH(Ogre3D_LIB)
  93. ENDIF(WIN32)
  94. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyOgre3D)
  95. ELSE(Ogre3D_FOUND AND OIS_FOUND)
  96. OV_PRINT(OV_PRINTED " FAILED to find Ogre3D/OIS...")
  97. ENDIF(Ogre3D_FOUND AND OIS_FOUND)
  98. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyOgre3D "Yes")