Make ImGui a module.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
c416eee9df
commit
0459fd3ba9
5 changed files with 37 additions and 54 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
|||
[submodule "source/frontends/qt/QHexView"]
|
||||
path = source/frontends/qt/QHexView
|
||||
url = ../../Dax89/QHexView.git
|
||||
[submodule "source/frontends/sdl/imgui/imgui"]
|
||||
path = source/frontends/sdl/imgui/imgui
|
||||
url = ../../ocornut/imgui
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
include(FindPkgConfig)
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
pkg_search_module(SDL2_IMAGE REQUIRED SDL2_image)
|
||||
pkg_search_module(GLES2 REQUIRED glesv2)
|
||||
set(IMGUI_PATH "imgui/imgui")
|
||||
|
||||
add_executable(sa2)
|
||||
|
||||
set(SOURCE_FILES
|
||||
|
@ -19,8 +24,6 @@ set(HEADER_FILES
|
|||
renderer/sdlrendererframe.h
|
||||
)
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
pkg_search_module(SDL2_IMAGE REQUIRED SDL2_image)
|
||||
|
||||
target_compile_features(sa2 PUBLIC cxx_std_17)
|
||||
|
||||
|
@ -32,6 +35,7 @@ target_include_directories(sa2 PRIVATE
|
|||
target_link_libraries(sa2 PRIVATE
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_IMAGE_LIBRARIES}
|
||||
${GLES2_LIBRARIES}
|
||||
appleii
|
||||
common2
|
||||
)
|
||||
|
@ -41,52 +45,36 @@ target_sources(sa2 PRIVATE
|
|||
${HEADER_FILES}
|
||||
)
|
||||
|
||||
set(IMGUI_PATH NONE CACHE PATH "path to imgui")
|
||||
target_sources(sa2 PRIVATE
|
||||
imgui/sdlimguiframe.cpp
|
||||
imgui/image.cpp
|
||||
imgui/settingshelper.cpp
|
||||
|
||||
if (EXISTS ${IMGUI_PATH}/imgui.h)
|
||||
message("Using IMGUI_PATH=${IMGUI_PATH}")
|
||||
imgui/sdlimguiframe.h
|
||||
imgui/image.h
|
||||
imgui/settingshelper.h
|
||||
imgui/imconfig.h
|
||||
imgui/gles.h
|
||||
|
||||
pkg_search_module(GLES2 REQUIRED glesv2)
|
||||
${IMGUI_PATH}/imgui.h
|
||||
${IMGUI_PATH}/imgui.cpp
|
||||
${IMGUI_PATH}/imgui_demo.cpp
|
||||
${IMGUI_PATH}/imgui_draw.cpp
|
||||
${IMGUI_PATH}/imgui_tables.cpp
|
||||
${IMGUI_PATH}/imgui_widgets.cpp
|
||||
${IMGUI_PATH}/backends/imgui_impl_sdl.cpp
|
||||
${IMGUI_PATH}/backends/imgui_impl_opengl3.cpp
|
||||
)
|
||||
|
||||
target_sources(sa2 PRIVATE
|
||||
imgui/sdlimguiframe.cpp
|
||||
imgui/image.cpp
|
||||
imgui/settingshelper.cpp
|
||||
|
||||
imgui/sdlimguiframe.h
|
||||
imgui/image.h
|
||||
imgui/settingshelper.h
|
||||
imgui/imconfig.h
|
||||
imgui/gles.h
|
||||
|
||||
${IMGUI_PATH}/imgui.h
|
||||
${IMGUI_PATH}/imgui.cpp
|
||||
${IMGUI_PATH}/imgui_demo.cpp
|
||||
${IMGUI_PATH}/imgui_draw.cpp
|
||||
${IMGUI_PATH}/imgui_tables.cpp
|
||||
${IMGUI_PATH}/imgui_widgets.cpp
|
||||
${IMGUI_PATH}/backends/imgui_impl_sdl.cpp
|
||||
${IMGUI_PATH}/backends/imgui_impl_opengl3.cpp
|
||||
)
|
||||
|
||||
target_include_directories(sa2 PRIVATE
|
||||
${IMGUI_PATH}
|
||||
${IMGUI_PATH}/backends
|
||||
)
|
||||
|
||||
target_link_libraries(sa2 PRIVATE
|
||||
${GLES2_LIBRARIES}
|
||||
)
|
||||
|
||||
target_compile_definitions(sa2 PRIVATE
|
||||
SA2_IMGUI
|
||||
IMGUI_IMPL_OPENGL_ES2
|
||||
IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h"
|
||||
)
|
||||
else()
|
||||
message("Bad IMGUI_PATH=${IMGUI_PATH}, skipping imgui code")
|
||||
endif()
|
||||
target_include_directories(sa2 PRIVATE
|
||||
${IMGUI_PATH}
|
||||
${IMGUI_PATH}/backends
|
||||
)
|
||||
|
||||
target_compile_definitions(sa2 PRIVATE
|
||||
IMGUI_IMPL_OPENGL_ES2
|
||||
IMGUI_USER_CONFIG="frontends/sdl/imgui/imconfig.h"
|
||||
)
|
||||
|
||||
install(TARGETS sa2
|
||||
DESTINATION bin)
|
||||
|
|
1
source/frontends/sdl/imgui/imgui
Submodule
1
source/frontends/sdl/imgui/imgui
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit cdf1926f21d17a3d9be7f69434cc18dc65dd6609
|
|
@ -18,10 +18,7 @@
|
|||
#include "frontends/sdl/utils.h"
|
||||
|
||||
#include "frontends/sdl/renderer/sdlrendererframe.h"
|
||||
|
||||
#ifdef SA2_IMGUI
|
||||
#include "frontends/sdl/imgui/sdlimguiframe.h"
|
||||
#endif
|
||||
|
||||
#include "CardManager.h"
|
||||
#include "Core.h"
|
||||
|
@ -115,7 +112,6 @@ void run_sdl(int argc, const char * argv [])
|
|||
|
||||
std::shared_ptr<sa2::SDLFrame> frame;
|
||||
|
||||
#ifdef SA2_IMGUI
|
||||
if (options.imgui)
|
||||
{
|
||||
frame.reset(new sa2::SDLImGuiFrame(options));
|
||||
|
@ -124,9 +120,6 @@ void run_sdl(int argc, const char * argv [])
|
|||
{
|
||||
frame.reset(new sa2::SDLRendererFrame(options));
|
||||
}
|
||||
#else
|
||||
frame.reset(new sa2::SDLRendererFrame(options));
|
||||
#endif
|
||||
|
||||
if (SDL_GL_SetSwapInterval(options.glSwapInterval))
|
||||
{
|
||||
|
|
|
@ -4,10 +4,8 @@ set -euxo pipefail
|
|||
|
||||
wget https://raw.githubusercontent.com/libretro/RetroArch/master/libretro-common/include/libretro.h -P libretro-common/include
|
||||
|
||||
git clone --depth=1 https://github.com/ocornut/imgui.git
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
cmake -DCMAKE_BUILD_TYPE=RELEASE -DLIBRETRO_COMMON_PATH=../libretro-common -DIMGUI_PATH=../imgui ..
|
||||
cmake -DCMAKE_BUILD_TYPE=RELEASE -DLIBRETRO_COMMON_PATH=../libretro-common ..
|
||||
make
|
||||
|
|
Loading…
Add table
Reference in a new issue