CMakeLists.txt 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. cmake_minimum_required(VERSION 2.6)
  2. set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)")
  3. if ( NOT CMAKE_INSTALL_PREFIX )
  4. set(CMAKE_INSTALL_PREFIX "/usr")
  5. endif()
  6. project(slop)
  7. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
  8. set( CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Directory where man pages reside. (/usr/share/man, /usr/local/share/man, etc.)" )
  9. set( CMAKE_COMPRESS_MAN TRUE CACHE BOOL "Whether or not to compress the man pages for install." )
  10. if ( CMAKE_COMPRESS_MAN )
  11. set( MANTARGET "slop.1.gz" )
  12. else()
  13. set( MANTARGET "slop.1" )
  14. endif()
  15. include_directories("${PROJECT_BINARY_DIR}")
  16. add_definitions(-DSLOP_VERSION="v5.3.21")
  17. # The names have to be unique unfortunately.
  18. set(EXECUTABLE_NAME "slop")
  19. set(LIBRARY_NAME "slopy")
  20. add_library(${LIBRARY_NAME} SHARED src/mouse.cpp
  21. src/keyboard.cpp
  22. src/x.cpp
  23. src/slopstates.cpp
  24. src/framebuffer.cpp
  25. src/windowhelper.cpp
  26. src/resource.cpp
  27. src/gl_core_3_3.c
  28. src/shader.cpp
  29. src/window.cpp
  30. src/slop.cpp
  31. src/rectangle.cpp
  32. src/xshaperectangle.cpp
  33. src/glrectangle.cpp)
  34. set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 11)
  35. set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
  36. add_executable(${EXECUTABLE_NAME} src/options.cpp
  37. src/main.cpp)
  38. set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
  39. find_package(GLM REQUIRED)
  40. find_package(X11 REQUIRED)
  41. find_package(XExt REQUIRED)
  42. find_package(GLX REQUIRED)
  43. find_package(OpenGL REQUIRED)
  44. include_directories(${X11_INCLUDE_DIR}
  45. ${GLM_INCLUDE_DIR}
  46. ${XEXT_INCLUDE_DIR}
  47. ${GLX_INCLUDE_DIR}
  48. ${OPENGL_INCLUDE_DIR})
  49. target_link_libraries(${EXECUTABLE_NAME} ${X11_LIBRARIES}
  50. ${GLM_LIBRARIES}
  51. ${OPENGL_LIBRARIES}
  52. ${GLX_LIBRARY}
  53. ${XEXT_LIBRARIES}
  54. ${LIBRARY_NAME})
  55. install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
  56. install( TARGETS ${LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
  57. install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_PREFIX}/include" COMPONENT development )
  58. install( FILES "${CMAKE_SOURCE_DIR}/${MANTARGET}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )