Skip to content

Commit

Permalink
GDExt example: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Jul 13, 2024
1 parent 5a92096 commit d5ee098
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
40 changes: 22 additions & 18 deletions doc/examples/GDExt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,41 @@ add_library(gdexample SHARED)
target_compile_features(gdexample PRIVATE cxx_std_20)
target_compile_definitions(gdexample PUBLIC
IMGUI_USER_CONFIG="imconfig-godot.h"
)
)
if (MSVC)
target_compile_options(godot-cpp PRIVATE "/MP")
target_compile_options(gdexample PRIVATE "/MP")
endif()

target_sources(gdexample PRIVATE
${FETCHCONTENT_BASE_DIR}/imgui-src/imgui.cpp
${FETCHCONTENT_BASE_DIR}/imgui-src/imgui_demo.cpp
${FETCHCONTENT_BASE_DIR}/imgui-src/imgui_draw.cpp
${FETCHCONTENT_BASE_DIR}/imgui-src/imgui_tables.cpp
${FETCHCONTENT_BASE_DIR}/imgui-src/imgui_widgets.cpp
${FETCHCONTENT_BASE_DIR}/imgui-src/imgui.h
${FETCHCONTENT_BASE_DIR}/implot-src/implot.cpp
${FETCHCONTENT_BASE_DIR}/implot-src/implot_demo.cpp
${FETCHCONTENT_BASE_DIR}/implot-src/implot_items.cpp
${FETCHCONTENT_BASE_DIR}/implot-src/implot.h
${FETCHCONTENT_BASE_DIR}/imgui_markdown-src/imgui_markdown.h
${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp
${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imgui.h
${implot_SOURCE_DIR}/implot.cpp
${implot_SOURCE_DIR}/implot_demo.cpp
${implot_SOURCE_DIR}/implot_items.cpp
${implot_SOURCE_DIR}/implot.h
${imgui_markdown_SOURCE_DIR}/imgui_markdown.h
src/example.cpp
src/example.h
src/register_types.cpp
src/register_types.h
src/gdmarkdown.cpp
src/gdmarkdown.h
)
)

target_link_libraries(gdexample PUBLIC godot-cpp)

target_include_directories(gdexample PRIVATE
src
${IMGUI_GODOT_INCLUDE}
${FETCHCONTENT_BASE_DIR}/imgui-src
${FETCHCONTENT_BASE_DIR}/implot-src
${FETCHCONTENT_BASE_DIR}/imgui_markdown-src
)
${imgui_SOURCE_DIR}
${implot_SOURCE_DIR}
${imgui_markdown_SOURCE_DIR}
)

set_property(TARGET gdexample
PROPERTY OUTPUT_NAME "libgdexample.windows.template_$<IF:$<CONFIG:Debug>,debug,release>.x86_64")
Expand All @@ -78,4 +82,4 @@ set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/project")

install(TARGETS gdexample
RUNTIME DESTINATION bin
)
)
4 changes: 2 additions & 2 deletions doc/examples/GDExt/src/gdmarkdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void ImGui::InitMarkdown()
italicFont = fonts[4];
}

void ImGui::Markdown(const std::string& text)
void ImGui::Markdown(std::string_view text)
{
ImGui::Markdown(text.c_str(), text.length(), mdConfig);
ImGui::Markdown(text.data(), text.length(), mdConfig);
}
4 changes: 2 additions & 2 deletions doc/examples/GDExt/src/gdmarkdown.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <string>
#include <string_view>

namespace ImGui {
void InitMarkdown();
void Markdown(const std::string& text);
void Markdown(std::string_view text);
} // namespace ImGui

0 comments on commit d5ee098

Please sign in to comment.