sdl.cmake 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # ***** BEGIN GPL LICENSE BLOCK *****
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ***** END GPL LICENSE BLOCK *****
  18. if(WIN32)
  19. set(SDL_EXTRA_ARGS
  20. -DSDL_STATIC=Off
  21. )
  22. else()
  23. set(SDL_EXTRA_ARGS
  24. -DSDL_STATIC=ON
  25. -DSDL_SHARED=OFF
  26. -DSDL_VIDEO=OFF
  27. -DSNDIO=OFF
  28. )
  29. endif()
  30. ExternalProject_Add(external_sdl
  31. URL ${SDL_URI}
  32. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  33. URL_HASH MD5=${SDL_HASH}
  34. PREFIX ${BUILD_DIR}/sdl
  35. PATCH_COMMAND ${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/sdl/src/external_sdl < ${PATCH_DIR}/sdl.diff
  36. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/sdl ${DEFAULT_CMAKE_FLAGS} ${SDL_EXTRA_ARGS}
  37. INSTALL_DIR ${LIBDIR}/sdl
  38. )
  39. if(BUILD_MODE STREQUAL Release AND WIN32)
  40. ExternalProject_Add_Step(external_sdl after_install
  41. COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/sdl/include/sdl2 ${HARVEST_TARGET}/sdl/include
  42. COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/sdl/lib ${HARVEST_TARGET}/sdl/lib
  43. COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/sdl/bin ${HARVEST_TARGET}/sdl/lib
  44. DEPENDEES install
  45. )
  46. endif()