-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
62 lines (45 loc) · 1.74 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 3.11.0)
project(AstroEngine VERSION 1.0)
if (DEFINED VULKAN_SDK_PATH)
set(Vulkan_INCLUDE_DIRS "${VULKAN_SDK_PATH}/include")
set(Vulkan_LIBRARIES "${VULKAN_SDK_PATH}/lib")
set(Vulkan_FOUND "True")
else()
find_package(Vulkan REQUIRED) # throws error if could not find Vulkan
message(STATUS "Found Vulkan: $ENV{VULKAN_SDK}")
endif()
if (NOT Vulkan_FOUND)
message(FATAL_ERROR "Could not find Vulkan library!")
else()
message(STATUS "Using vulkan lib at: ${Vulkan_LIBRARIES}")
endif()
find_package(glfw3 3.3 REQUIRED)
set(GLFW_LIB glfw)
message(STATUS "Found GLFW")
if (NOT GLFW_LIB)
message(FATAL_ERROR "Could not find glfw library!")
else()
message(STATUS "Using glfw lib at: ${GLFW_LIB}")
endif()
include_directories(external)
if (NOT TINYOBJ_PATH)
message(STATUS "TINYOBJ_PATH not specified in .env.cmake, using external/tinyobjloader")
set(TINYOBJ_PATH external/tinyobjloader)
endif()
if(NOT STB_PATH)
message(STATUS "STB_PATH not specified in .env.cmake, using external/stb")
set(STB_PATH external/stb)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
file(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/src
/Users/antonin/VulkanSDK/1.3.236.0/macOS/include
${TINYOBJ_PATH}
${STB_PATH})
target_link_libraries(${PROJECT_NAME} glfw ${Vulkan_LIBRARIES})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/shaders DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/textures DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/models DESTINATION ${CMAKE_CURRENT_BINARY_DIR})