1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-07-05 12:29:05 +02:00

cmake+imgui: add imgui submodule

This commit is contained in:
Anonymous Maarten 2018-12-20 20:30:22 +01:00 committed by Daniel Evans
parent 76fc914695
commit 0e5f1e5b5f
6 changed files with 76 additions and 0 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "external/microprofile/microprofile"]
path = external/microprofile/microprofile
url = https://github.com/jonasmr/microprofile.git
[submodule "imgui"]
path = external/imgui/imgui
url = https://github.com/ocornut/imgui.git

View File

@ -6,6 +6,7 @@ option(BUILD_VIEWER "Build GUI data viewer")
option(ENABLE_SCRIPT_DEBUG "Enable verbose script execution")
option(ENABLE_PROFILING "Enable detailed profiling metrics")
option(ENABLE_IMGUI "Enable imgui plugin")
option(TEST_DATA "Enable tests that require game data")

View File

@ -1,3 +1,7 @@
if(ENABLE_PROFILING)
add_subdirectory(microprofile)
endif()
if(ENABLE_IMGUI)
add_subdirectory(imgui)
endif()

58
external/imgui/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,58 @@
add_library(imgui EXCLUDE_FROM_ALL
rw_imconfig.h
imgui/imgui.h
imgui/imgui.cpp
imgui/imgui_demo.cpp
imgui/imgui_draw.cpp
imgui/imgui_internal.h
imgui/imgui_widgets.cpp
imgui/imstb_rectpack.h
imgui/imstb_textedit.h
imgui/imstb_truetype.h
)
target_include_directories(imgui SYSTEM
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/imgui"
)
target_compile_definitions(imgui
PUBLIC
IMGUI_USER_CONFIG="${CMAKE_CURRENT_SOURCE_DIR}/rw_imconfig.h"
)
add_library(imgui::core ALIAS imgui)
openrw_target_apply_options(
TARGET imgui
)
add_library(imgui_sdl_gl3 EXCLUDE_FROM_ALL
imgui/examples/imgui_impl_opengl3.h
imgui/examples/imgui_impl_opengl3.cpp
imgui/examples/imgui_impl_sdl.h
imgui/examples/imgui_impl_sdl.cpp
)
target_include_directories(imgui_sdl_gl3 SYSTEM
PUBLIC
"${CMAKE_CURRENT_LIST_DIR}/imgui/examples"
)
target_link_libraries(imgui_sdl_gl3
PUBLIC
imgui::core
SDL2::SDL2
)
# FIXME: extract gl loader to target + add property to get header
target_compile_definitions(imgui_sdl_gl3
PRIVATE
"IMGUI_IMPL_OPENGL_LOADER_CUSTOM=\"${OpenRW_SOURCE_DIR}/rwcore/gl/gl_core_3_3.h\""
)
add_library(imgui::sdl_gl3 ALIAS imgui_sdl_gl3)
openrw_target_apply_options(
TARGET imgui_sdl_gl3
)

1
external/imgui/imgui vendored Submodule

@ -0,0 +1 @@
Subproject commit 801645d35092c8da0eeabe71d7c1997c47aa3648

9
external/imgui/rw_imconfig.h vendored Normal file
View File

@ -0,0 +1,9 @@
#ifndef RW_IMCONFIG_H
#define RW_IMCONFIG_H
// Disable imgui assertions when not in debug mode
#ifndef RW_DEBUG
#define IM_ASSERT(MSG) //FIXME(madebr): remove comment
#endif
#endif // RW_IMCONFIG_H