2024-03-23 18:41:26 -07:00
|
|
|
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()
|
|
|
|
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})
|
2024-03-26 18:39:02 -07:00
|
|
|
if(${USE_GLES})
|
|
|
|
target_compile_definitions(imgui_ui PRIVATE "IMGUI_IMPL_OPENGL_ES2")
|
|
|
|
endif()
|
2024-04-24 09:59:51 -07:00
|
|
|
if(DEFINED EMSCRIPTEN)
|
|
|
|
target_compile_options(imgui_ui PRIVATE "-sUSE_SDL_IMAGE=2")
|
|
|
|
target_link_options(imgui_ui PUBLIC "-sMAX_WEBGL_VERSION=2" "-sMIN_WEBGL_VERSION=2" "-sFULL_ES3")
|
|
|
|
else()
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
find_package(SDL2_image REQUIRED)
|
|
|
|
target_link_libraries(imgui_ui PRIVATE OpenGL::${GLTarget} SDL2::SDL2 SDL2_image::SDL2_image)
|
|
|
|
endif()
|
2024-03-23 18:41:26 -07:00
|
|
|
target_include_directories(imgui_ui PRIVATE ${BACKEND_IMGUI_INC})
|
2024-04-24 09:59:51 -07:00
|
|
|
target_compile_definitions(imgui_ui PRIVATE IMGUI_USER_CONFIG="imgui_config.h")
|