-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
68 lines (43 loc) · 1.54 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
cmake_minimum_required(VERSION 3.10)
project(eseed_window)
option(ESD_WND_BUILD_EXAMPLES OFF "Build Examples")
option(ESD_WND_ENABLE_VULKAN_SUPPORT OFF "Enable Vulkan Support")
set(CMAKE_CXX_STANDARD 17)
# Library
add_library(eseed_window)
target_include_directories(eseed_window PUBLIC include)
# Include vulkan if requested
if(ESD_WND_ENABLE_VULKAN_SUPPORT)
find_package(Vulkan REQUIRED)
target_link_libraries(eseed_window Vulkan::Vulkan)
target_compile_definitions(eseed_window PRIVATE ESD_WND_INCLUDE_VULKAN_HPP)
endif()
# Auto detect platform if not manually set
if(NOT ESD_WND_PLATFORM)
if(WIN32)
set(PLATFORM "Win32")
elseif(UNIX AND NOT APPLE)
set(PLATFORM "X11")
else()
message(FATAL_ERROR "Could not auto detect platform, it may be unimplemented")
endif()
set(ESD_WND_PLATFORM ${PLATFORM} CACHE STRING "Target Platform" FORCE)
endif()
string(TOLOWER ${ESD_WND_PLATFORM} PLATFORM_DIR_NAME)
# Choose platform specific implementation
message("Using ${ESD_WND_PLATFORM}")
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/platforms/${PLATFORM_DIR_NAME}")
message(FATAL_ERROR "Unkown platform, it may have been typed incorrectly or is unimplemented")
endif()
add_subdirectory("platforms/${PLATFORM_DIR_NAME}")
# Testing
if(ESD_WND_BUILD_EXAMPLES)
# Basic Input
add_subdirectory(examples/basicinput)
# Sizing
add_subdirectory(examples/dimensions)
if(ESD_WND_ENABLE_VULKAN_SUPPORT)
# Vulkan Support
add_subdirectory(examples/vulkan)
endif()
endif()