-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
70 lines (58 loc) · 2.96 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
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
cmake_policy(VERSION 3.5)
set(NAME VulkanLearn)
project(${NAME} CXX)
include_directories($ENV{VK_SDK_PATH}/include/vulkan)
include_directories(external/assimp)
include_directories(external/gli)
include_directories(external/gli/external)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set (VULKAN_LIB1 "$ENV{VK_SDK_PATH}/Lib/vulkan-1.lib")
set (ASSIMP_LIB "lib/assimp/assimp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_WIN32_KHR")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
function(buildExample EXAMPLE)
file(GLOB VULKAN vulkan/*.h vulkan/*.cpp)
file(GLOB MATHS_DEFS maths/*.h maths/*.inl maths/*.cpp)
file(GLOB COMMON common/*.h common/*.cpp)
file(GLOB BASE base/*.h base/*.cpp)
file(GLOB CLASS class/*.h class/*.cpp)
file(GLOB THREAD thread/*.h thread/*.cpp thread/*.hpp)
file(GLOB SHADER data/shaders/*.vert data/shaders/*.frag data/shaders/*.sh data/shaders/*.comp)
file(GLOB ATMOSPHERE_SHADER data/shaders/atmosphere/*.vert data/shaders/atmosphere/*.frag data/shaders/atmosphere/*.sh data/shaders/atmosphere/*.comp)
file(GLOB COMPONENT component/*.h component/*.cpp)
file(GLOB SCENE scene/*.h scene/*.cpp)
file(GLOB APPENTRY appEntry/*.h appEntry/*.cpp)
file(GLOB PLANET planet/*.h planet/*.cpp)
IF(WIN32)
SET(PROJECT_WIN32_SOURCE "${PROJECT_SOURCE_DIR}/Win32Entry.cpp")
ENDIF(WIN32)
add_executable(${EXAMPLE} WIN32 ${PROJECT_SOURCE} ${PROJECT_HEADER} ${PROJECT_WIN32_SOURCE} ${MATHS_DEFS} ${COMMON} ${BASE} ${CLASS} ${THREAD} ${SHADER} ${ATMOSPHERE_SHADER} ${COMPONENT} ${VULKAN} ${SCENE} ${APPENTRY} ${PLANET})
source_group("maths\\" FILES ${MATHS_DEFS})
source_group("common\\" FILES ${COMMON})
source_group("class\\" FILES ${CLASS})
source_group("base\\" FILES ${BASE})
source_group("vulkan\\" FILES ${VULKAN})
source_group("thread\\" FILES ${THREAD})
source_group("shaders\\" FILES ${SHADER})
source_group("shaders\\atmosphere\\" FILES ${ATMOSPHERE_SHADER})
source_group("component\\" FILES ${COMPONENT})
source_group("scene\\" FILES ${SCENE})
source_group("appEntry\\" FILES ${APPENTRY})
source_group("planet\\" FILES ${PLANET})
target_link_libraries(${EXAMPLE} ${VULKAN_LIB} ${ASSIMP_LIB} ${VULKAN_LIB1})
set_target_properties(${EXAMPLE} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
endfunction(buildExample)
function(buildExamples EXAMPLES)
foreach(EXAMPLE ${EXAMPLES})
buildExample(${EXAMPLE})
endforeach(EXAMPLE)
endfunction(buildExamples)
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/" )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/" )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/" )
set(PROJECTS VulkanLearn)
buildExamples(${PROJECTS})