forked from thedmd/imgui-node-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
159 lines (131 loc) · 5.28 KB
/
Copy pathCMakeLists.txt
File metadata and controls
159 lines (131 loc) · 5.28 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
cmake_minimum_required(VERSION 4.0)
project(imgui-node-editor)
# Enable solution folders in Visual Studio and Folders in Xcode
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(IMGUI_NODE_EDITOR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
# Point CMake where to look for module files.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/misc/cmake-modules)
include_directories(include)
set(_Application_Sources
include/imgui-node-editor/application.h
src/application.cpp
src/entry_point.cpp
include/imgui-node-editor/imgui_extra_keys.h
include/imgui-node-editor/config.h.in
include/imgui-node-editor/setup.h
include/imgui-node-editor/platform.h
src/platform_win32.cpp
src/platform_glfw.cpp
include/imgui-node-editor/renderer.h
src/renderer_dx11.cpp
src/renderer_ogl3.cpp
include/imgui-node-editor/builders.h
include/imgui-node-editor/drawing.h
include/imgui-node-editor/widgets.h
src/builders.cpp
src/drawing.cpp
src/widgets.cpp
)
add_library(imgui-node-editor STATIC)
target_include_directories(imgui-node-editor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
find_package(imgui REQUIRED)
find_package(stb_image REQUIRED)
find_package(ScopeGuard REQUIRED)
target_link_libraries(imgui-node-editor PUBLIC imgui)
target_link_libraries(imgui-node-editor PRIVATE stb_image ScopeGuard)
if (WIN32)
list(APPEND _Application_Sources
src/imgui_impl_dx11.cpp
include/imgui-node-editor/imgui_impl_dx11.h
src/imgui_impl_win32.cpp
include/imgui-node-editor/imgui_impl_win32.h
)
set(_DXSDK_Dir ${IMGUI_NODE_EDITOR_ROOT_DIR}/external/DXSDK)
set(_DXSDK_Arch x86)
if (${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(_DXSDK_Arch x64)
endif()
add_library(dxerr STATIC ${_DXSDK_Dir}/src/dxerr.cpp)
target_include_directories(dxerr PUBLIC "${_DXSDK_Dir}/include")
set_property(TARGET dxerr PROPERTY FOLDER "external")
add_library(d3dx11 UNKNOWN IMPORTED)
set_target_properties(d3dx11 PROPERTIES
IMPORTED_LOCATION "${_DXSDK_Dir}/lib/${_DXSDK_Arch}/d3dx11.lib"
IMPORTED_LOCATION_DEBUG "${_DXSDK_Dir}/lib/${_DXSDK_Arch}/d3dx11d.lib"
INTERFACE_INCLUDE_DIRECTORIES "${_DXSDK_Dir}/include"
INTERFACE_LINK_LIBRARIES "$<$<CONFIG:Debug>:dxerr>"
)
target_link_libraries(imgui-node-editor PRIVATE d3d11.lib d3dcompiler.lib d3dx11)
else()
find_package(OpenGL REQUIRED)
find_package(glfw3 3 REQUIRED)
if (APPLE)
target_link_libraries(imgui-node-editor PRIVATE
"-framework CoreFoundation"
"-framework Cocoa"
"-framework IOKit"
"-framework CoreVideo"
)
endif()
endif()
if (OpenGL_FOUND)
set(HAVE_OPENGL YES)
target_include_directories(imgui-node-editor PRIVATE ${OPENGL_INCLUDE_DIR})
target_link_libraries(imgui-node-editor PRIVATE ${OPENGL_gl_LIBRARY})
list(APPEND _Application_Sources
src/imgui_impl_opengl3.cpp
include/imgui-node-editor/imgui_impl_opengl3.h
include/imgui-node-editor/imgui_impl_opengl3_loader.h
)
endif()
if (glfw3_FOUND)
set(HAVE_GLFW3 YES)
list(APPEND _Application_Sources
src/imgui_impl_glfw.cpp
include/imgui-node-editor/imgui_impl_glfw.h
)
target_link_libraries(imgui-node-editor PRIVATE
glfw
)
endif()
configure_file(
include/imgui-node-editor/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/source/config.h
)
target_compile_definitions(imgui-node-editor PRIVATE
#BACKEND_CONFIG=IMGUI_GLFW
#RENDERER_CONFIG=IMGUI_OGL3
)
target_include_directories(imgui-node-editor PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/source)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${_Application_Sources})
target_sources(imgui-node-editor PRIVATE ${_Application_Sources})
set_property(TARGET imgui-node-editor PROPERTY FOLDER "examples")
file(GLOB _Example_CommonResources CONFIGURE_DEPENDS "$/examples/data/*")
file(GLOB _Example_Resources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
if (WIN32)
set(_Example_Type WIN32)
set(ApplicationIcon examples/Application/Support/Icon.ico)
file(TO_NATIVE_PATH "${ApplicationIcon}" ApplicationIcon)
string(REPLACE "\\" "\\\\" ApplicationIcon "${ApplicationIcon}")
configure_file(
/examples/Application/Support/Resource.rc.in
${CMAKE_CURRENT_BINARY_DIR}/Resource.rc
)
source_group(TREE "/examples" FILES ${_Example_CommonResources})
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${_Example_Resources})
list(APPEND _Example_Resources
${CMAKE_CURRENT_BINARY_DIR}/Resource.rc
${_Example_CommonResources}
)
source_group("resources" FILES ${CMAKE_CURRENT_BINARY_DIR}/Resource.rc)
elseif (APPLE)
set(_Example_Type MACOSX_BUNDLE)
set_source_files_properties(${_Example_Resources} ${_Example_CommonResources} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources/data"
)
set(_Example_Icon "$/examples/application/support/Icon.icns")
list(APPEND _Example_Resources ${_Example_Icon})
set_source_files_properties(${_Example_Icon} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources"
)
endif()