Advertisement
brightprogrammer

Untitled

Mar 5th, 2021
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 7.87 KB | None | 0 0
  1. # all dependencies will be cloned in submodules directory and will be included from that directory only
  2. #                   .___.___                
  3. #  ____________   __| _/|  |   ____   ____  
  4. # /  ___/\____ \ / __ | |  |  /  _ \ / ___\
  5. # \___ \ |  |_> > /_/ | |  |_(  <_> ) /_/  >
  6. # /____  >|   __/\____ | |____/\____/\___  /
  7. #      \/ |__|        \/            /_____/
  8. #
  9. # spdlog dependency setup -----------------------------------------------------
  10. message("${Yellow}FINDING spdlog...${ColorReset}")
  11. # find whether include files are present or not
  12. find_path(SPDLOG_INCLUDE_FILE_PATH  NAMES spdlog.h
  13.                                     PATHS ${CMAKE_CURRENT_SOURCE_DIR}/spdlog/include/spdlog)
  14. if(NOT SPDLOG_INCLUDE_FILE_PATH)
  15.     # spdlog/spdlog.h wasn't found so init submodule and build it
  16.     message("${Yellow}NOT FOUND spdlog.${ColorReset}")
  17.     message("${Yellow}Cloning spdlog...${ColorReset}")
  18.     # init submodule
  19.     execute_process(COMMAND git submodule update --init -- ${CMAKE_CURRENT_SOURCE_DIR}/spdlog
  20.             WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
  21.     message("${Yellow}COMPLETED Cloning spdlog.${ColorReset}")
  22. else()
  23.     message("${Green}FOUND spdlog.${ColorReset}")
  24. endif()
  25.  
  26. # set include dir properly
  27. set(SPDLOG_MODULE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spdlog/include
  28.     CACHE PATH "SPDLOG Include Directory")
  29. # add it as a subdirectory
  30. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spdlog)
  31. # -----------------------------------------------------------------------------
  32. #        .__   _____        
  33. #   ____ |  |_/ ____\_  _  __
  34. #  / ___\|  |\   __\\ \/ \/ /
  35. # / /_/  >  |_|  |   \     /
  36. # \___  /|____/__|    \/\_/  
  37. # /_____/
  38. #
  39. # glfw3 dependency setup ------------------------------------------------------
  40. message("${Yellow}FINDING glfw3...${ColorReset}")
  41. # find whether include files are present or not
  42. find_path(GLFW_INCLUDE_FILE_PATH    NAMES glfw3.h
  43.                                     PATHS ${CMAKE_CURRENT_SOURCE_DIR}/glfw/include/GLFW)
  44. if(NOT GLFW_INCLUDE_FILE_PATH)
  45.     # glfw include file wasn't found
  46.     message("${Yellow}NOT FOUND glfw3${ColorReset}")
  47.     message("${Yellow}Cloning glfw3...${ColorReset}")
  48.     # init submodule
  49.     execute_process(COMMAND git submodule update --init -- ${CMAKE_CURRENT_SOURCE_DIR}/glfw
  50.         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
  51.     message("${Yellow}COMPLETED Cloning glfw3.${ColorReset}")
  52. else()
  53.     message("${Green}FOUND glfw3.${ColorReset}")
  54. endif()
  55.  
  56. # set the include dir
  57. set(GLFW_MODULE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/glfw/include
  58.     CACHE PATH "GLFW Include Directory")
  59. # add it as a subdirectory to build the library
  60. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glfw)
  61. # -----------------------------------------------------------------------------
  62. # ____   ____    .__   __                              ___ ___                     .___                  
  63. # \   \ /   /_ __|  | |  | _______    ____            /   |   \   ____ _____     __| _/___________  ______
  64. #  \   Y   /  |  \  | |  |/ /\__  \  /    \   ______ /    ~    \_/ __ \\__  \   / __ |/ __ \_  __ \/  ___/
  65. #   \     /|  |  /  |_|    <  / __ \|   |  \ /_____/ \    Y    /\  ___/ / __ \_/ /_/ \  ___/|  | \/\___ \
  66. #    \___/ |____/|____/__|_ \(____  /___|  /          \___|_  /  \___  >____  /\____ |\___  >__|  /____  >
  67. #                         \/     \/     \/                 \/       \/     \/      \/    \/           \/
  68. #
  69. #vulkan headers setup --------------------------------------------------------
  70. message("${Yellow}FINDING Vulkan-Headers...${ColorReset}")
  71. # find whether include files are present or not
  72. find_path(VULKAN_HEADERS_INCLUDE_FILE_PATH    NAMES "vulkan.h" "vulkan.hpp"
  73.     PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include/vulkan)
  74. if(NOT VULKAN_HEADERS_INCLUDE_FILE_PATH)
  75.     # Vulkan-Headers include file wasn't found
  76.     message("${Yellow}NOT FOUND Vulkan-Headers.${ColorReset}")
  77.     message("${Yellow}Cloning Vulkan-Headers...${ColorReset}")
  78.     # init submodule
  79.     execute_process(COMMAND git submodule update --init -- ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers
  80.         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
  81.     message("${Yellow}COMPLETED Cloning Vulkan-Headers.${ColorReset}")
  82. else()
  83.     message("${Green}FOUND Vulkan-Headers${ColorReset}")
  84. endif()
  85.  
  86. # set the include dir
  87. set(VULKAN_HEADERS_MODULE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include
  88.     CACHE PATH "Vulkan-Headers Include Directory")
  89. # add it as a subdirectory to build the library
  90. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers)
  91. # -----------------------------------------------------------------------------
  92. # ____   ____    .__   __                            .____                     .___            
  93. # \   \ /   /_ __|  | |  | _______    ____           |    |    _________     __| _/___________
  94. #  \   Y   /  |  \  | |  |/ /\__  \  /    \   ______ |    |   /  _ \__  \   / __ |/ __ \_  __ \
  95. #   \     /|  |  /  |_|    <  / __ \|   |  \ /_____/ |    |__(  <_> ) __ \_/ /_/ \  ___/|  | \/
  96. #    \___/ |____/|____/__|_ \(____  /___|  /         |_______ \____(____  /\____ |\___  >__|  
  97. #                         \/     \/     \/                  \/         \/      \/    \/      
  98. #
  99. # vulkan loader setup ---------------------------------------------------------
  100. message("${Yellow}FINDING Vulkan-Loader...${ColorReset}")
  101. # find whether include files are present or not
  102. find_path(VULKAN_LOADER_INCLUDE_FILE_PATH    NAMES "CMakeLists.txt"
  103.     PATHS ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Loader)
  104. if(NOT VULKAN_LOADER_INCLUDE_FILE_PATH)
  105.     # Vulkan-Loaders include file wasn't found
  106.     message("${Yellow}NOT FOUND Vulkan-Loader.${ColorReset}")
  107.     message("${Yellow}Cloning Vulkan-Loader...${ColorReset}")
  108.     # init submodule
  109.     execute_process(COMMAND git submodule update --init -- ${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Loader
  110.         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
  111.     message("${Yellow}COMPLETED Cloning Vulkan-Loader.${ColorReset}")
  112. else()
  113.     message("${Green}FOUND Vulkan-Loader${ColorReset}")
  114. endif()
  115.  
  116. # add it as a subdirectory to build the library
  117. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Loader)
  118. # -----------------------------------------------------------------------------
  119. #                              .___         ___                  ___  
  120. #    ____   ____   ____   ____ |  |   _____/  |_  ____   _______/  |_
  121. #   / ___\ /  _ \ /  _ \ / ___\|  | _/ __ \   __\/ __ \ /  ___/\   __\
  122. #  / /_/  >  <_> |  <_> ) /_/  >  |_\  ___/|  | \  ___/ \___ \  |  |  
  123. #  \___  / \____/ \____/\___  /|____/\___  >__|  \___  >____  > |__|  
  124. # /_____/              /_____/           \/          \/     \/      
  125. #
  126. # googletest setup ------------------------------------------------------------
  127. message("${Yellow}FINDING googletest...${ColorReset}")
  128. # find whether include files are present or not
  129. find_path(VULKAN_LOADER_INCLUDE_FILE_PATH    NAMES "CMakeLists.txt"
  130.     PATHS ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
  131. if(NOT VULKAN_LOADER_INCLUDE_FILE_PATH)
  132.     # googletest include file wasn't found
  133.     message("${Yellow}NOT FOUND googletest.${ColorReset}")
  134.     message("${Yellow}Cloning googletest...${ColorReset}")
  135.     # init submodule
  136.     execute_process(COMMAND git submodule update --init -- ${CMAKE_CURRENT_SOURCE_DIR}/googletest
  137.         WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
  138.     message("${Yellow}COMPLETED Cloning googletest.${ColorReset}")
  139. else()
  140.     message("${Green}FOUND googletest.${ColorReset}")
  141. endif()
  142.  
  143. # set include directory properly
  144. set(GOOGLETEST_MODULE_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/include
  145.     CACHE PATH "Google Tests Include Directory.")
  146. set(GOOGLETEST_MODULE_MOCK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/googlemock/include
  147.     CACHE PATH "Google Mock Include Directory.")
  148. # add it as a subdirectory to build the library
  149. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest)
  150.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement