CMakeLists.txt 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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, SHADER_PREFIX should be \"/usr\"." )
  11. endif()
  12. project(slop)
  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")
  20. set( source src/x.cpp
  21. src/window.cpp
  22. src/windowhelper.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(OpenGL REQUIRED)
  40. find_package(GLM REQUIRED)
  41. find_package(GLX REQUIRED)
  42. find_package(X11 REQUIRED)
  43. find_package(XExt REQUIRED)
  44. include_directories(${X11_INCLUDE_DIR}
  45. ${GLM_INCLUDE_DIR}
  46. ${GLX_INCLUDE_DIR}
  47. ${OPENGL_INCLUDE_DIR})
  48. target_link_libraries(${EXECUTABLE_NAME} ${X11_LIBRARIES}
  49. ${GLX_LIBRARIES}
  50. ${OPENGL_LIBRARIES})
  51. # Install targets
  52. install( TARGETS ${EXECUTABLE_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" )
  53. install( DIRECTORY "${CMAKE_SOURCE_DIR}/share" DESTINATION "${CMAKE_INSTALL_PREFIX}" )
  54. add_definitions(-DSHADER_PREFIX="${SHADER_PREFIX}")