-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (51 loc) · 2.35 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
cmake_minimum_required(VERSION 3.10)
project(Demo)
set(Y_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(Y_SOURCE_ENTRY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/entry")
include(HelperFunction.cmake)
# Default GLFW
option(IMGUI_PLATFORM_WIN32 "Use Win32 backend for GLFW" OFF)
option(IMGUI_PLATFORM_GLFW "Use GLFW backend for GLFW" ON)
if (IMGUI_PLATFORM_WIN32)
set_mutex_option(IMGUI_PLATFORM_WIN32 IMGUI_PLATFORM_GLFW)
elseif (IMGUI_PLATFORM_GLFW)
set_mutex_option(IMGUI_PLATFORM_GLFW IMGUI_PLATFORM_WIN32)
endif ()
if (IMGUI_PLATFORM_WIN32)
option(IMGUI_BACKEND_DX9 "[ImGui] Backend by [Direct3D9]" OFF)
option(IMGUI_BACKEND_DX10 "[ImGui] Backend by [Direct3D10]" OFF)
option(IMGUI_BACKEND_DX11 "[ImGui] Backend by [Direct3D11]" ON)
option(IMGUI_BACKEND_DX12 "[ImGui] Backend by [Direct3D12]" OFF)
if (IMGUI_BACKEND_DX9)
set_mutex_option(IMGUI_BACKEND_DX9 IMGUI_BACKEND_DX10 IMGUI_BACKEND_DX11 IMGUI_BACKEND_DX12)
elseif (IMGUI_BACKEND_DX10)
set_mutex_option(IMGUI_BACKEND_DX10 IMGUI_BACKEND_DX9 IMGUI_BACKEND_DX11 IMGUI_BACKEND_DX12)
elseif (IMGUI_BACKEND_DX11)
set_mutex_option(IMGUI_BACKEND_DX11 IMGUI_BACKEND_DX9 IMGUI_BACKEND_DX10 IMGUI_BACKEND_DX12)
elseif (IMGUI_BACKEND_DX12)
set_mutex_option(IMGUI_BACKEND_DX12 IMGUI_BACKEND_DX9 IMGUI_BACKEND_DX10 IMGUI_BACKEND_DX11)
endif ()
elseif (IMGUI_PLATFORM_GLFW)
option(IMGUI_BACKEND_OPENGL2 "[ImGui] Backend by [OpenGL2]" OFF)
option(IMGUI_BACKEND_OPENGL3 "[ImGui] Backend by [OpenGL3]" ON)
option(IMGUI_BACKEND_VULKAN "[ImGui] Backend by [Vulkan]" OFF)
if (IMGUI_BACKEND_OPENGL2)
set_mutex_option(IMGUI_BACKEND_OPENGL2 IMGUI_BACKEND_OPENGL3 IMGUI_BACKEND_VULKAN)
elseif (IMGUI_BACKEND_OPENGL3)
set_mutex_option(IMGUI_BACKEND_OPENGL3 IMGUI_BACKEND_OPENGL2 IMGUI_BACKEND_VULKAN)
elseif (IMGUI_BACKEND_VULKAN)
set_mutex_option(IMGUI_BACKEND_VULKAN IMGUI_BACKEND_OPENGL2 IMGUI_BACKEND_OPENGL3)
endif ()
endif ()
message(STATUS "[Platform]:")
message(STATUS " Win32? ${IMGUI_PLATFORM_WIN32}")
message(STATUS " GLFW ? ${IMGUI_PLATFORM_GLFW}")
include(${CMAKE_CURRENT_SOURCE_DIR}/ImGui.cmake)
if (WIN32)
set(Y_PLATFORM_EXE_TAG "WIN32")
endif ()
add_executable(Demo ${Y_PLATFORM_EXE_TAG}
${Y_SOURCE_DIR}/MainWindow.h
${Y_SOURCE_DIR}/MainWindow.cpp
)
target_link_libraries(Demo PRIVATE ImGui::ImGui)