-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (56 loc) · 1.84 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
cmake_minimum_required(VERSION 3.22)
project(
minimal_gui
DESCRIPTION "My minimal C++ imgui"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(OpenGL REQUIRED)
find_package(SDL2 REQUIRED)
include(FetchContent)
FetchContent_Declare(
imgui
GIT_REPOSITORY "https://github.com/ocornut/imgui.git"
# docking-latest
GIT_TAG 226e0d579d2632a81d95f60bb5d65c70e55feb90
)
FetchContent_MakeAvailable(imgui)
FetchContent_Declare(
implot
GIT_REPOSITORY "https://github.com/epezent/implot.git"
GIT_TAG f156599faefe316f7dd20fe6c783bf87c8bb6fd9
)
FetchContent_MakeAvailable(implot)
add_library(imgui
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui.h
${imgui_SOURCE_DIR}/imconfig.h
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_internal.h
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imstb_rectpack.h
${imgui_SOURCE_DIR}/imstb_textedit.h
${imgui_SOURCE_DIR}/imstb_truetype.h
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl2.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl2.h
${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.h
${implot_SOURCE_DIR}/implot.h
${implot_SOURCE_DIR}/implot_internal.h
${implot_SOURCE_DIR}/implot.cpp
${implot_SOURCE_DIR}/implot_items.cpp
${implot_SOURCE_DIR}/implot_demo.cpp
)
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
target_link_libraries(imgui PUBLIC SDL2::SDL2)
# Define the main executable
add_executable(${PROJECT_NAME} src/main.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE
${imgui_SOURCE_DIR}
${implot_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)
# Link SDL2 and ImGui to your project
target_link_libraries(${PROJECT_NAME} PRIVATE SDL2::SDL2 OpenGL::GL imgui)