123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #Change this if you need to target a specific CMake version
  2. cmake_minimum_required(VERSION 3.1)
  3. if(NOT CMAKE_BUILD_TYPE)
  4. set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
  5. endif()
  6. if( NOT CMAKE_INSTALL_PREFIX )
  7. set( CMAKE_INSTALL_PREFIX "/usr" )
  8. endif()
  9. if( NOT SHADER_PREFIX )
  10. set( SHADER_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "The path where slop thinks it resides in, so that it can find the shaders. This is not necessarily the CMAKE_INSTALL_PREFIX. For example if the shaders will exist in /usr/share/slop-wayland, SHADER_PREFIX should be \"/usr\"." )
  11. endif()
  12. project(slop-wayland)
  13. set(CMAKE_CXX_STANDARD 14)
  14. set(CMAKE_CXX_STANDARD_REQUIRED on)
  15. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wno-missing-braces")
  16. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
  17. include_directories("${PROJECT_BINARY_DIR}")
  18. # Define sources and executable
  19. set(EXECUTABLE_NAME "slop-wayland")
  20. set( source
  21. src/wayland.cpp
  22. src/window.cpp
  23. src/mouse.cpp
  24. src/keyboard.cpp
  25. src/framebuffer.cpp
  26. src/resource.cpp
  27. src/options.cpp
  28. src/gl_core_3_3.c
  29. src/shader.cpp
  30. src/slopstates.cpp
  31. src/slop.cpp
  32. src/rectangle.cpp
  33. src/main.cpp )
  34. add_executable(${EXECUTABLE_NAME} ${source})
  35. # Detect and add SFML
  36. set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
  37. #Find any version 2.X of SFML
  38. #See the FindSFML.cmake file for additional details and instructions
  39. find_package(Wayland REQUIRED)
  40. find_package(EGL REQUIRED)
  41. find_package(OpenGL REQUIRED)
  42. find_package(GLM REQUIRED)
  43. include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}
  44. ${WAYLAND_CURSOR_INCLUDE_DIR}
  45. ${WAYLAND_EGL_INCLUDE_DIR}
  46. ${EGL_INCLUDE_DIR}
  47. ${GLM_INCLUDE_DIR}
  48. ${OPENGL_INCLUDE_DIR})
  49. target_link_libraries(${EXECUTABLE_NAME} ${WAYLAND_CLIENT_LIBRARIES}
  50. ${WAYLAND_CURSOR_LIBRARIES}
  51. ${WAYLAND_EGL_LIBRARIES}
  52. ${EGL_LIBRARIES}
  53. ${OPENGL_LIBRARIES})
  54. # Install targets
  55. install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
  56. install( DIRECTORY "${CMAKE_SOURCE_DIR}/share" DESTINATION "${CMAKE_INSTALL_PREFIX}" )
  57. add_definitions(-DSHADER_PREFIX="${SHADER_PREFIX}")