Skip to content

Commit

Permalink
Merge pull request #1163 from floooh/dcimgui-fixes
Browse files Browse the repository at this point in the history
Fix sokol_gfx_imgui.h and sokol tests for switch from cimgui to dear_bindings
  • Loading branch information
floooh authored Dec 7, 2024
2 parents ad462b9 + 3dbf734 commit ce91d77
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 138 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
## Updates

### 07-Dec-2024

- Changes in sokol_imgui.h and sokol_gfx_imgui.h for a switch of the Dear ImGui
C bindings from https://github.com/cimgui/cimgui to https://github.com/floooh/dcimgui
(this is a 'source distribution repository' with the Dear ImGui C binding generated through the
new 'official' dear_bindings code generation - see https://github.com/dearimgui/dear_bindings).

This is only a breaking change if you include the sokol_gfx_imgui.h implementation
into a C source file, in that case you need to switch from https://github.com/cimgui/cimgui
to https://github.com/floooh/dcimgui. All other scenarios should be backward
compatible.

For details see PR https://github.com/floooh/sokol/pull/1163

### 23-Nov-2024

- sokol_app.h html5: Merged PR https://github.com/floooh/sokol/pull/1159 (related
Expand Down
4 changes: 2 additions & 2 deletions tests/compile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ if (ANDROID)
else()
add_executable(sokol-compiletest-c ${exe_type} ${c_sources})
add_executable(sokol-compiletest-nosokolapp-c sokol_gfx.c sokol_imgui_nosokolapp.c sokol_nuklear_nosokolapp.c)
target_link_libraries(sokol-compiletest-nosokolapp-c PUBLIC cimgui nuklear)
target_link_libraries(sokol-compiletest-nosokolapp-c PUBLIC imgui nuklear)
configure_c(sokol-compiletest-nosokolapp-c)
endif()
target_link_libraries(sokol-compiletest-c PUBLIC cimgui nuklear spine)
target_link_libraries(sokol-compiletest-c PUBLIC imgui nuklear spine)
configure_c(sokol-compiletest-c)

if (ANDROID)
Expand Down
3 changes: 1 addition & 2 deletions tests/compile/sokol_gfx_imgui.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "sokol_app.h"
#include "sokol_gfx.h"
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#if defined(_MSC_VER )
#pragma warning(disable:4201) // nonstandard extension used: nameless struct/union
#pragma warning(disable:4214) // nonstandard extension used: bit field types other than int
#endif
#include "cimgui/cimgui.h"
#include "cimgui.h"
#include "sokol_imgui.h"
#define SOKOL_IMPL
#include "sokol_gfx_imgui.h"
Expand Down
4 changes: 1 addition & 3 deletions tests/compile/sokol_imgui.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "sokol_app.h"
#include "sokol_gfx.h"
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#if defined(_MSC_VER )
#pragma warning(disable:4201) // nonstandard extension used: nameless struct/union
#pragma warning(disable:4214) // nonstandard extension used: bit field types other than int
#endif
#include "cimgui/cimgui.h"
#include "cimgui.h"
#define SOKOL_IMPL
#if defined(SOKOL_DUMMY_BACKEND)
#define SOKOL_IMGUI_NO_SOKOL_APP
Expand All @@ -15,4 +14,3 @@
void use_imgui_impl(void) {
simgui_setup(&(simgui_desc_t){0});
}

5 changes: 2 additions & 3 deletions tests/compile/sokol_imgui_nosokolapp.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "sokol_app.h"
#include "sokol_gfx.h"
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#if defined(_MSC_VER )
#pragma warning(disable:4201) // nonstandard extension used: nameless struct/union
#pragma warning(disable:4214) // nonstandard extension used: bit field types other than int
#endif
#include "cimgui/cimgui.h"
#include "cimgui.h"
#define SOKOL_IMPL
#define SOKOL_IMGUI_NO_SOKOL_APP
#include "sokol_imgui.h"
Expand All @@ -16,4 +15,4 @@ void use_imgui_impl(void) {

int main(void) {
return 0;
}
}
32 changes: 12 additions & 20 deletions tests/ext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# external dependencies

# NOTE FetchContent is so frigging slow that we just run git directly
set(cimgui_dir ${CMAKE_BINARY_DIR}/../_deps/cimgui)
set(dcimgui_dir ${CMAKE_BINARY_DIR}/../_deps/dcimgui)
set(spineruntimes_dir ${CMAKE_BINARY_DIR}/../_deps/spineruntimes)

if (IS_DIRECTORY ${cimgui_dir})
message("### ${cimgui_dir} exists...")
if (IS_DIRECTORY ${dcimgui_dir})
message("### ${dcimgui_dir} exists...")
else()
message("### Fetching cimgui to ${cimgui_dir} (this may take a while...)")
execute_process(COMMAND git clone --depth=1 --recursive https://github.com/fips-libs/fips-cimgui ${cimgui_dir})
message("### Fetching dcimgui to ${dcimgui_dir} (this may take a while...)")
execute_process(COMMAND git clone --depth=1 --recursive https://github.com/floooh/dcimgui ${dcimgui_dir})
endif()
if (IS_DIRECTORY ${spineruntimes_dir})
message("### ${spineruntimes_dir} exists...")
Expand All @@ -17,22 +17,14 @@ else()
execute_process(COMMAND git clone --depth=1 --branch 4.1 --recursive https://github.com/EsotericSoftware/spine-runtimes ${spineruntimes_dir})
endif()

add_library(cimgui
${cimgui_dir}/cimgui/cimgui.cpp
${cimgui_dir}/cimgui/imgui/imgui.cpp
${cimgui_dir}/cimgui/imgui/imgui_demo.cpp
${cimgui_dir}/cimgui/imgui/imgui_draw.cpp
${cimgui_dir}/cimgui/imgui/imgui_tables.cpp
${cimgui_dir}/cimgui/imgui/imgui_widgets.cpp)
target_include_directories(cimgui SYSTEM PUBLIC ${cimgui_dir})

add_library(imgui
${cimgui_dir}/cimgui/imgui/imgui.cpp
${cimgui_dir}/cimgui/imgui/imgui_demo.cpp
${cimgui_dir}/cimgui/imgui/imgui_draw.cpp
${cimgui_dir}/cimgui/imgui/imgui_tables.cpp
${cimgui_dir}/cimgui/imgui/imgui_widgets.cpp)
target_include_directories(imgui SYSTEM PUBLIC ${cimgui_dir}/cimgui/imgui)
${dcimgui_dir}/src/cimgui.cpp
${dcimgui_dir}/src/imgui.cpp
${dcimgui_dir}/src/imgui_demo.cpp
${dcimgui_dir}/src/imgui_draw.cpp
${dcimgui_dir}/src/imgui_tables.cpp
${dcimgui_dir}/src/imgui_widgets.cpp)
target_include_directories(imgui SYSTEM PUBLIC ${dcimgui_dir}/src)

add_library(spine
${spineruntimes_dir}/spine-c/spine-c/src/spine/Animation.c
Expand Down
Loading

0 comments on commit ce91d77

Please sign in to comment.