-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
96 lines (75 loc) · 2.08 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#this file is NOT YET ready for public use yet
#its eventual intent is to provide a .lib build of the core quickly from the command line
cmake_minimum_required(VERSION 3.7)
project(VGLVulkanCore)
set(VULKANSDK_ARCH "x86_64")
#TODO make this less dumb
if(DEFINED BUILD_SURFACE_X11)
set(surface_INCLUDE_DIRS "")
set(surface_LIBRARIES "-lX11")
elseif(DEFINED BUILD_SURFACE_macOS)
set(surface_INCLUDE_DIRS "")
set(surface_LIBRARIES "-framework Cocoa")
else()
set(surface_INCLUDE_DIRS "")
set(surface_LIBRARIES "")
endif()
include_directories(
${surface_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS}
)
if(DEFINED VMA_PATH)
message(STATUS "Using VMA for memory management...")
include_directories(
${VMA_PATH}
)
add_definitions(
-DVGL_VULKAN_CORE_USE_VMA
)
endif()
if(NOT DEFINED VULKANSDK)
message(FATAL_ERROR "Must be called with -DVULKANSDK=/path/to/vulkansdk")
endif()
include_directories(
"${VULKANSDK}/${VULKANSDK_ARCH}/include/vulkan"
"${CMAKE_SOURCE_DIR}/src/"
"${CMAKE_SOURCE_DIR}/src/os"
)
if(APPLE)
include_directories(
"${CMAKE_SOURCE_DIR}/src/os/mac"
"${VULKANSDK}/MoltenVK/include/vulkan"
"${CMAKE_SOURCE_DIR}/example/mac/Example/src" # TODO move this header
)
set(vglsurface "${CMAKE_SOURCE_DIR}/src/os/mac/VulkanSurface.mm")
add_definitions(-DMACOSX)
elseif(UNIX)
include_directories(
"${CMAKE_SOURCE_DIR}/src/os/linux"
"${CMAKE_SOURCE_DIR}/example/linux"
)
include_directories("${CMAKE_SOURCE_DIR}/src/os/linux")
set(vglsurface "${CMAKE_SOURCE_DIR}/src/os/linux/VulkanSurface.cpp")
elseif(MSVC)
#todo
endif()
link_directories(
"${VULKANSDK}/${VULKANSDK_ARCH}/lib"
)
file(GLOB vglcore "${CMAKE_SOURCE_DIR}/src/*.cpp")
file(GLOB vglos "${CMAKE_SOURCE_DIR}/src/os/*.cpp")
add_definitions(
-DVGL_VULKAN_CORE_STANDALONE
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG)
endif()
add_library(VGLVulkanCore STATIC
${vglcore} ${vglos} ${vglsurface}
)
set_property(TARGET VGLVulkanCore PROPERTY CXX_STANDARD 17)
#target_link_libraries(VGLVulkanCore
# ${SDL2_LIBRARIES}
# ${surface_LIBRARIES}
# vulkan
#)