-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
52 lines (44 loc) · 1.41 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
cmake_minimum_required(VERSION 3.20)
project(sdl_imgui VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(SDL_STATIC ON CACHE BOOL "" FORCE)
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
add_subdirectory(libs/sdl)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
add_subdirectory(libs/sdl_image)
# NOTE: can't just add_subdirectory(libs/imgui)
# because it doesn't contain a CMakeLists.txt file
# so it has to be added as a library instead.
# Should be able to build with just these sources:
# libs/imgui/imgui*.cpp (except imgui_demo.cpp unless we want to run the demo content)
# libs/imgui/backends/imgui_impl_sdl.cpp
# libs/imgui/backends/imgui_impl_opengl3.cpp
add_library(imgui
libs/imgui/imgui.cpp
libs/imgui/imgui_demo.cpp
libs/imgui/imgui_draw.cpp
libs/imgui/imgui_tables.cpp
libs/imgui/imgui_widgets.cpp
libs/imgui/backends/imgui_impl_sdl.cpp
libs/imgui/backends/imgui_impl_opengl3.cpp
)
# Make sure the backend source files can find required headers
target_include_directories(imgui PRIVATE
libs/imgui
libs/sdl/include
)
add_executable(sdl_imgui
src/main.cpp
)
include_directories(sdl_imgui PRIVATE
libs/sdl/include
libs/sdl_image
libs/imgui
libs/imgui/backends
)
target_link_libraries(sdl_imgui
opengl32
SDL2main SDL2-static
SDL2_image
imgui
)