Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

FindSDL2TTF.cmake 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # Locate SDL2 library
  2. # This module defines
  3. # SDL2_LIBRARY, the name of the library to link against
  4. # SDL2_FOUND, if false, do not try to link to SDL2
  5. # SDL2_INCLUDE_DIR, where to find SDL.h
  6. #
  7. # This module responds to the the flag:
  8. # SDL2_BUILDING_LIBRARY
  9. # If this is defined, then no SDL2main will be linked in because
  10. # only applications need main().
  11. # Otherwise, it is assumed you are building an application and this
  12. # module will attempt to locate and set the the proper link flags
  13. # as part of the returned SDL2_LIBRARY variable.
  14. #
  15. # Don't forget to include SDLmain.h and SDLmain.m your project for the
  16. # OS X framework based version. (Other versions link to -lSDL2main which
  17. # this module will try to find on your behalf.) Also for OS X, this
  18. # module will automatically add the -framework Cocoa on your behalf.
  19. #
  20. #
  21. # Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
  22. # and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
  23. # (SDL2.dll, libsdl2.so, SDL2.framework, etc).
  24. # Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
  25. # Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
  26. # as appropriate. These values are used to generate the final SDL2_LIBRARY
  27. # variable, but when these values are unset, SDL2_LIBRARY does not get created.
  28. #
  29. #
  30. # $SDL2DIR is an environment variable that would
  31. # correspond to the ./configure --prefix=$SDL2DIR
  32. # used in building SDL2.
  33. # l.e.galup 9-20-02
  34. #
  35. # Modified by Eric Wing.
  36. # Added code to assist with automated building by using environmental variables
  37. # and providing a more controlled/consistent search behavior.
  38. # Added new modifications to recognize OS X frameworks and
  39. # additional Unix paths (FreeBSD, etc).
  40. # Also corrected the header search path to follow "proper" SDL guidelines.
  41. # Added a search for SDL2main which is needed by some platforms.
  42. # Added a search for threads which is needed by some platforms.
  43. # Added needed compile switches for MinGW.
  44. #
  45. # On OSX, this will prefer the Framework version (if found) over others.
  46. # People will have to manually change the cache values of
  47. # SDL2_LIBRARY to override this selection or set the CMake environment
  48. # CMAKE_INCLUDE_PATH to modify the search paths.
  49. #
  50. # Note that the header path has changed from SDL2/SDL.h to just SDL.h
  51. # This needed to change because "proper" SDL convention
  52. # is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
  53. # reasons because not all systems place things in SDL2/ (see FreeBSD).
  54. #
  55. # =============================================================================
  56. # Copyright 2003-2009 Kitware, Inc.
  57. #
  58. # Redistribution and use in source and binary forms, with or without
  59. # modification, are permitted provided that the following conditions are met:
  60. #
  61. # 1. Redistributions of source code must retain the above copyright notice, this
  62. # list of conditions and the following disclaimer.
  63. # 2. Redistributions in binary form must reproduce the above copyright notice,
  64. # this list of conditions and the following disclaimer in the documentation
  65. # and/or other materials provided with the distribution.
  66. #
  67. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  68. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  69. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  70. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  71. # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  72. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  73. # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  74. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  75. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  76. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  77. # =============================================================================
  78. SET(SDL2TTF_SEARCH_PATHS
  79. ~/Library/Frameworks
  80. /Library/Frameworks
  81. /usr/local
  82. /usr
  83. /sw # Fink
  84. /opt/local # DarwinPorts
  85. /opt/csw # Blastwave
  86. /opt
  87. )
  88. FIND_PATH(SDL2TTF_INCLUDE_DIR SDL_ttf.h
  89. HINTS
  90. $ENV{SDL2TTFDIR}
  91. PATH_SUFFIXES include/SDL2 include
  92. PATHS ${SDL2TTF_SEARCH_PATHS}
  93. )
  94. FIND_LIBRARY(SDL2TTF_LIBRARY_TEMP
  95. NAMES SDL2_ttf
  96. HINTS
  97. $ENV{SDL2TTFDIR}
  98. PATH_SUFFIXES lib64 lib
  99. PATHS ${SDL2TTF_SEARCH_PATHS}
  100. )
  101. IF(SDL2TTF_LIBRARY_TEMP)
  102. # Set the final string here so the GUI reflects the final state.
  103. SET(SDL2TTF_LIBRARY ${SDL2TTF_LIBRARY_TEMP} CACHE STRING "Where the SDL2TTF Library can be found")
  104. # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
  105. SET(SDL2TTF_LIBRARY_TEMP "${SDL2TTF_LIBRARY_TEMP}" CACHE INTERNAL "")
  106. ENDIF(SDL2TTF_LIBRARY_TEMP)
  107. INCLUDE(FindPackageHandleStandardArgs)
  108. FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2TTF REQUIRED_VARS SDL2TTF_LIBRARY SDL2TTF_INCLUDE_DIR)