if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") set(GLES_NORMALLY_REQUIRED_FOR_ARCHITECTURE ON) elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") set(GLES_NORMALLY_REQUIRED_FOR_ARCHITECTURE ON) else() set(GLES_NORMALLY_REQUIRED_FOR_ARCHITECTURE OFF) endif() option(USE_GLES "Enable using OpenGL ES" ${GLES_NORMALLY_REQUIRED_FOR_ARCHITECTURE}) set(IMGUI_SRC imgui_demo.cpp imgui_draw.cpp imgui_tables.cpp imgui_widgets.cpp imgui.cpp misc/cpp/imgui_stdlib.cpp) set(IMGUI_BACKEND_SRC imgui_impl_opengl3.cpp imgui_impl_sdl2.cpp) set(BACKEND_IMGUI_SRC_BASE main.cpp base85.cpp file_browser.cpp main.cpp RendererBackend.cpp theme.cpp translation.cpp) foreach(SRC IN ITEMS ${IMGUI_BACKEND_SRC}) list(APPEND IMGUI_SRC backends/${SRC}) endforeach() foreach(SRC IN ITEMS ${IMGUI_SRC}) list(APPEND BACKEND_IMGUI_SRC_BASE imgui/${SRC}) endforeach() set(BACKEND_IMGUI_SRC ) foreach(SRC IN ITEMS ${BACKEND_IMGUI_SRC_BASE}) list(APPEND BACKEND_IMGUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${BACKEND_IMGUI_SRC_BASE}) endforeach() set(BACKEND_IMGUI_INC_BASE imgui imgui/backends imgui/misc/cpp IconFontCppHeaders assets imgui-filebrowser) set(BACKEND_IMGUI_INC ${INC} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) foreach(INCDIR IN ITEMS ${BACKEND_IMGUI_INC_BASE}) set(BACKEND_IMGUI_INC ${BACKEND_IMGUI_INC} ${CMAKE_CURRENT_SOURCE_DIR}/${INCDIR}) endforeach() find_package(SDL2 REQUIRED) find_package(SDL2_image REQUIRED) if(${USE_GLES}) set(GLComponents GLES2) set(GLTarget GLES2) else() set(GLComponents OpenGL) set(GLTarget GL) endif() find_package(OpenGL REQUIRED COMPONENTS ${GLComponents}) add_ui_backend(imgui_ui ${BACKEND_IMGUI_SRC}) target_link_libraries(imgui_ui PRIVATE OpenGL::${GLTarget} SDL2::SDL2 SDL2_image::SDL2_image) target_include_directories(imgui_ui PRIVATE ${BACKEND_IMGUI_INC}) target_compile_definitions(imgui_ui PRIVATE IMGUI_USER_CONFIG="imgui_config.h")