Skip to content

Commit

Permalink
fips compatibility, rename common C/C++ library to 'imgui'
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Dec 5, 2024
1 parent 649d40a commit 116069a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# builds a combined C and C++ library called 'imgui'
if (FIPS_IMPORT)
fips_begin_lib(cimgui)
fips_begin_lib(imgui)
fips_src(src)
fips_end_lib()
else()
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 14)
project(cimgui)
add_library(cimgui
set(CMAKE_CXX_STANDARD 11)
project(dcimgui)
add_library(imgui
src/cimgui.cpp
src/imgui_demo.cpp
src/imgui_draw.cpp
Expand All @@ -15,9 +16,9 @@ else()
src/imgui.cpp
)
endif()
target_include_directories(cimgui PUBLIC src)
target_include_directories(imgui PUBLIC src)
if (FIPS_CLANG OR FIPS_GCC)
target_compile_options(cimgui PUBLIC -Wno-return-type-c-linkage)
target_compile_options(imgui PUBLIC -Wno-return-type-c-linkage -Wno-unused-function)
elseif (FIPS_MSVC)
target_compile_options(cimgui PUBLIC /wd4190)
target_compile_options(imgui PUBLIC /wd4190)
endif()
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ A wrapper repository with code-generated C bindings for Dear ImGui using
the new dear_bindings approach (https://github.com/dearimgui/dear_bindings).

Uses the `ig` prefix and cimgui.h/cimgui.cpp filenames to be as compatible
as possible with the 'legacy' cimgui bindings.
as possible with the 'legacy' cimgui bindings (but please be aware that
there are still significant differences to the legacy cimgui bindings).

Includes a matching copy of Dear ImGui, versions are marked via git tags.
Includes a matching copy of Dear ImGui, versions are marked via git tags.

The CMakeLists.txt file can be used both from regular cmake projects and
from fips projects (https://floooh.github.io/fips/).

The CMakeLists.txt file builds a single static link library called 'imgui'
which exposes both the original C++ Dear ImGui API and the the C bindings
API.

To use the C API:

- include 'cimgui.h' and link with 'imgui'
- NOTE: the cimgui.h header contains duplicate symbol definitions and
must be compiled in C11 mode.

To use the C++ API:

- include 'imgui.h' and link with 'imgui'
5 changes: 5 additions & 0 deletions fips.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dcimgui
---
exports:
modules:
dcimgui: .

0 comments on commit 116069a

Please sign in to comment.