CMakeLists.txt 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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="v6.3.39")
  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/main.cpp)
  36. set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
  37. set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
  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. find_package(XRender REQUIRED)
  45. include_directories(${X11_INCLUDE_DIR}
  46. ${GLM_INCLUDE_DIR}
  47. ${XEXT_INCLUDE_DIR}
  48. ${GLX_INCLUDE_DIR}
  49. ${XRENDER_INCLUDE_DIR}
  50. ${OPENGL_INCLUDE_DIR})
  51. target_link_libraries(${LIBRARY_NAME} ${X11_LIBRARIES}
  52. ${GLM_LIBRARIES}
  53. ${OPENGL_LIBRARIES}
  54. ${GLX_LIBRARY}
  55. ${XRENDER_LIBRARY}
  56. ${XEXT_LIBRARIES})
  57. target_link_libraries(${EXECUTABLE_NAME} ${LIBRARY_NAME})
  58. install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
  59. install( TARGETS ${LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
  60. install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_PREFIX}/include" COMPONENT development )
  61. install( FILES "${CMAKE_SOURCE_DIR}/${MANTARGET}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )