Platformer in OpenGL
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

54 linhas
1.5 KiB

5 anos atrás
  1. cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
  2. project(openglapp VERSION 0.1.0)
  3. include(CTest)
  4. enable_testing()
  5. # Variables
  6. if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  7. set(PLATFORM_ARCH "64")
  8. elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
  9. set(PLATFORM_ARCH "32")
  10. endif()
  11. # Global
  12. set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
  13. set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
  14. set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
  15. # Includes
  16. include_directories(${INCLUDE_DIR})
  17. # Source
  18. file(GLOB SOURCES "${SRC_DIR}/*.cpp")
  19. add_executable(${PROJECT_NAME} ${SOURCES})
  20. # GLAD
  21. set(GLAD_DIR "${LIB_DIR}/glad")
  22. add_library("glad" "${GLAD_DIR}/src/glad.c")
  23. target_include_directories("glad" PRIVATE "${GLAD_DIR}/include")
  24. target_include_directories(${PROJECT_NAME} PRIVATE "${GLAD_DIR}/include")
  25. target_link_libraries(${PROJECT_NAME} "glad" "${CMAKE_DL_LIBS}")
  26. # GLFW
  27. set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
  28. set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
  29. set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
  30. set(GLFW_DIR "${LIB_DIR}/glfw-3.2.1")
  31. add_subdirectory("${GLFW_DIR}")
  32. target_include_directories(${PROJECT_NAME} PRIVATE "${GLFW_DIR}/include")
  33. # GLM
  34. set(GLM_TEST_ENABLE OFF CACHE BOOL "" FORCE)
  35. set(GLM_DIR "${LIB_DIR}/glm")
  36. add_subdirectory("${GLM_DIR}")
  37. target_include_directories(${PROJECT_NAME} PRIVATE "${GLM_DIR}/glm")
  38. set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
  39. target_link_libraries(${PROJECT_NAME} glfw)
  40. target_link_libraries(${PROJECT_NAME} glm)
  41. set(CPACK_PROJECT_NAME ${PROJECT_NAME})
  42. set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
  43. include(CPack)