Advertisement
Guest User

Untitled

a guest
Jul 1st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 3.34 KB | None | 0 0
  1. cmake_minimum_required(VERSION 3.14)
  2. project(mach)
  3.  
  4. set(CMAKE_CXX_STANDARD 17)
  5.  
  6. # Adding libdl, which is a dependency for GLAD on non-windows platforms and may not be recognized otherwise
  7. set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl")
  8.  
  9. add_executable(mach lib/glad.c src/MachApplication.cpp src/graphics/window/RenderWindow.cpp src/graphics/window/RenderWindow.hpp src/graphics/window/OpenGLWindow.cpp src/graphics/window/OpenGLWindow.hpp src/auxiliary/Constants.hpp src/io/input/KeyInput.cpp src/io/input/KeyInput.hpp src/io/input/MouseInput.cpp src/io/input/MouseInput.hpp src/MachApplication.hpp src/auxiliary/logging/Logger.cpp src/auxiliary/logging/Logger.hpp src/math/linalg/Vector/Vector.hpp src/math/linalg/Vector/Vector2.hpp src/math/linalg/Vector/Vector3.hpp src/math/linalg/Vector/Vector4.hpp src/math/linalg/LinAlgTypes.hpp src/math/linalg/Matrix/Matrix.hpp src/math/linalg/Vector/VectorTraits.hpp src/math/linalg/Quaternion.hpp src/math/util/NumberTraits.hpp src/math/linalg/Rotations.hpp src/math/linalg/Matrix/RotationMatrix.hpp src/auxiliary/exceptions/NotImplemented.hpp src/math/util/MathUtils.hpp tests/math/LinearAlgebraTests.hpp tests/TestRunner.hpp src/auxiliary/MachAssertion.hpp src/auxiliary/logging/LogUtils.hpp src/auxiliary/time/Timer.cpp src/auxiliary/time/Timer.hpp src/auxiliary/time/TimeUtils.hpp src/math/linalg/Matrix/ScaleMatrix.hpp src/graphics/shaders/GraphicsShader.hpp src/graphics/shaders/OpenGLShader.cpp src/graphics/shaders/OpenGLShader.hpp src/graphics/debug/OpenGLDebug.hpp src/graphics/renderer/Renderer.cpp src/graphics/renderer/Renderer.hpp src/graphics/renderer/OpenGLRenderer.cpp src/graphics/renderer/OpenGLRenderer.hpp src/io/FileIO.hpp src/graphics/geometry/Mesh.hpp src/auxiliary/parsing/ParserUtils.hpp src/auxiliary/VectorUtils.hpp src/graphics/model/WaveformObj.hpp src/graphics/model/Model.hpp)
  10.  
  11. # Sets a base path for the includes so that they can be used in the same way as in Visual Studio/Codeblocks
  12. set(BASEPATH "${CMAKE_SOURCE_DIR}/src")
  13. include_directories("${BASEPATH}")
  14.  
  15.  
  16. # Fix(es) for platform specific problems
  17. if (APPLE)
  18.     exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
  19.     string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
  20.     message(STATUS "OSX Version=${DARWIN_VERSION}")
  21.     if (DARWIN_VERSION GREATER 17)
  22.         message(STATUS "Running on OSX Mojave or higher, adding /usr/local/lib to link directories")
  23.         # Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035
  24.         link_directories(/usr/local/lib)
  25.     endif ()
  26. endif ()
  27.  
  28.  
  29. # Setting up PkgConfig
  30. find_package(PkgConfig REQUIRED)
  31.  
  32. # Finding and including GLAD
  33. target_include_directories(mach PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/")
  34.  
  35. # Finding and linking GLFW3
  36. find_package(glfw3 3.3 REQUIRED)
  37. if (GLFW3_FOUND)
  38.     message(STATUS "Found GLFW 3.3, Including and Linking now")
  39.     target_link_libraries(mach glfw)
  40. elseif (NOT GLFW_FOUND)
  41.     message(FATAL_ERROR "Could not find GLFW 3.3")
  42. endif ()
  43.  
  44. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
  45.  
  46. # Finding and linking OpenGL
  47. find_package(OpenGL REQUIRED)
  48. if (OPENGL_FOUND)
  49.     message(STATUS "Found OpenGL, Including and Linking now")
  50.     target_include_directories(mach PUBLIC ${OPENGL_INCLUDE_DIR})
  51.     target_link_libraries(mach ${OPENGL_gl_LIBRARY})
  52. endif (OPENGL_FOUND)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement