-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
81 lines (62 loc) · 3.4 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
71
72
73
74
75
76
77
78
79
80
81
#
# Chapter 3 - Device Hand Shake CMake file.
#
cmake_minimum_required(VERSION 3.7.1)
set(Recipe_Name "3D-Engine")
#Volkan ATTENTION need 32 bits bin
message(STATUS "Attempting to locate Vulkan SDK using manual path......")
set(VULKAN_SDK "C:/Users/natha/Desktop/dev/Bibliotheque/Vulkan")
set(VULKAN_VERSION "1.2.182.0")
set(VULKAN_PATH "${VULKAN_SDK}/${VULKAN_VERSION}")
message(STATUS "Using manual specified path: ${VULKAN_PATH}")
# Check if manual set path exists
if(NOT EXISTS "${VULKAN_PATH}")
message("Error: Unable to locate this Vulkan SDK path VULKAN_PATH: ${VULKAN_PATH}, please specify correct path.
For more information on correct installation process, please refer to subsection 'Getting started with Lunar-G SDK'
and 'Setting up first project with CMake' in Chapter 3, 'Shaking hands with the device' in this book 'Learning Vulkan', ISBN - 9781786469809.")
return()
endif()
# Specify a suitable project name
project(${Recipe_Name})
# Add any required preprocessor definitions here
#add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
# vulkan-1 library for build Vulkan application.
set(VULKAN_LIB_LIST "vulkan-1")
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# Include Vulkan header files from Vulkan SDK
include_directories(AFTER ${VULKAN_PATH}/Include)
# Link directory for vulkan-1
link_directories(${VULKAN_PATH}/Bin32;${VULKAN_PATH}/Lib32;)
endif()
# Define directories and the contained folder and files inside.
if(WIN32)
source_group("include" REGULAR_EXPRESSION "include/*")
source_group("source" REGULAR_EXPRESSION "source/*")
source_group("example" REGULAR_EXPRESSION "example/*")
endif(WIN32)
#glfw ATTENTION need 32 bits bin
include_directories("C:/Users/natha/Desktop/dev/Bibliotheque/glfw-3.3.2.bin.WIN32/include")
link_directories("C:/Users/natha/Desktop/dev/Bibliotheque/glfw-3.3.2.bin.WIN32/lib-mingw")
#glm headers only its simple
include_directories("C:/Users/natha/Desktop/dev/Bibliotheque/glm-0.9.9.8")
# Define include path
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/example)
# Gather list of header and source files for compilation
file(GLOB_RECURSE CPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
file(GLOB_RECURSE HPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/*.*)
file(GLOB_RECURSE EXAMPLE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/example/*.*)
# Build project, give it a name and includes list of file to be compiled
add_executable(${Recipe_Name} ${CPP_FILES} ${HPP_FILES} ${EXAMPLE_FILES})
# Link the debug and release libraries to the project
target_link_libraries( ${Recipe_Name} ${VULKAN_LIB_LIST} glfw3)
message("apres linking")
# Define project properties
set_property(TARGET ${Recipe_Name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/binaries)
set_property(TARGET ${Recipe_Name} PROPERTY RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/binaries)
set_property(TARGET ${Recipe_Name} PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/binaries)
set_property(TARGET ${Recipe_Name} PROPERTY RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/binaries)
set_property(TARGET ${Recipe_Name} PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/binaries)
# Define C++ version to be used for building the project
set_property(TARGET ${Recipe_Name} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${Recipe_Name} PROPERTY CXX_STANDARD_REQUIRED ON)