CMakeLists.txt 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.48")
  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/shader.cpp
  27. src/window.cpp
  28. src/slop.cpp
  29. src/rectangle.cpp
  30. src/xshaperectangle.cpp
  31. src/glrectangle.cpp)
  32. set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
  33. set_property(TARGET ${LIBRARY_NAME} PROPERTY CXX_STANDARD 11)
  34. add_executable(${EXECUTABLE_NAME} src/main.cpp)
  35. set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
  36. set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 11)
  37. set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
  38. find_package(GLEW REQUIRED)
  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. # Ahhhh, finally this eliminates the segfault on preload.
  46. find_package(Threads REQUIRED)
  47. include_directories(${X11_INCLUDE_DIR}
  48. ${GLEW_INCLUDE_DIR}
  49. ${GLM_INCLUDE_DIR}
  50. ${XEXT_INCLUDE_DIR}
  51. ${GLX_INCLUDE_DIR}
  52. ${XRENDER_INCLUDE_DIR}
  53. ${OPENGL_INCLUDE_DIR})
  54. target_link_libraries(${LIBRARY_NAME} ${X11_LIBRARIES}
  55. ${CMAKE_THREAD_LIBS_INIT}
  56. ${GLM_LIBRARIES}
  57. ${OPENGL_LIBRARIES}
  58. ${GLX_LIBRARY}
  59. ${XRENDER_LIBRARY}
  60. ${XEXT_LIBRARIES}
  61. ${GLEW_LIBRARIES})
  62. target_link_libraries(${EXECUTABLE_NAME} ${LIBRARY_NAME} )
  63. find_package(ICU COMPONENTS uc)
  64. set( SLOP_UNICODE TRUE CACHE BOOL "To enable or disable unicode support." )
  65. if ( SLOP_UNICODE AND ICU_FOUND )
  66. # ICU is required for old nvidia drivers to work for whatever reason.
  67. add_definitions(-DCXXOPTS_USE_UNICODE)
  68. include_directories( ${ICU_INCLUDE_DIR} )
  69. target_link_libraries(${EXECUTABLE_NAME} ${ICU_UC_LIBRARIES} )
  70. endif()
  71. install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
  72. install( TARGETS ${LIBRARY_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
  73. install( FILES ${CMAKE_SOURCE_DIR}/src/slop.hpp DESTINATION "${CMAKE_INSTALL_PREFIX}/include" COMPONENT development )
  74. install( FILES "${CMAKE_SOURCE_DIR}/${MANTARGET}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc )