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.

148 lines
4.1 KiB

  1. # - Try to find the PIXMAN library
  2. # Once done this will define
  3. #
  4. # PIXMAN_ROOT_DIR - Set this variable to the root installation of PIXMAN
  5. #
  6. # Read-Only variables:
  7. # PIXMAN_FOUND - system has the PIXMAN library
  8. # PIXMAN_INCLUDE_DIR - the PIXMAN include directory
  9. # PIXMAN_LIBRARIES - The libraries needed to use PIXMAN
  10. # PIXMAN_VERSION - This is set to $major.$minor.$revision (eg. 0.9.8)
  11. #=============================================================================
  12. # Copyright 2012 Dmitry Baryshnikov <polimax at mail dot ru>
  13. # Copyright 2017 Simon Richter <Simon.Richter at hogyros dot de>
  14. #
  15. # Distributed under the OSI-approved BSD License (the "License");
  16. # see accompanying file Copyright.txt for details.
  17. #
  18. # This software is distributed WITHOUT ANY WARRANTY; without even the
  19. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. # See the License for more information.
  21. #=============================================================================
  22. # (To distribute this file outside of CMake, substitute the full
  23. # License text for the above reference.)
  24. find_package(PkgConfig)
  25. if(PKG_CONFIG_FOUND)
  26. pkg_check_modules(_PIXMAN pixman-1)
  27. endif (PKG_CONFIG_FOUND)
  28. SET(_PIXMAN_ROOT_HINTS
  29. $ENV{PIXMAN}
  30. ${PIXMAN_ROOT_DIR}
  31. )
  32. SET(_PIXMAN_ROOT_PATHS
  33. $ENV{PIXMAN}/src
  34. /usr
  35. /usr/local
  36. )
  37. SET(_PIXMAN_ROOT_HINTS_AND_PATHS
  38. HINTS ${_PIXMAN_ROOT_HINTS}
  39. PATHS ${_PIXMAN_ROOT_PATHS}
  40. )
  41. FIND_PATH(PIXMAN_INCLUDE_DIR
  42. NAMES
  43. pixman.h
  44. HINTS
  45. ${_PIXMAN_INCLUDEDIR}
  46. ${_PIXMAN_ROOT_HINTS_AND_PATHS}
  47. PATH_SUFFIXES
  48. include
  49. "include/pixman-1"
  50. )
  51. IF(NOT PKGCONFIG_FOUND AND WIN32 AND NOT CYGWIN)
  52. # MINGW should go here too
  53. IF(MSVC)
  54. # Implementation details:
  55. # We are using the libraries located in the VC subdir instead of the parent directory eventhough :
  56. FIND_LIBRARY(PIXMAN
  57. NAMES
  58. pixman-1
  59. ${_PIXMAN_ROOT_HINTS_AND_PATHS}
  60. PATH_SUFFIXES
  61. "lib"
  62. "VC"
  63. "lib/VC"
  64. )
  65. MARK_AS_ADVANCED(PIXMAN)
  66. set( PIXMAN_LIBRARIES ${PIXMAN})
  67. ELSEIF(MINGW)
  68. # same player, for MingW
  69. FIND_LIBRARY(PIXMAN
  70. NAMES
  71. pixman-1
  72. ${_PIXMAN_ROOT_HINTS_AND_PATHS}
  73. PATH_SUFFIXES
  74. "lib"
  75. "lib/MinGW"
  76. )
  77. MARK_AS_ADVANCED(PIXMAN)
  78. set( PIXMAN_LIBRARIES ${PIXMAN})
  79. ELSE(MSVC)
  80. # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
  81. FIND_LIBRARY(PIXMAN
  82. NAMES
  83. pixman-1
  84. HINTS
  85. ${_PIXMAN_LIBDIR}
  86. ${_PIXMAN_ROOT_HINTS_AND_PATHS}
  87. PATH_SUFFIXES
  88. lib
  89. )
  90. MARK_AS_ADVANCED(PIXMAN)
  91. set( PIXMAN_LIBRARIES ${PIXMAN} )
  92. ENDIF(MSVC)
  93. ELSE()
  94. FIND_LIBRARY(PIXMAN_LIBRARY
  95. NAMES
  96. pixman-1
  97. HINTS
  98. ${_PIXMAN_LIBDIR}
  99. ${_PIXMAN_ROOT_HINTS_AND_PATHS}
  100. PATH_SUFFIXES
  101. "lib"
  102. "local/lib"
  103. )
  104. MARK_AS_ADVANCED(PIXMAN_LIBRARY)
  105. # compat defines
  106. SET(PIXMAN_LIBRARIES ${PIXMAN_LIBRARY})
  107. ENDIF()
  108. #message( STATUS "Pixman_FIND_VERSION=${Pixman_FIND_VERSION}.")
  109. #message( STATUS "PIXMAN_INCLUDE_DIR=${PIXMAN_INCLUDE_DIR}.")
  110. # Fetch version from pixman-version.h if a version was requested by find_package()
  111. if(PIXMAN_INCLUDE_DIR AND Pixman_FIND_VERSION)
  112. file(READ "${PIXMAN_INCLUDE_DIR}/pixman-version.h" _PIXMAN_VERSION_H_CONTENTS)
  113. string(REGEX REPLACE "^(.*\n)?#define[ \t]+PIXMAN_VERSION_MAJOR[ \t]+([0-9]+).*"
  114. "\\2" PIXMAN_VERSION_MAJOR ${_PIXMAN_VERSION_H_CONTENTS})
  115. string(REGEX REPLACE "^(.*\n)?#define[ \t]+PIXMAN_VERSION_MINOR[ \t]+([0-9]+).*"
  116. "\\2" PIXMAN_VERSION_MINOR ${_PIXMAN_VERSION_H_CONTENTS})
  117. string(REGEX REPLACE "^(.*\n)?#define[ \t]+PIXMAN_VERSION_MICRO[ \t]+([0-9]+).*"
  118. "\\2" PIXMAN_VERSION_MICRO ${_PIXMAN_VERSION_H_CONTENTS})
  119. set(PIXMAN_VERSION ${PIXMAN_VERSION_MAJOR}.${PIXMAN_VERSION_MINOR}.${PIXMAN_VERSION_MICRO}
  120. CACHE INTERNAL "The version number for Pixman libraries")
  121. endif()
  122. include(FindPackageHandleStandardArgs)
  123. find_package_handle_standard_args(Pixman
  124. REQUIRED_VARS
  125. PIXMAN_LIBRARIES
  126. PIXMAN_INCLUDE_DIR
  127. VERSION_VAR
  128. PIXMAN_VERSION
  129. )
  130. MARK_AS_ADVANCED(PIXMAN_INCLUDE_DIR PIXMAN_LIBRARIES)