123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. cmake_minimum_required(VERSION 3.1.3)
  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.38")
  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/resource.cpp
  26. src/gl_core_3_3.c
  27. src/shader.cpp
  28. src/window.cpp
  29. src/slop.cpp
  30. src/rectangle.cpp
  31. src/xshaperectangle.cpp
  32. src/glrectangle.cpp)
  33. set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
  34. set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 11)
  35. add_executable(${EXECUTABLE_NAME} src/options.cpp
  36. src/main.cpp)
  37. set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
  38. set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
  39. set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
  40. find_package(GLM REQUIRED)
  41. find_package(X11 REQUIRED)
  42. find_package(XExt REQUIRED)
  43. find_package(GLX REQUIRED)
  44. find_package(OpenGL REQUIRED)
  45. find_package(XRender REQUIRED)
  46. include_directories(${X11_INCLUDE_DIR}
  47. ${GLM_INCLUDE_DIR}
  48. ${XEXT_INCLUDE_DIR}
  49. ${GLX_INCLUDE_DIR}
  50. ${XRENDER_INCLUDE_DIR}
  51. ${OPENGL_INCLUDE_DIR})
  52. target_link_libraries(${LIBRARY_NAME} ${X11_LIBRARIES}
  53. ${GLM_LIBRARIES}
  54. ${OPENGL_LIBRARIES}
  55. ${GLX_LIBRARY}
  56. ${XRENDER_LIBRARY}
  57. ${XEXT_LIBRARIES})
  58. target_link_libraries(${EXECUTABLE_NAME} ${LIBRARY_NAME})
  59. install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
  60. install( TARGETS ${LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
  61. install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_PREFIX}/include" COMPONENT development )
  62. install( FILES "${CMAKE_SOURCE_DIR}/${MANTARGET}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )