Advertisement
nikeedev

Untitled

Jan 7th, 2024
1,779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.53 KB | None | 0 0
  1. add_executable(sandbox main.cpp
  2.         Game.cpp
  3.         Game.h
  4.         MyScene.cpp
  5.         MyScene.h
  6. )
  7.  
  8. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") # .exe and .dll
  9. set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") # .so and .dylib
  10. set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") # .lib and .a
  11.  
  12. # copy shaders
  13.  
  14. configure_file(shaders/shader.vert ${CMAKE_CURRENT_BINARY_DIR}/Debug/shaders/shader.vert COPYONLY)
  15. configure_file(shaders/shader.frag ${CMAKE_CURRENT_BINARY_DIR}/Debug/shaders/shader.frag COPYONLY)
  16.  
  17. include_directories(
  18.         ../snow/src
  19. )
  20.  
  21. # GLAD
  22. set_source_files_properties(${CMAKE_SOURCE_DIR}/libs/src/glad.c PROPERTIES LANGUAGE CXX )
  23. add_library(glad STATIC ${CMAKE_SOURCE_DIR}/libs/src/glad.c)
  24. target_link_libraries(sandbox glad)
  25. include_directories(
  26.         ${CMAKE_SOURCE_DIR}/libs/include
  27. )
  28.  
  29. if(MSVC)
  30.     # on Windows && Visual Studio
  31.     # Link GLFW library
  32.     add_library(glfw STATIC IMPORTED)
  33.     set_target_properties(glfw PROPERTIES
  34.             IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/libs/lib/glfw3.lib"
  35.             INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/libs/include")
  36.     target_link_libraries(sandbox glfw)
  37.  
  38.     include_directories(
  39.             ${CMAKE_SOURCE_DIR}/libs/include
  40.     )
  41.  
  42.     set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
  43. else()
  44.     # on UNIX/Linux
  45.     find_package(glfw3 3.3 REQUIRED)
  46.     target_link_libraries(sandbox glfw)
  47. endif()
  48.  
  49. target_link_libraries(
  50.         sandbox
  51.         snow
  52. )
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement