1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #Change this if you need to target a specific CMake version
  2. cmake_minimum_required(VERSION 3.1)
  3. add_definitions(-DSLOP_VERSION="v5.3.21")
  4. if(NOT CMAKE_BUILD_TYPE)
  5. set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
  6. endif()
  7. if( NOT CMAKE_INSTALL_PREFIX )
  8. set( CMAKE_INSTALL_PREFIX "/usr" )
  9. endif()
  10. if( NOT SHADER_PREFIX )
  11. 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, SHADER_PREFIX should be \"/usr\"." )
  12. endif()
  13. project(slop)
  14. set(CMAKE_CXX_STANDARD 14)
  15. set(CMAKE_CXX_STANDARD_REQUIRED on)
  16. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wno-missing-braces")
  17. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
  18. include_directories("${PROJECT_BINARY_DIR}")
  19. # Define sources and executable
  20. set(EXECUTABLE_NAME "slop")
  21. set( source src/x.cpp
  22. src/window.cpp
  23. src/windowhelper.cpp
  24. src/mouse.cpp
  25. src/keyboard.cpp
  26. src/framebuffer.cpp
  27. src/resource.cpp
  28. src/options.cpp
  29. src/gl_core_3_3.c
  30. src/shader.cpp
  31. src/slopstates.cpp
  32. src/slop.cpp
  33. src/rectangle.cpp
  34. src/main.cpp )
  35. add_executable(${EXECUTABLE_NAME} ${source})
  36. # Detect and add SFML
  37. set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules" )
  38. #Find any version 2.X of SFML
  39. #See the FindSFML.cmake file for additional details and instructions
  40. find_package(OpenGL REQUIRED)
  41. find_package(GLM REQUIRED)
  42. find_package(GLX REQUIRED)
  43. find_package(X11 REQUIRED)
  44. find_package(XExt REQUIRED)
  45. include_directories(${X11_INCLUDE_DIR}
  46. ${GLM_INCLUDE_DIR}
  47. ${GLX_INCLUDE_DIR}
  48. ${OPENGL_INCLUDE_DIR})
  49. target_link_libraries(${EXECUTABLE_NAME} ${X11_LIBRARIES}
  50. ${GLX_LIBRARIES}
  51. ${OPENGL_LIBRARIES})
  52. # Install targets
  53. install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
  54. install( DIRECTORY "${CMAKE_SOURCE_DIR}/share" DESTINATION "${CMAKE_INSTALL_PREFIX}" )
  55. add_definitions(-DSHADER_PREFIX="${SHADER_PREFIX}")