2020-09-29 13:47:50 +02:00
|
|
|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
|
|
|
|
|
|
|
project(imgui C CXX)
|
|
|
|
|
|
|
|
set(CPP_FILES
|
|
|
|
"imgui/imgui.cpp"
|
|
|
|
"imgui/imgui_draw.cpp"
|
|
|
|
"imgui/imgui_widgets.cpp"
|
2021-01-22 01:27:50 +01:00
|
|
|
"imgui/imgui_tables.cpp"
|
2020-09-29 13:47:50 +02:00
|
|
|
"imgui/imgui_demo.cpp"
|
|
|
|
|
|
|
|
"imgui/misc/cpp/imgui_stdlib.cpp"
|
|
|
|
|
|
|
|
"imgui_plot_var.cpp"
|
|
|
|
|
2021-01-22 01:27:50 +01:00
|
|
|
#"imgui_impl_sdl_gl3.cpp" # very old
|
|
|
|
#"imgui_impl_sdl.cpp" # old
|
|
|
|
#"imgui_impl_opengl3.cpp" # old
|
|
|
|
"imgui/backends/imgui_impl_sdl.cpp"
|
|
|
|
"imgui/backends/imgui_impl_opengl3.cpp"
|
2020-09-29 13:47:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(HPP_FILES
|
|
|
|
"imgui/imgui.h"
|
|
|
|
"imgui/imstb_rectpack.h"
|
|
|
|
"imgui/imstb_textedit.h"
|
|
|
|
"imgui/imstb_truetype.h"
|
|
|
|
|
|
|
|
"imgui/misc/cpp/imgui_stdlib.h"
|
|
|
|
|
|
|
|
"imgui_plot_var.hpp"
|
|
|
|
|
2021-01-22 01:27:50 +01:00
|
|
|
#"imgui_impl_sdl_gl3.h" # very old
|
|
|
|
#"imgui_impl_sdl.h" # old
|
|
|
|
#"imgui_impl_opengl3.h" # old
|
|
|
|
"imgui/backends/imgui_impl_sdl.h"
|
|
|
|
"imgui/backends/imgui_impl_opengl3.h"
|
2020-09-29 13:47:50 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
add_library(imgui ${CPP_FILES} ${HPP_FILES})
|
|
|
|
|
2022-08-03 16:09:22 +02:00
|
|
|
target_compile_features(imgui PUBLIC cxx_std_11)
|
|
|
|
|
2020-09-29 13:47:50 +02:00
|
|
|
if(MM_OPENGL_3_GLES)
|
|
|
|
target_compile_definitions(imgui PUBLIC IMGUI_IMPL_OPENGL_ES3)
|
|
|
|
target_compile_definitions(imgui PUBLIC IMGUI_IMPL_OPENGL_LOADER_CUSTOM) # bug?
|
|
|
|
else()
|
|
|
|
target_compile_definitions(imgui PUBLIC IMGUI_IMPL_OPENGL_LOADER_GLAD)
|
2022-10-30 16:36:17 +01:00
|
|
|
target_link_libraries(imgui PUBLIC glad)
|
2020-09-29 13:47:50 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
#target_include_directories(imgui PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
|
|
|
|
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/imgui") # im sad
|
|
|
|
|
2021-02-16 20:59:47 +01:00
|
|
|
target_compile_definitions(imgui PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1)
|
|
|
|
|
2020-09-29 13:47:50 +02:00
|
|
|
if(EMSCRIPTEN)
|
2022-10-30 16:36:17 +01:00
|
|
|
target_compile_options(imgui PUBLIC -sUSE_SDL=2)
|
|
|
|
target_link_libraries(imgui PUBLIC -sUSE_SDL=2 -sUSE_WEBGL2=1 -sFULL_ES3=1)
|
2020-09-29 13:47:50 +02:00
|
|
|
elseif(ANDROID)
|
2022-10-30 16:36:17 +01:00
|
|
|
target_link_libraries(imgui PUBLIC SDL)
|
2021-11-30 19:50:40 +01:00
|
|
|
elseif(VCPKG_TARGET_TRIPLET)
|
2022-10-30 16:36:17 +01:00
|
|
|
target_link_libraries(imgui
|
|
|
|
PUBLIC
|
|
|
|
SDL2::SDL2
|
2022-10-31 22:35:55 +01:00
|
|
|
#PRIVATE
|
|
|
|
#SDL2::SDL2main
|
|
|
|
#SDL2::SDL2-static
|
2022-10-30 16:36:17 +01:00
|
|
|
)
|
2021-11-30 19:50:40 +01:00
|
|
|
else()
|
2020-09-29 13:47:50 +02:00
|
|
|
target_include_directories(imgui PUBLIC "${SDL2_INCLUDE_DIR}")
|
2022-10-30 16:36:17 +01:00
|
|
|
target_link_libraries(imgui PUBLIC ${SDL2_LIBRARY})
|
2020-09-29 13:47:50 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
target_compile_definitions(imgui PUBLIC ImTextureID=unsigned\ long)
|
|
|
|
|